diff --git a/.gitignore b/.gitignore index f9d614c1..bb561be4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,4 @@ DerivedData *.ipa *.xcuserstate .DS_Store -framework/ -SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS -SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS -SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS \ No newline at end of file +framework/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 17edfe78..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Vendors/SGPlatform"] - path = Vendors/SGPlatform -url=https://github.com/libobjc/SGPlatform.git diff --git a/LICENSE b/LICENSE index 3949bce9..c0d42b85 100644 --- a/LICENSE +++ b/LICENSE @@ -1,166 +1,21 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. [http://fsf.org/] - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - +MIT License + +Copyright (c) 2017 Single + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 4ad813af..df10dbe9 100644 --- a/README.md +++ b/README.md @@ -1,206 +1,72 @@ -# Important Notice +![Logo](https://github.com/libobjc/SGPlayer/blob/dev/2.0/documents/banner.jpg?raw=true) -SGPlayer will be redesigned. Version 2.0 will be released in the spring of 2019. - -- [2.0 development branch](https://github.com/libobjc/SGPlayer/tree/develop/2.0.0) - - -![(Logo)](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/banner-small.png) ![Build Status](https://img.shields.io/badge/build-%20passing%20-brightgreen.svg) ![Platform](https://img.shields.io/badge/Platform-%20iOS%20macOS%20tvOS%20-blue.svg) -![Support](https://img.shields.io/badge/support-%20VR%20360%C2%B0%20-orange.svg) - -[中文介绍](https://github.com/libobjc/SGPlayer/blob/master/documents/README-chs.md) | [Principle](https://github.com/libobjc/SGPlayer/blob/master/documents/Principle-chs.md) | [Video Download](https://github.com/libobjc/SGDownload) # SGPlayer -- SGPlayer is a powerful media player framework for iOS, macOS, and tvOS. based on AVPlayer and FFmpeg. Support 360° panorama video, VR video. RTMP streaming. +- SGPlayer is a powerful media play framework for iOS, macOS, and tvOS. + +## Based On + +- FFmpeg +- Metal +- AudioUnit ## Features +- iOS, tvOS, macOS. - 360° panorama video. -- Gestures and sensors control vr video. -- distortion correction in cardboard mode. -- Support iOS, macOS, and tvOS. -- H.264 hardware accelerator (VideoToolBox). -- RTMP, RTSP streamings. -- Background playback mode. -- Selected audio track. -- Adjust the volume. -- Capture video artwork. -- Bitcode support. -- Simplest callback handle. - -## Build Instructions (Choose one of the way) - -### Method 1. Using build script +- Background playback. +- RTMP/RTSP streaming. +- Setting playback speed. +- Multiple audio/video tracks. +- H.264/H.265 hardware accelerator. -```obj-c +## Build -// iOS +```obj-c git clone https://github.com/libobjc/SGPlayer.git +git checkout 2.0 -B latest cd SGPlayer -sh compile-build.sh iOS -// macOS -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -sh compile-build.sh macOS +// iOS +./build.sh iOS build // tvOS -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -sh compile-build.sh tvOS - -``` - -### Method 2. Manually build - -- Step 1 - clone and init submodule. - -``` -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -git submodule update --init --recursive - -``` - -- Step 2 - build FFmpeg and add libs to the corresponding directory. - -```obj-c - -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS // iOS -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS // macOS -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS // tvOS +./build.sh tvOS build +// macOS +./build.sh macOS build ``` -### check build results - -![ffmpeg-libs](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/ffmpeg-libs.png) - - ## Usage -- more examples in the demo applications. +- Open demo/demo.xcworkspace with Xcode. -#### Dependencies +## Dependencies ```obj-c - -// iOS -- SGPlayer.framework -- SGPlatform.framework Optional -- CoreMedia.framework -- AudioToolBox.framework -- VideoToolBox.framework -- libiconv.tbd -- libbz2.tbd -- libz.tbd - -// macOS - SGPlayer.framework -- SGPlatform.framework Optional -- CoreMedia.framework +- AVFoundation.framework - AudioToolBox.framework - VideoToolBox.framework -- VideoDecodeAcceleration.framework - libiconv.tbd - libbz2.tbd - libz.tbd -- libizma.tbd - -``` - -### Basic video playback - -```obj-c - -self.player = [SGPlayer player]; - -// register callback handle. -[self.player registerPlayerNotificationTarget:self stateAction:@selector(stateAction:) progressAction:@selector(progressAction:) playableAction:@selector(playableAction:) errorAction:@selector(errorAction:)]; - -// display view tap action. -[self.player setViewTapAction:^(SGPlayer * _Nonnull player, SGPLFView * _Nonnull view) { -NSLog(@"player display view did click!"); -}]; - -// playback plane video. -[self.player replaceVideoWithURL:contentURL]; // 方式1 -[self.player replaceVideoWithURL:contentURL videoType:SGVideoTypeNormal]; // 方式2 - -// playback 360° panorama video. -[self.player replaceVideoWithURL:contentURL videoType:SGVideoTypeVR]; - -// start playing -[self.player play]; - -``` - -### Advanced settings - -```obj-c - -// selected playback core. -self.player.decoder = [SGPlayerDecoder defaultDecoder]; // default config,Together with AVPlayer and FFmpeg. -self.player.decoder = [SGPlayerDecoder AVPlayerDecoder]; // only use AVPlayer -self.player.decoder = [SGPlayerDecoder FFmpegDecoder]; // only use FFmpeg - -// set the specified format playback core. -self.player.decoder.decodeTypeForMPEG4 = SGDecoderTypeFFmpeg; // use FFmoeg play mp4 files. - -// open FFmpeg hardware accelerate. -self.player.decoder.hardwareAccelerateEnableForFFmpeg = YES; - -// enter cardboard mode -self.player.displayMode = SGDisplayModeBox; - -// set background mode. -// if allow background mode, you should open 'Background Modes' and check 'Audio' option, and set AVAudioSession Category to AVAudioSessionCategoryPlayback -self.player.backgroundMode = SGPlayerBackgroundModeAutoPlayAndPause; // auto play and pause. -self.player.backgroundMode = SGPlayerBackgroundModeContinue; // continue. - ``` +## Flow Chart -## Screenshots - -### iOS - -- Plane video - -![ios-i-see-fire](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/ios-i-see-fire.gif) - -- 360° panorama video - -![ios-google-vr](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/ios-google-vr.gif) - -- Cardboard mode - -![ios-google-vr-box](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/ios-google-vr-box.gif) - - -### macOS - -- Plane video - -![mac-i-see-fire](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/mac-i-see-fire.gif) - -- 360° panorama video - -![mac-google-vr](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/mac-google-vr.gif) +![Flow Chart](https://github.com/libobjc/SGPlayer/blob/dev/2.0/documents/flow-chart.jpg?raw=true) +## Related +- [KTVHTTPCache](https://github.com/ChangbaDevs/KTVHTTPCache) - A smart media cache framework. +- [KTVVideoProcess](https://github.com/ChangbaDevs/KTVVideoProcess) - A High-Performance video effects processing framework. ## Communication - GitHub : [Single](https://github.com/libobjc) - Email : libobjc@gmail.com - - -## Developed by Single - -- [KTVHTTPCache](https://github.com/ChangbaDevs/KTVHTTPCache) - A smart media cache framework. -- [KTVVideoProcess](https://github.com/ChangbaDevs/KTVVideoProcess) - A High-Performance video effects processing framework. diff --git a/SGPlayer.xcodeproj/project.pbxproj b/SGPlayer.xcodeproj/project.pbxproj index ff51dc92..7e0c2afa 100644 --- a/SGPlayer.xcodeproj/project.pbxproj +++ b/SGPlayer.xcodeproj/project.pbxproj @@ -7,824 +7,656 @@ objects = { /* Begin PBXBuildFile section */ - 9C25346F1FAB151500BBFA5C /* avcodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CB1FAB151400BBFA5C /* avcodec.h */; }; - 9C2534701FAB151500BBFA5C /* avcodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CB1FAB151400BBFA5C /* avcodec.h */; }; - 9C2534711FAB151500BBFA5C /* avcodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CB1FAB151400BBFA5C /* avcodec.h */; }; - 9C2534721FAB151500BBFA5C /* avdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CC1FAB151400BBFA5C /* avdct.h */; }; - 9C2534731FAB151500BBFA5C /* avdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CC1FAB151400BBFA5C /* avdct.h */; }; - 9C2534741FAB151500BBFA5C /* avdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CC1FAB151400BBFA5C /* avdct.h */; }; - 9C2534751FAB151500BBFA5C /* avfft.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CD1FAB151400BBFA5C /* avfft.h */; }; - 9C2534761FAB151500BBFA5C /* avfft.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CD1FAB151400BBFA5C /* avfft.h */; }; - 9C2534771FAB151500BBFA5C /* avfft.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CD1FAB151400BBFA5C /* avfft.h */; }; - 9C2534781FAB151500BBFA5C /* d3d11va.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CE1FAB151400BBFA5C /* d3d11va.h */; }; - 9C2534791FAB151500BBFA5C /* d3d11va.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CE1FAB151400BBFA5C /* d3d11va.h */; }; - 9C25347A1FAB151500BBFA5C /* d3d11va.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CE1FAB151400BBFA5C /* d3d11va.h */; }; - 9C25347B1FAB151500BBFA5C /* dirac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CF1FAB151400BBFA5C /* dirac.h */; }; - 9C25347C1FAB151500BBFA5C /* dirac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CF1FAB151400BBFA5C /* dirac.h */; }; - 9C25347D1FAB151500BBFA5C /* dirac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533CF1FAB151400BBFA5C /* dirac.h */; }; - 9C25347E1FAB151500BBFA5C /* dv_profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D01FAB151400BBFA5C /* dv_profile.h */; }; - 9C25347F1FAB151500BBFA5C /* dv_profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D01FAB151400BBFA5C /* dv_profile.h */; }; - 9C2534801FAB151500BBFA5C /* dv_profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D01FAB151400BBFA5C /* dv_profile.h */; }; - 9C2534811FAB151500BBFA5C /* dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D11FAB151400BBFA5C /* dxva2.h */; }; - 9C2534821FAB151500BBFA5C /* dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D11FAB151400BBFA5C /* dxva2.h */; }; - 9C2534831FAB151500BBFA5C /* dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D11FAB151400BBFA5C /* dxva2.h */; }; - 9C2534841FAB151500BBFA5C /* jni.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D21FAB151400BBFA5C /* jni.h */; }; - 9C2534851FAB151500BBFA5C /* jni.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D21FAB151400BBFA5C /* jni.h */; }; - 9C2534861FAB151500BBFA5C /* jni.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D21FAB151400BBFA5C /* jni.h */; }; - 9C2534871FAB151500BBFA5C /* mediacodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D31FAB151400BBFA5C /* mediacodec.h */; }; - 9C2534881FAB151500BBFA5C /* mediacodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D31FAB151400BBFA5C /* mediacodec.h */; }; - 9C2534891FAB151500BBFA5C /* mediacodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D31FAB151400BBFA5C /* mediacodec.h */; }; - 9C25348A1FAB151500BBFA5C /* qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D41FAB151400BBFA5C /* qsv.h */; }; - 9C25348B1FAB151500BBFA5C /* qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D41FAB151400BBFA5C /* qsv.h */; }; - 9C25348C1FAB151500BBFA5C /* qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D41FAB151400BBFA5C /* qsv.h */; }; - 9C25348D1FAB151500BBFA5C /* vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D51FAB151400BBFA5C /* vaapi.h */; }; - 9C25348E1FAB151500BBFA5C /* vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D51FAB151400BBFA5C /* vaapi.h */; }; - 9C25348F1FAB151500BBFA5C /* vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D51FAB151400BBFA5C /* vaapi.h */; }; - 9C2534901FAB151500BBFA5C /* vda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D61FAB151400BBFA5C /* vda.h */; }; - 9C2534911FAB151500BBFA5C /* vda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D61FAB151400BBFA5C /* vda.h */; }; - 9C2534921FAB151500BBFA5C /* vda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D61FAB151400BBFA5C /* vda.h */; }; - 9C2534931FAB151500BBFA5C /* vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D71FAB151400BBFA5C /* vdpau.h */; }; - 9C2534941FAB151500BBFA5C /* vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D71FAB151400BBFA5C /* vdpau.h */; }; - 9C2534951FAB151500BBFA5C /* vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D71FAB151400BBFA5C /* vdpau.h */; }; - 9C2534961FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D81FAB151400BBFA5C /* version.h */; }; - 9C2534971FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D81FAB151400BBFA5C /* version.h */; }; - 9C2534981FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D81FAB151400BBFA5C /* version.h */; }; - 9C2534991FAB151500BBFA5C /* videotoolbox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D91FAB151400BBFA5C /* videotoolbox.h */; }; - 9C25349A1FAB151500BBFA5C /* videotoolbox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D91FAB151400BBFA5C /* videotoolbox.h */; }; - 9C25349B1FAB151500BBFA5C /* videotoolbox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533D91FAB151400BBFA5C /* videotoolbox.h */; }; - 9C25349C1FAB151500BBFA5C /* vorbis_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DA1FAB151400BBFA5C /* vorbis_parser.h */; }; - 9C25349D1FAB151500BBFA5C /* vorbis_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DA1FAB151400BBFA5C /* vorbis_parser.h */; }; - 9C25349E1FAB151500BBFA5C /* vorbis_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DA1FAB151400BBFA5C /* vorbis_parser.h */; }; - 9C25349F1FAB151500BBFA5C /* xvmc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DB1FAB151400BBFA5C /* xvmc.h */; }; - 9C2534A01FAB151500BBFA5C /* xvmc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DB1FAB151400BBFA5C /* xvmc.h */; }; - 9C2534A11FAB151500BBFA5C /* xvmc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DB1FAB151400BBFA5C /* xvmc.h */; }; - 9C2534A21FAB151500BBFA5C /* avfilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DD1FAB151400BBFA5C /* avfilter.h */; }; - 9C2534A31FAB151500BBFA5C /* avfilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DD1FAB151400BBFA5C /* avfilter.h */; }; - 9C2534A41FAB151500BBFA5C /* avfilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DD1FAB151400BBFA5C /* avfilter.h */; }; - 9C2534A51FAB151500BBFA5C /* avfiltergraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DE1FAB151400BBFA5C /* avfiltergraph.h */; }; - 9C2534A61FAB151500BBFA5C /* avfiltergraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DE1FAB151400BBFA5C /* avfiltergraph.h */; }; - 9C2534A71FAB151500BBFA5C /* avfiltergraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DE1FAB151400BBFA5C /* avfiltergraph.h */; }; - 9C2534A81FAB151500BBFA5C /* buffersink.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DF1FAB151400BBFA5C /* buffersink.h */; }; - 9C2534A91FAB151500BBFA5C /* buffersink.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DF1FAB151400BBFA5C /* buffersink.h */; }; - 9C2534AA1FAB151500BBFA5C /* buffersink.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533DF1FAB151400BBFA5C /* buffersink.h */; }; - 9C2534AB1FAB151500BBFA5C /* buffersrc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E01FAB151400BBFA5C /* buffersrc.h */; }; - 9C2534AC1FAB151500BBFA5C /* buffersrc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E01FAB151400BBFA5C /* buffersrc.h */; }; - 9C2534AD1FAB151500BBFA5C /* buffersrc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E01FAB151400BBFA5C /* buffersrc.h */; }; - 9C2534AE1FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E11FAB151400BBFA5C /* version.h */; }; - 9C2534AF1FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E11FAB151400BBFA5C /* version.h */; }; - 9C2534B01FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E11FAB151400BBFA5C /* version.h */; }; - 9C2534B11FAB151500BBFA5C /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E31FAB151400BBFA5C /* avformat.h */; }; - 9C2534B21FAB151500BBFA5C /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E31FAB151400BBFA5C /* avformat.h */; }; - 9C2534B31FAB151500BBFA5C /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E31FAB151400BBFA5C /* avformat.h */; }; - 9C2534B41FAB151500BBFA5C /* avio.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E41FAB151400BBFA5C /* avio.h */; }; - 9C2534B51FAB151500BBFA5C /* avio.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E41FAB151400BBFA5C /* avio.h */; }; - 9C2534B61FAB151500BBFA5C /* avio.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E41FAB151400BBFA5C /* avio.h */; }; - 9C2534B71FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E51FAB151400BBFA5C /* version.h */; }; - 9C2534B81FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E51FAB151400BBFA5C /* version.h */; }; - 9C2534B91FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E51FAB151400BBFA5C /* version.h */; }; - 9C2534BA1FAB151500BBFA5C /* adler32.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E71FAB151400BBFA5C /* adler32.h */; }; - 9C2534BB1FAB151500BBFA5C /* adler32.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E71FAB151400BBFA5C /* adler32.h */; }; - 9C2534BC1FAB151500BBFA5C /* adler32.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E71FAB151400BBFA5C /* adler32.h */; }; - 9C2534BD1FAB151500BBFA5C /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E81FAB151400BBFA5C /* aes.h */; }; - 9C2534BE1FAB151500BBFA5C /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E81FAB151400BBFA5C /* aes.h */; }; - 9C2534BF1FAB151500BBFA5C /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E81FAB151400BBFA5C /* aes.h */; }; - 9C2534C01FAB151500BBFA5C /* aes_ctr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E91FAB151400BBFA5C /* aes_ctr.h */; }; - 9C2534C11FAB151500BBFA5C /* aes_ctr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E91FAB151400BBFA5C /* aes_ctr.h */; }; - 9C2534C21FAB151500BBFA5C /* aes_ctr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533E91FAB151400BBFA5C /* aes_ctr.h */; }; - 9C2534C31FAB151500BBFA5C /* attributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EA1FAB151400BBFA5C /* attributes.h */; }; - 9C2534C41FAB151500BBFA5C /* attributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EA1FAB151400BBFA5C /* attributes.h */; }; - 9C2534C51FAB151500BBFA5C /* attributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EA1FAB151400BBFA5C /* attributes.h */; }; - 9C2534C61FAB151500BBFA5C /* audio_fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EB1FAB151400BBFA5C /* audio_fifo.h */; }; - 9C2534C71FAB151500BBFA5C /* audio_fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EB1FAB151400BBFA5C /* audio_fifo.h */; }; - 9C2534C81FAB151500BBFA5C /* audio_fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EB1FAB151400BBFA5C /* audio_fifo.h */; }; - 9C2534C91FAB151500BBFA5C /* avassert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EC1FAB151400BBFA5C /* avassert.h */; }; - 9C2534CA1FAB151500BBFA5C /* avassert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EC1FAB151400BBFA5C /* avassert.h */; }; - 9C2534CB1FAB151500BBFA5C /* avassert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EC1FAB151400BBFA5C /* avassert.h */; }; - 9C2534CC1FAB151500BBFA5C /* avconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533ED1FAB151400BBFA5C /* avconfig.h */; }; - 9C2534CD1FAB151500BBFA5C /* avconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533ED1FAB151400BBFA5C /* avconfig.h */; }; - 9C2534CE1FAB151500BBFA5C /* avconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533ED1FAB151400BBFA5C /* avconfig.h */; }; - 9C2534CF1FAB151500BBFA5C /* avstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EE1FAB151400BBFA5C /* avstring.h */; }; - 9C2534D01FAB151500BBFA5C /* avstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EE1FAB151400BBFA5C /* avstring.h */; }; - 9C2534D11FAB151500BBFA5C /* avstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EE1FAB151400BBFA5C /* avstring.h */; }; - 9C2534D21FAB151500BBFA5C /* avutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EF1FAB151400BBFA5C /* avutil.h */; }; - 9C2534D31FAB151500BBFA5C /* avutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EF1FAB151400BBFA5C /* avutil.h */; }; - 9C2534D41FAB151500BBFA5C /* avutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533EF1FAB151400BBFA5C /* avutil.h */; }; - 9C2534D51FAB151500BBFA5C /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F01FAB151400BBFA5C /* base64.h */; }; - 9C2534D61FAB151500BBFA5C /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F01FAB151400BBFA5C /* base64.h */; }; - 9C2534D71FAB151500BBFA5C /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F01FAB151400BBFA5C /* base64.h */; }; - 9C2534D81FAB151500BBFA5C /* blowfish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F11FAB151400BBFA5C /* blowfish.h */; }; - 9C2534D91FAB151500BBFA5C /* blowfish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F11FAB151400BBFA5C /* blowfish.h */; }; - 9C2534DA1FAB151500BBFA5C /* blowfish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F11FAB151400BBFA5C /* blowfish.h */; }; - 9C2534DB1FAB151500BBFA5C /* bprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F21FAB151400BBFA5C /* bprint.h */; }; - 9C2534DC1FAB151500BBFA5C /* bprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F21FAB151400BBFA5C /* bprint.h */; }; - 9C2534DD1FAB151500BBFA5C /* bprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F21FAB151400BBFA5C /* bprint.h */; }; - 9C2534DE1FAB151500BBFA5C /* bswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F31FAB151400BBFA5C /* bswap.h */; }; - 9C2534DF1FAB151500BBFA5C /* bswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F31FAB151400BBFA5C /* bswap.h */; }; - 9C2534E01FAB151500BBFA5C /* bswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F31FAB151400BBFA5C /* bswap.h */; }; - 9C2534E11FAB151500BBFA5C /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F41FAB151400BBFA5C /* buffer.h */; }; - 9C2534E21FAB151500BBFA5C /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F41FAB151400BBFA5C /* buffer.h */; }; - 9C2534E31FAB151500BBFA5C /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F41FAB151400BBFA5C /* buffer.h */; }; - 9C2534E41FAB151500BBFA5C /* camellia.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F51FAB151400BBFA5C /* camellia.h */; }; - 9C2534E51FAB151500BBFA5C /* camellia.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F51FAB151400BBFA5C /* camellia.h */; }; - 9C2534E61FAB151500BBFA5C /* camellia.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F51FAB151400BBFA5C /* camellia.h */; }; - 9C2534E71FAB151500BBFA5C /* cast5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F61FAB151400BBFA5C /* cast5.h */; }; - 9C2534E81FAB151500BBFA5C /* cast5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F61FAB151400BBFA5C /* cast5.h */; }; - 9C2534E91FAB151500BBFA5C /* cast5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F61FAB151400BBFA5C /* cast5.h */; }; - 9C2534EA1FAB151500BBFA5C /* channel_layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F71FAB151400BBFA5C /* channel_layout.h */; }; - 9C2534EB1FAB151500BBFA5C /* channel_layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F71FAB151400BBFA5C /* channel_layout.h */; }; - 9C2534EC1FAB151500BBFA5C /* channel_layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F71FAB151400BBFA5C /* channel_layout.h */; }; - 9C2534ED1FAB151500BBFA5C /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F81FAB151400BBFA5C /* common.h */; }; - 9C2534EE1FAB151500BBFA5C /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F81FAB151400BBFA5C /* common.h */; }; - 9C2534EF1FAB151500BBFA5C /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F81FAB151400BBFA5C /* common.h */; }; - 9C2534F01FAB151500BBFA5C /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F91FAB151400BBFA5C /* cpu.h */; }; - 9C2534F11FAB151500BBFA5C /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F91FAB151400BBFA5C /* cpu.h */; }; - 9C2534F21FAB151500BBFA5C /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533F91FAB151400BBFA5C /* cpu.h */; }; - 9C2534F31FAB151500BBFA5C /* crc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FA1FAB151400BBFA5C /* crc.h */; }; - 9C2534F41FAB151500BBFA5C /* crc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FA1FAB151400BBFA5C /* crc.h */; }; - 9C2534F51FAB151500BBFA5C /* crc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FA1FAB151400BBFA5C /* crc.h */; }; - 9C2534F61FAB151500BBFA5C /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FB1FAB151400BBFA5C /* des.h */; }; - 9C2534F71FAB151500BBFA5C /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FB1FAB151400BBFA5C /* des.h */; }; - 9C2534F81FAB151500BBFA5C /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FB1FAB151400BBFA5C /* des.h */; }; - 9C2534F91FAB151500BBFA5C /* dict.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FC1FAB151400BBFA5C /* dict.h */; }; - 9C2534FA1FAB151500BBFA5C /* dict.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FC1FAB151400BBFA5C /* dict.h */; }; - 9C2534FB1FAB151500BBFA5C /* dict.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FC1FAB151400BBFA5C /* dict.h */; }; - 9C2534FC1FAB151500BBFA5C /* display.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FD1FAB151400BBFA5C /* display.h */; }; - 9C2534FD1FAB151500BBFA5C /* display.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FD1FAB151400BBFA5C /* display.h */; }; - 9C2534FE1FAB151500BBFA5C /* display.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FD1FAB151400BBFA5C /* display.h */; }; - 9C2534FF1FAB151500BBFA5C /* downmix_info.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FE1FAB151400BBFA5C /* downmix_info.h */; }; - 9C2535001FAB151500BBFA5C /* downmix_info.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FE1FAB151400BBFA5C /* downmix_info.h */; }; - 9C2535011FAB151500BBFA5C /* downmix_info.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FE1FAB151400BBFA5C /* downmix_info.h */; }; - 9C2535021FAB151500BBFA5C /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FF1FAB151400BBFA5C /* error.h */; }; - 9C2535031FAB151500BBFA5C /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FF1FAB151400BBFA5C /* error.h */; }; - 9C2535041FAB151500BBFA5C /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2533FF1FAB151400BBFA5C /* error.h */; }; - 9C2535051FAB151500BBFA5C /* eval.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534001FAB151400BBFA5C /* eval.h */; }; - 9C2535061FAB151500BBFA5C /* eval.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534001FAB151400BBFA5C /* eval.h */; }; - 9C2535071FAB151500BBFA5C /* eval.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534001FAB151400BBFA5C /* eval.h */; }; - 9C2535081FAB151500BBFA5C /* ffversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534011FAB151400BBFA5C /* ffversion.h */; }; - 9C2535091FAB151500BBFA5C /* ffversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534011FAB151400BBFA5C /* ffversion.h */; }; - 9C25350A1FAB151500BBFA5C /* ffversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534011FAB151400BBFA5C /* ffversion.h */; }; - 9C25350B1FAB151500BBFA5C /* fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534021FAB151400BBFA5C /* fifo.h */; }; - 9C25350C1FAB151500BBFA5C /* fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534021FAB151400BBFA5C /* fifo.h */; }; - 9C25350D1FAB151500BBFA5C /* fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534021FAB151400BBFA5C /* fifo.h */; }; - 9C25350E1FAB151500BBFA5C /* file.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534031FAB151400BBFA5C /* file.h */; }; - 9C25350F1FAB151500BBFA5C /* file.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534031FAB151400BBFA5C /* file.h */; }; - 9C2535101FAB151500BBFA5C /* file.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534031FAB151400BBFA5C /* file.h */; }; - 9C2535111FAB151500BBFA5C /* frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534041FAB151400BBFA5C /* frame.h */; }; - 9C2535121FAB151500BBFA5C /* frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534041FAB151400BBFA5C /* frame.h */; }; - 9C2535131FAB151500BBFA5C /* frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534041FAB151400BBFA5C /* frame.h */; }; - 9C2535141FAB151500BBFA5C /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534051FAB151400BBFA5C /* hash.h */; }; - 9C2535151FAB151500BBFA5C /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534051FAB151400BBFA5C /* hash.h */; }; - 9C2535161FAB151500BBFA5C /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534051FAB151400BBFA5C /* hash.h */; }; - 9C2535171FAB151500BBFA5C /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534061FAB151400BBFA5C /* hmac.h */; }; - 9C2535181FAB151500BBFA5C /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534061FAB151400BBFA5C /* hmac.h */; }; - 9C2535191FAB151500BBFA5C /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534061FAB151400BBFA5C /* hmac.h */; }; - 9C25351A1FAB151500BBFA5C /* hwcontext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534071FAB151400BBFA5C /* hwcontext.h */; }; - 9C25351B1FAB151500BBFA5C /* hwcontext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534071FAB151400BBFA5C /* hwcontext.h */; }; - 9C25351C1FAB151500BBFA5C /* hwcontext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534071FAB151400BBFA5C /* hwcontext.h */; }; - 9C25351D1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534081FAB151400BBFA5C /* hwcontext_cuda.h */; }; - 9C25351E1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534081FAB151400BBFA5C /* hwcontext_cuda.h */; }; - 9C25351F1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534081FAB151400BBFA5C /* hwcontext_cuda.h */; }; - 9C2535201FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534091FAB151400BBFA5C /* hwcontext_dxva2.h */; }; - 9C2535211FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534091FAB151400BBFA5C /* hwcontext_dxva2.h */; }; - 9C2535221FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534091FAB151400BBFA5C /* hwcontext_dxva2.h */; }; - 9C2535231FAB151500BBFA5C /* hwcontext_qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340A1FAB151400BBFA5C /* hwcontext_qsv.h */; }; - 9C2535241FAB151500BBFA5C /* hwcontext_qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340A1FAB151400BBFA5C /* hwcontext_qsv.h */; }; - 9C2535251FAB151500BBFA5C /* hwcontext_qsv.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340A1FAB151400BBFA5C /* hwcontext_qsv.h */; }; - 9C2535261FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340B1FAB151400BBFA5C /* hwcontext_vaapi.h */; }; - 9C2535271FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340B1FAB151400BBFA5C /* hwcontext_vaapi.h */; }; - 9C2535281FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340B1FAB151400BBFA5C /* hwcontext_vaapi.h */; }; - 9C2535291FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340C1FAB151400BBFA5C /* hwcontext_vdpau.h */; }; - 9C25352A1FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340C1FAB151400BBFA5C /* hwcontext_vdpau.h */; }; - 9C25352B1FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340C1FAB151400BBFA5C /* hwcontext_vdpau.h */; }; - 9C25352C1FAB151500BBFA5C /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340D1FAB151400BBFA5C /* imgutils.h */; }; - 9C25352D1FAB151500BBFA5C /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340D1FAB151400BBFA5C /* imgutils.h */; }; - 9C25352E1FAB151500BBFA5C /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340D1FAB151400BBFA5C /* imgutils.h */; }; - 9C25352F1FAB151500BBFA5C /* intfloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340E1FAB151400BBFA5C /* intfloat.h */; }; - 9C2535301FAB151500BBFA5C /* intfloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340E1FAB151400BBFA5C /* intfloat.h */; }; - 9C2535311FAB151500BBFA5C /* intfloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340E1FAB151400BBFA5C /* intfloat.h */; }; - 9C2535321FAB151500BBFA5C /* intreadwrite.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340F1FAB151400BBFA5C /* intreadwrite.h */; }; - 9C2535331FAB151500BBFA5C /* intreadwrite.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340F1FAB151400BBFA5C /* intreadwrite.h */; }; - 9C2535341FAB151500BBFA5C /* intreadwrite.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25340F1FAB151400BBFA5C /* intreadwrite.h */; }; - 9C2535351FAB151500BBFA5C /* lfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534101FAB151400BBFA5C /* lfg.h */; }; - 9C2535361FAB151500BBFA5C /* lfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534101FAB151400BBFA5C /* lfg.h */; }; - 9C2535371FAB151500BBFA5C /* lfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534101FAB151400BBFA5C /* lfg.h */; }; - 9C2535381FAB151500BBFA5C /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534111FAB151400BBFA5C /* log.h */; }; - 9C2535391FAB151500BBFA5C /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534111FAB151400BBFA5C /* log.h */; }; - 9C25353A1FAB151500BBFA5C /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534111FAB151400BBFA5C /* log.h */; }; - 9C25353B1FAB151500BBFA5C /* lzo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534121FAB151400BBFA5C /* lzo.h */; }; - 9C25353C1FAB151500BBFA5C /* lzo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534121FAB151400BBFA5C /* lzo.h */; }; - 9C25353D1FAB151500BBFA5C /* lzo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534121FAB151400BBFA5C /* lzo.h */; }; - 9C25353E1FAB151500BBFA5C /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534131FAB151400BBFA5C /* macros.h */; }; - 9C25353F1FAB151500BBFA5C /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534131FAB151400BBFA5C /* macros.h */; }; - 9C2535401FAB151500BBFA5C /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534131FAB151400BBFA5C /* macros.h */; }; - 9C2535411FAB151500BBFA5C /* mastering_display_metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534141FAB151400BBFA5C /* mastering_display_metadata.h */; }; - 9C2535421FAB151500BBFA5C /* mastering_display_metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534141FAB151400BBFA5C /* mastering_display_metadata.h */; }; - 9C2535431FAB151500BBFA5C /* mastering_display_metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534141FAB151400BBFA5C /* mastering_display_metadata.h */; }; - 9C2535441FAB151500BBFA5C /* mathematics.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534151FAB151400BBFA5C /* mathematics.h */; }; - 9C2535451FAB151500BBFA5C /* mathematics.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534151FAB151400BBFA5C /* mathematics.h */; }; - 9C2535461FAB151500BBFA5C /* mathematics.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534151FAB151400BBFA5C /* mathematics.h */; }; - 9C2535471FAB151500BBFA5C /* md5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534161FAB151400BBFA5C /* md5.h */; }; - 9C2535481FAB151500BBFA5C /* md5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534161FAB151400BBFA5C /* md5.h */; }; - 9C2535491FAB151500BBFA5C /* md5.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534161FAB151400BBFA5C /* md5.h */; }; - 9C25354A1FAB151500BBFA5C /* mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534171FAB151400BBFA5C /* mem.h */; }; - 9C25354B1FAB151500BBFA5C /* mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534171FAB151400BBFA5C /* mem.h */; }; - 9C25354C1FAB151500BBFA5C /* mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534171FAB151400BBFA5C /* mem.h */; }; - 9C25354D1FAB151500BBFA5C /* motion_vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534181FAB151400BBFA5C /* motion_vector.h */; }; - 9C25354E1FAB151500BBFA5C /* motion_vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534181FAB151400BBFA5C /* motion_vector.h */; }; - 9C25354F1FAB151500BBFA5C /* motion_vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534181FAB151400BBFA5C /* motion_vector.h */; }; - 9C2535501FAB151500BBFA5C /* murmur3.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534191FAB151400BBFA5C /* murmur3.h */; }; - 9C2535511FAB151500BBFA5C /* murmur3.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534191FAB151400BBFA5C /* murmur3.h */; }; - 9C2535521FAB151500BBFA5C /* murmur3.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534191FAB151400BBFA5C /* murmur3.h */; }; - 9C2535531FAB151500BBFA5C /* opt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341A1FAB151400BBFA5C /* opt.h */; }; - 9C2535541FAB151500BBFA5C /* opt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341A1FAB151400BBFA5C /* opt.h */; }; - 9C2535551FAB151500BBFA5C /* opt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341A1FAB151400BBFA5C /* opt.h */; }; - 9C2535561FAB151500BBFA5C /* parseutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341B1FAB151400BBFA5C /* parseutils.h */; }; - 9C2535571FAB151500BBFA5C /* parseutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341B1FAB151400BBFA5C /* parseutils.h */; }; - 9C2535581FAB151500BBFA5C /* parseutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341B1FAB151400BBFA5C /* parseutils.h */; }; - 9C2535591FAB151500BBFA5C /* pixdesc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341C1FAB151400BBFA5C /* pixdesc.h */; }; - 9C25355A1FAB151500BBFA5C /* pixdesc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341C1FAB151400BBFA5C /* pixdesc.h */; }; - 9C25355B1FAB151500BBFA5C /* pixdesc.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341C1FAB151400BBFA5C /* pixdesc.h */; }; - 9C25355C1FAB151500BBFA5C /* pixelutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341D1FAB151400BBFA5C /* pixelutils.h */; }; - 9C25355D1FAB151500BBFA5C /* pixelutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341D1FAB151400BBFA5C /* pixelutils.h */; }; - 9C25355E1FAB151500BBFA5C /* pixelutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341D1FAB151400BBFA5C /* pixelutils.h */; }; - 9C25355F1FAB151500BBFA5C /* pixfmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341E1FAB151400BBFA5C /* pixfmt.h */; }; - 9C2535601FAB151500BBFA5C /* pixfmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341E1FAB151400BBFA5C /* pixfmt.h */; }; - 9C2535611FAB151500BBFA5C /* pixfmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341E1FAB151400BBFA5C /* pixfmt.h */; }; - 9C2535621FAB151500BBFA5C /* random_seed.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341F1FAB151400BBFA5C /* random_seed.h */; }; - 9C2535631FAB151500BBFA5C /* random_seed.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341F1FAB151400BBFA5C /* random_seed.h */; }; - 9C2535641FAB151500BBFA5C /* random_seed.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25341F1FAB151400BBFA5C /* random_seed.h */; }; - 9C2535651FAB151500BBFA5C /* rational.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534201FAB151400BBFA5C /* rational.h */; }; - 9C2535661FAB151500BBFA5C /* rational.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534201FAB151400BBFA5C /* rational.h */; }; - 9C2535671FAB151500BBFA5C /* rational.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534201FAB151400BBFA5C /* rational.h */; }; - 9C2535681FAB151500BBFA5C /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534211FAB151400BBFA5C /* rc4.h */; }; - 9C2535691FAB151500BBFA5C /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534211FAB151400BBFA5C /* rc4.h */; }; - 9C25356A1FAB151500BBFA5C /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534211FAB151400BBFA5C /* rc4.h */; }; - 9C25356B1FAB151500BBFA5C /* replaygain.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534221FAB151400BBFA5C /* replaygain.h */; }; - 9C25356C1FAB151500BBFA5C /* replaygain.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534221FAB151400BBFA5C /* replaygain.h */; }; - 9C25356D1FAB151500BBFA5C /* replaygain.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534221FAB151400BBFA5C /* replaygain.h */; }; - 9C25356E1FAB151500BBFA5C /* ripemd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534231FAB151500BBFA5C /* ripemd.h */; }; - 9C25356F1FAB151500BBFA5C /* ripemd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534231FAB151500BBFA5C /* ripemd.h */; }; - 9C2535701FAB151500BBFA5C /* ripemd.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534231FAB151500BBFA5C /* ripemd.h */; }; - 9C2535711FAB151500BBFA5C /* samplefmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534241FAB151500BBFA5C /* samplefmt.h */; }; - 9C2535721FAB151500BBFA5C /* samplefmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534241FAB151500BBFA5C /* samplefmt.h */; }; - 9C2535731FAB151500BBFA5C /* samplefmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534241FAB151500BBFA5C /* samplefmt.h */; }; - 9C2535741FAB151500BBFA5C /* sha.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534251FAB151500BBFA5C /* sha.h */; }; - 9C2535751FAB151500BBFA5C /* sha.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534251FAB151500BBFA5C /* sha.h */; }; - 9C2535761FAB151500BBFA5C /* sha.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534251FAB151500BBFA5C /* sha.h */; }; - 9C2535771FAB151500BBFA5C /* sha512.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534261FAB151500BBFA5C /* sha512.h */; }; - 9C2535781FAB151500BBFA5C /* sha512.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534261FAB151500BBFA5C /* sha512.h */; }; - 9C2535791FAB151500BBFA5C /* sha512.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534261FAB151500BBFA5C /* sha512.h */; }; - 9C25357A1FAB151500BBFA5C /* stereo3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534271FAB151500BBFA5C /* stereo3d.h */; }; - 9C25357B1FAB151500BBFA5C /* stereo3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534271FAB151500BBFA5C /* stereo3d.h */; }; - 9C25357C1FAB151500BBFA5C /* stereo3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534271FAB151500BBFA5C /* stereo3d.h */; }; - 9C25357D1FAB151500BBFA5C /* tea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534281FAB151500BBFA5C /* tea.h */; }; - 9C25357E1FAB151500BBFA5C /* tea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534281FAB151500BBFA5C /* tea.h */; }; - 9C25357F1FAB151500BBFA5C /* tea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534281FAB151500BBFA5C /* tea.h */; }; - 9C2535801FAB151500BBFA5C /* threadmessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534291FAB151500BBFA5C /* threadmessage.h */; }; - 9C2535811FAB151500BBFA5C /* threadmessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534291FAB151500BBFA5C /* threadmessage.h */; }; - 9C2535821FAB151500BBFA5C /* threadmessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534291FAB151500BBFA5C /* threadmessage.h */; }; - 9C2535831FAB151500BBFA5C /* time.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342A1FAB151500BBFA5C /* time.h */; }; - 9C2535841FAB151500BBFA5C /* time.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342A1FAB151500BBFA5C /* time.h */; }; - 9C2535851FAB151500BBFA5C /* time.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342A1FAB151500BBFA5C /* time.h */; }; - 9C2535861FAB151500BBFA5C /* timecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342B1FAB151500BBFA5C /* timecode.h */; }; - 9C2535871FAB151500BBFA5C /* timecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342B1FAB151500BBFA5C /* timecode.h */; }; - 9C2535881FAB151500BBFA5C /* timecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342B1FAB151500BBFA5C /* timecode.h */; }; - 9C2535891FAB151500BBFA5C /* timestamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342C1FAB151500BBFA5C /* timestamp.h */; }; - 9C25358A1FAB151500BBFA5C /* timestamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342C1FAB151500BBFA5C /* timestamp.h */; }; - 9C25358B1FAB151500BBFA5C /* timestamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342C1FAB151500BBFA5C /* timestamp.h */; }; - 9C25358C1FAB151500BBFA5C /* tree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342D1FAB151500BBFA5C /* tree.h */; }; - 9C25358D1FAB151500BBFA5C /* tree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342D1FAB151500BBFA5C /* tree.h */; }; - 9C25358E1FAB151500BBFA5C /* tree.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342D1FAB151500BBFA5C /* tree.h */; }; - 9C25358F1FAB151500BBFA5C /* twofish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342E1FAB151500BBFA5C /* twofish.h */; }; - 9C2535901FAB151500BBFA5C /* twofish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342E1FAB151500BBFA5C /* twofish.h */; }; - 9C2535911FAB151500BBFA5C /* twofish.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342E1FAB151500BBFA5C /* twofish.h */; }; - 9C2535921FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342F1FAB151500BBFA5C /* version.h */; }; - 9C2535931FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342F1FAB151500BBFA5C /* version.h */; }; - 9C2535941FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25342F1FAB151500BBFA5C /* version.h */; }; - 9C2535951FAB151500BBFA5C /* xtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534301FAB151500BBFA5C /* xtea.h */; }; - 9C2535961FAB151500BBFA5C /* xtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534301FAB151500BBFA5C /* xtea.h */; }; - 9C2535971FAB151500BBFA5C /* xtea.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534301FAB151500BBFA5C /* xtea.h */; }; - 9C2535981FAB151500BBFA5C /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534321FAB151500BBFA5C /* swresample.h */; }; - 9C2535991FAB151500BBFA5C /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534321FAB151500BBFA5C /* swresample.h */; }; - 9C25359A1FAB151500BBFA5C /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534321FAB151500BBFA5C /* swresample.h */; }; - 9C25359B1FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534331FAB151500BBFA5C /* version.h */; }; - 9C25359C1FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534331FAB151500BBFA5C /* version.h */; }; - 9C25359D1FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534331FAB151500BBFA5C /* version.h */; }; - 9C25359E1FAB151500BBFA5C /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534351FAB151500BBFA5C /* swscale.h */; }; - 9C25359F1FAB151500BBFA5C /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534351FAB151500BBFA5C /* swscale.h */; }; - 9C2535A01FAB151500BBFA5C /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534351FAB151500BBFA5C /* swscale.h */; }; - 9C2535A11FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534361FAB151500BBFA5C /* version.h */; }; - 9C2535A21FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534361FAB151500BBFA5C /* version.h */; }; - 9C2535A31FAB151500BBFA5C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534361FAB151500BBFA5C /* version.h */; }; - 9C2535EC1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534531FAB151500BBFA5C /* SGFFAudioDecoder.h */; }; - 9C2535ED1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534531FAB151500BBFA5C /* SGFFAudioDecoder.h */; }; - 9C2535EE1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534531FAB151500BBFA5C /* SGFFAudioDecoder.h */; }; - 9C2535EF1FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534541FAB151500BBFA5C /* SGFFAudioDecoder.m */; }; - 9C2535F01FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534541FAB151500BBFA5C /* SGFFAudioDecoder.m */; }; - 9C2535F11FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534541FAB151500BBFA5C /* SGFFAudioDecoder.m */; }; - 9C2535F21FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534551FAB151500BBFA5C /* SGFFAudioFrame.h */; }; - 9C2535F31FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534551FAB151500BBFA5C /* SGFFAudioFrame.h */; }; - 9C2535F41FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534551FAB151500BBFA5C /* SGFFAudioFrame.h */; }; - 9C2535F51FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534561FAB151500BBFA5C /* SGFFAudioFrame.m */; }; - 9C2535F61FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534561FAB151500BBFA5C /* SGFFAudioFrame.m */; }; - 9C2535F71FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534561FAB151500BBFA5C /* SGFFAudioFrame.m */; }; - 9C2535F81FAB151500BBFA5C /* SGFFDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534571FAB151500BBFA5C /* SGFFDecoder.h */; }; - 9C2535F91FAB151500BBFA5C /* SGFFDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534571FAB151500BBFA5C /* SGFFDecoder.h */; }; - 9C2535FA1FAB151500BBFA5C /* SGFFDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534571FAB151500BBFA5C /* SGFFDecoder.h */; }; - 9C2535FB1FAB151500BBFA5C /* SGFFDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534581FAB151500BBFA5C /* SGFFDecoder.m */; }; - 9C2535FC1FAB151500BBFA5C /* SGFFDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534581FAB151500BBFA5C /* SGFFDecoder.m */; }; - 9C2535FD1FAB151500BBFA5C /* SGFFDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534581FAB151500BBFA5C /* SGFFDecoder.m */; }; - 9C2535FE1FAB151500BBFA5C /* SGFFFormatContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534591FAB151500BBFA5C /* SGFFFormatContext.h */; }; - 9C2535FF1FAB151500BBFA5C /* SGFFFormatContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534591FAB151500BBFA5C /* SGFFFormatContext.h */; }; - 9C2536001FAB151500BBFA5C /* SGFFFormatContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534591FAB151500BBFA5C /* SGFFFormatContext.h */; }; - 9C2536011FAB151500BBFA5C /* SGFFFormatContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345A1FAB151500BBFA5C /* SGFFFormatContext.m */; }; - 9C2536021FAB151500BBFA5C /* SGFFFormatContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345A1FAB151500BBFA5C /* SGFFFormatContext.m */; }; - 9C2536031FAB151500BBFA5C /* SGFFFormatContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345A1FAB151500BBFA5C /* SGFFFormatContext.m */; }; - 9C2536041FAB151500BBFA5C /* SGFFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345B1FAB151500BBFA5C /* SGFFFrame.h */; }; - 9C2536051FAB151500BBFA5C /* SGFFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345B1FAB151500BBFA5C /* SGFFFrame.h */; }; - 9C2536061FAB151500BBFA5C /* SGFFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345B1FAB151500BBFA5C /* SGFFFrame.h */; }; - 9C2536071FAB151500BBFA5C /* SGFFFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345C1FAB151500BBFA5C /* SGFFFrame.m */; }; - 9C2536081FAB151500BBFA5C /* SGFFFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345C1FAB151500BBFA5C /* SGFFFrame.m */; }; - 9C2536091FAB151500BBFA5C /* SGFFFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345C1FAB151500BBFA5C /* SGFFFrame.m */; }; - 9C25360A1FAB151500BBFA5C /* SGFFFramePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345D1FAB151500BBFA5C /* SGFFFramePool.h */; }; - 9C25360B1FAB151500BBFA5C /* SGFFFramePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345D1FAB151500BBFA5C /* SGFFFramePool.h */; }; - 9C25360C1FAB151500BBFA5C /* SGFFFramePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345D1FAB151500BBFA5C /* SGFFFramePool.h */; }; - 9C25360D1FAB151500BBFA5C /* SGFFFramePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345E1FAB151500BBFA5C /* SGFFFramePool.m */; }; - 9C25360E1FAB151500BBFA5C /* SGFFFramePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345E1FAB151500BBFA5C /* SGFFFramePool.m */; }; - 9C25360F1FAB151500BBFA5C /* SGFFFramePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25345E1FAB151500BBFA5C /* SGFFFramePool.m */; }; - 9C2536101FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345F1FAB151500BBFA5C /* SGFFFrameQueue.h */; }; - 9C2536111FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345F1FAB151500BBFA5C /* SGFFFrameQueue.h */; }; - 9C2536121FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25345F1FAB151500BBFA5C /* SGFFFrameQueue.h */; }; - 9C2536131FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534601FAB151500BBFA5C /* SGFFFrameQueue.m */; }; - 9C2536141FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534601FAB151500BBFA5C /* SGFFFrameQueue.m */; }; - 9C2536151FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534601FAB151500BBFA5C /* SGFFFrameQueue.m */; }; - 9C2536161FAB151500BBFA5C /* SGFFMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534611FAB151500BBFA5C /* SGFFMetadata.h */; }; - 9C2536171FAB151500BBFA5C /* SGFFMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534611FAB151500BBFA5C /* SGFFMetadata.h */; }; - 9C2536181FAB151500BBFA5C /* SGFFMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534611FAB151500BBFA5C /* SGFFMetadata.h */; }; - 9C2536191FAB151500BBFA5C /* SGFFMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534621FAB151500BBFA5C /* SGFFMetadata.m */; }; - 9C25361A1FAB151500BBFA5C /* SGFFMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534621FAB151500BBFA5C /* SGFFMetadata.m */; }; - 9C25361B1FAB151500BBFA5C /* SGFFMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534621FAB151500BBFA5C /* SGFFMetadata.m */; }; - 9C25361C1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534631FAB151500BBFA5C /* SGFFPacketQueue.h */; }; - 9C25361D1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534631FAB151500BBFA5C /* SGFFPacketQueue.h */; }; - 9C25361E1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534631FAB151500BBFA5C /* SGFFPacketQueue.h */; }; - 9C25361F1FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534641FAB151500BBFA5C /* SGFFPacketQueue.m */; }; - 9C2536201FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534641FAB151500BBFA5C /* SGFFPacketQueue.m */; }; - 9C2536211FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534641FAB151500BBFA5C /* SGFFPacketQueue.m */; }; - 9C2536221FAB151500BBFA5C /* SGFFTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534651FAB151500BBFA5C /* SGFFTools.h */; }; - 9C2536231FAB151500BBFA5C /* SGFFTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534651FAB151500BBFA5C /* SGFFTools.h */; }; - 9C2536241FAB151500BBFA5C /* SGFFTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534651FAB151500BBFA5C /* SGFFTools.h */; }; - 9C2536251FAB151500BBFA5C /* SGFFTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534661FAB151500BBFA5C /* SGFFTools.m */; }; - 9C2536261FAB151500BBFA5C /* SGFFTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534661FAB151500BBFA5C /* SGFFTools.m */; }; - 9C2536271FAB151500BBFA5C /* SGFFTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534661FAB151500BBFA5C /* SGFFTools.m */; }; - 9C2536281FAB151500BBFA5C /* SGFFTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534671FAB151500BBFA5C /* SGFFTrack.h */; }; - 9C2536291FAB151500BBFA5C /* SGFFTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534671FAB151500BBFA5C /* SGFFTrack.h */; }; - 9C25362A1FAB151500BBFA5C /* SGFFTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534671FAB151500BBFA5C /* SGFFTrack.h */; }; - 9C25362B1FAB151500BBFA5C /* SGFFTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534681FAB151500BBFA5C /* SGFFTrack.m */; }; - 9C25362C1FAB151500BBFA5C /* SGFFTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534681FAB151500BBFA5C /* SGFFTrack.m */; }; - 9C25362D1FAB151500BBFA5C /* SGFFTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2534681FAB151500BBFA5C /* SGFFTrack.m */; }; - 9C25362E1FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534691FAB151500BBFA5C /* SGFFVideoDecoder.h */; }; - 9C25362F1FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534691FAB151500BBFA5C /* SGFFVideoDecoder.h */; }; - 9C2536301FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2534691FAB151500BBFA5C /* SGFFVideoDecoder.h */; }; - 9C2536311FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346A1FAB151500BBFA5C /* SGFFVideoDecoder.m */; }; - 9C2536321FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346A1FAB151500BBFA5C /* SGFFVideoDecoder.m */; }; - 9C2536331FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346A1FAB151500BBFA5C /* SGFFVideoDecoder.m */; }; - 9C2536341FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346B1FAB151500BBFA5C /* SGFFVideoFrame.h */; }; - 9C2536351FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346B1FAB151500BBFA5C /* SGFFVideoFrame.h */; }; - 9C2536361FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346B1FAB151500BBFA5C /* SGFFVideoFrame.h */; }; - 9C2536371FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346C1FAB151500BBFA5C /* SGFFVideoFrame.m */; }; - 9C2536381FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346C1FAB151500BBFA5C /* SGFFVideoFrame.m */; }; - 9C2536391FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346C1FAB151500BBFA5C /* SGFFVideoFrame.m */; }; - 9C25363A1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346D1FAB151500BBFA5C /* SGFFVideoToolBox.h */; }; - 9C25363B1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346D1FAB151500BBFA5C /* SGFFVideoToolBox.h */; }; - 9C25363C1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25346D1FAB151500BBFA5C /* SGFFVideoToolBox.h */; }; - 9C25363D1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346E1FAB151500BBFA5C /* SGFFVideoToolBox.m */; }; - 9C25363E1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346E1FAB151500BBFA5C /* SGFFVideoToolBox.m */; }; - 9C25363F1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25346E1FAB151500BBFA5C /* SGFFVideoToolBox.m */; }; - 9C2536501FAB199500BBFA5C /* SGFFPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGFFPlayer.h */; }; - 9C2536511FAB199500BBFA5C /* SGFFPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGFFPlayer.h */; }; - 9C2536521FAB199500BBFA5C /* SGFFPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGFFPlayer.h */; }; - 9C2536531FAB199500BBFA5C /* SGFFPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGFFPlayer.m */; }; - 9C2536541FAB199500BBFA5C /* SGFFPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGFFPlayer.m */; }; - 9C2536551FAB199500BBFA5C /* SGFFPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGFFPlayer.m */; }; - 9C41E71D1E97569F006E5A65 /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793431E71402E00AD4289 /* libavcodec.a */; }; - 9C41E71E1E97569F006E5A65 /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793451E71402E00AD4289 /* libavfilter.a */; }; - 9C41E71F1E97569F006E5A65 /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793461E71402E00AD4289 /* libavformat.a */; }; - 9C41E7201E97569F006E5A65 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793471E71402E00AD4289 /* libavutil.a */; }; - 9C41E7211E97569F006E5A65 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793481E71402E00AD4289 /* libcrypto.a */; }; - 9C41E7221E97569F006E5A65 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793491E71402E00AD4289 /* libssl.a */; }; - 9C41E7231E97569F006E5A65 /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47934A1E71402E00AD4289 /* libswresample.a */; }; - 9C41E7241E97569F006E5A65 /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47934B1E71402E00AD4289 /* libswscale.a */; }; - 9C41E7251E9756A6006E5A65 /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793551E71403500AD4289 /* libavcodec.a */; }; - 9C41E7261E9756A6006E5A65 /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793571E71403500AD4289 /* libavfilter.a */; }; - 9C41E7271E9756A6006E5A65 /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793581E71403500AD4289 /* libavformat.a */; }; - 9C41E7281E9756A6006E5A65 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793591E71403500AD4289 /* libavutil.a */; }; - 9C41E7291E9756A6006E5A65 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47935A1E71403500AD4289 /* libcrypto.a */; }; - 9C41E72A1E9756A6006E5A65 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47935B1E71403500AD4289 /* libssl.a */; }; - 9C41E72B1E9756A6006E5A65 /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47935C1E71403500AD4289 /* libswresample.a */; }; - 9C41E72C1E9756A6006E5A65 /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47935D1E71403500AD4289 /* libswscale.a */; }; - 9C41E72D1E9756B0006E5A65 /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793671E71404A00AD4289 /* libavcodec.a */; }; - 9C41E72E1E9756B0006E5A65 /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C4793691E71404A00AD4289 /* libavfilter.a */; }; - 9C41E72F1E9756B0006E5A65 /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936A1E71404A00AD4289 /* libavformat.a */; }; - 9C41E7301E9756B0006E5A65 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936B1E71404A00AD4289 /* libavutil.a */; }; - 9C41E7311E9756B0006E5A65 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936C1E71404A00AD4289 /* libcrypto.a */; }; - 9C41E7321E9756B0006E5A65 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936D1E71404A00AD4289 /* libssl.a */; }; - 9C41E7331E9756B0006E5A65 /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936E1E71404A00AD4289 /* libswresample.a */; }; - 9C41E7341E9756B0006E5A65 /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C47936F1E71404A00AD4289 /* libswscale.a */; }; - 9C478EFF1E713A3200AD4289 /* SGPlayerImp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF71E713A3200AD4289 /* SGPlayerImp.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F001E713A3200AD4289 /* SGPlayerImp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF71E713A3200AD4289 /* SGPlayerImp.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F011E713A3200AD4289 /* SGPlayerImp.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF71E713A3200AD4289 /* SGPlayerImp.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F021E713A3200AD4289 /* SGPlayerImp.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EF81E713A3200AD4289 /* SGPlayerImp.m */; }; - 9C478F031E713A3200AD4289 /* SGPlayerImp.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EF81E713A3200AD4289 /* SGPlayerImp.m */; }; - 9C478F041E713A3200AD4289 /* SGPlayerImp.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EF81E713A3200AD4289 /* SGPlayerImp.m */; }; - 9C478F051E713A3200AD4289 /* SGPlayerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF91E713A3200AD4289 /* SGPlayerAction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F061E713A3200AD4289 /* SGPlayerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF91E713A3200AD4289 /* SGPlayerAction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F071E713A3200AD4289 /* SGPlayerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EF91E713A3200AD4289 /* SGPlayerAction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F081E713A3200AD4289 /* SGPlayerAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFA1E713A3200AD4289 /* SGPlayerAction.m */; }; - 9C478F091E713A3200AD4289 /* SGPlayerAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFA1E713A3200AD4289 /* SGPlayerAction.m */; }; - 9C478F0A1E713A3200AD4289 /* SGPlayerAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFA1E713A3200AD4289 /* SGPlayerAction.m */; }; - 9C478F0B1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFB1E713A3200AD4289 /* SGPlayerDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F0C1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFB1E713A3200AD4289 /* SGPlayerDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F0D1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFB1E713A3200AD4289 /* SGPlayerDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F0E1E713A3200AD4289 /* SGPlayerDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFC1E713A3200AD4289 /* SGPlayerDecoder.m */; }; - 9C478F0F1E713A3200AD4289 /* SGPlayerDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFC1E713A3200AD4289 /* SGPlayerDecoder.m */; }; - 9C478F101E713A3200AD4289 /* SGPlayerDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFC1E713A3200AD4289 /* SGPlayerDecoder.m */; }; - 9C478F111E713A3200AD4289 /* SGPlayerTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFD1E713A3200AD4289 /* SGPlayerTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F121E713A3200AD4289 /* SGPlayerTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFD1E713A3200AD4289 /* SGPlayerTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F131E713A3200AD4289 /* SGPlayerTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478EFD1E713A3200AD4289 /* SGPlayerTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9C478F141E713A3200AD4289 /* SGPlayerTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFE1E713A3200AD4289 /* SGPlayerTrack.m */; }; - 9C478F151E713A3200AD4289 /* SGPlayerTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFE1E713A3200AD4289 /* SGPlayerTrack.m */; }; - 9C478F161E713A3200AD4289 /* SGPlayerTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478EFE1E713A3200AD4289 /* SGPlayerTrack.m */; }; - 9C478F3D1E713AA800AD4289 /* SGPlayerMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F351E713AA800AD4289 /* SGPlayerMacro.h */; }; - 9C478F3E1E713AA800AD4289 /* SGPlayerMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F351E713AA800AD4289 /* SGPlayerMacro.h */; }; - 9C478F3F1E713AA800AD4289 /* SGPlayerMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F351E713AA800AD4289 /* SGPlayerMacro.h */; }; - 9C478F401E713AA800AD4289 /* SGPlayerNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F361E713AA800AD4289 /* SGPlayerNotification.h */; }; - 9C478F411E713AA800AD4289 /* SGPlayerNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F361E713AA800AD4289 /* SGPlayerNotification.h */; }; - 9C478F421E713AA800AD4289 /* SGPlayerNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F361E713AA800AD4289 /* SGPlayerNotification.h */; }; - 9C478F431E713AA800AD4289 /* SGPlayerNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F371E713AA800AD4289 /* SGPlayerNotification.m */; }; - 9C478F441E713AA800AD4289 /* SGPlayerNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F371E713AA800AD4289 /* SGPlayerNotification.m */; }; - 9C478F451E713AA800AD4289 /* SGPlayerNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F371E713AA800AD4289 /* SGPlayerNotification.m */; }; - 9C478F461E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F391E713AA800AD4289 /* SGPlayer+DisplayView.h */; }; - 9C478F471E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F391E713AA800AD4289 /* SGPlayer+DisplayView.h */; }; - 9C478F481E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F391E713AA800AD4289 /* SGPlayer+DisplayView.h */; }; - 9C478F491E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3A1E713AA800AD4289 /* SGPlayer+DisplayView.m */; }; - 9C478F4A1E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3A1E713AA800AD4289 /* SGPlayer+DisplayView.m */; }; - 9C478F4B1E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3A1E713AA800AD4289 /* SGPlayer+DisplayView.m */; }; - 9C478F4C1E713AA800AD4289 /* SGYUVTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F3B1E713AA800AD4289 /* SGYUVTools.h */; }; - 9C478F4D1E713AA800AD4289 /* SGYUVTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F3B1E713AA800AD4289 /* SGYUVTools.h */; }; - 9C478F4E1E713AA800AD4289 /* SGYUVTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F3B1E713AA800AD4289 /* SGYUVTools.h */; }; - 9C478F4F1E713AA800AD4289 /* SGYUVTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3C1E713AA800AD4289 /* SGYUVTools.m */; }; - 9C478F501E713AA800AD4289 /* SGYUVTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3C1E713AA800AD4289 /* SGYUVTools.m */; }; - 9C478F511E713AA800AD4289 /* SGYUVTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F3C1E713AA800AD4289 /* SGYUVTools.m */; }; - 9C478F571E713ABB00AD4289 /* SGFingerRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F531E713ABB00AD4289 /* SGFingerRotation.h */; }; - 9C478F581E713ABB00AD4289 /* SGFingerRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F531E713ABB00AD4289 /* SGFingerRotation.h */; }; - 9C478F591E713ABB00AD4289 /* SGFingerRotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F531E713ABB00AD4289 /* SGFingerRotation.h */; }; - 9C478F5A1E713ABB00AD4289 /* SGFingerRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F541E713ABB00AD4289 /* SGFingerRotation.m */; }; - 9C478F5B1E713ABB00AD4289 /* SGFingerRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F541E713ABB00AD4289 /* SGFingerRotation.m */; }; - 9C478F5C1E713ABB00AD4289 /* SGFingerRotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F541E713ABB00AD4289 /* SGFingerRotation.m */; }; - 9C478F5D1E713ABB00AD4289 /* SGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F551E713ABB00AD4289 /* SGMatrix.h */; }; - 9C478F5E1E713ABB00AD4289 /* SGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F551E713ABB00AD4289 /* SGMatrix.h */; }; - 9C478F5F1E713ABB00AD4289 /* SGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F551E713ABB00AD4289 /* SGMatrix.h */; }; - 9C478F601E713ABB00AD4289 /* SGMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F561E713ABB00AD4289 /* SGMatrix.m */; }; - 9C478F611E713ABB00AD4289 /* SGMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F561E713ABB00AD4289 /* SGMatrix.m */; }; - 9C478F621E713ABB00AD4289 /* SGMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F561E713ABB00AD4289 /* SGMatrix.m */; }; - 9C478F651E713AC600AD4289 /* SGSensors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C478F631E713AC600AD4289 /* SGSensors.h */; }; - 9C478F661E713AC600AD4289 /* SGSensors.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C478F641E713AC600AD4289 /* SGSensors.m */; }; - 9C4792DD1E713B4900AD4289 /* SGAVPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BB1E713B4900AD4289 /* SGAVPlayer.h */; }; - 9C4792DE1E713B4900AD4289 /* SGAVPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BB1E713B4900AD4289 /* SGAVPlayer.h */; }; - 9C4792DF1E713B4900AD4289 /* SGAVPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BB1E713B4900AD4289 /* SGAVPlayer.h */; }; - 9C4792E01E713B4900AD4289 /* SGAVPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BC1E713B4900AD4289 /* SGAVPlayer.m */; }; - 9C4792E11E713B4900AD4289 /* SGAVPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BC1E713B4900AD4289 /* SGAVPlayer.m */; }; - 9C4792E21E713B4900AD4289 /* SGAVPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BC1E713B4900AD4289 /* SGAVPlayer.m */; }; - 9C4792E31E713B4900AD4289 /* SGDisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BE1E713B4900AD4289 /* SGDisplayView.h */; }; - 9C4792E41E713B4900AD4289 /* SGDisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BE1E713B4900AD4289 /* SGDisplayView.h */; }; - 9C4792E51E713B4900AD4289 /* SGDisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792BE1E713B4900AD4289 /* SGDisplayView.h */; }; - 9C4792E61E713B4900AD4289 /* SGDisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BF1E713B4900AD4289 /* SGDisplayView.m */; }; - 9C4792E71E713B4900AD4289 /* SGDisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BF1E713B4900AD4289 /* SGDisplayView.m */; }; - 9C4792E81E713B4900AD4289 /* SGDisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792BF1E713B4900AD4289 /* SGDisplayView.m */; }; - 9C4792E91E713B4900AD4289 /* SGGLModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C11E713B4900AD4289 /* SGGLModel.h */; }; - 9C4792EA1E713B4900AD4289 /* SGGLModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C11E713B4900AD4289 /* SGGLModel.h */; }; - 9C4792EB1E713B4900AD4289 /* SGGLModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C11E713B4900AD4289 /* SGGLModel.h */; }; - 9C4792EC1E713B4900AD4289 /* SGGLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C21E713B4900AD4289 /* SGGLModel.m */; }; - 9C4792ED1E713B4900AD4289 /* SGGLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C21E713B4900AD4289 /* SGGLModel.m */; }; - 9C4792EE1E713B4900AD4289 /* SGGLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C21E713B4900AD4289 /* SGGLModel.m */; }; - 9C4792EF1E713B4900AD4289 /* SGGLNormalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C31E713B4900AD4289 /* SGGLNormalModel.h */; }; - 9C4792F01E713B4900AD4289 /* SGGLNormalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C31E713B4900AD4289 /* SGGLNormalModel.h */; }; - 9C4792F11E713B4900AD4289 /* SGGLNormalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C31E713B4900AD4289 /* SGGLNormalModel.h */; }; - 9C4792F21E713B4900AD4289 /* SGGLNormalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C41E713B4900AD4289 /* SGGLNormalModel.m */; }; - 9C4792F31E713B4900AD4289 /* SGGLNormalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C41E713B4900AD4289 /* SGGLNormalModel.m */; }; - 9C4792F41E713B4900AD4289 /* SGGLNormalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C41E713B4900AD4289 /* SGGLNormalModel.m */; }; - 9C4792F51E713B4900AD4289 /* SGGLVRModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C51E713B4900AD4289 /* SGGLVRModel.h */; }; - 9C4792F61E713B4900AD4289 /* SGGLVRModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C51E713B4900AD4289 /* SGGLVRModel.h */; }; - 9C4792F71E713B4900AD4289 /* SGGLVRModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792C51E713B4900AD4289 /* SGGLVRModel.h */; }; - 9C4792F81E713B4900AD4289 /* SGGLVRModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C61E713B4900AD4289 /* SGGLVRModel.m */; }; - 9C4792F91E713B4900AD4289 /* SGGLVRModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C61E713B4900AD4289 /* SGGLVRModel.m */; }; - 9C4792FA1E713B4900AD4289 /* SGGLVRModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792C61E713B4900AD4289 /* SGGLVRModel.m */; }; - 9C4793071E713B4900AD4289 /* SGGLProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792CC1E713B4900AD4289 /* SGGLProgram.h */; }; - 9C4793081E713B4900AD4289 /* SGGLProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792CC1E713B4900AD4289 /* SGGLProgram.h */; }; - 9C4793091E713B4900AD4289 /* SGGLProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792CC1E713B4900AD4289 /* SGGLProgram.h */; }; - 9C47930A1E713B4900AD4289 /* SGGLProgram.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792CD1E713B4900AD4289 /* SGGLProgram.m */; }; - 9C47930B1E713B4900AD4289 /* SGGLProgram.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792CD1E713B4900AD4289 /* SGGLProgram.m */; }; - 9C47930C1E713B4900AD4289 /* SGGLProgram.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792CD1E713B4900AD4289 /* SGGLProgram.m */; }; - 9C4793251E713B4900AD4289 /* SGDistortionModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792D91E713B4900AD4289 /* SGDistortionModel.h */; }; - 9C4793261E713B4900AD4289 /* SGDistortionModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792D91E713B4900AD4289 /* SGDistortionModel.h */; }; - 9C4793271E713B4900AD4289 /* SGDistortionModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792D91E713B4900AD4289 /* SGDistortionModel.h */; }; - 9C4793281E713B4900AD4289 /* SGDistortionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DA1E713B4900AD4289 /* SGDistortionModel.m */; }; - 9C4793291E713B4900AD4289 /* SGDistortionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DA1E713B4900AD4289 /* SGDistortionModel.m */; }; - 9C47932A1E713B4900AD4289 /* SGDistortionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DA1E713B4900AD4289 /* SGDistortionModel.m */; }; - 9C47932B1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792DB1E713B4900AD4289 /* SGDistortionRenderer.h */; }; - 9C47932C1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792DB1E713B4900AD4289 /* SGDistortionRenderer.h */; }; - 9C47932D1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4792DB1E713B4900AD4289 /* SGDistortionRenderer.h */; }; - 9C47932E1E713B4900AD4289 /* SGDistortionRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DC1E713B4900AD4289 /* SGDistortionRenderer.m */; }; - 9C47932F1E713B4900AD4289 /* SGDistortionRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DC1E713B4900AD4289 /* SGDistortionRenderer.m */; }; - 9C4793301E713B4900AD4289 /* SGDistortionRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4792DC1E713B4900AD4289 /* SGDistortionRenderer.m */; }; - 9C4793341E713B5400AD4289 /* SGAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4793321E713B5400AD4289 /* SGAudioManager.h */; }; - 9C4793351E713B5400AD4289 /* SGAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4793321E713B5400AD4289 /* SGAudioManager.h */; }; - 9C4793361E713B5400AD4289 /* SGAudioManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4793321E713B5400AD4289 /* SGAudioManager.h */; }; - 9C4793371E713B5400AD4289 /* SGAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4793331E713B5400AD4289 /* SGAudioManager.m */; }; - 9C4793381E713B5400AD4289 /* SGAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4793331E713B5400AD4289 /* SGAudioManager.m */; }; - 9C4793391E713B5400AD4289 /* SGAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4793331E713B5400AD4289 /* SGAudioManager.m */; }; - 9C47933E1E713B5C00AD4289 /* SGMacAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C47933A1E713B5C00AD4289 /* SGMacAudioDevice.h */; }; - 9C47933F1E713B5C00AD4289 /* SGMacAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C47933B1E713B5C00AD4289 /* SGMacAudioDevice.m */; }; - 9C4793401E713B5C00AD4289 /* SGMacAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C47933C1E713B5C00AD4289 /* SGMacAudioSession.h */; }; - 9C4793411E713B5C00AD4289 /* SGMacAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C47933D1E713B5C00AD4289 /* SGMacAudioSession.m */; }; - 9C5AB68E1E88B2AD0021F460 /* SGGLViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB68C1E88B2AD0021F460 /* SGGLViewController.h */; }; - 9C5AB68F1E88B2AD0021F460 /* SGGLViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB68C1E88B2AD0021F460 /* SGGLViewController.h */; }; - 9C5AB6901E88B2AD0021F460 /* SGGLViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB68C1E88B2AD0021F460 /* SGGLViewController.h */; }; - 9C5AB6911E88B2AD0021F460 /* SGGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB68D1E88B2AD0021F460 /* SGGLViewController.m */; }; - 9C5AB6921E88B2AD0021F460 /* SGGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB68D1E88B2AD0021F460 /* SGGLViewController.m */; }; - 9C5AB6931E88B2AD0021F460 /* SGGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB68D1E88B2AD0021F460 /* SGGLViewController.m */; }; - 9C5AB6DA1E88E7980021F460 /* SGGLTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6D81E88E7980021F460 /* SGGLTexture.h */; }; - 9C5AB6DB1E88E7980021F460 /* SGGLTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6D81E88E7980021F460 /* SGGLTexture.h */; }; - 9C5AB6DC1E88E7980021F460 /* SGGLTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6D81E88E7980021F460 /* SGGLTexture.h */; }; - 9C5AB6DD1E88E7980021F460 /* SGGLTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6D91E88E7980021F460 /* SGGLTexture.m */; }; - 9C5AB6DE1E88E7980021F460 /* SGGLTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6D91E88E7980021F460 /* SGGLTexture.m */; }; - 9C5AB6DF1E88E7980021F460 /* SGGLTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6D91E88E7980021F460 /* SGGLTexture.m */; }; - 9C5AB6E21E88E8F20021F460 /* SGGLTextureNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E01E88E8F20021F460 /* SGGLTextureNV12.h */; }; - 9C5AB6E31E88E8F20021F460 /* SGGLTextureNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E01E88E8F20021F460 /* SGGLTextureNV12.h */; }; - 9C5AB6E41E88E8F20021F460 /* SGGLTextureNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E01E88E8F20021F460 /* SGGLTextureNV12.h */; }; - 9C5AB6E51E88E8F20021F460 /* SGGLTextureNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E11E88E8F20021F460 /* SGGLTextureNV12.m */; }; - 9C5AB6E61E88E8F20021F460 /* SGGLTextureNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E11E88E8F20021F460 /* SGGLTextureNV12.m */; }; - 9C5AB6E71E88E8F20021F460 /* SGGLTextureNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E11E88E8F20021F460 /* SGGLTextureNV12.m */; }; - 9C5AB6EA1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E81E88E90B0021F460 /* SGGLTextureYUV420.h */; }; - 9C5AB6EB1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E81E88E90B0021F460 /* SGGLTextureYUV420.h */; }; - 9C5AB6EC1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6E81E88E90B0021F460 /* SGGLTextureYUV420.h */; }; - 9C5AB6ED1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E91E88E90B0021F460 /* SGGLTextureYUV420.m */; }; - 9C5AB6EE1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E91E88E90B0021F460 /* SGGLTextureYUV420.m */; }; - 9C5AB6EF1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6E91E88E90B0021F460 /* SGGLTextureYUV420.m */; }; - 9C5AB6F21E88EB720021F460 /* SGGLFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F01E88EB720021F460 /* SGGLFrame.h */; }; - 9C5AB6F31E88EB720021F460 /* SGGLFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F01E88EB720021F460 /* SGGLFrame.h */; }; - 9C5AB6F41E88EB720021F460 /* SGGLFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F01E88EB720021F460 /* SGGLFrame.h */; }; - 9C5AB6F51E88EB720021F460 /* SGGLFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F11E88EB720021F460 /* SGGLFrame.m */; }; - 9C5AB6F61E88EB720021F460 /* SGGLFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F11E88EB720021F460 /* SGGLFrame.m */; }; - 9C5AB6F71E88EB720021F460 /* SGGLFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F11E88EB720021F460 /* SGGLFrame.m */; }; - 9C5AB6FA1E88F0400021F460 /* SGGLProgramNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F81E88F0400021F460 /* SGGLProgramNV12.h */; }; - 9C5AB6FB1E88F0400021F460 /* SGGLProgramNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F81E88F0400021F460 /* SGGLProgramNV12.h */; }; - 9C5AB6FC1E88F0400021F460 /* SGGLProgramNV12.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB6F81E88F0400021F460 /* SGGLProgramNV12.h */; }; - 9C5AB6FD1E88F0400021F460 /* SGGLProgramNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F91E88F0400021F460 /* SGGLProgramNV12.m */; }; - 9C5AB6FE1E88F0400021F460 /* SGGLProgramNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F91E88F0400021F460 /* SGGLProgramNV12.m */; }; - 9C5AB6FF1E88F0400021F460 /* SGGLProgramNV12.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB6F91E88F0400021F460 /* SGGLProgramNV12.m */; }; - 9C5AB7021E88F0560021F460 /* SGGLProgramYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB7001E88F0560021F460 /* SGGLProgramYUV420.h */; }; - 9C5AB7031E88F0560021F460 /* SGGLProgramYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB7001E88F0560021F460 /* SGGLProgramYUV420.h */; }; - 9C5AB7041E88F0560021F460 /* SGGLProgramYUV420.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5AB7001E88F0560021F460 /* SGGLProgramYUV420.h */; }; - 9C5AB7051E88F0560021F460 /* SGGLProgramYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB7011E88F0560021F460 /* SGGLProgramYUV420.m */; }; - 9C5AB7061E88F0560021F460 /* SGGLProgramYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB7011E88F0560021F460 /* SGGLProgramYUV420.m */; }; - 9C5AB7071E88F0560021F460 /* SGGLProgramYUV420.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5AB7011E88F0560021F460 /* SGGLProgramYUV420.m */; }; - 9C816A281E8755E4007ED41B /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C09123D1E71283100E5AA46 /* SGPlatform.framework */; }; - 9C9823CA1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C9823C91FAAFFEB00142215 /* SGPlayerBuildConfig.h */; }; - 9C9823CB1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C9823C91FAAFFEB00142215 /* SGPlayerBuildConfig.h */; }; - 9C9823CC1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C9823C91FAAFFEB00142215 /* SGPlayerBuildConfig.h */; }; - 9CA86E7F1E8756BF00E4A8B1 /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C09123F1E71283100E5AA46 /* SGPlatform.framework */; }; - 9CA86E801E8756C700E4A8B1 /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C0912411E71283100E5AA46 /* SGPlatform.framework */; }; - 9CEFA6DB1E7122BF00835CAB /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEFA6D91E7122BF00835CAB /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9CEFA6E51E7125C800835CAB /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEFA6D91E7122BF00835CAB /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9CEFA6F01E7125CC00835CAB /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEFA6D91E7122BF00835CAB /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C03E5EC212E616B001F0E1B /* SGMotionSensor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C03E5EA212E616B001F0E1B /* SGMotionSensor.h */; }; + 9C03E5ED212E616B001F0E1B /* SGMotionSensor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C03E5EB212E616B001F0E1B /* SGMotionSensor.m */; }; + 9C03E5F0212E645B001F0E1B /* SGVRProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C03E5EE212E645B001F0E1B /* SGVRProjection.h */; }; + 9C03E5F1212E645B001F0E1B /* SGVRProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C03E5EF212E645B001F0E1B /* SGVRProjection.m */; }; + 9C0A6F34219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F32219C33EA0027D5B1 /* SGTrackDemuxer.h */; }; + 9C0A6F35219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F32219C33EA0027D5B1 /* SGTrackDemuxer.h */; }; + 9C0A6F36219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F32219C33EA0027D5B1 /* SGTrackDemuxer.h */; }; + 9C0A6F37219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F33219C33EA0027D5B1 /* SGTrackDemuxer.m */; }; + 9C0A6F38219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F33219C33EA0027D5B1 /* SGTrackDemuxer.m */; }; + 9C0A6F39219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F33219C33EA0027D5B1 /* SGTrackDemuxer.m */; }; + 9C0A6F3C219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F3A219C36300027D5B1 /* SGSegmentDemuxer.h */; }; + 9C0A6F3D219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F3A219C36300027D5B1 /* SGSegmentDemuxer.h */; }; + 9C0A6F3E219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0A6F3A219C36300027D5B1 /* SGSegmentDemuxer.h */; }; + 9C0A6F3F219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F3B219C36300027D5B1 /* SGSegmentDemuxer.m */; }; + 9C0A6F40219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F3B219C36300027D5B1 /* SGSegmentDemuxer.m */; }; + 9C0A6F41219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A6F3B219C36300027D5B1 /* SGSegmentDemuxer.m */; }; + 9C0B6CB3217D823500900F1E /* SGAsset+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB1217D823500900F1E /* SGAsset+Internal.h */; }; + 9C0DF028215A2FB9007142DB /* SGDemuxable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0DF027215A2FB9007142DB /* SGDemuxable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C11816522C4E23200A12FD4 /* SGMetalViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C11816322C4E23200A12FD4 /* SGMetalViewport.h */; }; + 9C11816622C4E23200A12FD4 /* SGMetalViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C11816322C4E23200A12FD4 /* SGMetalViewport.h */; }; + 9C11816722C4E23200A12FD4 /* SGMetalViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C11816322C4E23200A12FD4 /* SGMetalViewport.h */; }; + 9C11816822C4E23200A12FD4 /* SGMetalViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C11816422C4E23200A12FD4 /* SGMetalViewport.m */; }; + 9C11816922C4E23200A12FD4 /* SGMetalViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C11816422C4E23200A12FD4 /* SGMetalViewport.m */; }; + 9C11816A22C4E23200A12FD4 /* SGMetalViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C11816422C4E23200A12FD4 /* SGMetalViewport.m */; }; + 9C1378A82302681C00FE0CFD /* SGVideoProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378A62302681C00FE0CFD /* SGVideoProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378A92302681C00FE0CFD /* SGVideoProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378A62302681C00FE0CFD /* SGVideoProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378AA2302681C00FE0CFD /* SGVideoProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378A62302681C00FE0CFD /* SGVideoProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378AB2302681C00FE0CFD /* SGVideoProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378A72302681C00FE0CFD /* SGVideoProcessor.m */; }; + 9C1378AC2302681C00FE0CFD /* SGVideoProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378A72302681C00FE0CFD /* SGVideoProcessor.m */; }; + 9C1378AD2302681C00FE0CFD /* SGVideoProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378A72302681C00FE0CFD /* SGVideoProcessor.m */; }; + 9C1378B023026B3A00FE0CFD /* SGTrackSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378AE23026B3A00FE0CFD /* SGTrackSelection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378B123026B3A00FE0CFD /* SGTrackSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378AE23026B3A00FE0CFD /* SGTrackSelection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378B223026B3A00FE0CFD /* SGTrackSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378AE23026B3A00FE0CFD /* SGTrackSelection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378B323026B3A00FE0CFD /* SGTrackSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378AF23026B3A00FE0CFD /* SGTrackSelection.m */; }; + 9C1378B423026B3A00FE0CFD /* SGTrackSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378AF23026B3A00FE0CFD /* SGTrackSelection.m */; }; + 9C1378B523026B3A00FE0CFD /* SGTrackSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378AF23026B3A00FE0CFD /* SGTrackSelection.m */; }; + 9C1378B723026C6700FE0CFD /* SGProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378B623026C6700FE0CFD /* SGProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378B823026C6700FE0CFD /* SGProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378B623026C6700FE0CFD /* SGProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378B923026C6700FE0CFD /* SGProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378B623026C6700FE0CFD /* SGProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378BC23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378BA23029F2E00FE0CFD /* SGProcessorOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378BD23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378BA23029F2E00FE0CFD /* SGProcessorOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378BE23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1378BA23029F2E00FE0CFD /* SGProcessorOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1378BF23029F2E00FE0CFD /* SGProcessorOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378BB23029F2E00FE0CFD /* SGProcessorOptions.m */; }; + 9C1378C023029F2E00FE0CFD /* SGProcessorOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378BB23029F2E00FE0CFD /* SGProcessorOptions.m */; }; + 9C1378C123029F2E00FE0CFD /* SGProcessorOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1378BB23029F2E00FE0CFD /* SGProcessorOptions.m */; }; + 9C17554922C5B5B3003A93BC /* SGRenderTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C17554722C5B5B3003A93BC /* SGRenderTimer.h */; }; + 9C17554A22C5B5B3003A93BC /* SGRenderTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C17554722C5B5B3003A93BC /* SGRenderTimer.h */; }; + 9C17554B22C5B5B3003A93BC /* SGRenderTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C17554722C5B5B3003A93BC /* SGRenderTimer.h */; }; + 9C17554C22C5B5B3003A93BC /* SGRenderTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C17554822C5B5B3003A93BC /* SGRenderTimer.m */; }; + 9C17554D22C5B5B3003A93BC /* SGRenderTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C17554822C5B5B3003A93BC /* SGRenderTimer.m */; }; + 9C17554E22C5B5B3003A93BC /* SGRenderTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C17554822C5B5B3003A93BC /* SGRenderTimer.m */; }; + 9C1D222A201B1DA2005147FB /* SGMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1D2228201B1DA2005147FB /* SGMapping.h */; }; + 9C1D222D201B1DA3005147FB /* SGMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1D2229201B1DA2005147FB /* SGMapping.m */; }; + 9C1F2DE721AF8F1A00D42158 /* SGAudioMixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1F2DE521AF8F1A00D42158 /* SGAudioMixer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1F2DE821AF8F1A00D42158 /* SGAudioMixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1F2DE521AF8F1A00D42158 /* SGAudioMixer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1F2DE921AF8F1A00D42158 /* SGAudioMixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1F2DE521AF8F1A00D42158 /* SGAudioMixer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C1F2DEA21AF8F1A00D42158 /* SGAudioMixer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F2DE621AF8F1A00D42158 /* SGAudioMixer.m */; }; + 9C1F2DEB21AF8F1A00D42158 /* SGAudioMixer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F2DE621AF8F1A00D42158 /* SGAudioMixer.m */; }; + 9C1F2DEC21AF8F1A00D42158 /* SGAudioMixer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F2DE621AF8F1A00D42158 /* SGAudioMixer.m */; }; + 9C2536501FAB199500BBFA5C /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C2536531FAB199500BBFA5C /* SGPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGPlayer.m */; }; + 9C262A3322B344D3006C8542 /* SGDemuxerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3122B344D3006C8542 /* SGDemuxerOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3422B344D3006C8542 /* SGDemuxerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3122B344D3006C8542 /* SGDemuxerOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3522B344D3006C8542 /* SGDemuxerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3122B344D3006C8542 /* SGDemuxerOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3622B344D3006C8542 /* SGDemuxerOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3222B344D3006C8542 /* SGDemuxerOptions.m */; }; + 9C262A3722B344D3006C8542 /* SGDemuxerOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3222B344D3006C8542 /* SGDemuxerOptions.m */; }; + 9C262A3822B344D3006C8542 /* SGDemuxerOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3222B344D3006C8542 /* SGDemuxerOptions.m */; }; + 9C262A3B22B3450F006C8542 /* SGDecoderOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3922B3450F006C8542 /* SGDecoderOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3C22B3450F006C8542 /* SGDecoderOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3922B3450F006C8542 /* SGDecoderOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3D22B3450F006C8542 /* SGDecoderOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A3922B3450F006C8542 /* SGDecoderOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A3E22B3450F006C8542 /* SGDecoderOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3A22B3450F006C8542 /* SGDecoderOptions.m */; }; + 9C262A3F22B3450F006C8542 /* SGDecoderOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3A22B3450F006C8542 /* SGDecoderOptions.m */; }; + 9C262A4022B3450F006C8542 /* SGDecoderOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A3A22B3450F006C8542 /* SGDecoderOptions.m */; }; + 9C262A4322B359CC006C8542 /* SGRendererOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A4122B359CC006C8542 /* SGRendererOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A4422B359CC006C8542 /* SGRendererOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A4122B359CC006C8542 /* SGRendererOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A4522B359CC006C8542 /* SGRendererOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C262A4122B359CC006C8542 /* SGRendererOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C262A4622B359CC006C8542 /* SGRendererOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A4222B359CC006C8542 /* SGRendererOptions.m */; }; + 9C262A4722B359CC006C8542 /* SGRendererOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A4222B359CC006C8542 /* SGRendererOptions.m */; }; + 9C262A4822B359CC006C8542 /* SGRendererOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C262A4222B359CC006C8542 /* SGRendererOptions.m */; }; + 9C26CF57218D787D009FFCC4 /* SGClock+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C26CF56218D787D009FFCC4 /* SGClock+Internal.h */; }; + 9C26CF58218D7A2B009FFCC4 /* SGClock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5C98F920D26BE10089C112 /* SGClock.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C29D112217D741500343975 /* SGFrameOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C29D110217D741500343975 /* SGFrameOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C29D113217D741500343975 /* SGFrameOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C29D111217D741500343975 /* SGFrameOutput.m */; }; + 9C2C55932015911600131E15 /* SGObjectPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55912015911600131E15 /* SGObjectPool.h */; }; + 9C2C55962015911600131E15 /* SGObjectPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55922015911600131E15 /* SGObjectPool.m */; }; + 9C2C559B2015B87400131E15 /* SGVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55992015B87400131E15 /* SGVideoFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C2C559E2015B87400131E15 /* SGVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C559A2015B87400131E15 /* SGVideoFrame.m */; }; + 9C2C55A32015C1E100131E15 /* SGVideoRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55A12015C1E100131E15 /* SGVideoRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C2C55A62015C1E100131E15 /* SGVideoRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55A22015C1E100131E15 /* SGVideoRenderer.m */; }; + 9C2C55AD2015D1D200131E15 /* SGPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55AB2015D1D200131E15 /* SGPacket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C2C55B02015D1D200131E15 /* SGPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55AC2015D1D200131E15 /* SGPacket.m */; }; + 9C2C55B52015D92100131E15 /* SGObjectQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55B32015D92100131E15 /* SGObjectQueue.h */; }; + 9C2C55B82015D92100131E15 /* SGObjectQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55B42015D92100131E15 /* SGObjectQueue.m */; }; + 9C3082C3212518EC00B44298 /* SGVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C1212518EB00B44298 /* SGVideoDecoder.h */; }; + 9C3082C4212518EC00B44298 /* SGVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C2212518EC00B44298 /* SGVideoDecoder.m */; }; + 9C3082C721251AC200B44298 /* SGCodecContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C521251AC200B44298 /* SGCodecContext.h */; }; + 9C3082C821251AC200B44298 /* SGCodecContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C621251AC200B44298 /* SGCodecContext.m */; }; + 9C3082D0212521AB00B44298 /* SGAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082CE212521AB00B44298 /* SGAudioDecoder.h */; }; + 9C3082D1212521AB00B44298 /* SGAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082CF212521AB00B44298 /* SGAudioDecoder.m */; }; + 9C329AAA2005E3F800252B10 /* SGActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C329AA82005E3F800252B10 /* SGActivity.h */; }; + 9C329AAE2005E3F800252B10 /* SGActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C329AA92005E3F800252B10 /* SGActivity.m */; }; + 9C37487B2135521D00572166 /* SGSWScale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3748792135521D00572166 /* SGSWScale.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C37487C2135521D00572166 /* SGSWScale.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C37487A2135521D00572166 /* SGSWScale.m */; }; + 9C389ACC20108C2E003259FF /* SGFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C389ACB20108C2E003259FF /* SGFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C3A685B21CB76B20031DDE1 /* sonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A685921CB76B10031DDE1 /* sonic.h */; }; + 9C3A685C21CB76B20031DDE1 /* sonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A685921CB76B10031DDE1 /* sonic.h */; }; + 9C3A685D21CB76B20031DDE1 /* sonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A685921CB76B10031DDE1 /* sonic.h */; }; + 9C3A685E21CB76B20031DDE1 /* sonic.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A685A21CB76B10031DDE1 /* sonic.c */; }; + 9C3A685F21CB76B20031DDE1 /* sonic.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A685A21CB76B10031DDE1 /* sonic.c */; }; + 9C3A686021CB76B20031DDE1 /* sonic.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A685A21CB76B10031DDE1 /* sonic.c */; }; + 9C3A686321CB77010031DDE1 /* SGSonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A686121CB77010031DDE1 /* SGSonic.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C3A686421CB77010031DDE1 /* SGSonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A686121CB77010031DDE1 /* SGSonic.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C3A686521CB77010031DDE1 /* SGSonic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3A686121CB77010031DDE1 /* SGSonic.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C3A686621CB77010031DDE1 /* SGSonic.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A686221CB77010031DDE1 /* SGSonic.m */; }; + 9C3A686721CB77010031DDE1 /* SGSonic.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A686221CB77010031DDE1 /* SGSonic.m */; }; + 9C3A686821CB77010031DDE1 /* SGSonic.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3A686221CB77010031DDE1 /* SGSonic.m */; }; + 9C4190F521AFF17700134099 /* SGAudioMixerUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190F321AFF17700134099 /* SGAudioMixerUnit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4190F621AFF17700134099 /* SGAudioMixerUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190F321AFF17700134099 /* SGAudioMixerUnit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4190F721AFF17700134099 /* SGAudioMixerUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190F321AFF17700134099 /* SGAudioMixerUnit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4190F821AFF17700134099 /* SGAudioMixerUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190F421AFF17700134099 /* SGAudioMixerUnit.m */; }; + 9C4190F921AFF17700134099 /* SGAudioMixerUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190F421AFF17700134099 /* SGAudioMixerUnit.m */; }; + 9C4190FA21AFF17700134099 /* SGAudioMixerUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190F421AFF17700134099 /* SGAudioMixerUnit.m */; }; + 9C4190FD21B00FC600134099 /* SGMutableTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190FB21B00FC600134099 /* SGMutableTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4190FE21B00FC600134099 /* SGMutableTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190FB21B00FC600134099 /* SGMutableTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4190FF21B00FC600134099 /* SGMutableTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4190FB21B00FC600134099 /* SGMutableTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C41910021B00FC600134099 /* SGMutableTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190FC21B00FC600134099 /* SGMutableTrack.m */; }; + 9C41910121B00FC600134099 /* SGMutableTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190FC21B00FC600134099 /* SGMutableTrack.m */; }; + 9C41910221B00FC600134099 /* SGMutableTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4190FC21B00FC600134099 /* SGMutableTrack.m */; }; + 9C43D50D2187037200235169 /* SGOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50B2187037200235169 /* SGOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C43D50E2187037200235169 /* SGOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D50C2187037200235169 /* SGOptions.m */; }; + 9C43D51121872D3F00235169 /* SGLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50F21872D3F00235169 /* SGLock.h */; }; + 9C43D51221872D3F00235169 /* SGLock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D51021872D3F00235169 /* SGLock.m */; }; + 9C4663CA20D0F83600CADDA7 /* SGTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4663C820D0F83600CADDA7 /* SGTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C4663CD20D0F83600CADDA7 /* SGTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4663C920D0F83600CADDA7 /* SGTime.m */; }; + 9C525D5121AEC421005C5708 /* SGAudioDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C525D4F21AEC421005C5708 /* SGAudioDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C525D5221AEC421005C5708 /* SGAudioDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C525D4F21AEC421005C5708 /* SGAudioDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C525D5321AEC421005C5708 /* SGAudioDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C525D4F21AEC421005C5708 /* SGAudioDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C525D5421AEC421005C5708 /* SGAudioDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C525D5021AEC421005C5708 /* SGAudioDescriptor.m */; }; + 9C525D5521AEC421005C5708 /* SGAudioDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C525D5021AEC421005C5708 /* SGAudioDescriptor.m */; }; + 9C525D5621AEC421005C5708 /* SGAudioDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C525D5021AEC421005C5708 /* SGAudioDescriptor.m */; }; + 9C55337121B25EC000119235 /* SGData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C55337021B25EC000119235 /* SGData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C55337221B25EC000119235 /* SGData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C55337021B25EC000119235 /* SGData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C55337321B25EC000119235 /* SGData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C55337021B25EC000119235 /* SGData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C5C98FE20D26BE10089C112 /* SGClock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5C98FA20D26BE10089C112 /* SGClock.m */; }; + 9C65F5B222C5EC2B00AE27DE /* SGMetalProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C65F5B022C5EC2B00AE27DE /* SGMetalProjection.h */; }; + 9C65F5B322C5EC2B00AE27DE /* SGMetalProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C65F5B022C5EC2B00AE27DE /* SGMetalProjection.h */; }; + 9C65F5B422C5EC2B00AE27DE /* SGMetalProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C65F5B022C5EC2B00AE27DE /* SGMetalProjection.h */; }; + 9C65F5B522C5EC2B00AE27DE /* SGMetalProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C65F5B122C5EC2B00AE27DE /* SGMetalProjection.m */; }; + 9C65F5B622C5EC2B00AE27DE /* SGMetalProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C65F5B122C5EC2B00AE27DE /* SGMetalProjection.m */; }; + 9C65F5B722C5EC2B00AE27DE /* SGMetalProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C65F5B122C5EC2B00AE27DE /* SGMetalProjection.m */; }; + 9C661C5B2304074900908563 /* SGPlayerHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C661C5A2304074900908563 /* SGPlayerHeader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C661C5C2304074900908563 /* SGPlayerHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C661C5A2304074900908563 /* SGPlayerHeader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C661C5D2304074900908563 /* SGPlayerHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C661C5A2304074900908563 /* SGPlayerHeader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C661C5E230408DE00908563 /* SGDecodable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB5217DBA1800900F1E /* SGDecodable.h */; }; + 9C661C5F230408DE00908563 /* SGDecodable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB5217DBA1800900F1E /* SGDecodable.h */; }; + 9C661C60230408DF00908563 /* SGDecodable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB5217DBA1800900F1E /* SGDecodable.h */; }; + 9C66E1FA2188526200B70DAA /* SGAudioFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1F82188526200B70DAA /* SGAudioFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C66E1FB2188526200B70DAA /* SGAudioFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1F92188526200B70DAA /* SGAudioFormatter.m */; }; + 9C66E1FE2188550D00B70DAA /* SGSWResample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1FC2188550D00B70DAA /* SGSWResample.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C66E1FF2188550D00B70DAA /* SGSWResample.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1FD2188550D00B70DAA /* SGSWResample.m */; }; + 9C6F9029219BE154001051CE /* SGMutableAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6F9027219BE154001051CE /* SGMutableAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C6F902A219BE154001051CE /* SGMutableAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6F9027219BE154001051CE /* SGMutableAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C6F902B219BE154001051CE /* SGMutableAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6F9027219BE154001051CE /* SGMutableAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C6F902C219BE154001051CE /* SGMutableAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6F9028219BE154001051CE /* SGMutableAsset.m */; }; + 9C6F902D219BE154001051CE /* SGMutableAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6F9028219BE154001051CE /* SGMutableAsset.m */; }; + 9C6F902E219BE154001051CE /* SGMutableAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6F9028219BE154001051CE /* SGMutableAsset.m */; }; + 9C82EEB121AE356D00E9D523 /* SGAudioProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C82EEAF21AE356D00E9D523 /* SGAudioProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C82EEB221AE356D00E9D523 /* SGAudioProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C82EEAF21AE356D00E9D523 /* SGAudioProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C82EEB321AE356D00E9D523 /* SGAudioProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C82EEAF21AE356D00E9D523 /* SGAudioProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C82EEB421AE356D00E9D523 /* SGAudioProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C82EEB021AE356D00E9D523 /* SGAudioProcessor.m */; }; + 9C82EEB521AE356D00E9D523 /* SGAudioProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C82EEB021AE356D00E9D523 /* SGAudioProcessor.m */; }; + 9C82EEB621AE356D00E9D523 /* SGAudioProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C82EEB021AE356D00E9D523 /* SGAudioProcessor.m */; }; + 9C853F1221BFD85D005552C6 /* SGVideoDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C853F1021BFD85D005552C6 /* SGVideoDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C853F1321BFD85D005552C6 /* SGVideoDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C853F1021BFD85D005552C6 /* SGVideoDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C853F1421BFD85D005552C6 /* SGVideoDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C853F1021BFD85D005552C6 /* SGVideoDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C853F1521BFD85D005552C6 /* SGVideoDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C853F1121BFD85D005552C6 /* SGVideoDescriptor.m */; }; + 9C853F1621BFD85D005552C6 /* SGVideoDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C853F1121BFD85D005552C6 /* SGVideoDescriptor.m */; }; + 9C853F1721BFD85D005552C6 /* SGVideoDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C853F1121BFD85D005552C6 /* SGVideoDescriptor.m */; }; + 9C8637F721904A0900D730EC /* SGPlayerItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E47200DFFC700ED8A58 /* SGPlayerItem.m */; }; + 9C8637F821904A0900D730EC /* SGFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA3CDB320E1F74300B852D0 /* SGFrame.m */; }; + 9C8637F921904A0900D730EC /* SGPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55AC2015D1D200131E15 /* SGPacket.m */; }; + 9C8637FA21904A0900D730EC /* SGObjectPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55922015911600131E15 /* SGObjectPool.m */; }; + 9C8637FC21904A0900D730EC /* SGVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C559A2015B87400131E15 /* SGVideoFrame.m */; }; + 9C8637FD21904A0900D730EC /* SGClock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5C98FA20D26BE10089C112 /* SGClock.m */; }; + 9C8637FE21904A0900D730EC /* SGPLFImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51F2004D97C00D1F4C8 /* SGPLFImage.m */; }; + 9C8637FF21904A0900D730EC /* SGObjectQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55B42015D92100131E15 /* SGObjectQueue.m */; }; + 9C86380221904A0900D730EC /* SGVRProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C03E5EF212E645B001F0E1B /* SGVRProjection.m */; }; + 9C86380521904A0900D730EC /* SGLock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D51021872D3F00235169 /* SGLock.m */; }; + 9C86380621904A0900D730EC /* SGAudioRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E062011AE0700585326 /* SGAudioRenderer.m */; }; + 9C86380A21904A0900D730EC /* SGAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6842F200DD12F007BD834 /* SGAudioPlayer.m */; }; + 9C86380B21904A0900D730EC /* SGTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF52CF6200F45D700950B81 /* SGTrack.m */; }; + 9C86380C21904A0900D730EC /* SGPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGPlayer.m */; }; + 9C86380E21904A0900D730EC /* SGMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1D2229201B1DA2005147FB /* SGMapping.m */; }; + 9C86381121904A0900D730EC /* SGFrameOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C29D111217D741500343975 /* SGFrameOutput.m */; }; + 9C86381221904A0900D730EC /* SGCapacity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC649FE2181A8C000453B3E /* SGCapacity.m */; }; + 9C86381321904A0900D730EC /* SGActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C329AA92005E3F800252B10 /* SGActivity.m */; }; + 9C86381421904A0900D730EC /* SGError.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E7F200E1ACA00ED8A58 /* SGError.m */; }; + 9C86381521904A0900D730EC /* SGURLDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2BB2152335400079B38 /* SGURLDemuxer.m */; }; + 9C86381721904A0900D730EC /* SGVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C2212518EC00B44298 /* SGVideoDecoder.m */; }; + 9C86381921904A0900D730EC /* SGSWResample.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1FD2188550D00B70DAA /* SGSWResample.m */; }; + 9C86381A21904A0900D730EC /* SGVideoRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55A22015C1E100131E15 /* SGVideoRenderer.m */; }; + 9C86381B21904A0900D730EC /* SGPLFScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5222004D97C00D1F4C8 /* SGPLFScreen.m */; }; + 9C86381D21904A0900D730EC /* SGAudioFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1F92188526200B70DAA /* SGAudioFormatter.m */; }; + 9C86381E21904A0900D730EC /* SGFFmpeg.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB61F5E2112B93C00F5BE6B /* SGFFmpeg.m */; }; + 9C86382021904A0900D730EC /* SGPacketOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E62200E0ACC00ED8A58 /* SGPacketOutput.m */; }; + 9C86382121904A0900D730EC /* SGPLFColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51B2004D97C00D1F4C8 /* SGPLFColor.m */; }; + 9C86382321904A0900D730EC /* SGPLFView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5242004D97C00D1F4C8 /* SGPLFView.m */; }; + 9C86382521904A0900D730EC /* SGSWScale.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C37487A2135521D00572166 /* SGSWScale.m */; }; + 9C86382621904A0900D730EC /* SGAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082CF212521AB00B44298 /* SGAudioDecoder.m */; }; + 9C86382721904A0900D730EC /* SGURLAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2C02152386C00079B38 /* SGURLAsset.m */; }; + 9C86382821904A0900D730EC /* SGCodecContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C621251AC200B44298 /* SGCodecContext.m */; }; + 9C86382A21904A0900D730EC /* SGDecodeLoop.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15DE420118E1100585326 /* SGDecodeLoop.m */; }; + 9C86382C21904A0900D730EC /* SGVRViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CAAC99E2133A6800065E364 /* SGVRViewport.m */; }; + 9C86382E21904A0900D730EC /* SGAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E1E2011BC5400585326 /* SGAudioFrame.m */; }; + 9C86383021904A0900D730EC /* SGAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF63FC1211D8E33001B2684 /* SGAsset.m */; }; + 9C86383121904A0900D730EC /* SGOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D50C2187037200235169 /* SGOptions.m */; }; + 9C86383221904A0900D730EC /* SGTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4663C920D0F83600CADDA7 /* SGTime.m */; }; + 9C86383421904A0900D730EC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0D200C9B7000E833DA /* UIKit.framework */; }; + 9C86383521904A0900D730EC /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F11200C9B7B00E833DA /* AVFoundation.framework */; }; + 9C86383621904A0900D730EC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0F200C9B7700E833DA /* Foundation.framework */; }; + 9C86384321904A0900D730EC /* SGCapacity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649FD2181A8C000453B3E /* SGCapacity.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384421904A0900D730EC /* SGObjectPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55912015911600131E15 /* SGObjectPool.h */; }; + 9C86384621904A0900D730EC /* SGObjectQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55B32015D92100131E15 /* SGObjectQueue.h */; }; + 9C86384721904A0900D730EC /* SGAudioRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E052011AE0700585326 /* SGAudioRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384821904A0900D730EC /* SGVideoRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55A12015C1E100131E15 /* SGVideoRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384921904A0900D730EC /* SGLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50F21872D3F00235169 /* SGLock.h */; }; + 9C86384A21904A0900D730EC /* SGTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF52CF5200F45D700950B81 /* SGTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384B21904A0900D730EC /* SGPlayerItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E46200DFFC700ED8A58 /* SGPlayerItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384C21904A0900D730EC /* SGURLAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BF2152386C00079B38 /* SGURLAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384D21904A0900D730EC /* SGOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50B2187037200235169 /* SGOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384E21904A0900D730EC /* SGVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55992015B87400131E15 /* SGVideoFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86384F21904A0900D730EC /* SGFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C389ACB20108C2E003259FF /* SGFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385021904A0900D730EC /* SGAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E1D2011BC5400585326 /* SGAudioFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385121904A0900D730EC /* SGVRViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CAAC99D2133A6800065E364 /* SGVRViewport.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385221904A0900D730EC /* SGTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4663C820D0F83600CADDA7 /* SGTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385321904A0900D730EC /* SGClock+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C26CF56218D787D009FFCC4 /* SGClock+Internal.h */; }; + 9C86385421904A0900D730EC /* SGAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF63FC0211D8E33001B2684 /* SGAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385621904A0900D730EC /* SGDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA0F56220E0E24000501478 /* SGDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385721904A0900D730EC /* SGPLFScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5212004D97C00D1F4C8 /* SGPLFScreen.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385B21904A0900D730EC /* SGSWScale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3748792135521D00572166 /* SGSWScale.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385C21904A0900D730EC /* SGFrameOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C29D110217D741500343975 /* SGFrameOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385E21904A0900D730EC /* SGAudioFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1F82188526200B70DAA /* SGAudioFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86385F21904A0900D730EC /* SGURLDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BC2152335400079B38 /* SGURLDemuxer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386021904A0900D730EC /* SGPacketOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E61200E0ACC00ED8A58 /* SGPacketOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386121904A0900D730EC /* SGPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55AB2015D1D200131E15 /* SGPacket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386221904A0900D730EC /* SGClock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5C98F920D26BE10089C112 /* SGClock.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386421904A0900D730EC /* SGAsset+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB1217D823500900F1E /* SGAsset+Internal.h */; }; + 9C86386521904A0900D730EC /* SGMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5A12004E7ED00D1F4C8 /* SGMacro.h */; }; + 9C86386721904A0900D730EC /* SGFFmpeg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB61F5D2112B93C00F5BE6B /* SGFFmpeg.h */; }; + 9C86386821904A0900D730EC /* SGPLFTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F52D2004D97C00D1F4C8 /* SGPLFTargets.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386921904A0900D730EC /* SGRenderer+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDFC3E4218B10F00065C826 /* SGRenderer+Internal.h */; }; + 9C86386B21904A0900D730EC /* SGPLFObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5202004D97C00D1F4C8 /* SGPLFObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386E21904A0900D730EC /* SGPLFColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51A2004D97C00D1F4C8 /* SGPLFColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86386F21904A0900D730EC /* SGTrack+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCC9B217EF8E900430024 /* SGTrack+Internal.h */; }; + 9C86387121904A0900D730EC /* SGPLFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51E2004D97C00D1F4C8 /* SGPLFImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86387221904A0900D730EC /* SGSWResample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1FC2188550D00B70DAA /* SGSWResample.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86387321904A0900D730EC /* SGRenderable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E012011ADB500585326 /* SGRenderable.h */; }; + 9C86387421904A0900D730EC /* SGPLFView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5232004D97C00D1F4C8 /* SGPLFView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86387621904A0900D730EC /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86387921904A0900D730EC /* SGDecodeLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15DE320118E1100585326 /* SGDecodeLoop.h */; }; + 9C86387B21904A0900D730EC /* SGMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1D2228201B1DA2005147FB /* SGMapping.h */; }; + 9C86388121904A0900D730EC /* SGPacket+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA0217F109000430024 /* SGPacket+Internal.h */; }; + 9C86388321904A0900D730EC /* SGPlayerItem+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649F921818D8C00453B3E /* SGPlayerItem+Internal.h */; }; + 9C86388721904A0900D730EC /* SGDemuxable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0DF027215A2FB9007142DB /* SGDemuxable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86388921904A0900D730EC /* SGVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C1212518EB00B44298 /* SGVideoDecoder.h */; }; + 9C86388E21904A0900D730EC /* SGCodecContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C521251AC200B44298 /* SGCodecContext.h */; }; + 9C86388F21904A0900D730EC /* SGError.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E7E200E1ACA00ED8A58 /* SGError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C86389021904A0900D730EC /* SGFrame+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA6217F19BE00430024 /* SGFrame+Internal.h */; }; + 9C86389121904A0900D730EC /* SGVRProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C03E5EE212E645B001F0E1B /* SGVRProjection.h */; }; + 9C86389821904A0900D730EC /* SGActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C329AA82005E3F800252B10 /* SGActivity.h */; }; + 9C86389921904A0900D730EC /* SGAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082CE212521AB00B44298 /* SGAudioDecoder.h */; }; + 9C86389F21904A0900D730EC /* SGAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6842E200DD12F007BD834 /* SGAudioPlayer.h */; }; + 9C8D4E48200DFFC700ED8A58 /* SGPlayerItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E46200DFFC700ED8A58 /* SGPlayerItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C8D4E4B200DFFC700ED8A58 /* SGPlayerItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E47200DFFC700ED8A58 /* SGPlayerItem.m */; }; + 9C8D4E63200E0ACC00ED8A58 /* SGPacketOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E61200E0ACC00ED8A58 /* SGPacketOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C8D4E66200E0ACC00ED8A58 /* SGPacketOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E62200E0ACC00ED8A58 /* SGPacketOutput.m */; }; + 9C8D4E80200E1ACA00ED8A58 /* SGError.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E7E200E1ACA00ED8A58 /* SGError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C8D4E83200E1ACA00ED8A58 /* SGError.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E7F200E1ACA00ED8A58 /* SGError.m */; }; + 9C8D6B4B22C4A19500985D55 /* SGMetalSphereModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3022C4A19400985D55 /* SGMetalSphereModel.m */; }; + 9C8D6B4C22C4A19500985D55 /* SGMetalSphereModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3022C4A19400985D55 /* SGMetalSphereModel.m */; }; + 9C8D6B4D22C4A19500985D55 /* SGMetalSphereModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3022C4A19400985D55 /* SGMetalSphereModel.m */; }; + 9C8D6B4E22C4A19500985D55 /* SGMetal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3122C4A19400985D55 /* SGMetal.h */; }; + 9C8D6B4F22C4A19500985D55 /* SGMetal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3122C4A19400985D55 /* SGMetal.h */; }; + 9C8D6B5022C4A19500985D55 /* SGMetal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3122C4A19400985D55 /* SGMetal.h */; }; + 9C8D6B5122C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3222C4A19400985D55 /* SGMetalRenderPipelinePool.m */; }; + 9C8D6B5222C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3222C4A19400985D55 /* SGMetalRenderPipelinePool.m */; }; + 9C8D6B5322C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3222C4A19400985D55 /* SGMetalRenderPipelinePool.m */; }; + 9C8D6B5422C4A19500985D55 /* SGMetalTextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3322C4A19400985D55 /* SGMetalTextureLoader.m */; }; + 9C8D6B5522C4A19500985D55 /* SGMetalTextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3322C4A19400985D55 /* SGMetalTextureLoader.m */; }; + 9C8D6B5622C4A19500985D55 /* SGMetalTextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3322C4A19400985D55 /* SGMetalTextureLoader.m */; }; + 9C8D6B5722C4A19500985D55 /* SGMetalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3422C4A19400985D55 /* SGMetalModel.m */; }; + 9C8D6B5822C4A19500985D55 /* SGMetalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3422C4A19400985D55 /* SGMetalModel.m */; }; + 9C8D6B5922C4A19500985D55 /* SGMetalModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3422C4A19400985D55 /* SGMetalModel.m */; }; + 9C8D6B5A22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3522C4A19400985D55 /* SGMetalNV12RenderPipeline.m */; }; + 9C8D6B5B22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3522C4A19400985D55 /* SGMetalNV12RenderPipeline.m */; }; + 9C8D6B5C22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3522C4A19400985D55 /* SGMetalNV12RenderPipeline.m */; }; + 9C8D6B5D22C4A19500985D55 /* SGMetalTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3622C4A19400985D55 /* SGMetalTypes.h */; }; + 9C8D6B5E22C4A19500985D55 /* SGMetalTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3622C4A19400985D55 /* SGMetalTypes.h */; }; + 9C8D6B5F22C4A19500985D55 /* SGMetalTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3622C4A19400985D55 /* SGMetalTypes.h */; }; + 9C8D6B6022C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3722C4A19400985D55 /* SGMetalYUVRenderPipeline.m */; }; + 9C8D6B6122C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3722C4A19400985D55 /* SGMetalYUVRenderPipeline.m */; }; + 9C8D6B6222C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3722C4A19400985D55 /* SGMetalYUVRenderPipeline.m */; }; + 9C8D6B6322C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3822C4A19400985D55 /* SGMetalRenderPipeline.m */; }; + 9C8D6B6422C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3822C4A19400985D55 /* SGMetalRenderPipeline.m */; }; + 9C8D6B6522C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3822C4A19400985D55 /* SGMetalRenderPipeline.m */; }; + 9C8D6B6622C4A19500985D55 /* SGMetalPlaneModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3922C4A19400985D55 /* SGMetalPlaneModel.m */; }; + 9C8D6B6722C4A19500985D55 /* SGMetalPlaneModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3922C4A19400985D55 /* SGMetalPlaneModel.m */; }; + 9C8D6B6822C4A19500985D55 /* SGMetalPlaneModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3922C4A19400985D55 /* SGMetalPlaneModel.m */; }; + 9C8D6B6C22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3B22C4A19500985D55 /* SGMetalBGRARenderPipeline.m */; }; + 9C8D6B6D22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3B22C4A19500985D55 /* SGMetalBGRARenderPipeline.m */; }; + 9C8D6B6E22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B3B22C4A19500985D55 /* SGMetalBGRARenderPipeline.m */; }; + 9C8D6B7222C4A19500985D55 /* SGMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3D22C4A19500985D55 /* SGMetalRenderer.h */; }; + 9C8D6B7322C4A19500985D55 /* SGMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3D22C4A19500985D55 /* SGMetalRenderer.h */; }; + 9C8D6B7422C4A19500985D55 /* SGMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3D22C4A19500985D55 /* SGMetalRenderer.h */; }; + 9C8D6B7522C4A19500985D55 /* SGMetalSphereModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3E22C4A19500985D55 /* SGMetalSphereModel.h */; }; + 9C8D6B7622C4A19500985D55 /* SGMetalSphereModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3E22C4A19500985D55 /* SGMetalSphereModel.h */; }; + 9C8D6B7722C4A19500985D55 /* SGMetalSphereModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3E22C4A19500985D55 /* SGMetalSphereModel.h */; }; + 9C8D6B7822C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3F22C4A19500985D55 /* SGMetalNV12RenderPipeline.h */; }; + 9C8D6B7922C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3F22C4A19500985D55 /* SGMetalNV12RenderPipeline.h */; }; + 9C8D6B7A22C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B3F22C4A19500985D55 /* SGMetalNV12RenderPipeline.h */; }; + 9C8D6B7B22C4A19500985D55 /* SGMetalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4022C4A19500985D55 /* SGMetalModel.h */; }; + 9C8D6B7C22C4A19500985D55 /* SGMetalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4022C4A19500985D55 /* SGMetalModel.h */; }; + 9C8D6B7D22C4A19500985D55 /* SGMetalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4022C4A19500985D55 /* SGMetalModel.h */; }; + 9C8D6B7E22C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4122C4A19500985D55 /* SGMetalRenderPipelinePool.h */; }; + 9C8D6B7F22C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4122C4A19500985D55 /* SGMetalRenderPipelinePool.h */; }; + 9C8D6B8022C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4122C4A19500985D55 /* SGMetalRenderPipelinePool.h */; }; + 9C8D6B8122C4A19500985D55 /* SGMetalTextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4222C4A19500985D55 /* SGMetalTextureLoader.h */; }; + 9C8D6B8222C4A19500985D55 /* SGMetalTextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4222C4A19500985D55 /* SGMetalTextureLoader.h */; }; + 9C8D6B8322C4A19500985D55 /* SGMetalTextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4222C4A19500985D55 /* SGMetalTextureLoader.h */; }; + 9C8D6B8422C4A19500985D55 /* SGMetalPlaneModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4322C4A19500985D55 /* SGMetalPlaneModel.h */; }; + 9C8D6B8522C4A19500985D55 /* SGMetalPlaneModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4322C4A19500985D55 /* SGMetalPlaneModel.h */; }; + 9C8D6B8622C4A19500985D55 /* SGMetalPlaneModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4322C4A19500985D55 /* SGMetalPlaneModel.h */; }; + 9C8D6B8722C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4422C4A19500985D55 /* SGMetalYUVRenderPipeline.h */; }; + 9C8D6B8822C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4422C4A19500985D55 /* SGMetalYUVRenderPipeline.h */; }; + 9C8D6B8922C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4422C4A19500985D55 /* SGMetalYUVRenderPipeline.h */; }; + 9C8D6B8A22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4522C4A19500985D55 /* SGMetalRenderPipeline.h */; }; + 9C8D6B8B22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4522C4A19500985D55 /* SGMetalRenderPipeline.h */; }; + 9C8D6B8C22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4522C4A19500985D55 /* SGMetalRenderPipeline.h */; }; + 9C8D6B8D22C4A19500985D55 /* SGMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4622C4A19500985D55 /* SGMetalRenderer.m */; }; + 9C8D6B8E22C4A19500985D55 /* SGMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4622C4A19500985D55 /* SGMetalRenderer.m */; }; + 9C8D6B8F22C4A19500985D55 /* SGMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4622C4A19500985D55 /* SGMetalRenderer.m */; }; + 9C8D6B9322C4A19500985D55 /* SGMetalShader.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4822C4A19500985D55 /* SGMetalShader.metal */; }; + 9C8D6B9422C4A19500985D55 /* SGMetalShader.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4822C4A19500985D55 /* SGMetalShader.metal */; }; + 9C8D6B9522C4A19500985D55 /* SGMetalShader.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D6B4822C4A19500985D55 /* SGMetalShader.metal */; }; + 9C8D6B9622C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4922C4A19500985D55 /* SGMetalBGRARenderPipeline.h */; }; + 9C8D6B9722C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4922C4A19500985D55 /* SGMetalBGRARenderPipeline.h */; }; + 9C8D6B9822C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D6B4922C4A19500985D55 /* SGMetalBGRARenderPipeline.h */; }; + 9C935B9C21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C935B9B21CCCA58007813F4 /* SGDescriptor+Internal.h */; }; + 9C935B9D21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C935B9B21CCCA58007813F4 /* SGDescriptor+Internal.h */; }; + 9C935B9E21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C935B9B21CCCA58007813F4 /* SGDescriptor+Internal.h */; }; + 9C95D2BD2152335400079B38 /* SGURLDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2BB2152335400079B38 /* SGURLDemuxer.m */; }; + 9C95D2BE2152335400079B38 /* SGURLDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BC2152335400079B38 /* SGURLDemuxer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C95D2C12152386C00079B38 /* SGURLAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BF2152386C00079B38 /* SGURLAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9C95D2C22152386C00079B38 /* SGURLAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2C02152386C00079B38 /* SGURLAsset.m */; }; + 9CA0F56420E0E24000501478 /* SGDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA0F56220E0E24000501478 /* SGDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CA3CDB420E1F74300B852D0 /* SGFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA3CDB320E1F74300B852D0 /* SGFrame.m */; }; + 9CA57922219D69580061093B /* SGTimeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57920219D69580061093B /* SGTimeLayout.h */; }; + 9CA57923219D69580061093B /* SGTimeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57920219D69580061093B /* SGTimeLayout.h */; }; + 9CA57924219D69580061093B /* SGTimeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57920219D69580061093B /* SGTimeLayout.h */; }; + 9CA57925219D69580061093B /* SGTimeLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57921219D69580061093B /* SGTimeLayout.m */; }; + 9CA57926219D69580061093B /* SGTimeLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57921219D69580061093B /* SGTimeLayout.m */; }; + 9CA57927219D69580061093B /* SGTimeLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57921219D69580061093B /* SGTimeLayout.m */; }; + 9CA57932219DAA270061093B /* SGCodecDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57930219DAA270061093B /* SGCodecDescriptor.h */; }; + 9CA57933219DAA270061093B /* SGCodecDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57930219DAA270061093B /* SGCodecDescriptor.h */; }; + 9CA57934219DAA270061093B /* SGCodecDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA57930219DAA270061093B /* SGCodecDescriptor.h */; }; + 9CA57935219DAA270061093B /* SGCodecDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57931219DAA270061093B /* SGCodecDescriptor.m */; }; + 9CA57936219DAA270061093B /* SGCodecDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57931219DAA270061093B /* SGCodecDescriptor.m */; }; + 9CA57937219DAA270061093B /* SGCodecDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA57931219DAA270061093B /* SGCodecDescriptor.m */; }; + 9CAAC99F2133A6800065E364 /* SGVRViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CAAC99D2133A6800065E364 /* SGVRViewport.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CAAC9A22133A6800065E364 /* SGVRViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CAAC99E2133A6800065E364 /* SGVRViewport.m */; }; + 9CB01C93219E863D00B36CFA /* SGMutilDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB01C91219E863D00B36CFA /* SGMutilDemuxer.h */; }; + 9CB01C94219E863D00B36CFA /* SGMutilDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB01C91219E863D00B36CFA /* SGMutilDemuxer.h */; }; + 9CB01C95219E863D00B36CFA /* SGMutilDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB01C91219E863D00B36CFA /* SGMutilDemuxer.h */; }; + 9CB01C96219E863D00B36CFA /* SGMutilDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB01C92219E863D00B36CFA /* SGMutilDemuxer.m */; }; + 9CB01C97219E863D00B36CFA /* SGMutilDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB01C92219E863D00B36CFA /* SGMutilDemuxer.m */; }; + 9CB01C98219E863D00B36CFA /* SGMutilDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB01C92219E863D00B36CFA /* SGMutilDemuxer.m */; }; + 9CB61F5F2112B93C00F5BE6B /* SGFFmpeg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB61F5D2112B93C00F5BE6B /* SGFFmpeg.h */; }; + 9CB61F622112B93C00F5BE6B /* SGFFmpeg.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB61F5E2112B93C00F5BE6B /* SGFFmpeg.m */; }; + 9CC2AD7622A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7422A65C7B0095A081 /* SGPaddingDemuxer.h */; }; + 9CC2AD7722A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7422A65C7B0095A081 /* SGPaddingDemuxer.h */; }; + 9CC2AD7822A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7422A65C7B0095A081 /* SGPaddingDemuxer.h */; }; + 9CC2AD7922A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7522A65C7B0095A081 /* SGPaddingDemuxer.m */; }; + 9CC2AD7A22A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7522A65C7B0095A081 /* SGPaddingDemuxer.m */; }; + 9CC2AD7B22A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7522A65C7B0095A081 /* SGPaddingDemuxer.m */; }; + 9CC2AD7E22A660080095A081 /* SGPaddingSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7C22A660080095A081 /* SGPaddingSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CC2AD7F22A660080095A081 /* SGPaddingSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7C22A660080095A081 /* SGPaddingSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CC2AD8022A660080095A081 /* SGPaddingSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC2AD7C22A660080095A081 /* SGPaddingSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CC2AD8122A660080095A081 /* SGPaddingSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7D22A660080095A081 /* SGPaddingSegment.m */; }; + 9CC2AD8222A660080095A081 /* SGPaddingSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7D22A660080095A081 /* SGPaddingSegment.m */; }; + 9CC2AD8322A660080095A081 /* SGPaddingSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC2AD7D22A660080095A081 /* SGPaddingSegment.m */; }; + 9CC649FB21818D8C00453B3E /* SGPlayerItem+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649F921818D8C00453B3E /* SGPlayerItem+Internal.h */; }; + 9CC649FF2181A8C000453B3E /* SGCapacity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649FD2181A8C000453B3E /* SGCapacity.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CC64A002181A8C000453B3E /* SGCapacity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC649FE2181A8C000453B3E /* SGCapacity.m */; }; + 9CCC5F1F200C9BB200E833DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0F200C9B7700E833DA /* Foundation.framework */; }; + 9CCC5F20200C9BB700E833DA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F11200C9B7B00E833DA /* AVFoundation.framework */; }; + 9CCC5F21200C9BBB00E833DA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0D200C9B7000E833DA /* UIKit.framework */; }; + 9CD79E9E2190068E00E39A7D /* SGPlayerItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E47200DFFC700ED8A58 /* SGPlayerItem.m */; }; + 9CD79E9F2190068E00E39A7D /* SGFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CA3CDB320E1F74300B852D0 /* SGFrame.m */; }; + 9CD79EA02190068E00E39A7D /* SGPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55AC2015D1D200131E15 /* SGPacket.m */; }; + 9CD79EA12190068E00E39A7D /* SGObjectPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55922015911600131E15 /* SGObjectPool.m */; }; + 9CD79EA32190068E00E39A7D /* SGVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C559A2015B87400131E15 /* SGVideoFrame.m */; }; + 9CD79EA42190068E00E39A7D /* SGClock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C5C98FA20D26BE10089C112 /* SGClock.m */; }; + 9CD79EA52190068E00E39A7D /* SGPLFImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51F2004D97C00D1F4C8 /* SGPLFImage.m */; }; + 9CD79EA62190068E00E39A7D /* SGObjectQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55B42015D92100131E15 /* SGObjectQueue.m */; }; + 9CD79EA92190068E00E39A7D /* SGVRProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C03E5EF212E645B001F0E1B /* SGVRProjection.m */; }; + 9CD79EAC2190068E00E39A7D /* SGLock.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D51021872D3F00235169 /* SGLock.m */; }; + 9CD79EAD2190068E00E39A7D /* SGAudioRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E062011AE0700585326 /* SGAudioRenderer.m */; }; + 9CD79EB12190068E00E39A7D /* SGAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6842F200DD12F007BD834 /* SGAudioPlayer.m */; }; + 9CD79EB22190068E00E39A7D /* SGTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF52CF6200F45D700950B81 /* SGTrack.m */; }; + 9CD79EB32190068E00E39A7D /* SGPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C25364F1FAB199500BBFA5C /* SGPlayer.m */; }; + 9CD79EB52190068E00E39A7D /* SGMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C1D2229201B1DA2005147FB /* SGMapping.m */; }; + 9CD79EB82190068E00E39A7D /* SGFrameOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C29D111217D741500343975 /* SGFrameOutput.m */; }; + 9CD79EB92190068E00E39A7D /* SGCapacity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CC649FE2181A8C000453B3E /* SGCapacity.m */; }; + 9CD79EBA2190068E00E39A7D /* SGActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C329AA92005E3F800252B10 /* SGActivity.m */; }; + 9CD79EBB2190068E00E39A7D /* SGError.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E7F200E1ACA00ED8A58 /* SGError.m */; }; + 9CD79EBC2190068E00E39A7D /* SGURLDemuxer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2BB2152335400079B38 /* SGURLDemuxer.m */; }; + 9CD79EBE2190068E00E39A7D /* SGVideoDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C2212518EC00B44298 /* SGVideoDecoder.m */; }; + 9CD79EC02190068E00E39A7D /* SGSWResample.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1FD2188550D00B70DAA /* SGSWResample.m */; }; + 9CD79EC12190068E00E39A7D /* SGVideoRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2C55A22015C1E100131E15 /* SGVideoRenderer.m */; }; + 9CD79EC22190068E00E39A7D /* SGPLFScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5222004D97C00D1F4C8 /* SGPLFScreen.m */; }; + 9CD79EC42190068E00E39A7D /* SGAudioFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E1F92188526200B70DAA /* SGAudioFormatter.m */; }; + 9CD79EC52190068E00E39A7D /* SGFFmpeg.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB61F5E2112B93C00F5BE6B /* SGFFmpeg.m */; }; + 9CD79EC72190068E00E39A7D /* SGPacketOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D4E62200E0ACC00ED8A58 /* SGPacketOutput.m */; }; + 9CD79EC82190068E00E39A7D /* SGPLFColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51B2004D97C00D1F4C8 /* SGPLFColor.m */; }; + 9CD79ECA2190068E00E39A7D /* SGPLFView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5242004D97C00D1F4C8 /* SGPLFView.m */; }; + 9CD79ECC2190068E00E39A7D /* SGSWScale.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C37487A2135521D00572166 /* SGSWScale.m */; }; + 9CD79ECD2190068E00E39A7D /* SGAudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082CF212521AB00B44298 /* SGAudioDecoder.m */; }; + 9CD79ECE2190068E00E39A7D /* SGURLAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C95D2C02152386C00079B38 /* SGURLAsset.m */; }; + 9CD79ECF2190068E00E39A7D /* SGCodecContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C3082C621251AC200B44298 /* SGCodecContext.m */; }; + 9CD79ED12190068E00E39A7D /* SGDecodeLoop.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15DE420118E1100585326 /* SGDecodeLoop.m */; }; + 9CD79ED32190068E00E39A7D /* SGVRViewport.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CAAC99E2133A6800065E364 /* SGVRViewport.m */; }; + 9CD79ED52190068E00E39A7D /* SGAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E1E2011BC5400585326 /* SGAudioFrame.m */; }; + 9CD79ED72190068E00E39A7D /* SGAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF63FC1211D8E33001B2684 /* SGAsset.m */; }; + 9CD79ED82190068E00E39A7D /* SGOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C43D50C2187037200235169 /* SGOptions.m */; }; + 9CD79ED92190068E00E39A7D /* SGTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C4663C920D0F83600CADDA7 /* SGTime.m */; }; + 9CD79EDB2190068E00E39A7D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0D200C9B7000E833DA /* UIKit.framework */; }; + 9CD79EDC2190068E00E39A7D /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F11200C9B7B00E833DA /* AVFoundation.framework */; }; + 9CD79EDD2190068E00E39A7D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CCC5F0F200C9B7700E833DA /* Foundation.framework */; }; + 9CD79EE72190068E00E39A7D /* SGCapacity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649FD2181A8C000453B3E /* SGCapacity.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EE82190068E00E39A7D /* SGObjectPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55912015911600131E15 /* SGObjectPool.h */; }; + 9CD79EE92190068E00E39A7D /* SGObjectQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55B32015D92100131E15 /* SGObjectQueue.h */; }; + 9CD79EEA2190068E00E39A7D /* SGAudioRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E052011AE0700585326 /* SGAudioRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EEB2190068E00E39A7D /* SGVideoRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55A12015C1E100131E15 /* SGVideoRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EEC2190068E00E39A7D /* SGLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50F21872D3F00235169 /* SGLock.h */; }; + 9CD79EED2190068E00E39A7D /* SGTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF52CF5200F45D700950B81 /* SGTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EEE2190068E00E39A7D /* SGPlayerItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E46200DFFC700ED8A58 /* SGPlayerItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EEF2190068E00E39A7D /* SGURLAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BF2152386C00079B38 /* SGURLAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF02190068E00E39A7D /* SGOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C43D50B2187037200235169 /* SGOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF12190068E00E39A7D /* SGVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55992015B87400131E15 /* SGVideoFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF22190068E00E39A7D /* SGFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C389ACB20108C2E003259FF /* SGFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF32190068E00E39A7D /* SGAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E1D2011BC5400585326 /* SGAudioFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF42190068E00E39A7D /* SGVRViewport.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CAAC99D2133A6800065E364 /* SGVRViewport.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EF52190068E00E39A7D /* SGTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C4663C820D0F83600CADDA7 /* SGTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EFB2190068E00E39A7D /* SGClock+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C26CF56218D787D009FFCC4 /* SGClock+Internal.h */; }; + 9CD79EFC2190068E00E39A7D /* SGAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF63FC0211D8E33001B2684 /* SGAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79EFF2190068E00E39A7D /* SGDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CA0F56220E0E24000501478 /* SGDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F032190068E00E39A7D /* SGPLFScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5212004D97C00D1F4C8 /* SGPLFScreen.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F082190068E00E39A7D /* SGSWScale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3748792135521D00572166 /* SGSWScale.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0A2190068E00E39A7D /* SGFrameOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C29D110217D741500343975 /* SGFrameOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0B2190068E00E39A7D /* SGAudioFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1F82188526200B70DAA /* SGAudioFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0C2190068E00E39A7D /* SGURLDemuxer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C95D2BC2152335400079B38 /* SGURLDemuxer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0D2190068E00E39A7D /* SGPacketOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E61200E0ACC00ED8A58 /* SGPacketOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0E2190068E00E39A7D /* SGPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C2C55AB2015D1D200131E15 /* SGPacket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F0F2190068E00E39A7D /* SGClock.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C5C98F920D26BE10089C112 /* SGClock.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F122190068E00E39A7D /* SGAsset+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0B6CB1217D823500900F1E /* SGAsset+Internal.h */; }; + 9CD79F132190068E00E39A7D /* SGMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5A12004E7ED00D1F4C8 /* SGMacro.h */; }; + 9CD79F1B2190068E00E39A7D /* SGFFmpeg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB61F5D2112B93C00F5BE6B /* SGFFmpeg.h */; }; + 9CD79F232190068E00E39A7D /* SGPLFTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F52D2004D97C00D1F4C8 /* SGPLFTargets.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F242190068E00E39A7D /* SGRenderer+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDFC3E4218B10F00065C826 /* SGRenderer+Internal.h */; }; + 9CD79F272190068E00E39A7D /* SGPLFObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5202004D97C00D1F4C8 /* SGPLFObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F2A2190068E00E39A7D /* SGPLFColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51A2004D97C00D1F4C8 /* SGPLFColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F2C2190068E00E39A7D /* SGTrack+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCC9B217EF8E900430024 /* SGTrack+Internal.h */; }; + 9CD79F352190068E00E39A7D /* SGPLFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51E2004D97C00D1F4C8 /* SGPLFImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F372190068E00E39A7D /* SGSWResample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C66E1FC2188550D00B70DAA /* SGSWResample.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F3C2190068E00E39A7D /* SGRenderable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E012011ADB500585326 /* SGRenderable.h */; }; + 9CD79F422190068E00E39A7D /* SGPLFView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5232004D97C00D1F4C8 /* SGPLFView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F462190068E00E39A7D /* SGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C25364E1FAB199500BBFA5C /* SGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F4A2190068E00E39A7D /* SGDecodeLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15DE320118E1100585326 /* SGDecodeLoop.h */; }; + 9CD79F4D2190068E00E39A7D /* SGMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1D2228201B1DA2005147FB /* SGMapping.h */; }; + 9CD79F632190068E00E39A7D /* SGPacket+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA0217F109000430024 /* SGPacket+Internal.h */; }; + 9CD79F682190068E00E39A7D /* SGPlayerItem+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CC649F921818D8C00453B3E /* SGPlayerItem+Internal.h */; }; + 9CD79F6B2190068E00E39A7D /* SGDemuxable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C0DF027215A2FB9007142DB /* SGDemuxable.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F712190068E00E39A7D /* SGVideoDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C1212518EB00B44298 /* SGVideoDecoder.h */; }; + 9CD79F782190068E00E39A7D /* SGCodecContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082C521251AC200B44298 /* SGCodecContext.h */; }; + 9CD79F802190068E00E39A7D /* SGError.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C8D4E7E200E1ACA00ED8A58 /* SGError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CD79F812190068E00E39A7D /* SGFrame+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA6217F19BE00430024 /* SGFrame+Internal.h */; }; + 9CD79F822190068E00E39A7D /* SGVRProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C03E5EE212E645B001F0E1B /* SGVRProjection.h */; }; + 9CD79F8C2190068E00E39A7D /* SGActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C329AA82005E3F800252B10 /* SGActivity.h */; }; + 9CD79F8F2190068E00E39A7D /* SGAudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C3082CE212521AB00B44298 /* SGAudioDecoder.h */; }; + 9CD79F9C2190068E00E39A7D /* SGAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6842E200DD12F007BD834 /* SGAudioPlayer.h */; }; + 9CDFC3E6218B10F00065C826 /* SGRenderer+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CDFC3E4218B10F00065C826 /* SGRenderer+Internal.h */; }; + 9CE68430200DD12F007BD834 /* SGAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6842E200DD12F007BD834 /* SGAudioPlayer.h */; }; + 9CE68433200DD12F007BD834 /* SGAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6842F200DD12F007BD834 /* SGAudioPlayer.m */; }; + 9CE6F52F2004D97D00D1F4C8 /* SGPLFColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51A2004D97C00D1F4C8 /* SGPLFColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F5332004D97D00D1F4C8 /* SGPLFColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51B2004D97C00D1F4C8 /* SGPLFColor.m */; }; + 9CE6F53F2004D97D00D1F4C8 /* SGPLFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F51E2004D97C00D1F4C8 /* SGPLFImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F5432004D97D00D1F4C8 /* SGPLFImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F51F2004D97C00D1F4C8 /* SGPLFImage.m */; }; + 9CE6F5472004D97D00D1F4C8 /* SGPLFObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5202004D97C00D1F4C8 /* SGPLFObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F54B2004D97D00D1F4C8 /* SGPLFScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5212004D97C00D1F4C8 /* SGPLFScreen.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F54F2004D97D00D1F4C8 /* SGPLFScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5222004D97C00D1F4C8 /* SGPLFScreen.m */; }; + 9CE6F5532004D97D00D1F4C8 /* SGPLFView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5232004D97C00D1F4C8 /* SGPLFView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F5572004D97D00D1F4C8 /* SGPLFView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE6F5242004D97C00D1F4C8 /* SGPLFView.m */; }; + 9CE6F5772004D97D00D1F4C8 /* SGPLFTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F52D2004D97C00D1F4C8 /* SGPLFTargets.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE6F5A22004E7ED00D1F4C8 /* SGMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE6F5A12004E7ED00D1F4C8 /* SGMacro.h */; }; + 9CE71915219C3F7900256485 /* SGURLSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71913219C3F7900256485 /* SGURLSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE71916219C3F7900256485 /* SGURLSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71913219C3F7900256485 /* SGURLSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE71917219C3F7900256485 /* SGURLSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71913219C3F7900256485 /* SGURLSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE71918219C3F7900256485 /* SGURLSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71914219C3F7900256485 /* SGURLSegment.m */; }; + 9CE71919219C3F7900256485 /* SGURLSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71914219C3F7900256485 /* SGURLSegment.m */; }; + 9CE7191A219C3F7900256485 /* SGURLSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71914219C3F7900256485 /* SGURLSegment.m */; }; + 9CE7191D219C408300256485 /* SGSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE7191B219C408300256485 /* SGSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE7191E219C408300256485 /* SGSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE7191B219C408300256485 /* SGSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE7191F219C408300256485 /* SGSegment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE7191B219C408300256485 /* SGSegment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CE71920219C408300256485 /* SGSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE7191C219C408300256485 /* SGSegment.m */; }; + 9CE71921219C408300256485 /* SGSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE7191C219C408300256485 /* SGSegment.m */; }; + 9CE71922219C408300256485 /* SGSegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE7191C219C408300256485 /* SGSegment.m */; }; + 9CE71924219C480000256485 /* SGSegment+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71923219C47FF00256485 /* SGSegment+Internal.h */; }; + 9CE71925219C480000256485 /* SGSegment+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71923219C47FF00256485 /* SGSegment+Internal.h */; }; + 9CE71926219C480000256485 /* SGSegment+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71923219C47FF00256485 /* SGSegment+Internal.h */; }; + 9CE71929219C48AC00256485 /* SGDemuxerFunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71927219C48AC00256485 /* SGDemuxerFunnel.h */; }; + 9CE7192A219C48AC00256485 /* SGDemuxerFunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71927219C48AC00256485 /* SGDemuxerFunnel.h */; }; + 9CE7192B219C48AC00256485 /* SGDemuxerFunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CE71927219C48AC00256485 /* SGDemuxerFunnel.h */; }; + 9CE7192C219C48AC00256485 /* SGDemuxerFunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71928219C48AC00256485 /* SGDemuxerFunnel.m */; }; + 9CE7192D219C48AC00256485 /* SGDemuxerFunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71928219C48AC00256485 /* SGDemuxerFunnel.m */; }; + 9CE7192E219C48AC00256485 /* SGDemuxerFunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CE71928219C48AC00256485 /* SGDemuxerFunnel.m */; }; + 9CEBCC9D217EF8E900430024 /* SGTrack+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCC9B217EF8E900430024 /* SGTrack+Internal.h */; }; + 9CEBCCA2217F109000430024 /* SGPacket+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA0217F109000430024 /* SGPacket+Internal.h */; }; + 9CEBCCA8217F19BE00430024 /* SGFrame+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CEBCCA6217F19BE00430024 /* SGFrame+Internal.h */; }; + 9CF15DE520118E1100585326 /* SGDecodeLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15DE320118E1100585326 /* SGDecodeLoop.h */; }; + 9CF15DE820118E1100585326 /* SGDecodeLoop.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15DE420118E1100585326 /* SGDecodeLoop.m */; }; + 9CF15E022011ADB500585326 /* SGRenderable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E012011ADB500585326 /* SGRenderable.h */; }; + 9CF15E072011AE0700585326 /* SGAudioRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E052011AE0700585326 /* SGAudioRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CF15E0A2011AE0700585326 /* SGAudioRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E062011AE0700585326 /* SGAudioRenderer.m */; }; + 9CF15E1F2011BC5400585326 /* SGAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF15E1D2011BC5400585326 /* SGAudioFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CF15E222011BC5400585326 /* SGAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF15E1E2011BC5400585326 /* SGAudioFrame.m */; }; + 9CF52CF7200F45D700950B81 /* SGTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF52CF5200F45D700950B81 /* SGTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CF52CFA200F45D700950B81 /* SGTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF52CF6200F45D700950B81 /* SGTrack.m */; }; + 9CF63FC2211D8E33001B2684 /* SGAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CF63FC0211D8E33001B2684 /* SGAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9CF63FC3211D8E33001B2684 /* SGAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF63FC1211D8E33001B2684 /* SGAsset.m */; }; + 9CFA232B230BCD4400061AAC /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2323230BCD4300061AAC /* libavutil.a */; }; + 9CFA232C230BCD4400061AAC /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2324230BCD4300061AAC /* libcrypto.a */; }; + 9CFA232D230BCD4400061AAC /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2325230BCD4400061AAC /* libavformat.a */; }; + 9CFA232E230BCD4400061AAC /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2326230BCD4400061AAC /* libssl.a */; }; + 9CFA232F230BCD4400061AAC /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2327230BCD4400061AAC /* libswresample.a */; }; + 9CFA2330230BCD4400061AAC /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2328230BCD4400061AAC /* libavcodec.a */; }; + 9CFA2331230BCD4400061AAC /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2329230BCD4400061AAC /* libswscale.a */; }; + 9CFA2332230BCD4400061AAC /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA232A230BCD4400061AAC /* libavfilter.a */; }; + 9CFA2333230BCE3200061AAC /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2314230BCCEA00061AAC /* libavcodec.a */; }; + 9CFA2334230BCE3200061AAC /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2318230BCCEA00061AAC /* libavfilter.a */; }; + 9CFA2335230BCE3200061AAC /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2313230BCCE900061AAC /* libavformat.a */; }; + 9CFA2336230BCE3200061AAC /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2316230BCCEA00061AAC /* libavutil.a */; }; + 9CFA2337230BCE3200061AAC /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2315230BCCEA00061AAC /* libcrypto.a */; }; + 9CFA2338230BCE3200061AAC /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2317230BCCEA00061AAC /* libssl.a */; }; + 9CFA2339230BCE3200061AAC /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2319230BCCEA00061AAC /* libswresample.a */; }; + 9CFA233A230BCE3200061AAC /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA231A230BCCEA00061AAC /* libswscale.a */; }; + 9CFA2343230BCE5100061AAC /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA233B230BCE5100061AAC /* libavutil.a */; }; + 9CFA2344230BCE5100061AAC /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA233C230BCE5100061AAC /* libswscale.a */; }; + 9CFA2345230BCE5100061AAC /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA233D230BCE5100061AAC /* libssl.a */; }; + 9CFA2346230BCE5100061AAC /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA233E230BCE5100061AAC /* libavformat.a */; }; + 9CFA2347230BCE5100061AAC /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA233F230BCE5100061AAC /* libavfilter.a */; }; + 9CFA2348230BCE5100061AAC /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2340230BCE5100061AAC /* libcrypto.a */; }; + 9CFA2349230BCE5100061AAC /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2341230BCE5100061AAC /* libavcodec.a */; }; + 9CFA234A230BCE5100061AAC /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFA2342230BCE5100061AAC /* libswresample.a */; }; + 9CFA2354230BCFFC00061AAC /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA234D230BCFFC00061AAC /* imgutils.h */; }; + 9CFA2355230BCFFC00061AAC /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA234F230BCFFC00061AAC /* avformat.h */; }; + 9CFA2356230BCFFC00061AAC /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA2351230BCFFC00061AAC /* swscale.h */; }; + 9CFA2357230BCFFC00061AAC /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA2353230BCFFC00061AAC /* swresample.h */; }; + 9CFA2361230BD00400061AAC /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA235A230BD00400061AAC /* imgutils.h */; }; + 9CFA2362230BD00400061AAC /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA235C230BD00400061AAC /* avformat.h */; }; + 9CFA2363230BD00400061AAC /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA235E230BD00400061AAC /* swscale.h */; }; + 9CFA2364230BD00400061AAC /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA2360230BD00400061AAC /* swresample.h */; }; + 9CFA236E230BD00C00061AAC /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA2367230BD00C00061AAC /* imgutils.h */; }; + 9CFA236F230BD00C00061AAC /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA2369230BD00C00061AAC /* avformat.h */; }; + 9CFA2370230BD00C00061AAC /* swscale.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA236B230BD00C00061AAC /* swscale.h */; }; + 9CFA2371230BD00C00061AAC /* swresample.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CFA236D230BD00C00061AAC /* swresample.h */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 9C09123C1E71283100E5AA46 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9CEFA6361E7106B500835CAB; - remoteInfo = "SGPlatform iOS"; - }; - 9C09123E1E71283100E5AA46 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9CEFA64A1E71071800835CAB; - remoteInfo = "SGPlatform macOS"; - }; - 9C0912401E71283100E5AA46 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9CEFA6551E71073700835CAB; - remoteInfo = "SGPlatform tvOS"; - }; - 9C2CEFF71F10CA930099247F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 9CEFA6351E7106B500835CAB; - remoteInfo = "SGPlatform iOS"; - }; - 9C2CEFFC1F10CA970099247F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 9CEFA6411E71071800835CAB; - remoteInfo = "SGPlatform macOS"; - }; - 9C2CEFFE1F10CA9B0099247F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 9CEFA64C1E71073700835CAB; - remoteInfo = "SGPlatform tvOS"; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ - 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SGPlatform.xcodeproj; path = Vendors/SGPlatform/SGPlatform.xcodeproj; sourceTree = ""; }; - 9C2533CB1FAB151400BBFA5C /* avcodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avcodec.h; sourceTree = ""; }; - 9C2533CC1FAB151400BBFA5C /* avdct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avdct.h; sourceTree = ""; }; - 9C2533CD1FAB151400BBFA5C /* avfft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avfft.h; sourceTree = ""; }; - 9C2533CE1FAB151400BBFA5C /* d3d11va.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = d3d11va.h; sourceTree = ""; }; - 9C2533CF1FAB151400BBFA5C /* dirac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirac.h; sourceTree = ""; }; - 9C2533D01FAB151400BBFA5C /* dv_profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dv_profile.h; sourceTree = ""; }; - 9C2533D11FAB151400BBFA5C /* dxva2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dxva2.h; sourceTree = ""; }; - 9C2533D21FAB151400BBFA5C /* jni.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni.h; sourceTree = ""; }; - 9C2533D31FAB151400BBFA5C /* mediacodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mediacodec.h; sourceTree = ""; }; - 9C2533D41FAB151400BBFA5C /* qsv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qsv.h; sourceTree = ""; }; - 9C2533D51FAB151400BBFA5C /* vaapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vaapi.h; sourceTree = ""; }; - 9C2533D61FAB151400BBFA5C /* vda.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vda.h; sourceTree = ""; }; - 9C2533D71FAB151400BBFA5C /* vdpau.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vdpau.h; sourceTree = ""; }; - 9C2533D81FAB151400BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2533D91FAB151400BBFA5C /* videotoolbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = videotoolbox.h; sourceTree = ""; }; - 9C2533DA1FAB151400BBFA5C /* vorbis_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vorbis_parser.h; sourceTree = ""; }; - 9C2533DB1FAB151400BBFA5C /* xvmc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xvmc.h; sourceTree = ""; }; - 9C2533DD1FAB151400BBFA5C /* avfilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avfilter.h; sourceTree = ""; }; - 9C2533DE1FAB151400BBFA5C /* avfiltergraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avfiltergraph.h; sourceTree = ""; }; - 9C2533DF1FAB151400BBFA5C /* buffersink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffersink.h; sourceTree = ""; }; - 9C2533E01FAB151400BBFA5C /* buffersrc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffersrc.h; sourceTree = ""; }; - 9C2533E11FAB151400BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2533E31FAB151400BBFA5C /* avformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avformat.h; sourceTree = ""; }; - 9C2533E41FAB151400BBFA5C /* avio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avio.h; sourceTree = ""; }; - 9C2533E51FAB151400BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2533E71FAB151400BBFA5C /* adler32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = adler32.h; sourceTree = ""; }; - 9C2533E81FAB151400BBFA5C /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; - 9C2533E91FAB151400BBFA5C /* aes_ctr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_ctr.h; sourceTree = ""; }; - 9C2533EA1FAB151400BBFA5C /* attributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = attributes.h; sourceTree = ""; }; - 9C2533EB1FAB151400BBFA5C /* audio_fifo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_fifo.h; sourceTree = ""; }; - 9C2533EC1FAB151400BBFA5C /* avassert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avassert.h; sourceTree = ""; }; - 9C2533ED1FAB151400BBFA5C /* avconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avconfig.h; sourceTree = ""; }; - 9C2533EE1FAB151400BBFA5C /* avstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avstring.h; sourceTree = ""; }; - 9C2533EF1FAB151400BBFA5C /* avutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avutil.h; sourceTree = ""; }; - 9C2533F01FAB151400BBFA5C /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = ""; }; - 9C2533F11FAB151400BBFA5C /* blowfish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blowfish.h; sourceTree = ""; }; - 9C2533F21FAB151400BBFA5C /* bprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bprint.h; sourceTree = ""; }; - 9C2533F31FAB151400BBFA5C /* bswap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bswap.h; sourceTree = ""; }; - 9C2533F41FAB151400BBFA5C /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer.h; sourceTree = ""; }; - 9C2533F51FAB151400BBFA5C /* camellia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = camellia.h; sourceTree = ""; }; - 9C2533F61FAB151400BBFA5C /* cast5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cast5.h; sourceTree = ""; }; - 9C2533F71FAB151400BBFA5C /* channel_layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = channel_layout.h; sourceTree = ""; }; - 9C2533F81FAB151400BBFA5C /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - 9C2533F91FAB151400BBFA5C /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; - 9C2533FA1FAB151400BBFA5C /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crc.h; sourceTree = ""; }; - 9C2533FB1FAB151400BBFA5C /* des.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = des.h; sourceTree = ""; }; - 9C2533FC1FAB151400BBFA5C /* dict.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dict.h; sourceTree = ""; }; - 9C2533FD1FAB151400BBFA5C /* display.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = display.h; sourceTree = ""; }; - 9C2533FE1FAB151400BBFA5C /* downmix_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = downmix_info.h; sourceTree = ""; }; - 9C2533FF1FAB151400BBFA5C /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = ""; }; - 9C2534001FAB151400BBFA5C /* eval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eval.h; sourceTree = ""; }; - 9C2534011FAB151400BBFA5C /* ffversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffversion.h; sourceTree = ""; }; - 9C2534021FAB151400BBFA5C /* fifo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fifo.h; sourceTree = ""; }; - 9C2534031FAB151400BBFA5C /* file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = file.h; sourceTree = ""; }; - 9C2534041FAB151400BBFA5C /* frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frame.h; sourceTree = ""; }; - 9C2534051FAB151400BBFA5C /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = ""; }; - 9C2534061FAB151400BBFA5C /* hmac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hmac.h; sourceTree = ""; }; - 9C2534071FAB151400BBFA5C /* hwcontext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext.h; sourceTree = ""; }; - 9C2534081FAB151400BBFA5C /* hwcontext_cuda.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext_cuda.h; sourceTree = ""; }; - 9C2534091FAB151400BBFA5C /* hwcontext_dxva2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext_dxva2.h; sourceTree = ""; }; - 9C25340A1FAB151400BBFA5C /* hwcontext_qsv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext_qsv.h; sourceTree = ""; }; - 9C25340B1FAB151400BBFA5C /* hwcontext_vaapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext_vaapi.h; sourceTree = ""; }; - 9C25340C1FAB151400BBFA5C /* hwcontext_vdpau.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hwcontext_vdpau.h; sourceTree = ""; }; - 9C25340D1FAB151400BBFA5C /* imgutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgutils.h; sourceTree = ""; }; - 9C25340E1FAB151400BBFA5C /* intfloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intfloat.h; sourceTree = ""; }; - 9C25340F1FAB151400BBFA5C /* intreadwrite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intreadwrite.h; sourceTree = ""; }; - 9C2534101FAB151400BBFA5C /* lfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lfg.h; sourceTree = ""; }; - 9C2534111FAB151400BBFA5C /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; - 9C2534121FAB151400BBFA5C /* lzo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lzo.h; sourceTree = ""; }; - 9C2534131FAB151400BBFA5C /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macros.h; sourceTree = ""; }; - 9C2534141FAB151400BBFA5C /* mastering_display_metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mastering_display_metadata.h; sourceTree = ""; }; - 9C2534151FAB151400BBFA5C /* mathematics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathematics.h; sourceTree = ""; }; - 9C2534161FAB151400BBFA5C /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; - 9C2534171FAB151400BBFA5C /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = ""; }; - 9C2534181FAB151400BBFA5C /* motion_vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = motion_vector.h; sourceTree = ""; }; - 9C2534191FAB151400BBFA5C /* murmur3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = murmur3.h; sourceTree = ""; }; - 9C25341A1FAB151400BBFA5C /* opt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opt.h; sourceTree = ""; }; - 9C25341B1FAB151400BBFA5C /* parseutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parseutils.h; sourceTree = ""; }; - 9C25341C1FAB151400BBFA5C /* pixdesc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixdesc.h; sourceTree = ""; }; - 9C25341D1FAB151400BBFA5C /* pixelutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixelutils.h; sourceTree = ""; }; - 9C25341E1FAB151400BBFA5C /* pixfmt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixfmt.h; sourceTree = ""; }; - 9C25341F1FAB151400BBFA5C /* random_seed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = random_seed.h; sourceTree = ""; }; - 9C2534201FAB151400BBFA5C /* rational.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rational.h; sourceTree = ""; }; - 9C2534211FAB151400BBFA5C /* rc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rc4.h; sourceTree = ""; }; - 9C2534221FAB151400BBFA5C /* replaygain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = replaygain.h; sourceTree = ""; }; - 9C2534231FAB151500BBFA5C /* ripemd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ripemd.h; sourceTree = ""; }; - 9C2534241FAB151500BBFA5C /* samplefmt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = samplefmt.h; sourceTree = ""; }; - 9C2534251FAB151500BBFA5C /* sha.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha.h; sourceTree = ""; }; - 9C2534261FAB151500BBFA5C /* sha512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha512.h; sourceTree = ""; }; - 9C2534271FAB151500BBFA5C /* stereo3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stereo3d.h; sourceTree = ""; }; - 9C2534281FAB151500BBFA5C /* tea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tea.h; sourceTree = ""; }; - 9C2534291FAB151500BBFA5C /* threadmessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = threadmessage.h; sourceTree = ""; }; - 9C25342A1FAB151500BBFA5C /* time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = ""; }; - 9C25342B1FAB151500BBFA5C /* timecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timecode.h; sourceTree = ""; }; - 9C25342C1FAB151500BBFA5C /* timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timestamp.h; sourceTree = ""; }; - 9C25342D1FAB151500BBFA5C /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = ""; }; - 9C25342E1FAB151500BBFA5C /* twofish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = twofish.h; sourceTree = ""; }; - 9C25342F1FAB151500BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2534301FAB151500BBFA5C /* xtea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xtea.h; sourceTree = ""; }; - 9C2534321FAB151500BBFA5C /* swresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swresample.h; sourceTree = ""; }; - 9C2534331FAB151500BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2534351FAB151500BBFA5C /* swscale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swscale.h; sourceTree = ""; }; - 9C2534361FAB151500BBFA5C /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 9C2534531FAB151500BBFA5C /* SGFFAudioDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFAudioDecoder.h; sourceTree = ""; }; - 9C2534541FAB151500BBFA5C /* SGFFAudioDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFAudioDecoder.m; sourceTree = ""; }; - 9C2534551FAB151500BBFA5C /* SGFFAudioFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFAudioFrame.h; sourceTree = ""; }; - 9C2534561FAB151500BBFA5C /* SGFFAudioFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFAudioFrame.m; sourceTree = ""; }; - 9C2534571FAB151500BBFA5C /* SGFFDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFDecoder.h; sourceTree = ""; }; - 9C2534581FAB151500BBFA5C /* SGFFDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFDecoder.m; sourceTree = ""; }; - 9C2534591FAB151500BBFA5C /* SGFFFormatContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFFormatContext.h; sourceTree = ""; }; - 9C25345A1FAB151500BBFA5C /* SGFFFormatContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFFormatContext.m; sourceTree = ""; }; - 9C25345B1FAB151500BBFA5C /* SGFFFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFFrame.h; sourceTree = ""; }; - 9C25345C1FAB151500BBFA5C /* SGFFFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFFrame.m; sourceTree = ""; }; - 9C25345D1FAB151500BBFA5C /* SGFFFramePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFFramePool.h; sourceTree = ""; }; - 9C25345E1FAB151500BBFA5C /* SGFFFramePool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFFramePool.m; sourceTree = ""; }; - 9C25345F1FAB151500BBFA5C /* SGFFFrameQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFFrameQueue.h; sourceTree = ""; }; - 9C2534601FAB151500BBFA5C /* SGFFFrameQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFFrameQueue.m; sourceTree = ""; }; - 9C2534611FAB151500BBFA5C /* SGFFMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFMetadata.h; sourceTree = ""; }; - 9C2534621FAB151500BBFA5C /* SGFFMetadata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFMetadata.m; sourceTree = ""; }; - 9C2534631FAB151500BBFA5C /* SGFFPacketQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFPacketQueue.h; sourceTree = ""; }; - 9C2534641FAB151500BBFA5C /* SGFFPacketQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFPacketQueue.m; sourceTree = ""; }; - 9C2534651FAB151500BBFA5C /* SGFFTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFTools.h; sourceTree = ""; }; - 9C2534661FAB151500BBFA5C /* SGFFTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFTools.m; sourceTree = ""; }; - 9C2534671FAB151500BBFA5C /* SGFFTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFTrack.h; sourceTree = ""; }; - 9C2534681FAB151500BBFA5C /* SGFFTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFTrack.m; sourceTree = ""; }; - 9C2534691FAB151500BBFA5C /* SGFFVideoDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFVideoDecoder.h; sourceTree = ""; }; - 9C25346A1FAB151500BBFA5C /* SGFFVideoDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFVideoDecoder.m; sourceTree = ""; }; - 9C25346B1FAB151500BBFA5C /* SGFFVideoFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFVideoFrame.h; sourceTree = ""; }; - 9C25346C1FAB151500BBFA5C /* SGFFVideoFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFVideoFrame.m; sourceTree = ""; }; - 9C25346D1FAB151500BBFA5C /* SGFFVideoToolBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFVideoToolBox.h; sourceTree = ""; }; - 9C25346E1FAB151500BBFA5C /* SGFFVideoToolBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFVideoToolBox.m; sourceTree = ""; }; - 9C25364A1FAB196D00BBFA5C /* SGFFPlayerShell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFPlayerShell.h; sourceTree = ""; }; - 9C25364B1FAB196D00BBFA5C /* SGFFPlayerShell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFPlayerShell.m; sourceTree = ""; }; - 9C25364E1FAB199500BBFA5C /* SGFFPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFFPlayer.h; sourceTree = ""; }; - 9C25364F1FAB199500BBFA5C /* SGFFPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFFPlayer.m; sourceTree = ""; }; - 9C478EF71E713A3200AD4289 /* SGPlayerImp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerImp.h; sourceTree = ""; }; - 9C478EF81E713A3200AD4289 /* SGPlayerImp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayerImp.m; sourceTree = ""; }; - 9C478EF91E713A3200AD4289 /* SGPlayerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerAction.h; sourceTree = ""; }; - 9C478EFA1E713A3200AD4289 /* SGPlayerAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayerAction.m; sourceTree = ""; }; - 9C478EFB1E713A3200AD4289 /* SGPlayerDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerDecoder.h; sourceTree = ""; }; - 9C478EFC1E713A3200AD4289 /* SGPlayerDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayerDecoder.m; sourceTree = ""; }; - 9C478EFD1E713A3200AD4289 /* SGPlayerTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerTrack.h; sourceTree = ""; }; - 9C478EFE1E713A3200AD4289 /* SGPlayerTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayerTrack.m; sourceTree = ""; }; - 9C478F351E713AA800AD4289 /* SGPlayerMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerMacro.h; sourceTree = ""; }; - 9C478F361E713AA800AD4289 /* SGPlayerNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayerNotification.h; sourceTree = ""; }; - 9C478F371E713AA800AD4289 /* SGPlayerNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayerNotification.m; sourceTree = ""; }; - 9C478F391E713AA800AD4289 /* SGPlayer+DisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SGPlayer+DisplayView.h"; sourceTree = ""; }; - 9C478F3A1E713AA800AD4289 /* SGPlayer+DisplayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SGPlayer+DisplayView.m"; sourceTree = ""; }; - 9C478F3B1E713AA800AD4289 /* SGYUVTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGYUVTools.h; sourceTree = ""; }; - 9C478F3C1E713AA800AD4289 /* SGYUVTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGYUVTools.m; sourceTree = ""; }; - 9C478F531E713ABB00AD4289 /* SGFingerRotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGFingerRotation.h; sourceTree = ""; }; - 9C478F541E713ABB00AD4289 /* SGFingerRotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGFingerRotation.m; sourceTree = ""; }; - 9C478F551E713ABB00AD4289 /* SGMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMatrix.h; sourceTree = ""; }; - 9C478F561E713ABB00AD4289 /* SGMatrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMatrix.m; sourceTree = ""; }; - 9C478F631E713AC600AD4289 /* SGSensors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGSensors.h; sourceTree = ""; }; - 9C478F641E713AC600AD4289 /* SGSensors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGSensors.m; sourceTree = ""; }; - 9C4792BB1E713B4900AD4289 /* SGAVPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGAVPlayer.h; sourceTree = ""; }; - 9C4792BC1E713B4900AD4289 /* SGAVPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGAVPlayer.m; sourceTree = ""; }; - 9C4792BE1E713B4900AD4289 /* SGDisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGDisplayView.h; sourceTree = ""; }; - 9C4792BF1E713B4900AD4289 /* SGDisplayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGDisplayView.m; sourceTree = ""; }; - 9C4792C11E713B4900AD4289 /* SGGLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLModel.h; sourceTree = ""; }; - 9C4792C21E713B4900AD4289 /* SGGLModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLModel.m; sourceTree = ""; }; - 9C4792C31E713B4900AD4289 /* SGGLNormalModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLNormalModel.h; sourceTree = ""; }; - 9C4792C41E713B4900AD4289 /* SGGLNormalModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLNormalModel.m; sourceTree = ""; }; - 9C4792C51E713B4900AD4289 /* SGGLVRModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLVRModel.h; sourceTree = ""; }; - 9C4792C61E713B4900AD4289 /* SGGLVRModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLVRModel.m; sourceTree = ""; }; - 9C4792CC1E713B4900AD4289 /* SGGLProgram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLProgram.h; sourceTree = ""; }; - 9C4792CD1E713B4900AD4289 /* SGGLProgram.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLProgram.m; sourceTree = ""; }; - 9C4792D91E713B4900AD4289 /* SGDistortionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGDistortionModel.h; sourceTree = ""; }; - 9C4792DA1E713B4900AD4289 /* SGDistortionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGDistortionModel.m; sourceTree = ""; }; - 9C4792DB1E713B4900AD4289 /* SGDistortionRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGDistortionRenderer.h; sourceTree = ""; }; - 9C4792DC1E713B4900AD4289 /* SGDistortionRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGDistortionRenderer.m; sourceTree = ""; }; - 9C4793321E713B5400AD4289 /* SGAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGAudioManager.h; sourceTree = ""; }; - 9C4793331E713B5400AD4289 /* SGAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGAudioManager.m; sourceTree = ""; }; - 9C47933A1E713B5C00AD4289 /* SGMacAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMacAudioDevice.h; sourceTree = ""; }; - 9C47933B1E713B5C00AD4289 /* SGMacAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMacAudioDevice.m; sourceTree = ""; }; - 9C47933C1E713B5C00AD4289 /* SGMacAudioSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMacAudioSession.h; sourceTree = ""; }; - 9C47933D1E713B5C00AD4289 /* SGMacAudioSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMacAudioSession.m; sourceTree = ""; }; + 9C03E5EA212E616B001F0E1B /* SGMotionSensor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMotionSensor.h; sourceTree = ""; }; + 9C03E5EB212E616B001F0E1B /* SGMotionSensor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMotionSensor.m; sourceTree = ""; }; + 9C03E5EE212E645B001F0E1B /* SGVRProjection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVRProjection.h; sourceTree = ""; }; + 9C03E5EF212E645B001F0E1B /* SGVRProjection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVRProjection.m; sourceTree = ""; }; + 9C0A6F32219C33EA0027D5B1 /* SGTrackDemuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGTrackDemuxer.h; sourceTree = ""; }; + 9C0A6F33219C33EA0027D5B1 /* SGTrackDemuxer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGTrackDemuxer.m; sourceTree = ""; }; + 9C0A6F3A219C36300027D5B1 /* SGSegmentDemuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGSegmentDemuxer.h; sourceTree = ""; }; + 9C0A6F3B219C36300027D5B1 /* SGSegmentDemuxer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGSegmentDemuxer.m; sourceTree = ""; }; + 9C0B6CB1217D823500900F1E /* SGAsset+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SGAsset+Internal.h"; sourceTree = ""; }; + 9C0B6CB5217DBA1800900F1E /* SGDecodable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDecodable.h; sourceTree = ""; }; + 9C0DF027215A2FB9007142DB /* SGDemuxable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDemuxable.h; sourceTree = ""; }; + 9C11816322C4E23200A12FD4 /* SGMetalViewport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMetalViewport.h; sourceTree = ""; }; + 9C11816422C4E23200A12FD4 /* SGMetalViewport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMetalViewport.m; sourceTree = ""; }; + 9C1378A62302681C00FE0CFD /* SGVideoProcessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVideoProcessor.h; sourceTree = ""; }; + 9C1378A72302681C00FE0CFD /* SGVideoProcessor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVideoProcessor.m; sourceTree = ""; }; + 9C1378AE23026B3A00FE0CFD /* SGTrackSelection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGTrackSelection.h; sourceTree = ""; }; + 9C1378AF23026B3A00FE0CFD /* SGTrackSelection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGTrackSelection.m; sourceTree = ""; }; + 9C1378B623026C6700FE0CFD /* SGProcessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGProcessor.h; sourceTree = ""; }; + 9C1378BA23029F2E00FE0CFD /* SGProcessorOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGProcessorOptions.h; sourceTree = ""; }; + 9C1378BB23029F2E00FE0CFD /* SGProcessorOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGProcessorOptions.m; sourceTree = ""; }; + 9C17554722C5B5B3003A93BC /* SGRenderTimer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGRenderTimer.h; sourceTree = ""; }; + 9C17554822C5B5B3003A93BC /* SGRenderTimer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGRenderTimer.m; sourceTree = ""; }; + 9C1D2228201B1DA2005147FB /* SGMapping.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMapping.h; sourceTree = ""; }; + 9C1D2229201B1DA2005147FB /* SGMapping.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMapping.m; sourceTree = ""; }; + 9C1F2DE521AF8F1A00D42158 /* SGAudioMixer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioMixer.h; sourceTree = ""; }; + 9C1F2DE621AF8F1A00D42158 /* SGAudioMixer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioMixer.m; sourceTree = ""; }; + 9C25364E1FAB199500BBFA5C /* SGPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayer.h; sourceTree = ""; }; + 9C25364F1FAB199500BBFA5C /* SGPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayer.m; sourceTree = ""; }; + 9C262A3122B344D3006C8542 /* SGDemuxerOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDemuxerOptions.h; sourceTree = ""; }; + 9C262A3222B344D3006C8542 /* SGDemuxerOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGDemuxerOptions.m; sourceTree = ""; }; + 9C262A3922B3450F006C8542 /* SGDecoderOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDecoderOptions.h; sourceTree = ""; }; + 9C262A3A22B3450F006C8542 /* SGDecoderOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGDecoderOptions.m; sourceTree = ""; }; + 9C262A4122B359CC006C8542 /* SGRendererOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGRendererOptions.h; sourceTree = ""; }; + 9C262A4222B359CC006C8542 /* SGRendererOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGRendererOptions.m; sourceTree = ""; }; + 9C26CF56218D787D009FFCC4 /* SGClock+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SGClock+Internal.h"; sourceTree = ""; }; + 9C29D110217D741500343975 /* SGFrameOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGFrameOutput.h; sourceTree = ""; }; + 9C29D111217D741500343975 /* SGFrameOutput.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGFrameOutput.m; sourceTree = ""; }; + 9C2C55912015911600131E15 /* SGObjectPool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGObjectPool.h; sourceTree = ""; }; + 9C2C55922015911600131E15 /* SGObjectPool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGObjectPool.m; sourceTree = ""; }; + 9C2C55992015B87400131E15 /* SGVideoFrame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVideoFrame.h; sourceTree = ""; }; + 9C2C559A2015B87400131E15 /* SGVideoFrame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVideoFrame.m; sourceTree = ""; }; + 9C2C55A12015C1E100131E15 /* SGVideoRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVideoRenderer.h; sourceTree = ""; }; + 9C2C55A22015C1E100131E15 /* SGVideoRenderer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVideoRenderer.m; sourceTree = ""; }; + 9C2C55AB2015D1D200131E15 /* SGPacket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPacket.h; sourceTree = ""; }; + 9C2C55AC2015D1D200131E15 /* SGPacket.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGPacket.m; sourceTree = ""; }; + 9C2C55B32015D92100131E15 /* SGObjectQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGObjectQueue.h; sourceTree = ""; }; + 9C2C55B42015D92100131E15 /* SGObjectQueue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGObjectQueue.m; sourceTree = ""; }; + 9C3082C1212518EB00B44298 /* SGVideoDecoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVideoDecoder.h; sourceTree = ""; }; + 9C3082C2212518EC00B44298 /* SGVideoDecoder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVideoDecoder.m; sourceTree = ""; }; + 9C3082C521251AC200B44298 /* SGCodecContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGCodecContext.h; sourceTree = ""; }; + 9C3082C621251AC200B44298 /* SGCodecContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGCodecContext.m; sourceTree = ""; }; + 9C3082CE212521AB00B44298 /* SGAudioDecoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioDecoder.h; sourceTree = ""; }; + 9C3082CF212521AB00B44298 /* SGAudioDecoder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioDecoder.m; sourceTree = ""; }; + 9C329AA82005E3F800252B10 /* SGActivity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGActivity.h; sourceTree = ""; }; + 9C329AA92005E3F800252B10 /* SGActivity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGActivity.m; sourceTree = ""; }; + 9C3748792135521D00572166 /* SGSWScale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGSWScale.h; sourceTree = ""; }; + 9C37487A2135521D00572166 /* SGSWScale.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGSWScale.m; sourceTree = ""; }; + 9C389ACB20108C2E003259FF /* SGFrame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGFrame.h; sourceTree = ""; }; + 9C3A685921CB76B10031DDE1 /* sonic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sonic.h; sourceTree = ""; }; + 9C3A685A21CB76B10031DDE1 /* sonic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sonic.c; sourceTree = ""; }; + 9C3A686121CB77010031DDE1 /* SGSonic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGSonic.h; sourceTree = ""; }; + 9C3A686221CB77010031DDE1 /* SGSonic.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGSonic.m; sourceTree = ""; }; + 9C4190F321AFF17700134099 /* SGAudioMixerUnit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioMixerUnit.h; sourceTree = ""; }; + 9C4190F421AFF17700134099 /* SGAudioMixerUnit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioMixerUnit.m; sourceTree = ""; }; + 9C4190FB21B00FC600134099 /* SGMutableTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMutableTrack.h; sourceTree = ""; }; + 9C4190FC21B00FC600134099 /* SGMutableTrack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMutableTrack.m; sourceTree = ""; }; + 9C43D50B2187037200235169 /* SGOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGOptions.h; sourceTree = ""; }; + 9C43D50C2187037200235169 /* SGOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGOptions.m; sourceTree = ""; }; + 9C43D50F21872D3F00235169 /* SGLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGLock.h; sourceTree = ""; }; + 9C43D51021872D3F00235169 /* SGLock.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGLock.m; sourceTree = ""; }; + 9C4663C820D0F83600CADDA7 /* SGTime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGTime.h; sourceTree = ""; }; + 9C4663C920D0F83600CADDA7 /* SGTime.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGTime.m; sourceTree = ""; }; 9C4793431E71402E00AD4289 /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS/libavcodec.a"; sourceTree = ""; }; 9C4793441E71402E00AD4289 /* libavdevice.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavdevice.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS/libavdevice.a"; sourceTree = ""; }; 9C4793451E71402E00AD4289 /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS/libavfilter.a"; sourceTree = ""; }; @@ -852,1045 +684,1268 @@ 9C47936D1E71404A00AD4289 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS/libssl.a"; sourceTree = ""; }; 9C47936E1E71404A00AD4289 /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS/libswresample.a"; sourceTree = ""; }; 9C47936F1E71404A00AD4289 /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS/libswscale.a"; sourceTree = ""; }; - 9C5AB68C1E88B2AD0021F460 /* SGGLViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLViewController.h; sourceTree = ""; }; - 9C5AB68D1E88B2AD0021F460 /* SGGLViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLViewController.m; sourceTree = ""; }; - 9C5AB6D81E88E7980021F460 /* SGGLTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLTexture.h; sourceTree = ""; }; - 9C5AB6D91E88E7980021F460 /* SGGLTexture.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLTexture.m; sourceTree = ""; }; - 9C5AB6E01E88E8F20021F460 /* SGGLTextureNV12.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLTextureNV12.h; sourceTree = ""; }; - 9C5AB6E11E88E8F20021F460 /* SGGLTextureNV12.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLTextureNV12.m; sourceTree = ""; }; - 9C5AB6E81E88E90B0021F460 /* SGGLTextureYUV420.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLTextureYUV420.h; sourceTree = ""; }; - 9C5AB6E91E88E90B0021F460 /* SGGLTextureYUV420.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLTextureYUV420.m; sourceTree = ""; }; - 9C5AB6F01E88EB720021F460 /* SGGLFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLFrame.h; sourceTree = ""; }; - 9C5AB6F11E88EB720021F460 /* SGGLFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLFrame.m; sourceTree = ""; }; - 9C5AB6F81E88F0400021F460 /* SGGLProgramNV12.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLProgramNV12.h; sourceTree = ""; }; - 9C5AB6F91E88F0400021F460 /* SGGLProgramNV12.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLProgramNV12.m; sourceTree = ""; }; - 9C5AB7001E88F0560021F460 /* SGGLProgramYUV420.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGGLProgramYUV420.h; sourceTree = ""; }; - 9C5AB7011E88F0560021F460 /* SGGLProgramYUV420.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGGLProgramYUV420.m; sourceTree = ""; }; - 9C9823C91FAAFFEB00142215 /* SGPlayerBuildConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPlayerBuildConfig.h; sourceTree = ""; }; + 9C525D4F21AEC421005C5708 /* SGAudioDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioDescriptor.h; sourceTree = ""; }; + 9C525D5021AEC421005C5708 /* SGAudioDescriptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioDescriptor.m; sourceTree = ""; }; + 9C55337021B25EC000119235 /* SGData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGData.h; sourceTree = ""; }; + 9C5C7BD4230AAC1200C75E3A /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = build/build/universal/lib/libswscale.a; sourceTree = ""; }; + 9C5C7BD5230AAC1200C75E3A /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = build/build/universal/lib/libavcodec.a; sourceTree = ""; }; + 9C5C7BD6230AAC1200C75E3A /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = build/build/universal/lib/libavfilter.a; sourceTree = ""; }; + 9C5C7BD7230AAC1200C75E3A /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = build/build/universal/lib/libcrypto.a; sourceTree = ""; }; + 9C5C7BD8230AAC1200C75E3A /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = build/build/universal/lib/libswresample.a; sourceTree = ""; }; + 9C5C7BD9230AAC1200C75E3A /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = build/build/universal/lib/libavutil.a; sourceTree = ""; }; + 9C5C7BDA230AAC1200C75E3A /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = build/build/universal/lib/libavformat.a; sourceTree = ""; }; + 9C5C7BDB230AAC1200C75E3A /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = build/build/universal/lib/libssl.a; sourceTree = ""; }; + 9C5C98F920D26BE10089C112 /* SGClock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGClock.h; sourceTree = ""; }; + 9C5C98FA20D26BE10089C112 /* SGClock.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGClock.m; sourceTree = ""; }; + 9C65F5B022C5EC2B00AE27DE /* SGMetalProjection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMetalProjection.h; sourceTree = ""; }; + 9C65F5B122C5EC2B00AE27DE /* SGMetalProjection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMetalProjection.m; sourceTree = ""; }; + 9C661C5A2304074900908563 /* SGPlayerHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPlayerHeader.h; sourceTree = ""; }; + 9C66E1F82188526200B70DAA /* SGAudioFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioFormatter.h; sourceTree = ""; }; + 9C66E1F92188526200B70DAA /* SGAudioFormatter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioFormatter.m; sourceTree = ""; }; + 9C66E1FC2188550D00B70DAA /* SGSWResample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGSWResample.h; sourceTree = ""; }; + 9C66E1FD2188550D00B70DAA /* SGSWResample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGSWResample.m; sourceTree = ""; }; + 9C6F9027219BE154001051CE /* SGMutableAsset.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMutableAsset.h; sourceTree = ""; }; + 9C6F9028219BE154001051CE /* SGMutableAsset.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMutableAsset.m; sourceTree = ""; }; + 9C82EEAF21AE356D00E9D523 /* SGAudioProcessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioProcessor.h; sourceTree = ""; }; + 9C82EEB021AE356D00E9D523 /* SGAudioProcessor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioProcessor.m; sourceTree = ""; }; + 9C853F1021BFD85D005552C6 /* SGVideoDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVideoDescriptor.h; sourceTree = ""; }; + 9C853F1121BFD85D005552C6 /* SGVideoDescriptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVideoDescriptor.m; sourceTree = ""; }; + 9C8636512190408300D730EC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libavformat.a"; sourceTree = ""; }; + 9C8636522190408300D730EC /* libavdevice.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavdevice.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libavdevice.a"; sourceTree = ""; }; + 9C8636532190408300D730EC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libswscale.a"; sourceTree = ""; }; + 9C8636542190408300D730EC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libssl.a"; sourceTree = ""; }; + 9C8636552190408300D730EC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libavutil.a"; sourceTree = ""; }; + 9C8636562190408300D730EC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libswresample.a"; sourceTree = ""; }; + 9C8636572190408300D730EC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libcrypto.a"; sourceTree = ""; }; + 9C8636582190408300D730EC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libavfilter.a"; sourceTree = ""; }; + 9C8636592190408300D730EC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-iOS/libavcodec.a"; sourceTree = ""; }; + 9C8637D22190476600D730EC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libswresample.a"; sourceTree = ""; }; + 9C8637D32190476600D730EC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libssl.a"; sourceTree = ""; }; + 9C8637D42190476600D730EC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libcrypto.a"; sourceTree = ""; }; + 9C8637D52190476600D730EC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libavutil.a"; sourceTree = ""; }; + 9C8637D62190476600D730EC /* libavdevice.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavdevice.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libavdevice.a"; sourceTree = ""; }; + 9C8637D72190476600D730EC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libavcodec.a"; sourceTree = ""; }; + 9C8637D82190476600D730EC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libavfilter.a"; sourceTree = ""; }; + 9C8637D92190476600D730EC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libavformat.a"; sourceTree = ""; }; + 9C8637DA2190476600D730EC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-tvOS/libswscale.a"; sourceTree = ""; }; + 9C8638A521904A0900D730EC /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C8638A721904AF700D730EC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libssl.a"; sourceTree = ""; }; + 9C8638A821904AF700D730EC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libavformat.a"; sourceTree = ""; }; + 9C8638A921904AF700D730EC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libcrypto.a"; sourceTree = ""; }; + 9C8638AA21904AF700D730EC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libavutil.a"; sourceTree = ""; }; + 9C8638AB21904AF700D730EC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libswresample.a"; sourceTree = ""; }; + 9C8638AC21904AF700D730EC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libavcodec.a"; sourceTree = ""; }; + 9C8638AD21904AF700D730EC /* libavdevice.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavdevice.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libavdevice.a"; sourceTree = ""; }; + 9C8638AE21904AF700D730EC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libswscale.a"; sourceTree = ""; }; + 9C8638AF21904AF700D730EC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = "SGPlayer/Classes/Core/SGFFmpeg/lib-macOS/libavfilter.a"; sourceTree = ""; }; + 9C8D4E46200DFFC700ED8A58 /* SGPlayerItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPlayerItem.h; sourceTree = ""; }; + 9C8D4E47200DFFC700ED8A58 /* SGPlayerItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGPlayerItem.m; sourceTree = ""; }; + 9C8D4E61200E0ACC00ED8A58 /* SGPacketOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPacketOutput.h; sourceTree = ""; }; + 9C8D4E62200E0ACC00ED8A58 /* SGPacketOutput.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGPacketOutput.m; sourceTree = ""; }; + 9C8D4E7E200E1ACA00ED8A58 /* SGError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGError.h; sourceTree = ""; }; + 9C8D4E7F200E1ACA00ED8A58 /* SGError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGError.m; sourceTree = ""; }; + 9C8D6B3022C4A19400985D55 /* SGMetalSphereModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalSphereModel.m; sourceTree = ""; }; + 9C8D6B3122C4A19400985D55 /* SGMetal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetal.h; sourceTree = ""; }; + 9C8D6B3222C4A19400985D55 /* SGMetalRenderPipelinePool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalRenderPipelinePool.m; sourceTree = ""; }; + 9C8D6B3322C4A19400985D55 /* SGMetalTextureLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalTextureLoader.m; sourceTree = ""; }; + 9C8D6B3422C4A19400985D55 /* SGMetalModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalModel.m; sourceTree = ""; }; + 9C8D6B3522C4A19400985D55 /* SGMetalNV12RenderPipeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalNV12RenderPipeline.m; sourceTree = ""; }; + 9C8D6B3622C4A19400985D55 /* SGMetalTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalTypes.h; sourceTree = ""; }; + 9C8D6B3722C4A19400985D55 /* SGMetalYUVRenderPipeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalYUVRenderPipeline.m; sourceTree = ""; }; + 9C8D6B3822C4A19400985D55 /* SGMetalRenderPipeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalRenderPipeline.m; sourceTree = ""; }; + 9C8D6B3922C4A19400985D55 /* SGMetalPlaneModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalPlaneModel.m; sourceTree = ""; }; + 9C8D6B3B22C4A19500985D55 /* SGMetalBGRARenderPipeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalBGRARenderPipeline.m; sourceTree = ""; }; + 9C8D6B3D22C4A19500985D55 /* SGMetalRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalRenderer.h; sourceTree = ""; }; + 9C8D6B3E22C4A19500985D55 /* SGMetalSphereModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalSphereModel.h; sourceTree = ""; }; + 9C8D6B3F22C4A19500985D55 /* SGMetalNV12RenderPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalNV12RenderPipeline.h; sourceTree = ""; }; + 9C8D6B4022C4A19500985D55 /* SGMetalModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalModel.h; sourceTree = ""; }; + 9C8D6B4122C4A19500985D55 /* SGMetalRenderPipelinePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalRenderPipelinePool.h; sourceTree = ""; }; + 9C8D6B4222C4A19500985D55 /* SGMetalTextureLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalTextureLoader.h; sourceTree = ""; }; + 9C8D6B4322C4A19500985D55 /* SGMetalPlaneModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalPlaneModel.h; sourceTree = ""; }; + 9C8D6B4422C4A19500985D55 /* SGMetalYUVRenderPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalYUVRenderPipeline.h; sourceTree = ""; }; + 9C8D6B4522C4A19500985D55 /* SGMetalRenderPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalRenderPipeline.h; sourceTree = ""; }; + 9C8D6B4622C4A19500985D55 /* SGMetalRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGMetalRenderer.m; sourceTree = ""; }; + 9C8D6B4822C4A19500985D55 /* SGMetalShader.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = SGMetalShader.metal; sourceTree = ""; }; + 9C8D6B4922C4A19500985D55 /* SGMetalBGRARenderPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMetalBGRARenderPipeline.h; sourceTree = ""; }; + 9C935B9B21CCCA58007813F4 /* SGDescriptor+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SGDescriptor+Internal.h"; sourceTree = ""; }; + 9C95D2BB2152335400079B38 /* SGURLDemuxer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGURLDemuxer.m; sourceTree = ""; }; + 9C95D2BC2152335400079B38 /* SGURLDemuxer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGURLDemuxer.h; sourceTree = ""; }; + 9C95D2BF2152386C00079B38 /* SGURLAsset.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGURLAsset.h; sourceTree = ""; }; + 9C95D2C02152386C00079B38 /* SGURLAsset.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGURLAsset.m; sourceTree = ""; }; + 9CA0F56220E0E24000501478 /* SGDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDefines.h; sourceTree = ""; }; + 9CA3CDB320E1F74300B852D0 /* SGFrame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGFrame.m; sourceTree = ""; }; + 9CA57920219D69580061093B /* SGTimeLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGTimeLayout.h; sourceTree = ""; }; + 9CA57921219D69580061093B /* SGTimeLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGTimeLayout.m; sourceTree = ""; }; + 9CA57930219DAA270061093B /* SGCodecDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGCodecDescriptor.h; sourceTree = ""; }; + 9CA57931219DAA270061093B /* SGCodecDescriptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGCodecDescriptor.m; sourceTree = ""; }; + 9CAAC99D2133A6800065E364 /* SGVRViewport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGVRViewport.h; sourceTree = ""; }; + 9CAAC99E2133A6800065E364 /* SGVRViewport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGVRViewport.m; sourceTree = ""; }; + 9CB01C91219E863D00B36CFA /* SGMutilDemuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGMutilDemuxer.h; sourceTree = ""; }; + 9CB01C92219E863D00B36CFA /* SGMutilDemuxer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGMutilDemuxer.m; sourceTree = ""; }; + 9CB61F5D2112B93C00F5BE6B /* SGFFmpeg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGFFmpeg.h; sourceTree = ""; }; + 9CB61F5E2112B93C00F5BE6B /* SGFFmpeg.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGFFmpeg.m; sourceTree = ""; }; + 9CC2AD7422A65C7B0095A081 /* SGPaddingDemuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPaddingDemuxer.h; sourceTree = ""; }; + 9CC2AD7522A65C7B0095A081 /* SGPaddingDemuxer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGPaddingDemuxer.m; sourceTree = ""; }; + 9CC2AD7C22A660080095A081 /* SGPaddingSegment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPaddingSegment.h; sourceTree = ""; }; + 9CC2AD7D22A660080095A081 /* SGPaddingSegment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGPaddingSegment.m; sourceTree = ""; }; + 9CC649F921818D8C00453B3E /* SGPlayerItem+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SGPlayerItem+Internal.h"; sourceTree = ""; }; + 9CC649FD2181A8C000453B3E /* SGCapacity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGCapacity.h; sourceTree = ""; }; + 9CC649FE2181A8C000453B3E /* SGCapacity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGCapacity.m; sourceTree = ""; }; + 9CCC5F0D200C9B7000E833DA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 9CCC5F0F200C9B7700E833DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 9CCC5F11200C9B7B00E833DA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; + 9CCC5F13200C9B8200E833DA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 9CCC5F15200C9B8600E833DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 9CCC5F17200C9B8A00E833DA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 9CCC5F19200C9B9400E833DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 9CCC5F1B200C9B9800E833DA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; + 9CCC5F1D200C9BA200E833DA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 9CD79FA62190068E00E39A7D /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CDFC3E4218B10F00065C826 /* SGRenderer+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SGRenderer+Internal.h"; sourceTree = ""; }; + 9CE6842E200DD12F007BD834 /* SGAudioPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioPlayer.h; sourceTree = ""; }; + 9CE6842F200DD12F007BD834 /* SGAudioPlayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioPlayer.m; sourceTree = ""; }; + 9CE6F51A2004D97C00D1F4C8 /* SGPLFColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFColor.h; sourceTree = ""; }; + 9CE6F51B2004D97C00D1F4C8 /* SGPLFColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPLFColor.m; sourceTree = ""; }; + 9CE6F51E2004D97C00D1F4C8 /* SGPLFImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFImage.h; sourceTree = ""; }; + 9CE6F51F2004D97C00D1F4C8 /* SGPLFImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPLFImage.m; sourceTree = ""; }; + 9CE6F5202004D97C00D1F4C8 /* SGPLFObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFObject.h; sourceTree = ""; }; + 9CE6F5212004D97C00D1F4C8 /* SGPLFScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFScreen.h; sourceTree = ""; }; + 9CE6F5222004D97C00D1F4C8 /* SGPLFScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPLFScreen.m; sourceTree = ""; }; + 9CE6F5232004D97C00D1F4C8 /* SGPLFView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFView.h; sourceTree = ""; }; + 9CE6F5242004D97C00D1F4C8 /* SGPLFView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPLFView.m; sourceTree = ""; }; + 9CE6F52D2004D97C00D1F4C8 /* SGPLFTargets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPLFTargets.h; sourceTree = ""; }; + 9CE6F5A12004E7ED00D1F4C8 /* SGMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGMacro.h; sourceTree = ""; }; + 9CE71913219C3F7900256485 /* SGURLSegment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGURLSegment.h; sourceTree = ""; }; + 9CE71914219C3F7900256485 /* SGURLSegment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGURLSegment.m; sourceTree = ""; }; + 9CE7191B219C408300256485 /* SGSegment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGSegment.h; sourceTree = ""; }; + 9CE7191C219C408300256485 /* SGSegment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGSegment.m; sourceTree = ""; }; + 9CE71923219C47FF00256485 /* SGSegment+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SGSegment+Internal.h"; sourceTree = ""; }; + 9CE71927219C48AC00256485 /* SGDemuxerFunnel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDemuxerFunnel.h; sourceTree = ""; }; + 9CE71928219C48AC00256485 /* SGDemuxerFunnel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGDemuxerFunnel.m; sourceTree = ""; }; + 9CEBCC9B217EF8E900430024 /* SGTrack+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SGTrack+Internal.h"; sourceTree = ""; }; + 9CEBCCA0217F109000430024 /* SGPacket+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SGPacket+Internal.h"; sourceTree = ""; }; + 9CEBCCA6217F19BE00430024 /* SGFrame+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SGFrame+Internal.h"; sourceTree = ""; }; 9CEFA6D61E7122BF00835CAB /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9CEFA6D91E7122BF00835CAB /* SGPlayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGPlayer.h; sourceTree = ""; }; 9CEFA6DA1E7122BF00835CAB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9CEFA6EA1E7125C800835CAB /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9CEFA6F51E7125CC00835CAB /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CF15DE320118E1100585326 /* SGDecodeLoop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGDecodeLoop.h; sourceTree = ""; }; + 9CF15DE420118E1100585326 /* SGDecodeLoop.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGDecodeLoop.m; sourceTree = ""; }; + 9CF15E012011ADB500585326 /* SGRenderable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGRenderable.h; sourceTree = ""; }; + 9CF15E052011AE0700585326 /* SGAudioRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioRenderer.h; sourceTree = ""; }; + 9CF15E062011AE0700585326 /* SGAudioRenderer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioRenderer.m; sourceTree = ""; }; + 9CF15E1D2011BC5400585326 /* SGAudioFrame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAudioFrame.h; sourceTree = ""; }; + 9CF15E1E2011BC5400585326 /* SGAudioFrame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAudioFrame.m; sourceTree = ""; }; + 9CF52CF5200F45D700950B81 /* SGTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGTrack.h; sourceTree = ""; }; + 9CF52CF6200F45D700950B81 /* SGTrack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGTrack.m; sourceTree = ""; }; + 9CF63FC0211D8E33001B2684 /* SGAsset.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGAsset.h; sourceTree = ""; }; + 9CF63FC1211D8E33001B2684 /* SGAsset.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGAsset.m; sourceTree = ""; }; + 9CF9A01C212D1D34008178BC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libssl.a"; sourceTree = ""; }; + 9CF9A01D212D1D34008178BC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libavformat.a"; sourceTree = ""; }; + 9CF9A01E212D1D34008178BC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libswscale.a"; sourceTree = ""; }; + 9CF9A01F212D1D34008178BC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libavutil.a"; sourceTree = ""; }; + 9CF9A020212D1D34008178BC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libavcodec.a"; sourceTree = ""; }; + 9CF9A021212D1D34008178BC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libswresample.a"; sourceTree = ""; }; + 9CF9A022212D1D35008178BC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libavfilter.a"; sourceTree = ""; }; + 9CF9A023212D1D35008178BC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "SGPlayer/Classes/Core/SGFFmpeg/FFmpeg-4.0.2-lib-iOS/libcrypto.a"; sourceTree = ""; }; + 9CFA2313230BCCE900061AAC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = build/build/iOS/universal/lib/libavformat.a; sourceTree = ""; }; + 9CFA2314230BCCEA00061AAC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = build/build/iOS/universal/lib/libavcodec.a; sourceTree = ""; }; + 9CFA2315230BCCEA00061AAC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = build/build/iOS/universal/lib/libcrypto.a; sourceTree = ""; }; + 9CFA2316230BCCEA00061AAC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = build/build/iOS/universal/lib/libavutil.a; sourceTree = ""; }; + 9CFA2317230BCCEA00061AAC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = build/build/iOS/universal/lib/libssl.a; sourceTree = ""; }; + 9CFA2318230BCCEA00061AAC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = build/build/iOS/universal/lib/libavfilter.a; sourceTree = ""; }; + 9CFA2319230BCCEA00061AAC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = build/build/iOS/universal/lib/libswresample.a; sourceTree = ""; }; + 9CFA231A230BCCEA00061AAC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = build/build/iOS/universal/lib/libswscale.a; sourceTree = ""; }; + 9CFA2323230BCD4300061AAC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = build/build/macOS/universal/lib/libavutil.a; sourceTree = ""; }; + 9CFA2324230BCD4300061AAC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = build/build/macOS/universal/lib/libcrypto.a; sourceTree = ""; }; + 9CFA2325230BCD4400061AAC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = build/build/macOS/universal/lib/libavformat.a; sourceTree = ""; }; + 9CFA2326230BCD4400061AAC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = build/build/macOS/universal/lib/libssl.a; sourceTree = ""; }; + 9CFA2327230BCD4400061AAC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = build/build/macOS/universal/lib/libswresample.a; sourceTree = ""; }; + 9CFA2328230BCD4400061AAC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = build/build/macOS/universal/lib/libavcodec.a; sourceTree = ""; }; + 9CFA2329230BCD4400061AAC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = build/build/macOS/universal/lib/libswscale.a; sourceTree = ""; }; + 9CFA232A230BCD4400061AAC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = build/build/macOS/universal/lib/libavfilter.a; sourceTree = ""; }; + 9CFA233B230BCE5100061AAC /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = build/build/tvOS/universal/lib/libavutil.a; sourceTree = ""; }; + 9CFA233C230BCE5100061AAC /* libswscale.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswscale.a; path = build/build/tvOS/universal/lib/libswscale.a; sourceTree = ""; }; + 9CFA233D230BCE5100061AAC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = build/build/tvOS/universal/lib/libssl.a; sourceTree = ""; }; + 9CFA233E230BCE5100061AAC /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = build/build/tvOS/universal/lib/libavformat.a; sourceTree = ""; }; + 9CFA233F230BCE5100061AAC /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = build/build/tvOS/universal/lib/libavfilter.a; sourceTree = ""; }; + 9CFA2340230BCE5100061AAC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = build/build/tvOS/universal/lib/libcrypto.a; sourceTree = ""; }; + 9CFA2341230BCE5100061AAC /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = build/build/tvOS/universal/lib/libavcodec.a; sourceTree = ""; }; + 9CFA2342230BCE5100061AAC /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = build/build/tvOS/universal/lib/libswresample.a; sourceTree = ""; }; + 9CFA234D230BCFFC00061AAC /* imgutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgutils.h; sourceTree = ""; }; + 9CFA234F230BCFFC00061AAC /* avformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avformat.h; sourceTree = ""; }; + 9CFA2351230BCFFC00061AAC /* swscale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swscale.h; sourceTree = ""; }; + 9CFA2353230BCFFC00061AAC /* swresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swresample.h; sourceTree = ""; }; + 9CFA235A230BD00400061AAC /* imgutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgutils.h; sourceTree = ""; }; + 9CFA235C230BD00400061AAC /* avformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avformat.h; sourceTree = ""; }; + 9CFA235E230BD00400061AAC /* swscale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swscale.h; sourceTree = ""; }; + 9CFA2360230BD00400061AAC /* swresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swresample.h; sourceTree = ""; }; + 9CFA2367230BD00C00061AAC /* imgutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgutils.h; sourceTree = ""; }; + 9CFA2369230BD00C00061AAC /* avformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avformat.h; sourceTree = ""; }; + 9CFA236B230BD00C00061AAC /* swscale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swscale.h; sourceTree = ""; }; + 9CFA236D230BD00C00061AAC /* swresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = swresample.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 9CEFA6D21E7122BF00835CAB /* Frameworks */ = { + 9C86383321904A0900D730EC /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9C816A281E8755E4007ED41B /* SGPlatform.framework in Frameworks */, - 9C41E71D1E97569F006E5A65 /* libavcodec.a in Frameworks */, - 9C41E71E1E97569F006E5A65 /* libavfilter.a in Frameworks */, - 9C41E71F1E97569F006E5A65 /* libavformat.a in Frameworks */, - 9C41E7201E97569F006E5A65 /* libavutil.a in Frameworks */, - 9C41E7211E97569F006E5A65 /* libcrypto.a in Frameworks */, - 9C41E7221E97569F006E5A65 /* libssl.a in Frameworks */, - 9C41E7231E97569F006E5A65 /* libswresample.a in Frameworks */, - 9C41E7241E97569F006E5A65 /* libswscale.a in Frameworks */, + 9CFA232B230BCD4400061AAC /* libavutil.a in Frameworks */, + 9CFA232C230BCD4400061AAC /* libcrypto.a in Frameworks */, + 9CFA232D230BCD4400061AAC /* libavformat.a in Frameworks */, + 9CFA232E230BCD4400061AAC /* libssl.a in Frameworks */, + 9CFA232F230BCD4400061AAC /* libswresample.a in Frameworks */, + 9CFA2330230BCD4400061AAC /* libavcodec.a in Frameworks */, + 9CFA2331230BCD4400061AAC /* libswscale.a in Frameworks */, + 9CFA2332230BCD4400061AAC /* libavfilter.a in Frameworks */, + 9C86383421904A0900D730EC /* UIKit.framework in Frameworks */, + 9C86383521904A0900D730EC /* AVFoundation.framework in Frameworks */, + 9C86383621904A0900D730EC /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6E31E7125C800835CAB /* Frameworks */ = { + 9CD79EDA2190068E00E39A7D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9CA86E7F1E8756BF00E4A8B1 /* SGPlatform.framework in Frameworks */, - 9C41E7251E9756A6006E5A65 /* libavcodec.a in Frameworks */, - 9C41E7261E9756A6006E5A65 /* libavfilter.a in Frameworks */, - 9C41E7271E9756A6006E5A65 /* libavformat.a in Frameworks */, - 9C41E7281E9756A6006E5A65 /* libavutil.a in Frameworks */, - 9C41E7291E9756A6006E5A65 /* libcrypto.a in Frameworks */, - 9C41E72A1E9756A6006E5A65 /* libssl.a in Frameworks */, - 9C41E72B1E9756A6006E5A65 /* libswresample.a in Frameworks */, - 9C41E72C1E9756A6006E5A65 /* libswscale.a in Frameworks */, + 9CFA2343230BCE5100061AAC /* libavutil.a in Frameworks */, + 9CFA2344230BCE5100061AAC /* libswscale.a in Frameworks */, + 9CFA2345230BCE5100061AAC /* libssl.a in Frameworks */, + 9CFA2346230BCE5100061AAC /* libavformat.a in Frameworks */, + 9CFA2347230BCE5100061AAC /* libavfilter.a in Frameworks */, + 9CFA2348230BCE5100061AAC /* libcrypto.a in Frameworks */, + 9CFA2349230BCE5100061AAC /* libavcodec.a in Frameworks */, + 9CFA234A230BCE5100061AAC /* libswresample.a in Frameworks */, + 9CD79EDB2190068E00E39A7D /* UIKit.framework in Frameworks */, + 9CD79EDC2190068E00E39A7D /* AVFoundation.framework in Frameworks */, + 9CD79EDD2190068E00E39A7D /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6EE1E7125CC00835CAB /* Frameworks */ = { + 9CEFA6D21E7122BF00835CAB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9CA86E801E8756C700E4A8B1 /* SGPlatform.framework in Frameworks */, - 9C41E72D1E9756B0006E5A65 /* libavcodec.a in Frameworks */, - 9C41E72E1E9756B0006E5A65 /* libavfilter.a in Frameworks */, - 9C41E72F1E9756B0006E5A65 /* libavformat.a in Frameworks */, - 9C41E7301E9756B0006E5A65 /* libavutil.a in Frameworks */, - 9C41E7311E9756B0006E5A65 /* libcrypto.a in Frameworks */, - 9C41E7321E9756B0006E5A65 /* libssl.a in Frameworks */, - 9C41E7331E9756B0006E5A65 /* libswresample.a in Frameworks */, - 9C41E7341E9756B0006E5A65 /* libswscale.a in Frameworks */, + 9CFA2333230BCE3200061AAC /* libavcodec.a in Frameworks */, + 9CFA2334230BCE3200061AAC /* libavfilter.a in Frameworks */, + 9CFA2335230BCE3200061AAC /* libavformat.a in Frameworks */, + 9CFA2336230BCE3200061AAC /* libavutil.a in Frameworks */, + 9CFA2337230BCE3200061AAC /* libcrypto.a in Frameworks */, + 9CFA2338230BCE3200061AAC /* libssl.a in Frameworks */, + 9CFA2339230BCE3200061AAC /* libswresample.a in Frameworks */, + 9CFA233A230BCE3200061AAC /* libswscale.a in Frameworks */, + 9CCC5F21200C9BBB00E833DA /* UIKit.framework in Frameworks */, + 9CCC5F20200C9BB700E833DA /* AVFoundation.framework in Frameworks */, + 9CCC5F1F200C9BB200E833DA /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 9C0912371E71283100E5AA46 /* Products */ = { + 9C03E5E9212E60F7001F0E1B /* SGVR */ = { isa = PBXGroup; children = ( - 9C09123D1E71283100E5AA46 /* SGPlatform.framework */, - 9C09123F1E71283100E5AA46 /* SGPlatform.framework */, - 9C0912411E71283100E5AA46 /* SGPlatform.framework */, + 9C03E5EA212E616B001F0E1B /* SGMotionSensor.h */, + 9C03E5EB212E616B001F0E1B /* SGMotionSensor.m */, + 9C03E5EE212E645B001F0E1B /* SGVRProjection.h */, + 9C03E5EF212E645B001F0E1B /* SGVRProjection.m */, + 9CAAC99D2133A6800065E364 /* SGVRViewport.h */, + 9CAAC99E2133A6800065E364 /* SGVRViewport.m */, ); - name = Products; + path = SGVR; sourceTree = ""; }; - 9C2533C81FAB151400BBFA5C /* ffmpeg */ = { + 9C129F2A211857C800B816DC /* SGContainer */ = { isa = PBXGroup; children = ( - 9C2533C91FAB151400BBFA5C /* include */, + 9C2C55912015911600131E15 /* SGObjectPool.h */, + 9C2C55922015911600131E15 /* SGObjectPool.m */, + 9C2C55B32015D92100131E15 /* SGObjectQueue.h */, + 9C2C55B42015D92100131E15 /* SGObjectQueue.m */, ); - path = ffmpeg; + path = SGContainer; sourceTree = ""; }; - 9C2533C91FAB151400BBFA5C /* include */ = { + 9C2534521FAB151500BBFA5C /* SGFFmpeg */ = { isa = PBXGroup; children = ( - 9C2533CA1FAB151400BBFA5C /* libavcodec */, - 9C2533DC1FAB151400BBFA5C /* libavfilter */, - 9C2533E21FAB151400BBFA5C /* libavformat */, - 9C2533E61FAB151400BBFA5C /* libavutil */, - 9C2534311FAB151500BBFA5C /* libswresample */, - 9C2534341FAB151500BBFA5C /* libswscale */, - ); - path = include; + 9CFA234B230BCFFC00061AAC /* iOS */, + 9CFA2358230BD00400061AAC /* macOS */, + 9CFA2365230BD00C00061AAC /* tvOS */, + 9CB61F5D2112B93C00F5BE6B /* SGFFmpeg.h */, + 9CB61F5E2112B93C00F5BE6B /* SGFFmpeg.m */, + ); + path = SGFFmpeg; sourceTree = ""; }; - 9C2533CA1FAB151400BBFA5C /* libavcodec */ = { + 9C262A3022B34356006C8542 /* SGOption */ = { isa = PBXGroup; children = ( - 9C2533CB1FAB151400BBFA5C /* avcodec.h */, - 9C2533CC1FAB151400BBFA5C /* avdct.h */, - 9C2533CD1FAB151400BBFA5C /* avfft.h */, - 9C2533CE1FAB151400BBFA5C /* d3d11va.h */, - 9C2533CF1FAB151400BBFA5C /* dirac.h */, - 9C2533D01FAB151400BBFA5C /* dv_profile.h */, - 9C2533D11FAB151400BBFA5C /* dxva2.h */, - 9C2533D21FAB151400BBFA5C /* jni.h */, - 9C2533D31FAB151400BBFA5C /* mediacodec.h */, - 9C2533D41FAB151400BBFA5C /* qsv.h */, - 9C2533D51FAB151400BBFA5C /* vaapi.h */, - 9C2533D61FAB151400BBFA5C /* vda.h */, - 9C2533D71FAB151400BBFA5C /* vdpau.h */, - 9C2533D81FAB151400BBFA5C /* version.h */, - 9C2533D91FAB151400BBFA5C /* videotoolbox.h */, - 9C2533DA1FAB151400BBFA5C /* vorbis_parser.h */, - 9C2533DB1FAB151400BBFA5C /* xvmc.h */, - ); - path = libavcodec; + 9C43D50B2187037200235169 /* SGOptions.h */, + 9C43D50C2187037200235169 /* SGOptions.m */, + 9C262A3122B344D3006C8542 /* SGDemuxerOptions.h */, + 9C262A3222B344D3006C8542 /* SGDemuxerOptions.m */, + 9C262A3922B3450F006C8542 /* SGDecoderOptions.h */, + 9C262A3A22B3450F006C8542 /* SGDecoderOptions.m */, + 9C1378BA23029F2E00FE0CFD /* SGProcessorOptions.h */, + 9C1378BB23029F2E00FE0CFD /* SGProcessorOptions.m */, + 9C262A4122B359CC006C8542 /* SGRendererOptions.h */, + 9C262A4222B359CC006C8542 /* SGRendererOptions.m */, + ); + path = SGOption; sourceTree = ""; }; - 9C2533DC1FAB151400BBFA5C /* libavfilter */ = { + 9C3082D821255CA400B44298 /* SGDefine */ = { isa = PBXGroup; children = ( - 9C2533DD1FAB151400BBFA5C /* avfilter.h */, - 9C2533DE1FAB151400BBFA5C /* avfiltergraph.h */, - 9C2533DF1FAB151400BBFA5C /* buffersink.h */, - 9C2533E01FAB151400BBFA5C /* buffersrc.h */, - 9C2533E11FAB151400BBFA5C /* version.h */, + 9CE6F5A12004E7ED00D1F4C8 /* SGMacro.h */, + 9C1D2228201B1DA2005147FB /* SGMapping.h */, + 9C1D2229201B1DA2005147FB /* SGMapping.m */, ); - path = libavfilter; + path = SGDefine; sourceTree = ""; }; - 9C2533E21FAB151400BBFA5C /* libavformat */ = { + 9C3A685721CB76B10031DDE1 /* Vendor */ = { isa = PBXGroup; children = ( - 9C2533E31FAB151400BBFA5C /* avformat.h */, - 9C2533E41FAB151400BBFA5C /* avio.h */, - 9C2533E51FAB151400BBFA5C /* version.h */, + 9C3A685821CB76B10031DDE1 /* sonic */, ); - path = libavformat; + path = Vendor; sourceTree = ""; }; - 9C2533E61FAB151400BBFA5C /* libavutil */ = { + 9C3A685821CB76B10031DDE1 /* sonic */ = { isa = PBXGroup; children = ( - 9C2533E71FAB151400BBFA5C /* adler32.h */, - 9C2533E81FAB151400BBFA5C /* aes.h */, - 9C2533E91FAB151400BBFA5C /* aes_ctr.h */, - 9C2533EA1FAB151400BBFA5C /* attributes.h */, - 9C2533EB1FAB151400BBFA5C /* audio_fifo.h */, - 9C2533EC1FAB151400BBFA5C /* avassert.h */, - 9C2533ED1FAB151400BBFA5C /* avconfig.h */, - 9C2533EE1FAB151400BBFA5C /* avstring.h */, - 9C2533EF1FAB151400BBFA5C /* avutil.h */, - 9C2533F01FAB151400BBFA5C /* base64.h */, - 9C2533F11FAB151400BBFA5C /* blowfish.h */, - 9C2533F21FAB151400BBFA5C /* bprint.h */, - 9C2533F31FAB151400BBFA5C /* bswap.h */, - 9C2533F41FAB151400BBFA5C /* buffer.h */, - 9C2533F51FAB151400BBFA5C /* camellia.h */, - 9C2533F61FAB151400BBFA5C /* cast5.h */, - 9C2533F71FAB151400BBFA5C /* channel_layout.h */, - 9C2533F81FAB151400BBFA5C /* common.h */, - 9C2533F91FAB151400BBFA5C /* cpu.h */, - 9C2533FA1FAB151400BBFA5C /* crc.h */, - 9C2533FB1FAB151400BBFA5C /* des.h */, - 9C2533FC1FAB151400BBFA5C /* dict.h */, - 9C2533FD1FAB151400BBFA5C /* display.h */, - 9C2533FE1FAB151400BBFA5C /* downmix_info.h */, - 9C2533FF1FAB151400BBFA5C /* error.h */, - 9C2534001FAB151400BBFA5C /* eval.h */, - 9C2534011FAB151400BBFA5C /* ffversion.h */, - 9C2534021FAB151400BBFA5C /* fifo.h */, - 9C2534031FAB151400BBFA5C /* file.h */, - 9C2534041FAB151400BBFA5C /* frame.h */, - 9C2534051FAB151400BBFA5C /* hash.h */, - 9C2534061FAB151400BBFA5C /* hmac.h */, - 9C2534071FAB151400BBFA5C /* hwcontext.h */, - 9C2534081FAB151400BBFA5C /* hwcontext_cuda.h */, - 9C2534091FAB151400BBFA5C /* hwcontext_dxva2.h */, - 9C25340A1FAB151400BBFA5C /* hwcontext_qsv.h */, - 9C25340B1FAB151400BBFA5C /* hwcontext_vaapi.h */, - 9C25340C1FAB151400BBFA5C /* hwcontext_vdpau.h */, - 9C25340D1FAB151400BBFA5C /* imgutils.h */, - 9C25340E1FAB151400BBFA5C /* intfloat.h */, - 9C25340F1FAB151400BBFA5C /* intreadwrite.h */, - 9C2534101FAB151400BBFA5C /* lfg.h */, - 9C2534111FAB151400BBFA5C /* log.h */, - 9C2534121FAB151400BBFA5C /* lzo.h */, - 9C2534131FAB151400BBFA5C /* macros.h */, - 9C2534141FAB151400BBFA5C /* mastering_display_metadata.h */, - 9C2534151FAB151400BBFA5C /* mathematics.h */, - 9C2534161FAB151400BBFA5C /* md5.h */, - 9C2534171FAB151400BBFA5C /* mem.h */, - 9C2534181FAB151400BBFA5C /* motion_vector.h */, - 9C2534191FAB151400BBFA5C /* murmur3.h */, - 9C25341A1FAB151400BBFA5C /* opt.h */, - 9C25341B1FAB151400BBFA5C /* parseutils.h */, - 9C25341C1FAB151400BBFA5C /* pixdesc.h */, - 9C25341D1FAB151400BBFA5C /* pixelutils.h */, - 9C25341E1FAB151400BBFA5C /* pixfmt.h */, - 9C25341F1FAB151400BBFA5C /* random_seed.h */, - 9C2534201FAB151400BBFA5C /* rational.h */, - 9C2534211FAB151400BBFA5C /* rc4.h */, - 9C2534221FAB151400BBFA5C /* replaygain.h */, - 9C2534231FAB151500BBFA5C /* ripemd.h */, - 9C2534241FAB151500BBFA5C /* samplefmt.h */, - 9C2534251FAB151500BBFA5C /* sha.h */, - 9C2534261FAB151500BBFA5C /* sha512.h */, - 9C2534271FAB151500BBFA5C /* stereo3d.h */, - 9C2534281FAB151500BBFA5C /* tea.h */, - 9C2534291FAB151500BBFA5C /* threadmessage.h */, - 9C25342A1FAB151500BBFA5C /* time.h */, - 9C25342B1FAB151500BBFA5C /* timecode.h */, - 9C25342C1FAB151500BBFA5C /* timestamp.h */, - 9C25342D1FAB151500BBFA5C /* tree.h */, - 9C25342E1FAB151500BBFA5C /* twofish.h */, - 9C25342F1FAB151500BBFA5C /* version.h */, - 9C2534301FAB151500BBFA5C /* xtea.h */, + 9C3A685921CB76B10031DDE1 /* sonic.h */, + 9C3A685A21CB76B10031DDE1 /* sonic.c */, ); - path = libavutil; + path = sonic; sourceTree = ""; }; - 9C2534311FAB151500BBFA5C /* libswresample */ = { + 9C478EF31E7139E500AD4289 /* Classes */ = { isa = PBXGroup; children = ( - 9C2534321FAB151500BBFA5C /* swresample.h */, - 9C2534331FAB151500BBFA5C /* version.h */, + 9C25364E1FAB199500BBFA5C /* SGPlayer.h */, + 9C25364F1FAB199500BBFA5C /* SGPlayer.m */, + 9C661C5A2304074900908563 /* SGPlayerHeader.h */, + 9C478F341E713A9B00AD4289 /* Core */, ); - path = libswresample; + path = Classes; sourceTree = ""; }; - 9C2534341FAB151500BBFA5C /* libswscale */ = { + 9C478F341E713A9B00AD4289 /* Core */ = { isa = PBXGroup; children = ( - 9C2534351FAB151500BBFA5C /* swscale.h */, - 9C2534361FAB151500BBFA5C /* version.h */, + 9C3A685721CB76B10031DDE1 /* Vendor */, + 9C262A3022B34356006C8542 /* SGOption */, + 9CF63FBF211D8E26001B2684 /* SGAsset */, + 9C4FB1A92111BD640079C2D2 /* SGSession */, + 9C8D4E5C200E0A0600ED8A58 /* SGDemuxer */, + 9C8D4E69200E101D00ED8A58 /* SGDecoder */, + 9CF15DF420119FBE00585326 /* SGRenderer */, + 9CBD0BA7201625010094CFC7 /* SGAudio */, + 9C129F2A211857C800B816DC /* SGContainer */, + 9CF15DF320119D0300585326 /* SGData */, + 9C6F901E219BDCDC001051CE /* SGProcessor */, + 9C3082D821255CA400B44298 /* SGDefine */, + 9CE6F5912004E37600D1F4C8 /* SGCommon */, + 9CE6904021C105760089B33A /* SGDescription */, + 9C8D6B2F22C4A19400985D55 /* SGMetal */, + 9CE6F5172004D97C00D1F4C8 /* SGPlatform */, + 9C2534521FAB151500BBFA5C /* SGFFmpeg */, + 9C03E5E9212E60F7001F0E1B /* SGVR */, ); - path = libswscale; + path = Core; sourceTree = ""; }; - 9C2534521FAB151500BBFA5C /* SGFFmpeg */ = { + 9C4793421E71402E00AD4289 /* Frameworks */ = { isa = PBXGroup; children = ( - 9C2534531FAB151500BBFA5C /* SGFFAudioDecoder.h */, - 9C2534541FAB151500BBFA5C /* SGFFAudioDecoder.m */, - 9C2534551FAB151500BBFA5C /* SGFFAudioFrame.h */, - 9C2534561FAB151500BBFA5C /* SGFFAudioFrame.m */, - 9C2534571FAB151500BBFA5C /* SGFFDecoder.h */, - 9C2534581FAB151500BBFA5C /* SGFFDecoder.m */, - 9C2534591FAB151500BBFA5C /* SGFFFormatContext.h */, - 9C25345A1FAB151500BBFA5C /* SGFFFormatContext.m */, - 9C25345B1FAB151500BBFA5C /* SGFFFrame.h */, - 9C25345C1FAB151500BBFA5C /* SGFFFrame.m */, - 9C25345D1FAB151500BBFA5C /* SGFFFramePool.h */, - 9C25345E1FAB151500BBFA5C /* SGFFFramePool.m */, - 9C25345F1FAB151500BBFA5C /* SGFFFrameQueue.h */, - 9C2534601FAB151500BBFA5C /* SGFFFrameQueue.m */, - 9C2534611FAB151500BBFA5C /* SGFFMetadata.h */, - 9C2534621FAB151500BBFA5C /* SGFFMetadata.m */, - 9C2534631FAB151500BBFA5C /* SGFFPacketQueue.h */, - 9C2534641FAB151500BBFA5C /* SGFFPacketQueue.m */, - 9C2534651FAB151500BBFA5C /* SGFFTools.h */, - 9C2534661FAB151500BBFA5C /* SGFFTools.m */, - 9C2534671FAB151500BBFA5C /* SGFFTrack.h */, - 9C2534681FAB151500BBFA5C /* SGFFTrack.m */, - 9C2534691FAB151500BBFA5C /* SGFFVideoDecoder.h */, - 9C25346A1FAB151500BBFA5C /* SGFFVideoDecoder.m */, - 9C25346B1FAB151500BBFA5C /* SGFFVideoFrame.h */, - 9C25346C1FAB151500BBFA5C /* SGFFVideoFrame.m */, - 9C25346D1FAB151500BBFA5C /* SGFFVideoToolBox.h */, - 9C25346E1FAB151500BBFA5C /* SGFFVideoToolBox.m */, + 9CF9A020212D1D34008178BC /* libavcodec.a */, + 9CFA2341230BCE5100061AAC /* libavcodec.a */, + 9CF9A022212D1D35008178BC /* libavfilter.a */, + 9C8636592190408300D730EC /* libavcodec.a */, + 9C8637D72190476600D730EC /* libavcodec.a */, + 9C5C7BD5230AAC1200C75E3A /* libavcodec.a */, + 9C5C7BD6230AAC1200C75E3A /* libavfilter.a */, + 9CFA2314230BCCEA00061AAC /* libavcodec.a */, + 9CFA2318230BCCEA00061AAC /* libavfilter.a */, + 9CFA2328230BCD4400061AAC /* libavcodec.a */, + 9CFA232A230BCD4400061AAC /* libavfilter.a */, + 9CFA233F230BCE5100061AAC /* libavfilter.a */, + 9C5C7BDA230AAC1200C75E3A /* libavformat.a */, + 9CFA2325230BCD4400061AAC /* libavformat.a */, + 9CFA233E230BCE5100061AAC /* libavformat.a */, + 9C5C7BD9230AAC1200C75E3A /* libavutil.a */, + 9CFA2316230BCCEA00061AAC /* libavutil.a */, + 9C5C7BD7230AAC1200C75E3A /* libcrypto.a */, + 9CFA2340230BCE5100061AAC /* libcrypto.a */, + 9C5C7BDB230AAC1200C75E3A /* libssl.a */, + 9C5C7BD8230AAC1200C75E3A /* libswresample.a */, + 9CFA233D230BCE5100061AAC /* libssl.a */, + 9CFA2342230BCE5100061AAC /* libswresample.a */, + 9C5C7BD4230AAC1200C75E3A /* libswscale.a */, + 9CFA2313230BCCE900061AAC /* libavformat.a */, + 9CFA2315230BCCEA00061AAC /* libcrypto.a */, + 9CFA2317230BCCEA00061AAC /* libssl.a */, + 9CFA2319230BCCEA00061AAC /* libswresample.a */, + 9CFA231A230BCCEA00061AAC /* libswscale.a */, + 9CFA2323230BCD4300061AAC /* libavutil.a */, + 9CFA2324230BCD4300061AAC /* libcrypto.a */, + 9CFA2326230BCD4400061AAC /* libssl.a */, + 9CFA2327230BCD4400061AAC /* libswresample.a */, + 9CFA2329230BCD4400061AAC /* libswscale.a */, + 9CFA233B230BCE5100061AAC /* libavutil.a */, + 9CFA233C230BCE5100061AAC /* libswscale.a */, + 9C8636522190408300D730EC /* libavdevice.a */, + 9C8636582190408300D730EC /* libavfilter.a */, + 9C8638AC21904AF700D730EC /* libavcodec.a */, + 9C8638AD21904AF700D730EC /* libavdevice.a */, + 9C8638AF21904AF700D730EC /* libavfilter.a */, + 9CF9A01D212D1D34008178BC /* libavformat.a */, + 9C8637D62190476600D730EC /* libavdevice.a */, + 9C8637D82190476600D730EC /* libavfilter.a */, + 9C8637D92190476600D730EC /* libavformat.a */, + 9CF9A01F212D1D34008178BC /* libavutil.a */, + 9C8637D52190476600D730EC /* libavutil.a */, + 9C8638AA21904AF700D730EC /* libavutil.a */, + 9CF9A023212D1D35008178BC /* libcrypto.a */, + 9C8636552190408300D730EC /* libavutil.a */, + 9C8636572190408300D730EC /* libcrypto.a */, + 9C8637D42190476600D730EC /* libcrypto.a */, + 9C8638A821904AF700D730EC /* libavformat.a */, + 9C8638A921904AF700D730EC /* libcrypto.a */, + 9CF9A01C212D1D34008178BC /* libssl.a */, + 9C8637D32190476600D730EC /* libssl.a */, + 9CF9A021212D1D34008178BC /* libswresample.a */, + 9C8636542190408300D730EC /* libssl.a */, + 9C8636562190408300D730EC /* libswresample.a */, + 9CF9A01E212D1D34008178BC /* libswscale.a */, + 9C8636512190408300D730EC /* libavformat.a */, + 9C8636532190408300D730EC /* libswscale.a */, + 9C8637D22190476600D730EC /* libswresample.a */, + 9C8637DA2190476600D730EC /* libswscale.a */, + 9C8638A721904AF700D730EC /* libssl.a */, + 9C8638AB21904AF700D730EC /* libswresample.a */, + 9C8638AE21904AF700D730EC /* libswscale.a */, + 9CCC5F1D200C9BA200E833DA /* UIKit.framework */, + 9CCC5F1B200C9B9800E833DA /* AVFoundation.framework */, + 9CCC5F19200C9B9400E833DA /* Foundation.framework */, + 9CCC5F17200C9B8A00E833DA /* AppKit.framework */, + 9CCC5F15200C9B8600E833DA /* Foundation.framework */, + 9CCC5F11200C9B7B00E833DA /* AVFoundation.framework */, + 9CCC5F13200C9B8200E833DA /* AVFoundation.framework */, + 9CCC5F0F200C9B7700E833DA /* Foundation.framework */, + 9CCC5F0D200C9B7000E833DA /* UIKit.framework */, + 9C4793671E71404A00AD4289 /* libavcodec.a */, + 9C4793681E71404A00AD4289 /* libavdevice.a */, + 9C4793691E71404A00AD4289 /* libavfilter.a */, + 9C47936A1E71404A00AD4289 /* libavformat.a */, + 9C47936B1E71404A00AD4289 /* libavutil.a */, + 9C47936C1E71404A00AD4289 /* libcrypto.a */, + 9C47936D1E71404A00AD4289 /* libssl.a */, + 9C47936E1E71404A00AD4289 /* libswresample.a */, + 9C47936F1E71404A00AD4289 /* libswscale.a */, + 9C4793551E71403500AD4289 /* libavcodec.a */, + 9C4793561E71403500AD4289 /* libavdevice.a */, + 9C4793571E71403500AD4289 /* libavfilter.a */, + 9C4793581E71403500AD4289 /* libavformat.a */, + 9C4793591E71403500AD4289 /* libavutil.a */, + 9C47935A1E71403500AD4289 /* libcrypto.a */, + 9C47935B1E71403500AD4289 /* libssl.a */, + 9C47935C1E71403500AD4289 /* libswresample.a */, + 9C47935D1E71403500AD4289 /* libswscale.a */, + 9C4793431E71402E00AD4289 /* libavcodec.a */, + 9C4793441E71402E00AD4289 /* libavdevice.a */, + 9C4793451E71402E00AD4289 /* libavfilter.a */, + 9C4793461E71402E00AD4289 /* libavformat.a */, + 9C4793471E71402E00AD4289 /* libavutil.a */, + 9C4793481E71402E00AD4289 /* libcrypto.a */, + 9C4793491E71402E00AD4289 /* libssl.a */, + 9C47934A1E71402E00AD4289 /* libswresample.a */, + 9C47934B1E71402E00AD4289 /* libswscale.a */, ); - path = SGFFmpeg; + name = Frameworks; sourceTree = ""; }; - 9C478EF31E7139E500AD4289 /* Classes */ = { + 9C4FB1A92111BD640079C2D2 /* SGSession */ = { isa = PBXGroup; children = ( - 9C478EF71E713A3200AD4289 /* SGPlayerImp.h */, - 9C478EF81E713A3200AD4289 /* SGPlayerImp.m */, - 9C478EFD1E713A3200AD4289 /* SGPlayerTrack.h */, - 9C478EFE1E713A3200AD4289 /* SGPlayerTrack.m */, - 9C478EF91E713A3200AD4289 /* SGPlayerAction.h */, - 9C478EFA1E713A3200AD4289 /* SGPlayerAction.m */, - 9C478EFB1E713A3200AD4289 /* SGPlayerDecoder.h */, - 9C478EFC1E713A3200AD4289 /* SGPlayerDecoder.m */, - 9C478F341E713A9B00AD4289 /* Core */, + 9C8D4E46200DFFC700ED8A58 /* SGPlayerItem.h */, + 9C8D4E47200DFFC700ED8A58 /* SGPlayerItem.m */, + 9CC649F921818D8C00453B3E /* SGPlayerItem+Internal.h */, + 9C29D110217D741500343975 /* SGFrameOutput.h */, + 9C29D111217D741500343975 /* SGFrameOutput.m */, + 9C8D4E61200E0ACC00ED8A58 /* SGPacketOutput.h */, + 9C8D4E62200E0ACC00ED8A58 /* SGPacketOutput.m */, ); - path = Classes; + path = SGSession; sourceTree = ""; }; - 9C478F341E713A9B00AD4289 /* Core */ = { + 9C6F901E219BDCDC001051CE /* SGProcessor */ = { isa = PBXGroup; children = ( - 9C478F351E713AA800AD4289 /* SGPlayerMacro.h */, - 9C9823C91FAAFFEB00142215 /* SGPlayerBuildConfig.h */, - 9C478F361E713AA800AD4289 /* SGPlayerNotification.h */, - 9C478F371E713AA800AD4289 /* SGPlayerNotification.m */, - 9C4792B91E713B4900AD4289 /* SGAVPlayer */, - 9C478F671E713B0F00AD4289 /* SGFFPlayer */, - 9C4792BD1E713B4900AD4289 /* SGDisplay */, - 9C4792D81E713B4900AD4289 /* SGDistortion */, - 9C478F521E713ABB00AD4289 /* SGMatrix */, - 9C478F381E713AA800AD4289 /* SGTools */, - 9C4793311E713B5400AD4289 /* SGAudio */, + 9C1378B623026C6700FE0CFD /* SGProcessor.h */, + 9C82EEAF21AE356D00E9D523 /* SGAudioProcessor.h */, + 9C82EEB021AE356D00E9D523 /* SGAudioProcessor.m */, + 9C1378A62302681C00FE0CFD /* SGVideoProcessor.h */, + 9C1378A72302681C00FE0CFD /* SGVideoProcessor.m */, + 9C66E1F82188526200B70DAA /* SGAudioFormatter.h */, + 9C66E1F92188526200B70DAA /* SGAudioFormatter.m */, + 9C1F2DE521AF8F1A00D42158 /* SGAudioMixer.h */, + 9C1F2DE621AF8F1A00D42158 /* SGAudioMixer.m */, + 9C4190F321AFF17700134099 /* SGAudioMixerUnit.h */, + 9C4190F421AFF17700134099 /* SGAudioMixerUnit.m */, + 9C66E1FC2188550D00B70DAA /* SGSWResample.h */, + 9C66E1FD2188550D00B70DAA /* SGSWResample.m */, + 9C3748792135521D00572166 /* SGSWScale.h */, + 9C37487A2135521D00572166 /* SGSWScale.m */, + 9C3A686121CB77010031DDE1 /* SGSonic.h */, + 9C3A686221CB77010031DDE1 /* SGSonic.m */, ); - path = Core; + path = SGProcessor; sourceTree = ""; }; - 9C478F381E713AA800AD4289 /* SGTools */ = { + 9C8D4E5C200E0A0600ED8A58 /* SGDemuxer */ = { isa = PBXGroup; children = ( - 9C478F391E713AA800AD4289 /* SGPlayer+DisplayView.h */, - 9C478F3A1E713AA800AD4289 /* SGPlayer+DisplayView.m */, - 9C478F3B1E713AA800AD4289 /* SGYUVTools.h */, - 9C478F3C1E713AA800AD4289 /* SGYUVTools.m */, + 9C0DF027215A2FB9007142DB /* SGDemuxable.h */, + 9C95D2BC2152335400079B38 /* SGURLDemuxer.h */, + 9C95D2BB2152335400079B38 /* SGURLDemuxer.m */, + 9CE71927219C48AC00256485 /* SGDemuxerFunnel.h */, + 9CE71928219C48AC00256485 /* SGDemuxerFunnel.m */, + 9CB01C91219E863D00B36CFA /* SGMutilDemuxer.h */, + 9CB01C92219E863D00B36CFA /* SGMutilDemuxer.m */, + 9C0A6F32219C33EA0027D5B1 /* SGTrackDemuxer.h */, + 9C0A6F33219C33EA0027D5B1 /* SGTrackDemuxer.m */, + 9CC2AD7422A65C7B0095A081 /* SGPaddingDemuxer.h */, + 9CC2AD7522A65C7B0095A081 /* SGPaddingDemuxer.m */, + 9C0A6F3A219C36300027D5B1 /* SGSegmentDemuxer.h */, + 9C0A6F3B219C36300027D5B1 /* SGSegmentDemuxer.m */, ); - path = SGTools; + path = SGDemuxer; sourceTree = ""; }; - 9C478F521E713ABB00AD4289 /* SGMatrix */ = { + 9C8D4E69200E101D00ED8A58 /* SGDecoder */ = { isa = PBXGroup; children = ( - 9C478F551E713ABB00AD4289 /* SGMatrix.h */, - 9C478F561E713ABB00AD4289 /* SGMatrix.m */, - 9C478F631E713AC600AD4289 /* SGSensors.h */, - 9C478F641E713AC600AD4289 /* SGSensors.m */, - 9C478F531E713ABB00AD4289 /* SGFingerRotation.h */, - 9C478F541E713ABB00AD4289 /* SGFingerRotation.m */, - ); - path = SGMatrix; + 9C0B6CB5217DBA1800900F1E /* SGDecodable.h */, + 9CF15DE320118E1100585326 /* SGDecodeLoop.h */, + 9CF15DE420118E1100585326 /* SGDecodeLoop.m */, + 9C3082CE212521AB00B44298 /* SGAudioDecoder.h */, + 9C3082CF212521AB00B44298 /* SGAudioDecoder.m */, + 9C3082C1212518EB00B44298 /* SGVideoDecoder.h */, + 9C3082C2212518EC00B44298 /* SGVideoDecoder.m */, + 9C3082C521251AC200B44298 /* SGCodecContext.h */, + 9C3082C621251AC200B44298 /* SGCodecContext.m */, + ); + path = SGDecoder; sourceTree = ""; }; - 9C478F671E713B0F00AD4289 /* SGFFPlayer */ = { + 9C8D6B2F22C4A19400985D55 /* SGMetal */ = { isa = PBXGroup; children = ( - 9C2533C81FAB151400BBFA5C /* ffmpeg */, - 9C2534521FAB151500BBFA5C /* SGFFmpeg */, - 9C25364E1FAB199500BBFA5C /* SGFFPlayer.h */, - 9C25364F1FAB199500BBFA5C /* SGFFPlayer.m */, - 9C25364A1FAB196D00BBFA5C /* SGFFPlayerShell.h */, - 9C25364B1FAB196D00BBFA5C /* SGFFPlayerShell.m */, + 9C8D6B3122C4A19400985D55 /* SGMetal.h */, + 9C8D6B3622C4A19400985D55 /* SGMetalTypes.h */, + 9C11816322C4E23200A12FD4 /* SGMetalViewport.h */, + 9C11816422C4E23200A12FD4 /* SGMetalViewport.m */, + 9C8D6B3D22C4A19500985D55 /* SGMetalRenderer.h */, + 9C8D6B4622C4A19500985D55 /* SGMetalRenderer.m */, + 9C65F5B022C5EC2B00AE27DE /* SGMetalProjection.h */, + 9C65F5B122C5EC2B00AE27DE /* SGMetalProjection.m */, + 9C8D6B4022C4A19500985D55 /* SGMetalModel.h */, + 9C8D6B3422C4A19400985D55 /* SGMetalModel.m */, + 9C8D6B4322C4A19500985D55 /* SGMetalPlaneModel.h */, + 9C8D6B3922C4A19400985D55 /* SGMetalPlaneModel.m */, + 9C8D6B3E22C4A19500985D55 /* SGMetalSphereModel.h */, + 9C8D6B3022C4A19400985D55 /* SGMetalSphereModel.m */, + 9C8D6B4522C4A19500985D55 /* SGMetalRenderPipeline.h */, + 9C8D6B3822C4A19400985D55 /* SGMetalRenderPipeline.m */, + 9C8D6B4122C4A19500985D55 /* SGMetalRenderPipelinePool.h */, + 9C8D6B3222C4A19400985D55 /* SGMetalRenderPipelinePool.m */, + 9C8D6B4922C4A19500985D55 /* SGMetalBGRARenderPipeline.h */, + 9C8D6B3B22C4A19500985D55 /* SGMetalBGRARenderPipeline.m */, + 9C8D6B3F22C4A19500985D55 /* SGMetalNV12RenderPipeline.h */, + 9C8D6B3522C4A19400985D55 /* SGMetalNV12RenderPipeline.m */, + 9C8D6B4422C4A19500985D55 /* SGMetalYUVRenderPipeline.h */, + 9C8D6B3722C4A19400985D55 /* SGMetalYUVRenderPipeline.m */, + 9C8D6B4222C4A19500985D55 /* SGMetalTextureLoader.h */, + 9C8D6B3322C4A19400985D55 /* SGMetalTextureLoader.m */, + 9C8D6B4822C4A19500985D55 /* SGMetalShader.metal */, ); - path = SGFFPlayer; + path = SGMetal; sourceTree = ""; }; - 9C4792B91E713B4900AD4289 /* SGAVPlayer */ = { + 9CBD0BA7201625010094CFC7 /* SGAudio */ = { isa = PBXGroup; children = ( - 9C4792BB1E713B4900AD4289 /* SGAVPlayer.h */, - 9C4792BC1E713B4900AD4289 /* SGAVPlayer.m */, + 9CE6842E200DD12F007BD834 /* SGAudioPlayer.h */, + 9CE6842F200DD12F007BD834 /* SGAudioPlayer.m */, ); - path = SGAVPlayer; + path = SGAudio; sourceTree = ""; }; - 9C4792BD1E713B4900AD4289 /* SGDisplay */ = { + 9CE6904021C105760089B33A /* SGDescription */ = { isa = PBXGroup; children = ( - 9C4792BE1E713B4900AD4289 /* SGDisplayView.h */, - 9C4792BF1E713B4900AD4289 /* SGDisplayView.m */, - 9C4792C01E713B4900AD4289 /* SGGLModel */, - 9C4792C71E713B4900AD4289 /* SGGLProgram */, - 9C4792CE1E713B4900AD4289 /* SGGLTexture */, - 9C4792D11E713B4900AD4289 /* SGGLView */, - ); - path = SGDisplay; + 9C935B9B21CCCA58007813F4 /* SGDescriptor+Internal.h */, + 9C525D4F21AEC421005C5708 /* SGAudioDescriptor.h */, + 9C525D5021AEC421005C5708 /* SGAudioDescriptor.m */, + 9C853F1021BFD85D005552C6 /* SGVideoDescriptor.h */, + 9C853F1121BFD85D005552C6 /* SGVideoDescriptor.m */, + 9CA57930219DAA270061093B /* SGCodecDescriptor.h */, + 9CA57931219DAA270061093B /* SGCodecDescriptor.m */, + ); + path = SGDescription; sourceTree = ""; }; - 9C4792C01E713B4900AD4289 /* SGGLModel */ = { + 9CE6F5172004D97C00D1F4C8 /* SGPlatform */ = { isa = PBXGroup; children = ( - 9C4792C11E713B4900AD4289 /* SGGLModel.h */, - 9C4792C21E713B4900AD4289 /* SGGLModel.m */, - 9C4792C31E713B4900AD4289 /* SGGLNormalModel.h */, - 9C4792C41E713B4900AD4289 /* SGGLNormalModel.m */, - 9C4792C51E713B4900AD4289 /* SGGLVRModel.h */, - 9C4792C61E713B4900AD4289 /* SGGLVRModel.m */, - ); - path = SGGLModel; + 9CE6F52D2004D97C00D1F4C8 /* SGPLFTargets.h */, + 9CE6F5202004D97C00D1F4C8 /* SGPLFObject.h */, + 9CE6F5232004D97C00D1F4C8 /* SGPLFView.h */, + 9CE6F5242004D97C00D1F4C8 /* SGPLFView.m */, + 9CE6F51E2004D97C00D1F4C8 /* SGPLFImage.h */, + 9CE6F51F2004D97C00D1F4C8 /* SGPLFImage.m */, + 9CE6F51A2004D97C00D1F4C8 /* SGPLFColor.h */, + 9CE6F51B2004D97C00D1F4C8 /* SGPLFColor.m */, + 9CE6F5212004D97C00D1F4C8 /* SGPLFScreen.h */, + 9CE6F5222004D97C00D1F4C8 /* SGPLFScreen.m */, + ); + path = SGPlatform; sourceTree = ""; }; - 9C4792C71E713B4900AD4289 /* SGGLProgram */ = { + 9CE6F5912004E37600D1F4C8 /* SGCommon */ = { isa = PBXGroup; children = ( - 9C4792CC1E713B4900AD4289 /* SGGLProgram.h */, - 9C4792CD1E713B4900AD4289 /* SGGLProgram.m */, - 9C5AB6F81E88F0400021F460 /* SGGLProgramNV12.h */, - 9C5AB6F91E88F0400021F460 /* SGGLProgramNV12.m */, - 9C5AB7001E88F0560021F460 /* SGGLProgramYUV420.h */, - 9C5AB7011E88F0560021F460 /* SGGLProgramYUV420.m */, - ); - path = SGGLProgram; + 9CA0F56220E0E24000501478 /* SGDefines.h */, + 9C43D50F21872D3F00235169 /* SGLock.h */, + 9C43D51021872D3F00235169 /* SGLock.m */, + 9C4663C820D0F83600CADDA7 /* SGTime.h */, + 9C4663C920D0F83600CADDA7 /* SGTime.m */, + 9C8D4E7E200E1ACA00ED8A58 /* SGError.h */, + 9C8D4E7F200E1ACA00ED8A58 /* SGError.m */, + 9C329AA82005E3F800252B10 /* SGActivity.h */, + 9C329AA92005E3F800252B10 /* SGActivity.m */, + ); + path = SGCommon; sourceTree = ""; }; - 9C4792CE1E713B4900AD4289 /* SGGLTexture */ = { + 9CEFA6CC1E7122BF00835CAB = { isa = PBXGroup; children = ( - 9C5AB6D81E88E7980021F460 /* SGGLTexture.h */, - 9C5AB6D91E88E7980021F460 /* SGGLTexture.m */, - 9C5AB6E01E88E8F20021F460 /* SGGLTextureNV12.h */, - 9C5AB6E11E88E8F20021F460 /* SGGLTextureNV12.m */, - 9C5AB6E81E88E90B0021F460 /* SGGLTextureYUV420.h */, - 9C5AB6E91E88E90B0021F460 /* SGGLTextureYUV420.m */, - ); - path = SGGLTexture; + 9CEFA6D81E7122BF00835CAB /* SGPlayer */, + 9CEFA6D71E7122BF00835CAB /* Products */, + 9C4793421E71402E00AD4289 /* Frameworks */, + ); sourceTree = ""; }; - 9C4792D11E713B4900AD4289 /* SGGLView */ = { + 9CEFA6D71E7122BF00835CAB /* Products */ = { isa = PBXGroup; children = ( - 9C5AB6F01E88EB720021F460 /* SGGLFrame.h */, - 9C5AB6F11E88EB720021F460 /* SGGLFrame.m */, - 9C5AB68C1E88B2AD0021F460 /* SGGLViewController.h */, - 9C5AB68D1E88B2AD0021F460 /* SGGLViewController.m */, + 9CEFA6D61E7122BF00835CAB /* SGPlayer.framework */, + 9CD79FA62190068E00E39A7D /* SGPlayer.framework */, + 9C8638A521904A0900D730EC /* SGPlayer.framework */, ); - path = SGGLView; + name = Products; sourceTree = ""; }; - 9C4792D81E713B4900AD4289 /* SGDistortion */ = { + 9CEFA6D81E7122BF00835CAB /* SGPlayer */ = { isa = PBXGroup; children = ( - 9C4792D91E713B4900AD4289 /* SGDistortionModel.h */, - 9C4792DA1E713B4900AD4289 /* SGDistortionModel.m */, - 9C4792DB1E713B4900AD4289 /* SGDistortionRenderer.h */, - 9C4792DC1E713B4900AD4289 /* SGDistortionRenderer.m */, + 9CEFA6DA1E7122BF00835CAB /* Info.plist */, + 9C478EF31E7139E500AD4289 /* Classes */, ); - path = SGDistortion; + path = SGPlayer; sourceTree = ""; }; - 9C4793311E713B5400AD4289 /* SGAudio */ = { + 9CF15DF320119D0300585326 /* SGData */ = { isa = PBXGroup; children = ( - 9C4793321E713B5400AD4289 /* SGAudioManager.h */, - 9C4793331E713B5400AD4289 /* SGAudioManager.m */, - 9C47933A1E713B5C00AD4289 /* SGMacAudioDevice.h */, - 9C47933B1E713B5C00AD4289 /* SGMacAudioDevice.m */, - 9C47933C1E713B5C00AD4289 /* SGMacAudioSession.h */, - 9C47933D1E713B5C00AD4289 /* SGMacAudioSession.m */, + 9C55337021B25EC000119235 /* SGData.h */, + 9C2C55AB2015D1D200131E15 /* SGPacket.h */, + 9C2C55AC2015D1D200131E15 /* SGPacket.m */, + 9CEBCCA0217F109000430024 /* SGPacket+Internal.h */, + 9C389ACB20108C2E003259FF /* SGFrame.h */, + 9CA3CDB320E1F74300B852D0 /* SGFrame.m */, + 9CEBCCA6217F19BE00430024 /* SGFrame+Internal.h */, + 9CF15E1D2011BC5400585326 /* SGAudioFrame.h */, + 9CF15E1E2011BC5400585326 /* SGAudioFrame.m */, + 9C2C55992015B87400131E15 /* SGVideoFrame.h */, + 9C2C559A2015B87400131E15 /* SGVideoFrame.m */, + 9CA57920219D69580061093B /* SGTimeLayout.h */, + 9CA57921219D69580061093B /* SGTimeLayout.m */, + 9CC649FD2181A8C000453B3E /* SGCapacity.h */, + 9CC649FE2181A8C000453B3E /* SGCapacity.m */, ); - path = SGAudio; + path = SGData; sourceTree = ""; }; - 9C4793421E71402E00AD4289 /* Frameworks */ = { + 9CF15DF420119FBE00585326 /* SGRenderer */ = { isa = PBXGroup; children = ( - 9C4793671E71404A00AD4289 /* libavcodec.a */, - 9C4793681E71404A00AD4289 /* libavdevice.a */, - 9C4793691E71404A00AD4289 /* libavfilter.a */, - 9C47936A1E71404A00AD4289 /* libavformat.a */, - 9C47936B1E71404A00AD4289 /* libavutil.a */, - 9C47936C1E71404A00AD4289 /* libcrypto.a */, - 9C47936D1E71404A00AD4289 /* libssl.a */, - 9C47936E1E71404A00AD4289 /* libswresample.a */, - 9C47936F1E71404A00AD4289 /* libswscale.a */, - 9C4793551E71403500AD4289 /* libavcodec.a */, - 9C4793561E71403500AD4289 /* libavdevice.a */, - 9C4793571E71403500AD4289 /* libavfilter.a */, - 9C4793581E71403500AD4289 /* libavformat.a */, - 9C4793591E71403500AD4289 /* libavutil.a */, - 9C47935A1E71403500AD4289 /* libcrypto.a */, - 9C47935B1E71403500AD4289 /* libssl.a */, - 9C47935C1E71403500AD4289 /* libswresample.a */, - 9C47935D1E71403500AD4289 /* libswscale.a */, - 9C4793431E71402E00AD4289 /* libavcodec.a */, - 9C4793441E71402E00AD4289 /* libavdevice.a */, - 9C4793451E71402E00AD4289 /* libavfilter.a */, - 9C4793461E71402E00AD4289 /* libavformat.a */, - 9C4793471E71402E00AD4289 /* libavutil.a */, - 9C4793481E71402E00AD4289 /* libcrypto.a */, - 9C4793491E71402E00AD4289 /* libssl.a */, - 9C47934A1E71402E00AD4289 /* libswresample.a */, - 9C47934B1E71402E00AD4289 /* libswscale.a */, + 9C5C98F920D26BE10089C112 /* SGClock.h */, + 9C5C98FA20D26BE10089C112 /* SGClock.m */, + 9C26CF56218D787D009FFCC4 /* SGClock+Internal.h */, + 9CF15E012011ADB500585326 /* SGRenderable.h */, + 9CDFC3E4218B10F00065C826 /* SGRenderer+Internal.h */, + 9CF15E052011AE0700585326 /* SGAudioRenderer.h */, + 9CF15E062011AE0700585326 /* SGAudioRenderer.m */, + 9C2C55A12015C1E100131E15 /* SGVideoRenderer.h */, + 9C2C55A22015C1E100131E15 /* SGVideoRenderer.m */, + 9C17554722C5B5B3003A93BC /* SGRenderTimer.h */, + 9C17554822C5B5B3003A93BC /* SGRenderTimer.m */, ); - name = Frameworks; + path = SGRenderer; sourceTree = ""; }; - 9CEFA6CC1E7122BF00835CAB = { + 9CF63FBF211D8E26001B2684 /* SGAsset */ = { isa = PBXGroup; children = ( - 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */, - 9CEFA6D81E7122BF00835CAB /* SGPlayer */, - 9CEFA6D71E7122BF00835CAB /* Products */, - 9C4793421E71402E00AD4289 /* Frameworks */, + 9CF63FC0211D8E33001B2684 /* SGAsset.h */, + 9CF63FC1211D8E33001B2684 /* SGAsset.m */, + 9C0B6CB1217D823500900F1E /* SGAsset+Internal.h */, + 9C95D2BF2152386C00079B38 /* SGURLAsset.h */, + 9C95D2C02152386C00079B38 /* SGURLAsset.m */, + 9C6F9027219BE154001051CE /* SGMutableAsset.h */, + 9C6F9028219BE154001051CE /* SGMutableAsset.m */, + 9CE7191B219C408300256485 /* SGSegment.h */, + 9CE7191C219C408300256485 /* SGSegment.m */, + 9CE71923219C47FF00256485 /* SGSegment+Internal.h */, + 9CE71913219C3F7900256485 /* SGURLSegment.h */, + 9CE71914219C3F7900256485 /* SGURLSegment.m */, + 9CC2AD7C22A660080095A081 /* SGPaddingSegment.h */, + 9CC2AD7D22A660080095A081 /* SGPaddingSegment.m */, + 9CF52CF5200F45D700950B81 /* SGTrack.h */, + 9CF52CF6200F45D700950B81 /* SGTrack.m */, + 9CEBCC9B217EF8E900430024 /* SGTrack+Internal.h */, + 9C4190FB21B00FC600134099 /* SGMutableTrack.h */, + 9C4190FC21B00FC600134099 /* SGMutableTrack.m */, + 9C1378AE23026B3A00FE0CFD /* SGTrackSelection.h */, + 9C1378AF23026B3A00FE0CFD /* SGTrackSelection.m */, ); + path = SGAsset; sourceTree = ""; }; - 9CEFA6D71E7122BF00835CAB /* Products */ = { + 9CFA234B230BCFFC00061AAC /* iOS */ = { isa = PBXGroup; children = ( - 9CEFA6D61E7122BF00835CAB /* SGPlayer.framework */, - 9CEFA6EA1E7125C800835CAB /* SGPlayer.framework */, - 9CEFA6F51E7125CC00835CAB /* SGPlayer.framework */, + 9CFA234C230BCFFC00061AAC /* libavutil */, + 9CFA234E230BCFFC00061AAC /* libavformat */, + 9CFA2350230BCFFC00061AAC /* libswscale */, + 9CFA2352230BCFFC00061AAC /* libswresample */, ); - name = Products; + name = iOS; + path = ../../../../build/build/iOS/universal/include; sourceTree = ""; }; - 9CEFA6D81E7122BF00835CAB /* SGPlayer */ = { + 9CFA234C230BCFFC00061AAC /* libavutil */ = { isa = PBXGroup; children = ( - 9CEFA6D91E7122BF00835CAB /* SGPlayer.h */, - 9CEFA6DA1E7122BF00835CAB /* Info.plist */, - 9C478EF31E7139E500AD4289 /* Classes */, + 9CFA234D230BCFFC00061AAC /* imgutils.h */, ); - path = SGPlayer; + path = libavutil; + sourceTree = ""; + }; + 9CFA234E230BCFFC00061AAC /* libavformat */ = { + isa = PBXGroup; + children = ( + 9CFA234F230BCFFC00061AAC /* avformat.h */, + ); + path = libavformat; + sourceTree = ""; + }; + 9CFA2350230BCFFC00061AAC /* libswscale */ = { + isa = PBXGroup; + children = ( + 9CFA2351230BCFFC00061AAC /* swscale.h */, + ); + path = libswscale; + sourceTree = ""; + }; + 9CFA2352230BCFFC00061AAC /* libswresample */ = { + isa = PBXGroup; + children = ( + 9CFA2353230BCFFC00061AAC /* swresample.h */, + ); + path = libswresample; + sourceTree = ""; + }; + 9CFA2358230BD00400061AAC /* macOS */ = { + isa = PBXGroup; + children = ( + 9CFA2359230BD00400061AAC /* libavutil */, + 9CFA235B230BD00400061AAC /* libavformat */, + 9CFA235D230BD00400061AAC /* libswscale */, + 9CFA235F230BD00400061AAC /* libswresample */, + ); + name = macOS; + path = ../../../../build/build/macOS/universal/include; + sourceTree = ""; + }; + 9CFA2359230BD00400061AAC /* libavutil */ = { + isa = PBXGroup; + children = ( + 9CFA235A230BD00400061AAC /* imgutils.h */, + ); + path = libavutil; + sourceTree = ""; + }; + 9CFA235B230BD00400061AAC /* libavformat */ = { + isa = PBXGroup; + children = ( + 9CFA235C230BD00400061AAC /* avformat.h */, + ); + path = libavformat; + sourceTree = ""; + }; + 9CFA235D230BD00400061AAC /* libswscale */ = { + isa = PBXGroup; + children = ( + 9CFA235E230BD00400061AAC /* swscale.h */, + ); + path = libswscale; + sourceTree = ""; + }; + 9CFA235F230BD00400061AAC /* libswresample */ = { + isa = PBXGroup; + children = ( + 9CFA2360230BD00400061AAC /* swresample.h */, + ); + path = libswresample; + sourceTree = ""; + }; + 9CFA2365230BD00C00061AAC /* tvOS */ = { + isa = PBXGroup; + children = ( + 9CFA2366230BD00C00061AAC /* libavutil */, + 9CFA2368230BD00C00061AAC /* libavformat */, + 9CFA236A230BD00C00061AAC /* libswscale */, + 9CFA236C230BD00C00061AAC /* libswresample */, + ); + name = tvOS; + path = ../../../../build/build/tvOS/universal/include; + sourceTree = ""; + }; + 9CFA2366230BD00C00061AAC /* libavutil */ = { + isa = PBXGroup; + children = ( + 9CFA2367230BD00C00061AAC /* imgutils.h */, + ); + path = libavutil; + sourceTree = ""; + }; + 9CFA2368230BD00C00061AAC /* libavformat */ = { + isa = PBXGroup; + children = ( + 9CFA2369230BD00C00061AAC /* avformat.h */, + ); + path = libavformat; + sourceTree = ""; + }; + 9CFA236A230BD00C00061AAC /* libswscale */ = { + isa = PBXGroup; + children = ( + 9CFA236B230BD00C00061AAC /* swscale.h */, + ); + path = libswscale; + sourceTree = ""; + }; + 9CFA236C230BD00C00061AAC /* libswresample */ = { + isa = PBXGroup; + children = ( + 9CFA236D230BD00C00061AAC /* swresample.h */, + ); + path = libswresample; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 9CEFA6D31E7122BF00835CAB /* Headers */ = { + 9C86384021904A0900D730EC /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 9C2535111FAB151500BBFA5C /* frame.h in Headers */, - 9C2534DE1FAB151500BBFA5C /* bswap.h in Headers */, - 9C478F111E713A3200AD4289 /* SGPlayerTrack.h in Headers */, - 9C2535321FAB151500BBFA5C /* intreadwrite.h in Headers */, - 9C478F0B1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */, - 9C478F051E713A3200AD4289 /* SGPlayerAction.h in Headers */, - 9C2534DB1FAB151500BBFA5C /* bprint.h in Headers */, - 9C2534721FAB151500BBFA5C /* avdct.h in Headers */, - 9C2535921FAB151500BBFA5C /* version.h in Headers */, - 9C2534AE1FAB151500BBFA5C /* version.h in Headers */, - 9C2535471FAB151500BBFA5C /* md5.h in Headers */, - 9C25362E1FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */, - 9C478EFF1E713A3200AD4289 /* SGPlayerImp.h in Headers */, - 9C2535171FAB151500BBFA5C /* hmac.h in Headers */, - 9C25346F1FAB151500BBFA5C /* avcodec.h in Headers */, - 9C2534EA1FAB151500BBFA5C /* channel_layout.h in Headers */, - 9C2536101FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */, - 9C2534901FAB151500BBFA5C /* vda.h in Headers */, - 9C25352C1FAB151500BBFA5C /* imgutils.h in Headers */, - 9C5AB68E1E88B2AD0021F460 /* SGGLViewController.h in Headers */, - 9C2534F01FAB151500BBFA5C /* cpu.h in Headers */, - 9C2535621FAB151500BBFA5C /* random_seed.h in Headers */, - 9C478F651E713AC600AD4289 /* SGSensors.h in Headers */, - 9C2535681FAB151500BBFA5C /* rc4.h in Headers */, - 9C25350B1FAB151500BBFA5C /* fifo.h in Headers */, - 9C2535F81FAB151500BBFA5C /* SGFFDecoder.h in Headers */, - 9C2534931FAB151500BBFA5C /* vdpau.h in Headers */, - 9C4793341E713B5400AD4289 /* SGAudioManager.h in Headers */, - 9C25356E1FAB151500BBFA5C /* ripemd.h in Headers */, - 9C2534E41FAB151500BBFA5C /* camellia.h in Headers */, - 9C2535591FAB151500BBFA5C /* pixdesc.h in Headers */, - 9C2535201FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */, - 9C2535771FAB151500BBFA5C /* sha512.h in Headers */, - 9C478F3D1E713AA800AD4289 /* SGPlayerMacro.h in Headers */, - 9C2534B71FAB151500BBFA5C /* version.h in Headers */, - 9C2534C01FAB151500BBFA5C /* aes_ctr.h in Headers */, - 9C25354A1FAB151500BBFA5C /* mem.h in Headers */, - 9C25359E1FAB151500BBFA5C /* swscale.h in Headers */, - 9C2535051FAB151500BBFA5C /* eval.h in Headers */, - 9C2534A21FAB151500BBFA5C /* avfilter.h in Headers */, - 9C25358C1FAB151500BBFA5C /* tree.h in Headers */, - 9C2536341FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */, - 9C5AB6DA1E88E7980021F460 /* SGGLTexture.h in Headers */, - 9C4793251E713B4900AD4289 /* SGDistortionModel.h in Headers */, - 9C9823CA1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */, - 9C2534D81FAB151500BBFA5C /* blowfish.h in Headers */, - 9C25352F1FAB151500BBFA5C /* intfloat.h in Headers */, - 9C2535291FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */, - 9C25351A1FAB151500BBFA5C /* hwcontext.h in Headers */, - 9C5AB6FA1E88F0400021F460 /* SGGLProgramNV12.h in Headers */, - 9C47932B1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */, - 9C2534C91FAB151500BBFA5C /* avassert.h in Headers */, - 9C2536221FAB151500BBFA5C /* SGFFTools.h in Headers */, - 9C2534F91FAB151500BBFA5C /* dict.h in Headers */, - 9C2534CF1FAB151500BBFA5C /* avstring.h in Headers */, - 9C2534BD1FAB151500BBFA5C /* aes.h in Headers */, - 9C2534FC1FAB151500BBFA5C /* display.h in Headers */, - 9C2534781FAB151500BBFA5C /* d3d11va.h in Headers */, - 9C2534961FAB151500BBFA5C /* version.h in Headers */, - 9C2535831FAB151500BBFA5C /* time.h in Headers */, - 9C25347B1FAB151500BBFA5C /* dirac.h in Headers */, - 9C2535411FAB151500BBFA5C /* mastering_display_metadata.h in Headers */, - 9C2534B41FAB151500BBFA5C /* avio.h in Headers */, - 9C5AB6E21E88E8F20021F460 /* SGGLTextureNV12.h in Headers */, - 9C478F4C1E713AA800AD4289 /* SGYUVTools.h in Headers */, - 9C2535081FAB151500BBFA5C /* ffversion.h in Headers */, - 9C2535A11FAB151500BBFA5C /* version.h in Headers */, - 9C2535021FAB151500BBFA5C /* error.h in Headers */, - 9C25353E1FAB151500BBFA5C /* macros.h in Headers */, - 9C25353B1FAB151500BBFA5C /* lzo.h in Headers */, - 9C25356B1FAB151500BBFA5C /* replaygain.h in Headers */, - 9C4792E31E713B4900AD4289 /* SGDisplayView.h in Headers */, - 9C25363A1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */, - 9C25351D1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */, - 9C2535FE1FAB151500BBFA5C /* SGFFFormatContext.h in Headers */, - 9C2534A81FAB151500BBFA5C /* buffersink.h in Headers */, - 9C25349C1FAB151500BBFA5C /* vorbis_parser.h in Headers */, - 9C4792E91E713B4900AD4289 /* SGGLModel.h in Headers */, - 9C2535561FAB151500BBFA5C /* parseutils.h in Headers */, - 9C25348A1FAB151500BBFA5C /* qsv.h in Headers */, - 9C2535861FAB151500BBFA5C /* timecode.h in Headers */, - 9C25358F1FAB151500BBFA5C /* twofish.h in Headers */, - 9C2534D51FAB151500BBFA5C /* base64.h in Headers */, - 9C25357D1FAB151500BBFA5C /* tea.h in Headers */, - 9CEFA6DB1E7122BF00835CAB /* SGPlayer.h in Headers */, - 9C2535141FAB151500BBFA5C /* hash.h in Headers */, - 9C2536041FAB151500BBFA5C /* SGFFFrame.h in Headers */, - 9C2535F21FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */, - 9C2534991FAB151500BBFA5C /* videotoolbox.h in Headers */, - 9C2535951FAB151500BBFA5C /* xtea.h in Headers */, - 9C2534751FAB151500BBFA5C /* avfft.h in Headers */, - 9C2534B11FAB151500BBFA5C /* avformat.h in Headers */, - 9C478F571E713ABB00AD4289 /* SGFingerRotation.h in Headers */, - 9C25360A1FAB151500BBFA5C /* SGFFFramePool.h in Headers */, - 9C5AB7021E88F0560021F460 /* SGGLProgramYUV420.h in Headers */, - 9C4793071E713B4900AD4289 /* SGGLProgram.h in Headers */, - 9C4792DD1E713B4900AD4289 /* SGAVPlayer.h in Headers */, - 9C2534CC1FAB151500BBFA5C /* avconfig.h in Headers */, - 9C2535741FAB151500BBFA5C /* sha.h in Headers */, - 9C2534E71FAB151500BBFA5C /* cast5.h in Headers */, - 9C2534E11FAB151500BBFA5C /* buffer.h in Headers */, - 9C4792EF1E713B4900AD4289 /* SGGLNormalModel.h in Headers */, - 9C25349F1FAB151500BBFA5C /* xvmc.h in Headers */, - 9C2534A51FAB151500BBFA5C /* avfiltergraph.h in Headers */, - 9C2534ED1FAB151500BBFA5C /* common.h in Headers */, - 9C2534FF1FAB151500BBFA5C /* downmix_info.h in Headers */, - 9C2535381FAB151500BBFA5C /* log.h in Headers */, - 9C2535531FAB151500BBFA5C /* opt.h in Headers */, - 9C2534F61FAB151500BBFA5C /* des.h in Headers */, - 9C2534871FAB151500BBFA5C /* mediacodec.h in Headers */, - 9C2536281FAB151500BBFA5C /* SGFFTrack.h in Headers */, - 9C2534C31FAB151500BBFA5C /* attributes.h in Headers */, - 9C2534AB1FAB151500BBFA5C /* buffersrc.h in Headers */, - 9C25361C1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */, - 9C25348D1FAB151500BBFA5C /* vaapi.h in Headers */, - 9C25354D1FAB151500BBFA5C /* motion_vector.h in Headers */, - 9C2535651FAB151500BBFA5C /* rational.h in Headers */, - 9C2536161FAB151500BBFA5C /* SGFFMetadata.h in Headers */, - 9C2534D21FAB151500BBFA5C /* avutil.h in Headers */, - 9C2534C61FAB151500BBFA5C /* audio_fifo.h in Headers */, - 9C25359B1FAB151500BBFA5C /* version.h in Headers */, - 9C25357A1FAB151500BBFA5C /* stereo3d.h in Headers */, - 9C2535801FAB151500BBFA5C /* threadmessage.h in Headers */, - 9C478F401E713AA800AD4289 /* SGPlayerNotification.h in Headers */, - 9C2535EC1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */, - 9C478F461E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */, - 9C2535441FAB151500BBFA5C /* mathematics.h in Headers */, - 9C2534841FAB151500BBFA5C /* jni.h in Headers */, - 9C2535351FAB151500BBFA5C /* lfg.h in Headers */, - 9C25350E1FAB151500BBFA5C /* file.h in Headers */, - 9C2534811FAB151500BBFA5C /* dxva2.h in Headers */, - 9C2536501FAB199500BBFA5C /* SGFFPlayer.h in Headers */, - 9C5AB6F21E88EB720021F460 /* SGGLFrame.h in Headers */, - 9C4792F51E713B4900AD4289 /* SGGLVRModel.h in Headers */, - 9C478F5D1E713ABB00AD4289 /* SGMatrix.h in Headers */, - 9C2535501FAB151500BBFA5C /* murmur3.h in Headers */, - 9C25355F1FAB151500BBFA5C /* pixfmt.h in Headers */, - 9C5AB6EA1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */, - 9C2535231FAB151500BBFA5C /* hwcontext_qsv.h in Headers */, - 9C25347E1FAB151500BBFA5C /* dv_profile.h in Headers */, - 9C2535981FAB151500BBFA5C /* swresample.h in Headers */, - 9C2535261FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */, - 9C2534BA1FAB151500BBFA5C /* adler32.h in Headers */, - 9C25355C1FAB151500BBFA5C /* pixelutils.h in Headers */, - 9C2535891FAB151500BBFA5C /* timestamp.h in Headers */, - 9C2535711FAB151500BBFA5C /* samplefmt.h in Headers */, - 9C2534F31FAB151500BBFA5C /* crc.h in Headers */, + 9C82EEB221AE356D00E9D523 /* SGAudioProcessor.h in Headers */, + 9C86385721904A0900D730EC /* SGPLFScreen.h in Headers */, + 9C86388721904A0900D730EC /* SGDemuxable.h in Headers */, + 9C86385F21904A0900D730EC /* SGURLDemuxer.h in Headers */, + 9C86388F21904A0900D730EC /* SGError.h in Headers */, + 9C86385E21904A0900D730EC /* SGAudioFormatter.h in Headers */, + 9C1F2DE821AF8F1A00D42158 /* SGAudioMixer.h in Headers */, + 9C4190F621AFF17700134099 /* SGAudioMixerUnit.h in Headers */, + 9C86387221904A0900D730EC /* SGSWResample.h in Headers */, + 9C86385B21904A0900D730EC /* SGSWScale.h in Headers */, + 9C3A686421CB77010031DDE1 /* SGSonic.h in Headers */, + 9C661C5C2304074900908563 /* SGPlayerHeader.h in Headers */, + 9C1378A92302681C00FE0CFD /* SGVideoProcessor.h in Headers */, + 9C1378BD23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */, + 9C1378B823026C6700FE0CFD /* SGProcessor.h in Headers */, + 9C1378B123026B3A00FE0CFD /* SGTrackSelection.h in Headers */, + 9C86386121904A0900D730EC /* SGPacket.h in Headers */, + 9C86386021904A0900D730EC /* SGPacketOutput.h in Headers */, + 9C262A3C22B3450F006C8542 /* SGDecoderOptions.h in Headers */, + 9C262A4422B359CC006C8542 /* SGRendererOptions.h in Headers */, + 9C262A3422B344D3006C8542 /* SGDemuxerOptions.h in Headers */, + 9C86385C21904A0900D730EC /* SGFrameOutput.h in Headers */, + 9CC2AD7F22A660080095A081 /* SGPaddingSegment.h in Headers */, + 9C853F1321BFD85D005552C6 /* SGVideoDescriptor.h in Headers */, + 9C525D5221AEC421005C5708 /* SGAudioDescriptor.h in Headers */, + 9C55337221B25EC000119235 /* SGData.h in Headers */, + 9C4190FE21B00FC600134099 /* SGMutableTrack.h in Headers */, + 9C8D6B8522C4A19500985D55 /* SGMetalPlaneModel.h in Headers */, + 9CE71916219C3F7900256485 /* SGURLSegment.h in Headers */, + 9CE7191E219C408300256485 /* SGSegment.h in Headers */, + 9C6F902A219BE154001051CE /* SGMutableAsset.h in Headers */, + 9C8D6B4F22C4A19500985D55 /* SGMetal.h in Headers */, + 9C86384D21904A0900D730EC /* SGOptions.h in Headers */, + 9C86384321904A0900D730EC /* SGCapacity.h in Headers */, + 9C86384721904A0900D730EC /* SGAudioRenderer.h in Headers */, + 9C86384821904A0900D730EC /* SGVideoRenderer.h in Headers */, + 9CFA2362230BD00400061AAC /* avformat.h in Headers */, + 9C0A6F35219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */, + 9C86384921904A0900D730EC /* SGLock.h in Headers */, + 9C86384A21904A0900D730EC /* SGTrack.h in Headers */, + 9C86384B21904A0900D730EC /* SGPlayerItem.h in Headers */, + 9C86384C21904A0900D730EC /* SGURLAsset.h in Headers */, + 9C86384E21904A0900D730EC /* SGVideoFrame.h in Headers */, + 9C86384F21904A0900D730EC /* SGFrame.h in Headers */, + 9C86385021904A0900D730EC /* SGAudioFrame.h in Headers */, + 9C86385121904A0900D730EC /* SGVRViewport.h in Headers */, + 9C86385221904A0900D730EC /* SGTime.h in Headers */, + 9C86385321904A0900D730EC /* SGClock+Internal.h in Headers */, + 9C11816622C4E23200A12FD4 /* SGMetalViewport.h in Headers */, + 9C86385421904A0900D730EC /* SGAsset.h in Headers */, + 9C8D6B8822C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */, + 9C86385621904A0900D730EC /* SGDefines.h in Headers */, + 9C8D6B7622C4A19500985D55 /* SGMetalSphereModel.h in Headers */, + 9C86384421904A0900D730EC /* SGObjectPool.h in Headers */, + 9C86384621904A0900D730EC /* SGObjectQueue.h in Headers */, + 9CB01C94219E863D00B36CFA /* SGMutilDemuxer.h in Headers */, + 9CFA2361230BD00400061AAC /* imgutils.h in Headers */, + 9CE7192A219C48AC00256485 /* SGDemuxerFunnel.h in Headers */, + 9C8D6B5E22C4A19500985D55 /* SGMetalTypes.h in Headers */, + 9C86386221904A0900D730EC /* SGClock.h in Headers */, + 9C8D6B8222C4A19500985D55 /* SGMetalTextureLoader.h in Headers */, + 9C86386421904A0900D730EC /* SGAsset+Internal.h in Headers */, + 9C86386521904A0900D730EC /* SGMacro.h in Headers */, + 9C86386721904A0900D730EC /* SGFFmpeg.h in Headers */, + 9C86386821904A0900D730EC /* SGPLFTargets.h in Headers */, + 9C86386921904A0900D730EC /* SGRenderer+Internal.h in Headers */, + 9C17554A22C5B5B3003A93BC /* SGRenderTimer.h in Headers */, + 9CA57933219DAA270061093B /* SGCodecDescriptor.h in Headers */, + 9C86386B21904A0900D730EC /* SGPLFObject.h in Headers */, + 9C8D6B8B22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */, + 9C86386E21904A0900D730EC /* SGPLFColor.h in Headers */, + 9C86386F21904A0900D730EC /* SGTrack+Internal.h in Headers */, + 9C86387121904A0900D730EC /* SGPLFImage.h in Headers */, + 9C86387321904A0900D730EC /* SGRenderable.h in Headers */, + 9C86387421904A0900D730EC /* SGPLFView.h in Headers */, + 9CFA2363230BD00400061AAC /* swscale.h in Headers */, + 9C8D6B7922C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */, + 9C86387621904A0900D730EC /* SGPlayer.h in Headers */, + 9C86387921904A0900D730EC /* SGDecodeLoop.h in Headers */, + 9C86387B21904A0900D730EC /* SGMapping.h in Headers */, + 9CE71925219C480000256485 /* SGSegment+Internal.h in Headers */, + 9C3A685C21CB76B20031DDE1 /* sonic.h in Headers */, + 9C661C5F230408DE00908563 /* SGDecodable.h in Headers */, + 9C8D6B9722C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */, + 9C935B9D21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */, + 9C86388121904A0900D730EC /* SGPacket+Internal.h in Headers */, + 9C86388321904A0900D730EC /* SGPlayerItem+Internal.h in Headers */, + 9C8D6B7C22C4A19500985D55 /* SGMetalModel.h in Headers */, + 9C86388921904A0900D730EC /* SGVideoDecoder.h in Headers */, + 9C86388E21904A0900D730EC /* SGCodecContext.h in Headers */, + 9C8D6B7F22C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */, + 9CA57923219D69580061093B /* SGTimeLayout.h in Headers */, + 9C65F5B322C5EC2B00AE27DE /* SGMetalProjection.h in Headers */, + 9C0A6F3D219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */, + 9C86389021904A0900D730EC /* SGFrame+Internal.h in Headers */, + 9C86389121904A0900D730EC /* SGVRProjection.h in Headers */, + 9C8D6B7322C4A19500985D55 /* SGMetalRenderer.h in Headers */, + 9CC2AD7722A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */, + 9C86389821904A0900D730EC /* SGActivity.h in Headers */, + 9C86389921904A0900D730EC /* SGAudioDecoder.h in Headers */, + 9C86389F21904A0900D730EC /* SGAudioPlayer.h in Headers */, + 9CFA2364230BD00400061AAC /* swresample.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6E41E7125C800835CAB /* Headers */ = { + 9CD79EE62190068E00E39A7D /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 9C2534941FAB151500BBFA5C /* vdpau.h in Headers */, - 9C2534FD1FAB151500BBFA5C /* display.h in Headers */, - 9C25359C1FAB151500BBFA5C /* version.h in Headers */, - 9C2534CA1FAB151500BBFA5C /* avassert.h in Headers */, - 9C2534AF1FAB151500BBFA5C /* version.h in Headers */, - 9C2534DC1FAB151500BBFA5C /* bprint.h in Headers */, - 9C478F121E713A3200AD4289 /* SGPlayerTrack.h in Headers */, - 9C2534BE1FAB151500BBFA5C /* aes.h in Headers */, - 9C25355D1FAB151500BBFA5C /* pixelutils.h in Headers */, - 9C2534881FAB151500BBFA5C /* mediacodec.h in Headers */, - 9C2535ED1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */, - 9C478F0C1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */, - 9C2534C11FAB151500BBFA5C /* aes_ctr.h in Headers */, - 9C478F061E713A3200AD4289 /* SGPlayerAction.h in Headers */, - 9C2534701FAB151500BBFA5C /* avcodec.h in Headers */, - 9C25350F1FAB151500BBFA5C /* file.h in Headers */, - 9C2536351FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */, - 9C25351B1FAB151500BBFA5C /* hwcontext.h in Headers */, - 9C2535781FAB151500BBFA5C /* sha512.h in Headers */, - 9C2535421FAB151500BBFA5C /* mastering_display_metadata.h in Headers */, - 9C2535181FAB151500BBFA5C /* hmac.h in Headers */, - 9C25347F1FAB151500BBFA5C /* dv_profile.h in Headers */, - 9C2534FA1FAB151500BBFA5C /* dict.h in Headers */, - 9C478F001E713A3200AD4289 /* SGPlayerImp.h in Headers */, - 9C5AB6E31E88E8F20021F460 /* SGGLTextureNV12.h in Headers */, - 9C25362F1FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */, - 9C25357E1FAB151500BBFA5C /* tea.h in Headers */, - 9C2534CD1FAB151500BBFA5C /* avconfig.h in Headers */, - 9C2535151FAB151500BBFA5C /* hash.h in Headers */, - 9C5AB6FB1E88F0400021F460 /* SGGLProgramNV12.h in Headers */, - 9C2536291FAB151500BBFA5C /* SGFFTrack.h in Headers */, - 9C478F3E1E713AA800AD4289 /* SGPlayerMacro.h in Headers */, - 9C2534F11FAB151500BBFA5C /* cpu.h in Headers */, - 9C478F4D1E713AA800AD4289 /* SGYUVTools.h in Headers */, - 9CEFA6E51E7125C800835CAB /* SGPlayer.h in Headers */, - 9C2534A91FAB151500BBFA5C /* buffersink.h in Headers */, - 9C478F581E713ABB00AD4289 /* SGFingerRotation.h in Headers */, - 9C25348B1FAB151500BBFA5C /* qsv.h in Headers */, - 9C2535661FAB151500BBFA5C /* rational.h in Headers */, - 9C2535A21FAB151500BBFA5C /* version.h in Headers */, - 9C25358D1FAB151500BBFA5C /* tree.h in Headers */, - 9C2534821FAB151500BBFA5C /* dxva2.h in Headers */, - 9C25350C1FAB151500BBFA5C /* fifo.h in Headers */, - 9C2535931FAB151500BBFA5C /* version.h in Headers */, - 9C2534F41FAB151500BBFA5C /* crc.h in Headers */, - 9C2536171FAB151500BBFA5C /* SGFFMetadata.h in Headers */, - 9C4793401E713B5C00AD4289 /* SGMacAudioSession.h in Headers */, - 9C2534971FAB151500BBFA5C /* version.h in Headers */, - 9C2535631FAB151500BBFA5C /* random_seed.h in Headers */, - 9C2534F71FAB151500BBFA5C /* des.h in Headers */, - 9C4793261E713B4900AD4289 /* SGDistortionModel.h in Headers */, - 9C2535871FAB151500BBFA5C /* timecode.h in Headers */, - 9C2534DF1FAB151500BBFA5C /* bswap.h in Headers */, - 9C2534C71FAB151500BBFA5C /* audio_fifo.h in Headers */, - 9C2534A61FAB151500BBFA5C /* avfiltergraph.h in Headers */, - 9C25352A1FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */, - 9C2534E21FAB151500BBFA5C /* buffer.h in Headers */, - 9C2534D01FAB151500BBFA5C /* avstring.h in Headers */, - 9C2534D91FAB151500BBFA5C /* blowfish.h in Headers */, - 9C2535391FAB151500BBFA5C /* log.h in Headers */, - 9C2536111FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */, - 9C2535691FAB151500BBFA5C /* rc4.h in Headers */, - 9C25347C1FAB151500BBFA5C /* dirac.h in Headers */, - 9C2534B51FAB151500BBFA5C /* avio.h in Headers */, - 9C2535031FAB151500BBFA5C /* error.h in Headers */, - 9C2534791FAB151500BBFA5C /* d3d11va.h in Headers */, - 9C2535091FAB151500BBFA5C /* ffversion.h in Headers */, - 9C5AB68F1E88B2AD0021F460 /* SGGLViewController.h in Headers */, - 9C25359F1FAB151500BBFA5C /* swscale.h in Headers */, - 9C25349D1FAB151500BBFA5C /* vorbis_parser.h in Headers */, - 9C2535601FAB151500BBFA5C /* pixfmt.h in Headers */, - 9C25353F1FAB151500BBFA5C /* macros.h in Headers */, - 9C5AB6EB1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */, - 9C2534BB1FAB151500BBFA5C /* adler32.h in Headers */, - 9C2534731FAB151500BBFA5C /* avdct.h in Headers */, - 9C47932C1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */, - 9C4792F01E713B4900AD4289 /* SGGLNormalModel.h in Headers */, - 9C2535541FAB151500BBFA5C /* opt.h in Headers */, - 9C2534761FAB151500BBFA5C /* avfft.h in Headers */, - 9C4793351E713B5400AD4289 /* SGAudioManager.h in Headers */, - 9C25363B1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */, - 9C4792DE1E713B4900AD4289 /* SGAVPlayer.h in Headers */, - 9C25356C1FAB151500BBFA5C /* replaygain.h in Headers */, - 9C2535811FAB151500BBFA5C /* threadmessage.h in Headers */, - 9C25349A1FAB151500BBFA5C /* videotoolbox.h in Headers */, - 9C9823CB1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */, - 9C478F411E713AA800AD4289 /* SGPlayerNotification.h in Headers */, - 9C4792E41E713B4900AD4289 /* SGDisplayView.h in Headers */, - 9C2534AC1FAB151500BBFA5C /* buffersrc.h in Headers */, - 9C25354B1FAB151500BBFA5C /* mem.h in Headers */, - 9C5AB6F31E88EB720021F460 /* SGGLFrame.h in Headers */, - 9C2534E81FAB151500BBFA5C /* cast5.h in Headers */, - 9C25353C1FAB151500BBFA5C /* lzo.h in Headers */, - 9C4792F61E713B4900AD4289 /* SGGLVRModel.h in Headers */, - 9C478F471E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */, - 9C5AB7031E88F0560021F460 /* SGGLProgramYUV420.h in Headers */, - 9C2534851FAB151500BBFA5C /* jni.h in Headers */, - 9C2535901FAB151500BBFA5C /* twofish.h in Headers */, - 9C2535121FAB151500BBFA5C /* frame.h in Headers */, - 9C2534D31FAB151500BBFA5C /* avutil.h in Headers */, - 9C2534A01FAB151500BBFA5C /* xvmc.h in Headers */, - 9C4793081E713B4900AD4289 /* SGGLProgram.h in Headers */, - 9C2535001FAB151500BBFA5C /* downmix_info.h in Headers */, - 9C2535FF1FAB151500BBFA5C /* SGFFFormatContext.h in Headers */, - 9C2535241FAB151500BBFA5C /* hwcontext_qsv.h in Headers */, - 9C2535451FAB151500BBFA5C /* mathematics.h in Headers */, - 9C25357B1FAB151500BBFA5C /* stereo3d.h in Headers */, - 9C2535571FAB151500BBFA5C /* parseutils.h in Headers */, - 9C2535211FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */, - 9C2534911FAB151500BBFA5C /* vda.h in Headers */, - 9C2535991FAB151500BBFA5C /* swresample.h in Headers */, - 9C25356F1FAB151500BBFA5C /* ripemd.h in Headers */, - 9C2534EB1FAB151500BBFA5C /* channel_layout.h in Headers */, - 9C25348E1FAB151500BBFA5C /* vaapi.h in Headers */, - 9C2535301FAB151500BBFA5C /* intfloat.h in Headers */, - 9C2535511FAB151500BBFA5C /* murmur3.h in Headers */, - 9C2536051FAB151500BBFA5C /* SGFFFrame.h in Headers */, - 9C25351E1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */, - 9C25361D1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */, - 9C5AB6DB1E88E7980021F460 /* SGGLTexture.h in Headers */, - 9C2535841FAB151500BBFA5C /* time.h in Headers */, - 9C47933E1E713B5C00AD4289 /* SGMacAudioDevice.h in Headers */, - 9C25352D1FAB151500BBFA5C /* imgutils.h in Headers */, - 9C2535961FAB151500BBFA5C /* xtea.h in Headers */, - 9C2534EE1FAB151500BBFA5C /* common.h in Headers */, - 9C25358A1FAB151500BBFA5C /* timestamp.h in Headers */, - 9C2534B81FAB151500BBFA5C /* version.h in Headers */, - 9C2535331FAB151500BBFA5C /* intreadwrite.h in Headers */, - 9C2535F91FAB151500BBFA5C /* SGFFDecoder.h in Headers */, - 9C2536511FAB199500BBFA5C /* SGFFPlayer.h in Headers */, - 9C25354E1FAB151500BBFA5C /* motion_vector.h in Headers */, - 9C2534A31FAB151500BBFA5C /* avfilter.h in Headers */, - 9C2534E51FAB151500BBFA5C /* camellia.h in Headers */, - 9C2534D61FAB151500BBFA5C /* base64.h in Headers */, - 9C2535061FAB151500BBFA5C /* eval.h in Headers */, - 9C2535361FAB151500BBFA5C /* lfg.h in Headers */, - 9C25360B1FAB151500BBFA5C /* SGFFFramePool.h in Headers */, - 9C2535F31FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */, - 9C2535481FAB151500BBFA5C /* md5.h in Headers */, - 9C2535271FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */, - 9C2534B21FAB151500BBFA5C /* avformat.h in Headers */, - 9C2536231FAB151500BBFA5C /* SGFFTools.h in Headers */, - 9C4792EA1E713B4900AD4289 /* SGGLModel.h in Headers */, - 9C2535721FAB151500BBFA5C /* samplefmt.h in Headers */, - 9C2534C41FAB151500BBFA5C /* attributes.h in Headers */, - 9C2535751FAB151500BBFA5C /* sha.h in Headers */, - 9C25355A1FAB151500BBFA5C /* pixdesc.h in Headers */, - 9C478F5E1E713ABB00AD4289 /* SGMatrix.h in Headers */, + 9C82EEB321AE356D00E9D523 /* SGAudioProcessor.h in Headers */, + 9CD79F032190068E00E39A7D /* SGPLFScreen.h in Headers */, + 9CD79F6B2190068E00E39A7D /* SGDemuxable.h in Headers */, + 9CD79F0C2190068E00E39A7D /* SGURLDemuxer.h in Headers */, + 9CD79F802190068E00E39A7D /* SGError.h in Headers */, + 9CD79F0B2190068E00E39A7D /* SGAudioFormatter.h in Headers */, + 9C1F2DE921AF8F1A00D42158 /* SGAudioMixer.h in Headers */, + 9C4190F721AFF17700134099 /* SGAudioMixerUnit.h in Headers */, + 9CD79F372190068E00E39A7D /* SGSWResample.h in Headers */, + 9CD79F082190068E00E39A7D /* SGSWScale.h in Headers */, + 9C3A686521CB77010031DDE1 /* SGSonic.h in Headers */, + 9C661C5D2304074900908563 /* SGPlayerHeader.h in Headers */, + 9C1378AA2302681C00FE0CFD /* SGVideoProcessor.h in Headers */, + 9C1378BE23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */, + 9C1378B923026C6700FE0CFD /* SGProcessor.h in Headers */, + 9C1378B223026B3A00FE0CFD /* SGTrackSelection.h in Headers */, + 9CD79F0E2190068E00E39A7D /* SGPacket.h in Headers */, + 9CD79F0D2190068E00E39A7D /* SGPacketOutput.h in Headers */, + 9C262A3D22B3450F006C8542 /* SGDecoderOptions.h in Headers */, + 9C262A4522B359CC006C8542 /* SGRendererOptions.h in Headers */, + 9C262A3522B344D3006C8542 /* SGDemuxerOptions.h in Headers */, + 9CD79F0A2190068E00E39A7D /* SGFrameOutput.h in Headers */, + 9CC2AD8022A660080095A081 /* SGPaddingSegment.h in Headers */, + 9C853F1421BFD85D005552C6 /* SGVideoDescriptor.h in Headers */, + 9C525D5321AEC421005C5708 /* SGAudioDescriptor.h in Headers */, + 9C55337321B25EC000119235 /* SGData.h in Headers */, + 9C4190FF21B00FC600134099 /* SGMutableTrack.h in Headers */, + 9C8D6B8622C4A19500985D55 /* SGMetalPlaneModel.h in Headers */, + 9CE71917219C3F7900256485 /* SGURLSegment.h in Headers */, + 9CE7191F219C408300256485 /* SGSegment.h in Headers */, + 9C6F902B219BE154001051CE /* SGMutableAsset.h in Headers */, + 9C8D6B5022C4A19500985D55 /* SGMetal.h in Headers */, + 9CD79EF02190068E00E39A7D /* SGOptions.h in Headers */, + 9CD79EE72190068E00E39A7D /* SGCapacity.h in Headers */, + 9CD79EEA2190068E00E39A7D /* SGAudioRenderer.h in Headers */, + 9CD79EEB2190068E00E39A7D /* SGVideoRenderer.h in Headers */, + 9CFA236F230BD00C00061AAC /* avformat.h in Headers */, + 9C0A6F36219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */, + 9CD79EEC2190068E00E39A7D /* SGLock.h in Headers */, + 9CD79EED2190068E00E39A7D /* SGTrack.h in Headers */, + 9CD79EEE2190068E00E39A7D /* SGPlayerItem.h in Headers */, + 9CD79EEF2190068E00E39A7D /* SGURLAsset.h in Headers */, + 9CD79EF12190068E00E39A7D /* SGVideoFrame.h in Headers */, + 9CD79EF22190068E00E39A7D /* SGFrame.h in Headers */, + 9CD79EF32190068E00E39A7D /* SGAudioFrame.h in Headers */, + 9C11816722C4E23200A12FD4 /* SGMetalViewport.h in Headers */, + 9CD79EF42190068E00E39A7D /* SGVRViewport.h in Headers */, + 9C8D6B8922C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */, + 9CB01C95219E863D00B36CFA /* SGMutilDemuxer.h in Headers */, + 9CD79EF52190068E00E39A7D /* SGTime.h in Headers */, + 9C8D6B7722C4A19500985D55 /* SGMetalSphereModel.h in Headers */, + 9CD79EE82190068E00E39A7D /* SGObjectPool.h in Headers */, + 9CD79EE92190068E00E39A7D /* SGObjectQueue.h in Headers */, + 9CD79EFB2190068E00E39A7D /* SGClock+Internal.h in Headers */, + 9CD79EFC2190068E00E39A7D /* SGAsset.h in Headers */, + 9CD79EFF2190068E00E39A7D /* SGDefines.h in Headers */, + 9CFA236E230BD00C00061AAC /* imgutils.h in Headers */, + 9CE7192B219C48AC00256485 /* SGDemuxerFunnel.h in Headers */, + 9C8D6B5F22C4A19500985D55 /* SGMetalTypes.h in Headers */, + 9C8D6B8322C4A19500985D55 /* SGMetalTextureLoader.h in Headers */, + 9CD79F0F2190068E00E39A7D /* SGClock.h in Headers */, + 9CA57934219DAA270061093B /* SGCodecDescriptor.h in Headers */, + 9CD79F122190068E00E39A7D /* SGAsset+Internal.h in Headers */, + 9CD79F132190068E00E39A7D /* SGMacro.h in Headers */, + 9C8D6B8C22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */, + 9CD79F1B2190068E00E39A7D /* SGFFmpeg.h in Headers */, + 9C17554B22C5B5B3003A93BC /* SGRenderTimer.h in Headers */, + 9CD79F232190068E00E39A7D /* SGPLFTargets.h in Headers */, + 9CD79F242190068E00E39A7D /* SGRenderer+Internal.h in Headers */, + 9CD79F272190068E00E39A7D /* SGPLFObject.h in Headers */, + 9CD79F2A2190068E00E39A7D /* SGPLFColor.h in Headers */, + 9CD79F2C2190068E00E39A7D /* SGTrack+Internal.h in Headers */, + 9CD79F352190068E00E39A7D /* SGPLFImage.h in Headers */, + 9C8D6B7A22C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */, + 9CD79F3C2190068E00E39A7D /* SGRenderable.h in Headers */, + 9CFA2370230BD00C00061AAC /* swscale.h in Headers */, + 9CD79F422190068E00E39A7D /* SGPLFView.h in Headers */, + 9CE71926219C480000256485 /* SGSegment+Internal.h in Headers */, + 9CD79F462190068E00E39A7D /* SGPlayer.h in Headers */, + 9CD79F4A2190068E00E39A7D /* SGDecodeLoop.h in Headers */, + 9C661C60230408DF00908563 /* SGDecodable.h in Headers */, + 9C3A685D21CB76B20031DDE1 /* sonic.h in Headers */, + 9C8D6B9822C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */, + 9CD79F4D2190068E00E39A7D /* SGMapping.h in Headers */, + 9C935B9E21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */, + 9CD79F632190068E00E39A7D /* SGPacket+Internal.h in Headers */, + 9CD79F682190068E00E39A7D /* SGPlayerItem+Internal.h in Headers */, + 9C8D6B7D22C4A19500985D55 /* SGMetalModel.h in Headers */, + 9CD79F712190068E00E39A7D /* SGVideoDecoder.h in Headers */, + 9CA57924219D69580061093B /* SGTimeLayout.h in Headers */, + 9C8D6B8022C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */, + 9C65F5B422C5EC2B00AE27DE /* SGMetalProjection.h in Headers */, + 9C0A6F3E219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */, + 9CD79F782190068E00E39A7D /* SGCodecContext.h in Headers */, + 9C8D6B7422C4A19500985D55 /* SGMetalRenderer.h in Headers */, + 9CD79F812190068E00E39A7D /* SGFrame+Internal.h in Headers */, + 9CD79F822190068E00E39A7D /* SGVRProjection.h in Headers */, + 9CC2AD7822A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */, + 9CD79F8C2190068E00E39A7D /* SGActivity.h in Headers */, + 9CD79F8F2190068E00E39A7D /* SGAudioDecoder.h in Headers */, + 9CD79F9C2190068E00E39A7D /* SGAudioPlayer.h in Headers */, + 9CFA2371230BD00C00061AAC /* swresample.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6EF1E7125CC00835CAB /* Headers */ = { + 9CEFA6D31E7122BF00835CAB /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 9C2535191FAB151500BBFA5C /* hmac.h in Headers */, - 9C25348F1FAB151500BBFA5C /* vaapi.h in Headers */, - 9C2535A31FAB151500BBFA5C /* version.h in Headers */, - 9C2534CE1FAB151500BBFA5C /* avconfig.h in Headers */, - 9C25354F1FAB151500BBFA5C /* motion_vector.h in Headers */, - 9C25356A1FAB151500BBFA5C /* rc4.h in Headers */, - 9C2534861FAB151500BBFA5C /* jni.h in Headers */, - 9C25352B1FAB151500BBFA5C /* hwcontext_vdpau.h in Headers */, - 9C25362A1FAB151500BBFA5C /* SGFFTrack.h in Headers */, - 9C2535551FAB151500BBFA5C /* opt.h in Headers */, - 9C2534F81FAB151500BBFA5C /* des.h in Headers */, - 9C2536241FAB151500BBFA5C /* SGFFTools.h in Headers */, - 9C2535F41FAB151500BBFA5C /* SGFFAudioFrame.h in Headers */, - 9C2534DD1FAB151500BBFA5C /* bprint.h in Headers */, - 9C2534E31FAB151500BBFA5C /* buffer.h in Headers */, - 9C2535251FAB151500BBFA5C /* hwcontext_qsv.h in Headers */, - 9C2536121FAB151500BBFA5C /* SGFFFrameQueue.h in Headers */, - 9C2535881FAB151500BBFA5C /* timecode.h in Headers */, - 9C478F131E713A3200AD4289 /* SGPlayerTrack.h in Headers */, - 9C25352E1FAB151500BBFA5C /* imgutils.h in Headers */, - 9C2535911FAB151500BBFA5C /* twofish.h in Headers */, - 9C2535281FAB151500BBFA5C /* hwcontext_vaapi.h in Headers */, - 9C2535EE1FAB151500BBFA5C /* SGFFAudioDecoder.h in Headers */, - 9C9823CC1FAAFFEB00142215 /* SGPlayerBuildConfig.h in Headers */, - 9C5AB6DC1E88E7980021F460 /* SGGLTexture.h in Headers */, - 9C478F0D1E713A3200AD4289 /* SGPlayerDecoder.h in Headers */, - 9C2535821FAB151500BBFA5C /* threadmessage.h in Headers */, - 9C2534B91FAB151500BBFA5C /* version.h in Headers */, - 9C2534921FAB151500BBFA5C /* vda.h in Headers */, - 9C2534981FAB151500BBFA5C /* version.h in Headers */, - 9C2534EC1FAB151500BBFA5C /* channel_layout.h in Headers */, - 9C478F071E713A3200AD4289 /* SGPlayerAction.h in Headers */, - 9C2534D41FAB151500BBFA5C /* avutil.h in Headers */, - 9C478F011E713A3200AD4289 /* SGPlayerImp.h in Headers */, - 9C2535971FAB151500BBFA5C /* xtea.h in Headers */, - 9C25347D1FAB151500BBFA5C /* dirac.h in Headers */, - 9C2534711FAB151500BBFA5C /* avcodec.h in Headers */, - 9C2536181FAB151500BBFA5C /* SGFFMetadata.h in Headers */, - 9C5AB6EC1E88E90B0021F460 /* SGGLTextureYUV420.h in Headers */, - 9C25360C1FAB151500BBFA5C /* SGFFFramePool.h in Headers */, - 9C4793271E713B4900AD4289 /* SGDistortionModel.h in Headers */, - 9C2534AD1FAB151500BBFA5C /* buffersrc.h in Headers */, - 9C25358E1FAB151500BBFA5C /* tree.h in Headers */, - 9C2534E61FAB151500BBFA5C /* camellia.h in Headers */, - 9C2534771FAB151500BBFA5C /* avfft.h in Headers */, - 9C2534A41FAB151500BBFA5C /* avfilter.h in Headers */, - 9C2534D71FAB151500BBFA5C /* base64.h in Headers */, - 9C25350D1FAB151500BBFA5C /* fifo.h in Headers */, - 9C2534741FAB151500BBFA5C /* avdct.h in Headers */, - 9C2534AA1FAB151500BBFA5C /* buffersink.h in Headers */, - 9C2535731FAB151500BBFA5C /* samplefmt.h in Headers */, - 9C2534F21FAB151500BBFA5C /* cpu.h in Headers */, - 9C2535461FAB151500BBFA5C /* mathematics.h in Headers */, - 9C2535A01FAB151500BBFA5C /* swscale.h in Headers */, - 9C2534E01FAB151500BBFA5C /* bswap.h in Headers */, - 9C2534BC1FAB151500BBFA5C /* adler32.h in Headers */, - 9C25351F1FAB151500BBFA5C /* hwcontext_cuda.h in Headers */, - 9C2535101FAB151500BBFA5C /* file.h in Headers */, - 9C2534801FAB151500BBFA5C /* dv_profile.h in Headers */, - 9C2535941FAB151500BBFA5C /* version.h in Headers */, - 9C2534D11FAB151500BBFA5C /* avstring.h in Headers */, - 9C478F3F1E713AA800AD4289 /* SGPlayerMacro.h in Headers */, - 9C2535791FAB151500BBFA5C /* sha512.h in Headers */, - 9C2535671FAB151500BBFA5C /* rational.h in Headers */, - 9C2534CB1FAB151500BBFA5C /* avassert.h in Headers */, - 9C4792DF1E713B4900AD4289 /* SGAVPlayer.h in Headers */, - 9C2535FA1FAB151500BBFA5C /* SGFFDecoder.h in Headers */, - 9C25357C1FAB151500BBFA5C /* stereo3d.h in Headers */, - 9C2534EF1FAB151500BBFA5C /* common.h in Headers */, - 9C25357F1FAB151500BBFA5C /* tea.h in Headers */, - 9C478F4E1E713AA800AD4289 /* SGYUVTools.h in Headers */, - 9C2536061FAB151500BBFA5C /* SGFFFrame.h in Headers */, - 9C25359D1FAB151500BBFA5C /* version.h in Headers */, - 9C2535371FAB151500BBFA5C /* lfg.h in Headers */, - 9C2535341FAB151500BBFA5C /* intreadwrite.h in Headers */, - 9C2536001FAB151500BBFA5C /* SGFFFormatContext.h in Headers */, - 9C25355B1FAB151500BBFA5C /* pixdesc.h in Headers */, - 9C2534A11FAB151500BBFA5C /* xvmc.h in Headers */, - 9C2535581FAB151500BBFA5C /* parseutils.h in Headers */, - 9CEFA6F01E7125CC00835CAB /* SGPlayer.h in Headers */, - 9C478F591E713ABB00AD4289 /* SGFingerRotation.h in Headers */, - 9C4792EB1E713B4900AD4289 /* SGGLModel.h in Headers */, - 9C2535161FAB151500BBFA5C /* hash.h in Headers */, - 9C2536521FAB199500BBFA5C /* SGFFPlayer.h in Headers */, - 9C2534C51FAB151500BBFA5C /* attributes.h in Headers */, - 9C5AB6FC1E88F0400021F460 /* SGGLProgramNV12.h in Headers */, - 9C4792E51E713B4900AD4289 /* SGDisplayView.h in Headers */, - 9C2534FE1FAB151500BBFA5C /* display.h in Headers */, - 9C25347A1FAB151500BBFA5C /* d3d11va.h in Headers */, - 9C2535131FAB151500BBFA5C /* frame.h in Headers */, - 9C2535611FAB151500BBFA5C /* pixfmt.h in Headers */, - 9C4793091E713B4900AD4289 /* SGGLProgram.h in Headers */, - 9C2535071FAB151500BBFA5C /* eval.h in Headers */, - 9C2535701FAB151500BBFA5C /* ripemd.h in Headers */, - 9C2535491FAB151500BBFA5C /* md5.h in Headers */, - 9C2534BF1FAB151500BBFA5C /* aes.h in Headers */, - 9C2534B31FAB151500BBFA5C /* avformat.h in Headers */, - 9C2534F51FAB151500BBFA5C /* crc.h in Headers */, - 9C2535761FAB151500BBFA5C /* sha.h in Headers */, - 9C25354C1FAB151500BBFA5C /* mem.h in Headers */, - 9C478F421E713AA800AD4289 /* SGPlayerNotification.h in Headers */, - 9C4793361E713B5400AD4289 /* SGAudioManager.h in Headers */, - 9C2535011FAB151500BBFA5C /* downmix_info.h in Headers */, - 9C2535401FAB151500BBFA5C /* macros.h in Headers */, - 9C2535641FAB151500BBFA5C /* random_seed.h in Headers */, - 9C25361E1FAB151500BBFA5C /* SGFFPacketQueue.h in Headers */, - 9C2534831FAB151500BBFA5C /* dxva2.h in Headers */, - 9C2534A71FAB151500BBFA5C /* avfiltergraph.h in Headers */, - 9C2535221FAB151500BBFA5C /* hwcontext_dxva2.h in Headers */, - 9C25363C1FAB151500BBFA5C /* SGFFVideoToolBox.h in Headers */, - 9C2534B01FAB151500BBFA5C /* version.h in Headers */, - 9C25351C1FAB151500BBFA5C /* hwcontext.h in Headers */, - 9C2536361FAB151500BBFA5C /* SGFFVideoFrame.h in Headers */, - 9C2534FB1FAB151500BBFA5C /* dict.h in Headers */, - 9C2534C21FAB151500BBFA5C /* aes_ctr.h in Headers */, - 9C2534E91FAB151500BBFA5C /* cast5.h in Headers */, - 9C25349B1FAB151500BBFA5C /* videotoolbox.h in Headers */, - 9C5AB6F41E88EB720021F460 /* SGGLFrame.h in Headers */, - 9C25359A1FAB151500BBFA5C /* swresample.h in Headers */, - 9C2535521FAB151500BBFA5C /* murmur3.h in Headers */, - 9C2534B61FAB151500BBFA5C /* avio.h in Headers */, - 9C25358B1FAB151500BBFA5C /* timestamp.h in Headers */, - 9C2535041FAB151500BBFA5C /* error.h in Headers */, - 9C2534C81FAB151500BBFA5C /* audio_fifo.h in Headers */, - 9C2535311FAB151500BBFA5C /* intfloat.h in Headers */, - 9C4792F71E713B4900AD4289 /* SGGLVRModel.h in Headers */, - 9C25350A1FAB151500BBFA5C /* ffversion.h in Headers */, - 9C2534951FAB151500BBFA5C /* vdpau.h in Headers */, - 9C5AB6901E88B2AD0021F460 /* SGGLViewController.h in Headers */, - 9C47932D1E713B4900AD4289 /* SGDistortionRenderer.h in Headers */, - 9C25353D1FAB151500BBFA5C /* lzo.h in Headers */, - 9C5AB7041E88F0560021F460 /* SGGLProgramYUV420.h in Headers */, - 9C478F481E713AA800AD4289 /* SGPlayer+DisplayView.h in Headers */, - 9C25348C1FAB151500BBFA5C /* qsv.h in Headers */, - 9C25356D1FAB151500BBFA5C /* replaygain.h in Headers */, - 9C4792F11E713B4900AD4289 /* SGGLNormalModel.h in Headers */, - 9C2536301FAB151500BBFA5C /* SGFFVideoDecoder.h in Headers */, - 9C5AB6E41E88E8F20021F460 /* SGGLTextureNV12.h in Headers */, - 9C2535851FAB151500BBFA5C /* time.h in Headers */, - 9C25355E1FAB151500BBFA5C /* pixelutils.h in Headers */, - 9C2534891FAB151500BBFA5C /* mediacodec.h in Headers */, - 9C25349E1FAB151500BBFA5C /* vorbis_parser.h in Headers */, - 9C2535431FAB151500BBFA5C /* mastering_display_metadata.h in Headers */, - 9C25353A1FAB151500BBFA5C /* log.h in Headers */, - 9C2534DA1FAB151500BBFA5C /* blowfish.h in Headers */, - 9C478F5F1E713ABB00AD4289 /* SGMatrix.h in Headers */, + 9CE6F54B2004D97D00D1F4C8 /* SGPLFScreen.h in Headers */, + 9C0DF028215A2FB9007142DB /* SGDemuxable.h in Headers */, + 9C95D2BE2152335400079B38 /* SGURLDemuxer.h in Headers */, + 9C8D4E80200E1ACA00ED8A58 /* SGError.h in Headers */, + 9C66E1FA2188526200B70DAA /* SGAudioFormatter.h in Headers */, + 9C1F2DE721AF8F1A00D42158 /* SGAudioMixer.h in Headers */, + 9C4190F521AFF17700134099 /* SGAudioMixerUnit.h in Headers */, + 9C66E1FE2188550D00B70DAA /* SGSWResample.h in Headers */, + 9C37487B2135521D00572166 /* SGSWScale.h in Headers */, + 9C3A686321CB77010031DDE1 /* SGSonic.h in Headers */, + 9C661C5B2304074900908563 /* SGPlayerHeader.h in Headers */, + 9C1378A82302681C00FE0CFD /* SGVideoProcessor.h in Headers */, + 9C82EEB121AE356D00E9D523 /* SGAudioProcessor.h in Headers */, + 9C1378BC23029F2E00FE0CFD /* SGProcessorOptions.h in Headers */, + 9C1378B723026C6700FE0CFD /* SGProcessor.h in Headers */, + 9CFA2355230BCFFC00061AAC /* avformat.h in Headers */, + 9CC2AD7E22A660080095A081 /* SGPaddingSegment.h in Headers */, + 9C1378B023026B3A00FE0CFD /* SGTrackSelection.h in Headers */, + 9C262A3B22B3450F006C8542 /* SGDecoderOptions.h in Headers */, + 9C262A4322B359CC006C8542 /* SGRendererOptions.h in Headers */, + 9C65F5B222C5EC2B00AE27DE /* SGMetalProjection.h in Headers */, + 9C262A3322B344D3006C8542 /* SGDemuxerOptions.h in Headers */, + 9C2C55AD2015D1D200131E15 /* SGPacket.h in Headers */, + 9C8D4E63200E0ACC00ED8A58 /* SGPacketOutput.h in Headers */, + 9C29D112217D741500343975 /* SGFrameOutput.h in Headers */, + 9CFA2356230BCFFC00061AAC /* swscale.h in Headers */, + 9C853F1221BFD85D005552C6 /* SGVideoDescriptor.h in Headers */, + 9C525D5121AEC421005C5708 /* SGAudioDescriptor.h in Headers */, + 9C55337121B25EC000119235 /* SGData.h in Headers */, + 9CE71915219C3F7900256485 /* SGURLSegment.h in Headers */, + 9C11816522C4E23200A12FD4 /* SGMetalViewport.h in Headers */, + 9C4190FD21B00FC600134099 /* SGMutableTrack.h in Headers */, + 9CE7191D219C408300256485 /* SGSegment.h in Headers */, + 9C6F9029219BE154001051CE /* SGMutableAsset.h in Headers */, + 9C43D50D2187037200235169 /* SGOptions.h in Headers */, + 9CC649FF2181A8C000453B3E /* SGCapacity.h in Headers */, + 9CF15E072011AE0700585326 /* SGAudioRenderer.h in Headers */, + 9C2C55A32015C1E100131E15 /* SGVideoRenderer.h in Headers */, + 9C43D51121872D3F00235169 /* SGLock.h in Headers */, + 9CF52CF7200F45D700950B81 /* SGTrack.h in Headers */, + 9C8D4E48200DFFC700ED8A58 /* SGPlayerItem.h in Headers */, + 9C95D2C12152386C00079B38 /* SGURLAsset.h in Headers */, + 9C2C559B2015B87400131E15 /* SGVideoFrame.h in Headers */, + 9C389ACC20108C2E003259FF /* SGFrame.h in Headers */, + 9CF15E1F2011BC5400585326 /* SGAudioFrame.h in Headers */, + 9C935B9C21CCCA58007813F4 /* SGDescriptor+Internal.h in Headers */, + 9C8D6B9622C4A19500985D55 /* SGMetalBGRARenderPipeline.h in Headers */, + 9C8D6B7E22C4A19500985D55 /* SGMetalRenderPipelinePool.h in Headers */, + 9CAAC99F2133A6800065E364 /* SGVRViewport.h in Headers */, + 9C4663CA20D0F83600CADDA7 /* SGTime.h in Headers */, + 9C26CF57218D787D009FFCC4 /* SGClock+Internal.h in Headers */, + 9C8D6B7B22C4A19500985D55 /* SGMetalModel.h in Headers */, + 9CF63FC2211D8E33001B2684 /* SGAsset.h in Headers */, + 9CA0F56420E0E24000501478 /* SGDefines.h in Headers */, + 9CEBCCA2217F109000430024 /* SGPacket+Internal.h in Headers */, + 9C0A6F3C219C36300027D5B1 /* SGSegmentDemuxer.h in Headers */, + 9CB01C93219E863D00B36CFA /* SGMutilDemuxer.h in Headers */, + 9C0A6F34219C33EA0027D5B1 /* SGTrackDemuxer.h in Headers */, + 9C8D6B7822C4A19500985D55 /* SGMetalNV12RenderPipeline.h in Headers */, + 9CE71929219C48AC00256485 /* SGDemuxerFunnel.h in Headers */, + 9C2C55932015911600131E15 /* SGObjectPool.h in Headers */, + 9C2C55B52015D92100131E15 /* SGObjectQueue.h in Headers */, + 9CE71924219C480000256485 /* SGSegment+Internal.h in Headers */, + 9C26CF58218D7A2B009FFCC4 /* SGClock.h in Headers */, + 9C8D6B4E22C4A19500985D55 /* SGMetal.h in Headers */, + 9C0B6CB3217D823500900F1E /* SGAsset+Internal.h in Headers */, + 9CE6F5A22004E7ED00D1F4C8 /* SGMacro.h in Headers */, + 9CB61F5F2112B93C00F5BE6B /* SGFFmpeg.h in Headers */, + 9CFA2354230BCFFC00061AAC /* imgutils.h in Headers */, + 9C661C5E230408DE00908563 /* SGDecodable.h in Headers */, + 9CE6F5772004D97D00D1F4C8 /* SGPLFTargets.h in Headers */, + 9CDFC3E6218B10F00065C826 /* SGRenderer+Internal.h in Headers */, + 9CE6F5472004D97D00D1F4C8 /* SGPLFObject.h in Headers */, + 9CE6F52F2004D97D00D1F4C8 /* SGPLFColor.h in Headers */, + 9CEBCC9D217EF8E900430024 /* SGTrack+Internal.h in Headers */, + 9C8D6B8422C4A19500985D55 /* SGMetalPlaneModel.h in Headers */, + 9CE6F53F2004D97D00D1F4C8 /* SGPLFImage.h in Headers */, + 9CF15E022011ADB500585326 /* SGRenderable.h in Headers */, + 9CE6F5532004D97D00D1F4C8 /* SGPLFView.h in Headers */, + 9CC2AD7622A65C7B0095A081 /* SGPaddingDemuxer.h in Headers */, + 9C2536501FAB199500BBFA5C /* SGPlayer.h in Headers */, + 9CF15DE520118E1100585326 /* SGDecodeLoop.h in Headers */, + 9C1D222A201B1DA2005147FB /* SGMapping.h in Headers */, + 9CA57922219D69580061093B /* SGTimeLayout.h in Headers */, + 9C8D6B5D22C4A19500985D55 /* SGMetalTypes.h in Headers */, + 9CC649FB21818D8C00453B3E /* SGPlayerItem+Internal.h in Headers */, + 9C8D6B8722C4A19500985D55 /* SGMetalYUVRenderPipeline.h in Headers */, + 9CA57932219DAA270061093B /* SGCodecDescriptor.h in Headers */, + 9C8D6B8122C4A19500985D55 /* SGMetalTextureLoader.h in Headers */, + 9C3082C3212518EC00B44298 /* SGVideoDecoder.h in Headers */, + 9C8D6B8A22C4A19500985D55 /* SGMetalRenderPipeline.h in Headers */, + 9C3082C721251AC200B44298 /* SGCodecContext.h in Headers */, + 9C8D6B7222C4A19500985D55 /* SGMetalRenderer.h in Headers */, + 9CEBCCA8217F19BE00430024 /* SGFrame+Internal.h in Headers */, + 9C3A685B21CB76B20031DDE1 /* sonic.h in Headers */, + 9C03E5F0212E645B001F0E1B /* SGVRProjection.h in Headers */, + 9C03E5EC212E616B001F0E1B /* SGMotionSensor.h in Headers */, + 9CFA2357230BCFFC00061AAC /* swresample.h in Headers */, + 9C329AAA2005E3F800252B10 /* SGActivity.h in Headers */, + 9C3082D0212521AB00B44298 /* SGAudioDecoder.h in Headers */, + 9CE68430200DD12F007BD834 /* SGAudioPlayer.h in Headers */, + 9C8D6B7522C4A19500985D55 /* SGMetalSphereModel.h in Headers */, + 9C17554922C5B5B3003A93BC /* SGRenderTimer.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 9CEFA6D51E7122BF00835CAB /* SGPlayer iOS */ = { + 9C8637F521904A0900D730EC /* SGPlayer macOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 9CEFA6DE1E7122BF00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer iOS" */; + buildConfigurationList = 9C8638A221904A0900D730EC /* Build configuration list for PBXNativeTarget "SGPlayer macOS" */; buildPhases = ( - 9CEFA6D11E7122BF00835CAB /* Sources */, - 9CEFA6D21E7122BF00835CAB /* Frameworks */, - 9CEFA6D31E7122BF00835CAB /* Headers */, - 9CEFA6D41E7122BF00835CAB /* Resources */, + 9C8637F621904A0900D730EC /* Sources */, + 9C86383321904A0900D730EC /* Frameworks */, + 9C86384021904A0900D730EC /* Headers */, + 9C8638A121904A0900D730EC /* Resources */, ); buildRules = ( ); dependencies = ( - 9C2CEFF81F10CA930099247F /* PBXTargetDependency */, ); - name = "SGPlayer iOS"; + name = "SGPlayer macOS"; productName = SGPlayer; - productReference = 9CEFA6D61E7122BF00835CAB /* SGPlayer.framework */; + productReference = 9C8638A521904A0900D730EC /* SGPlayer.framework */; productType = "com.apple.product-type.framework"; }; - 9CEFA6E11E7125C800835CAB /* SGPlayer macOS */ = { + 9CD79E9C2190068E00E39A7D /* SGPlayer tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 9CEFA6E71E7125C800835CAB /* Build configuration list for PBXNativeTarget "SGPlayer macOS" */; + buildConfigurationList = 9CD79FA32190068E00E39A7D /* Build configuration list for PBXNativeTarget "SGPlayer tvOS" */; buildPhases = ( - 9CEFA6E21E7125C800835CAB /* Sources */, - 9CEFA6E31E7125C800835CAB /* Frameworks */, - 9CEFA6E41E7125C800835CAB /* Headers */, - 9CEFA6E61E7125C800835CAB /* Resources */, + 9CD79E9D2190068E00E39A7D /* Sources */, + 9CD79EDA2190068E00E39A7D /* Frameworks */, + 9CD79EE62190068E00E39A7D /* Headers */, + 9CD79FA22190068E00E39A7D /* Resources */, ); buildRules = ( ); dependencies = ( - 9C2CEFFD1F10CA970099247F /* PBXTargetDependency */, ); - name = "SGPlayer macOS"; + name = "SGPlayer tvOS"; productName = SGPlayer; - productReference = 9CEFA6EA1E7125C800835CAB /* SGPlayer.framework */; + productReference = 9CD79FA62190068E00E39A7D /* SGPlayer.framework */; productType = "com.apple.product-type.framework"; }; - 9CEFA6EC1E7125CC00835CAB /* SGPlayer tvOS */ = { + 9CEFA6D51E7122BF00835CAB /* SGPlayer iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 9CEFA6F21E7125CC00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer tvOS" */; + buildConfigurationList = 9CEFA6DE1E7122BF00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer iOS" */; buildPhases = ( - 9CEFA6ED1E7125CC00835CAB /* Sources */, - 9CEFA6EE1E7125CC00835CAB /* Frameworks */, - 9CEFA6EF1E7125CC00835CAB /* Headers */, - 9CEFA6F11E7125CC00835CAB /* Resources */, + 9CEFA6D11E7122BF00835CAB /* Sources */, + 9CEFA6D21E7122BF00835CAB /* Frameworks */, + 9CEFA6D31E7122BF00835CAB /* Headers */, + 9CEFA6D41E7122BF00835CAB /* Resources */, ); buildRules = ( ); dependencies = ( - 9C2CEFFF1F10CA9B0099247F /* PBXTargetDependency */, ); - name = "SGPlayer tvOS"; + name = "SGPlayer iOS"; productName = SGPlayer; - productReference = 9CEFA6F51E7125CC00835CAB /* SGPlayer.framework */; + productReference = 9CEFA6D61E7122BF00835CAB /* SGPlayer.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -1899,17 +1954,17 @@ 9CEFA6CD1E7122BF00835CAB /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = single; TargetAttributes = { - 9CEFA6D51E7122BF00835CAB = { - CreatedOnToolsVersion = 8.2.1; + 9C8637F521904A0900D730EC = { ProvisioningStyle = Automatic; }; - 9CEFA6E11E7125C800835CAB = { + 9CD79E9C2190068E00E39A7D = { ProvisioningStyle = Automatic; }; - 9CEFA6EC1E7125CC00835CAB = { + 9CEFA6D51E7122BF00835CAB = { + CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; }; }; @@ -1924,61 +1979,31 @@ mainGroup = 9CEFA6CC1E7122BF00835CAB; productRefGroup = 9CEFA6D71E7122BF00835CAB /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 9C0912371E71283100E5AA46 /* Products */; - ProjectRef = 9C0912361E71283100E5AA46 /* SGPlatform.xcodeproj */; - }, - ); projectRoot = ""; targets = ( 9CEFA6D51E7122BF00835CAB /* SGPlayer iOS */, - 9CEFA6E11E7125C800835CAB /* SGPlayer macOS */, - 9CEFA6EC1E7125CC00835CAB /* SGPlayer tvOS */, + 9C8637F521904A0900D730EC /* SGPlayer macOS */, + 9CD79E9C2190068E00E39A7D /* SGPlayer tvOS */, ); }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - 9C09123D1E71283100E5AA46 /* SGPlatform.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SGPlatform.framework; - remoteRef = 9C09123C1E71283100E5AA46 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9C09123F1E71283100E5AA46 /* SGPlatform.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SGPlatform.framework; - remoteRef = 9C09123E1E71283100E5AA46 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 9C0912411E71283100E5AA46 /* SGPlatform.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SGPlatform.framework; - remoteRef = 9C0912401E71283100E5AA46 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ - 9CEFA6D41E7122BF00835CAB /* Resources */ = { + 9C8638A121904A0900D730EC /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6E61E7125C800835CAB /* Resources */ = { + 9CD79FA22190068E00E39A7D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6F11E7125CC00835CAB /* Resources */ = { + 9CEFA6D41E7122BF00835CAB /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -1988,171 +2013,415 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 9CEFA6D11E7122BF00835CAB /* Sources */ = { + 9C8637F621904A0900D730EC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C2536191FAB151500BBFA5C /* SGFFMetadata.m in Sources */, - 9C2536251FAB151500BBFA5C /* SGFFTools.m in Sources */, - 9C2536311FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */, - 9C4792F81E713B4900AD4289 /* SGGLVRModel.m in Sources */, - 9C5AB7051E88F0560021F460 /* SGGLProgramYUV420.m in Sources */, - 9C4792EC1E713B4900AD4289 /* SGGLModel.m in Sources */, - 9C478F081E713A3200AD4289 /* SGPlayerAction.m in Sources */, - 9C478F0E1E713A3200AD4289 /* SGPlayerDecoder.m in Sources */, - 9C478F5A1E713ABB00AD4289 /* SGFingerRotation.m in Sources */, - 9C478F431E713AA800AD4289 /* SGPlayerNotification.m in Sources */, - 9C2535EF1FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */, - 9C2536071FAB151500BBFA5C /* SGFFFrame.m in Sources */, - 9C2535FB1FAB151500BBFA5C /* SGFFDecoder.m in Sources */, - 9C47930A1E713B4900AD4289 /* SGGLProgram.m in Sources */, - 9C4793281E713B4900AD4289 /* SGDistortionModel.m in Sources */, - 9C478F4F1E713AA800AD4289 /* SGYUVTools.m in Sources */, - 9C5AB6ED1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */, - 9C5AB6FD1E88F0400021F460 /* SGGLProgramNV12.m in Sources */, - 9C2536131FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */, - 9C4793371E713B5400AD4289 /* SGAudioManager.m in Sources */, - 9C4792E01E713B4900AD4289 /* SGAVPlayer.m in Sources */, - 9C2536531FAB199500BBFA5C /* SGFFPlayer.m in Sources */, - 9C4792F21E713B4900AD4289 /* SGGLNormalModel.m in Sources */, - 9C5AB6DD1E88E7980021F460 /* SGGLTexture.m in Sources */, - 9C4792E61E713B4900AD4289 /* SGDisplayView.m in Sources */, - 9C25361F1FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */, - 9C2535F51FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */, - 9C25360D1FAB151500BBFA5C /* SGFFFramePool.m in Sources */, - 9C2536371FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */, - 9C5AB6E51E88E8F20021F460 /* SGGLTextureNV12.m in Sources */, - 9C478F661E713AC600AD4289 /* SGSensors.m in Sources */, - 9C478F141E713A3200AD4289 /* SGPlayerTrack.m in Sources */, - 9C478F491E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */, - 9C2536011FAB151500BBFA5C /* SGFFFormatContext.m in Sources */, - 9C25363D1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */, - 9C5AB6F51E88EB720021F460 /* SGGLFrame.m in Sources */, - 9C478F601E713ABB00AD4289 /* SGMatrix.m in Sources */, - 9C5AB6911E88B2AD0021F460 /* SGGLViewController.m in Sources */, - 9C478F021E713A3200AD4289 /* SGPlayerImp.m in Sources */, - 9C25362B1FAB151500BBFA5C /* SGFFTrack.m in Sources */, - 9C47932E1E713B4900AD4289 /* SGDistortionRenderer.m in Sources */, + 9C4190F921AFF17700134099 /* SGAudioMixerUnit.m in Sources */, + 9C8637F721904A0900D730EC /* SGPlayerItem.m in Sources */, + 9C8637F821904A0900D730EC /* SGFrame.m in Sources */, + 9C8637F921904A0900D730EC /* SGPacket.m in Sources */, + 9C8637FA21904A0900D730EC /* SGObjectPool.m in Sources */, + 9C8637FC21904A0900D730EC /* SGVideoFrame.m in Sources */, + 9C8637FD21904A0900D730EC /* SGClock.m in Sources */, + 9C8637FE21904A0900D730EC /* SGPLFImage.m in Sources */, + 9C41910121B00FC600134099 /* SGMutableTrack.m in Sources */, + 9C65F5B622C5EC2B00AE27DE /* SGMetalProjection.m in Sources */, + 9C8637FF21904A0900D730EC /* SGObjectQueue.m in Sources */, + 9CA57936219DAA270061093B /* SGCodecDescriptor.m in Sources */, + 9CE71921219C408300256485 /* SGSegment.m in Sources */, + 9C86380221904A0900D730EC /* SGVRProjection.m in Sources */, + 9C86380521904A0900D730EC /* SGLock.m in Sources */, + 9C86380621904A0900D730EC /* SGAudioRenderer.m in Sources */, + 9C86380A21904A0900D730EC /* SGAudioPlayer.m in Sources */, + 9C1378AC2302681C00FE0CFD /* SGVideoProcessor.m in Sources */, + 9C86380B21904A0900D730EC /* SGTrack.m in Sources */, + 9C86380C21904A0900D730EC /* SGPlayer.m in Sources */, + 9C8D6B8E22C4A19500985D55 /* SGMetalRenderer.m in Sources */, + 9CB01C97219E863D00B36CFA /* SGMutilDemuxer.m in Sources */, + 9C86380E21904A0900D730EC /* SGMapping.m in Sources */, + 9CC2AD7A22A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */, + 9C6F902D219BE154001051CE /* SGMutableAsset.m in Sources */, + 9C86381121904A0900D730EC /* SGFrameOutput.m in Sources */, + 9C86381221904A0900D730EC /* SGCapacity.m in Sources */, + 9C86381321904A0900D730EC /* SGActivity.m in Sources */, + 9C8D6B4C22C4A19500985D55 /* SGMetalSphereModel.m in Sources */, + 9C86381421904A0900D730EC /* SGError.m in Sources */, + 9C86381521904A0900D730EC /* SGURLDemuxer.m in Sources */, + 9C86381721904A0900D730EC /* SGVideoDecoder.m in Sources */, + 9C3A685F21CB76B20031DDE1 /* sonic.c in Sources */, + 9C525D5521AEC421005C5708 /* SGAudioDescriptor.m in Sources */, + 9C86381921904A0900D730EC /* SGSWResample.m in Sources */, + 9C86381A21904A0900D730EC /* SGVideoRenderer.m in Sources */, + 9C86381B21904A0900D730EC /* SGPLFScreen.m in Sources */, + 9C86381D21904A0900D730EC /* SGAudioFormatter.m in Sources */, + 9C86381E21904A0900D730EC /* SGFFmpeg.m in Sources */, + 9C0A6F38219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */, + 9C8D6B9422C4A19500985D55 /* SGMetalShader.metal in Sources */, + 9C1F2DEB21AF8F1A00D42158 /* SGAudioMixer.m in Sources */, + 9C82EEB521AE356D00E9D523 /* SGAudioProcessor.m in Sources */, + 9C11816922C4E23200A12FD4 /* SGMetalViewport.m in Sources */, + 9C1378C023029F2E00FE0CFD /* SGProcessorOptions.m in Sources */, + 9C8D6B6722C4A19500985D55 /* SGMetalPlaneModel.m in Sources */, + 9C0A6F40219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */, + 9C86382021904A0900D730EC /* SGPacketOutput.m in Sources */, + 9C86382121904A0900D730EC /* SGPLFColor.m in Sources */, + 9C8D6B6D22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */, + 9C1378B423026B3A00FE0CFD /* SGTrackSelection.m in Sources */, + 9CE71919219C3F7900256485 /* SGURLSegment.m in Sources */, + 9C262A3F22B3450F006C8542 /* SGDecoderOptions.m in Sources */, + 9C8D6B6422C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */, + 9C8D6B5B22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */, + 9C86382321904A0900D730EC /* SGPLFView.m in Sources */, + 9C8D6B5822C4A19500985D55 /* SGMetalModel.m in Sources */, + 9C86382521904A0900D730EC /* SGSWScale.m in Sources */, + 9C86382621904A0900D730EC /* SGAudioDecoder.m in Sources */, + 9C262A3722B344D3006C8542 /* SGDemuxerOptions.m in Sources */, + 9C3A686721CB77010031DDE1 /* SGSonic.m in Sources */, + 9CA57926219D69580061093B /* SGTimeLayout.m in Sources */, + 9C86382721904A0900D730EC /* SGURLAsset.m in Sources */, + 9C86382821904A0900D730EC /* SGCodecContext.m in Sources */, + 9C262A4722B359CC006C8542 /* SGRendererOptions.m in Sources */, + 9C8D6B5522C4A19500985D55 /* SGMetalTextureLoader.m in Sources */, + 9C853F1621BFD85D005552C6 /* SGVideoDescriptor.m in Sources */, + 9C86382A21904A0900D730EC /* SGDecodeLoop.m in Sources */, + 9C86382C21904A0900D730EC /* SGVRViewport.m in Sources */, + 9C86382E21904A0900D730EC /* SGAudioFrame.m in Sources */, + 9C8D6B5222C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */, + 9C17554D22C5B5B3003A93BC /* SGRenderTimer.m in Sources */, + 9CC2AD8222A660080095A081 /* SGPaddingSegment.m in Sources */, + 9C86383021904A0900D730EC /* SGAsset.m in Sources */, + 9C86383121904A0900D730EC /* SGOptions.m in Sources */, + 9CE7192D219C48AC00256485 /* SGDemuxerFunnel.m in Sources */, + 9C8D6B6122C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */, + 9C86383221904A0900D730EC /* SGTime.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6E21E7125C800835CAB /* Sources */ = { + 9CD79E9D2190068E00E39A7D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C47933F1E713B5C00AD4289 /* SGMacAudioDevice.m in Sources */, - 9C4792E71E713B4900AD4289 /* SGDisplayView.m in Sources */, - 9C4793381E713B5400AD4289 /* SGAudioManager.m in Sources */, - 9C2536321FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */, - 9C2536201FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */, - 9C478F091E713A3200AD4289 /* SGPlayerAction.m in Sources */, - 9C25362C1FAB151500BBFA5C /* SGFFTrack.m in Sources */, - 9C4793411E713B5C00AD4289 /* SGMacAudioSession.m in Sources */, - 9C2535F61FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */, - 9C2536021FAB151500BBFA5C /* SGFFFormatContext.m in Sources */, - 9C478F0F1E713A3200AD4289 /* SGPlayerDecoder.m in Sources */, - 9C2536381FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */, - 9C5AB6EE1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */, - 9C2535FC1FAB151500BBFA5C /* SGFFDecoder.m in Sources */, - 9C4793291E713B4900AD4289 /* SGDistortionModel.m in Sources */, - 9C47932F1E713B4900AD4289 /* SGDistortionRenderer.m in Sources */, - 9C5AB6DE1E88E7980021F460 /* SGGLTexture.m in Sources */, - 9C478F5B1E713ABB00AD4289 /* SGFingerRotation.m in Sources */, - 9C5AB6FE1E88F0400021F460 /* SGGLProgramNV12.m in Sources */, - 9C47930B1E713B4900AD4289 /* SGGLProgram.m in Sources */, - 9C4792E11E713B4900AD4289 /* SGAVPlayer.m in Sources */, - 9C5AB6921E88B2AD0021F460 /* SGGLViewController.m in Sources */, - 9C4792F91E713B4900AD4289 /* SGGLVRModel.m in Sources */, - 9C25363E1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */, - 9C25360E1FAB151500BBFA5C /* SGFFFramePool.m in Sources */, - 9C478F441E713AA800AD4289 /* SGPlayerNotification.m in Sources */, - 9C478F501E713AA800AD4289 /* SGYUVTools.m in Sources */, - 9C5AB6F61E88EB720021F460 /* SGGLFrame.m in Sources */, - 9C478F151E713A3200AD4289 /* SGPlayerTrack.m in Sources */, - 9C2536081FAB151500BBFA5C /* SGFFFrame.m in Sources */, - 9C4792ED1E713B4900AD4289 /* SGGLModel.m in Sources */, - 9C4792F31E713B4900AD4289 /* SGGLNormalModel.m in Sources */, - 9C478F4A1E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */, - 9C2535F01FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */, - 9C5AB6E61E88E8F20021F460 /* SGGLTextureNV12.m in Sources */, - 9C5AB7061E88F0560021F460 /* SGGLProgramYUV420.m in Sources */, - 9C2536541FAB199500BBFA5C /* SGFFPlayer.m in Sources */, - 9C25361A1FAB151500BBFA5C /* SGFFMetadata.m in Sources */, - 9C2536261FAB151500BBFA5C /* SGFFTools.m in Sources */, - 9C478F611E713ABB00AD4289 /* SGMatrix.m in Sources */, - 9C478F031E713A3200AD4289 /* SGPlayerImp.m in Sources */, - 9C2536141FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */, + 9C4190FA21AFF17700134099 /* SGAudioMixerUnit.m in Sources */, + 9CD79E9E2190068E00E39A7D /* SGPlayerItem.m in Sources */, + 9CD79E9F2190068E00E39A7D /* SGFrame.m in Sources */, + 9CD79EA02190068E00E39A7D /* SGPacket.m in Sources */, + 9CD79EA12190068E00E39A7D /* SGObjectPool.m in Sources */, + 9CD79EA32190068E00E39A7D /* SGVideoFrame.m in Sources */, + 9CD79EA42190068E00E39A7D /* SGClock.m in Sources */, + 9CD79EA52190068E00E39A7D /* SGPLFImage.m in Sources */, + 9C41910221B00FC600134099 /* SGMutableTrack.m in Sources */, + 9C65F5B722C5EC2B00AE27DE /* SGMetalProjection.m in Sources */, + 9CD79EA62190068E00E39A7D /* SGObjectQueue.m in Sources */, + 9CA57937219DAA270061093B /* SGCodecDescriptor.m in Sources */, + 9CE71922219C408300256485 /* SGSegment.m in Sources */, + 9CD79EA92190068E00E39A7D /* SGVRProjection.m in Sources */, + 9CD79EAC2190068E00E39A7D /* SGLock.m in Sources */, + 9CD79EAD2190068E00E39A7D /* SGAudioRenderer.m in Sources */, + 9CD79EB12190068E00E39A7D /* SGAudioPlayer.m in Sources */, + 9C1378AD2302681C00FE0CFD /* SGVideoProcessor.m in Sources */, + 9CD79EB22190068E00E39A7D /* SGTrack.m in Sources */, + 9CD79EB32190068E00E39A7D /* SGPlayer.m in Sources */, + 9C8D6B8F22C4A19500985D55 /* SGMetalRenderer.m in Sources */, + 9CB01C98219E863D00B36CFA /* SGMutilDemuxer.m in Sources */, + 9CD79EB52190068E00E39A7D /* SGMapping.m in Sources */, + 9CC2AD7B22A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */, + 9C6F902E219BE154001051CE /* SGMutableAsset.m in Sources */, + 9CD79EB82190068E00E39A7D /* SGFrameOutput.m in Sources */, + 9CD79EB92190068E00E39A7D /* SGCapacity.m in Sources */, + 9CD79EBA2190068E00E39A7D /* SGActivity.m in Sources */, + 9C8D6B4D22C4A19500985D55 /* SGMetalSphereModel.m in Sources */, + 9CD79EBB2190068E00E39A7D /* SGError.m in Sources */, + 9CD79EBC2190068E00E39A7D /* SGURLDemuxer.m in Sources */, + 9CD79EBE2190068E00E39A7D /* SGVideoDecoder.m in Sources */, + 9C3A686021CB76B20031DDE1 /* sonic.c in Sources */, + 9C525D5621AEC421005C5708 /* SGAudioDescriptor.m in Sources */, + 9CD79EC02190068E00E39A7D /* SGSWResample.m in Sources */, + 9CD79EC12190068E00E39A7D /* SGVideoRenderer.m in Sources */, + 9CD79EC22190068E00E39A7D /* SGPLFScreen.m in Sources */, + 9CD79EC42190068E00E39A7D /* SGAudioFormatter.m in Sources */, + 9CD79EC52190068E00E39A7D /* SGFFmpeg.m in Sources */, + 9C0A6F39219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */, + 9C8D6B9522C4A19500985D55 /* SGMetalShader.metal in Sources */, + 9C1F2DEC21AF8F1A00D42158 /* SGAudioMixer.m in Sources */, + 9C82EEB621AE356D00E9D523 /* SGAudioProcessor.m in Sources */, + 9C11816A22C4E23200A12FD4 /* SGMetalViewport.m in Sources */, + 9C1378C123029F2E00FE0CFD /* SGProcessorOptions.m in Sources */, + 9C8D6B6822C4A19500985D55 /* SGMetalPlaneModel.m in Sources */, + 9C0A6F41219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */, + 9CD79EC72190068E00E39A7D /* SGPacketOutput.m in Sources */, + 9CD79EC82190068E00E39A7D /* SGPLFColor.m in Sources */, + 9C8D6B6E22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */, + 9C1378B523026B3A00FE0CFD /* SGTrackSelection.m in Sources */, + 9CE7191A219C3F7900256485 /* SGURLSegment.m in Sources */, + 9C262A4022B3450F006C8542 /* SGDecoderOptions.m in Sources */, + 9C8D6B6522C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */, + 9C8D6B5C22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */, + 9CD79ECA2190068E00E39A7D /* SGPLFView.m in Sources */, + 9C8D6B5922C4A19500985D55 /* SGMetalModel.m in Sources */, + 9CD79ECC2190068E00E39A7D /* SGSWScale.m in Sources */, + 9CD79ECD2190068E00E39A7D /* SGAudioDecoder.m in Sources */, + 9C262A3822B344D3006C8542 /* SGDemuxerOptions.m in Sources */, + 9C3A686821CB77010031DDE1 /* SGSonic.m in Sources */, + 9CA57927219D69580061093B /* SGTimeLayout.m in Sources */, + 9CD79ECE2190068E00E39A7D /* SGURLAsset.m in Sources */, + 9CD79ECF2190068E00E39A7D /* SGCodecContext.m in Sources */, + 9C262A4822B359CC006C8542 /* SGRendererOptions.m in Sources */, + 9C8D6B5622C4A19500985D55 /* SGMetalTextureLoader.m in Sources */, + 9C853F1721BFD85D005552C6 /* SGVideoDescriptor.m in Sources */, + 9CD79ED12190068E00E39A7D /* SGDecodeLoop.m in Sources */, + 9CD79ED32190068E00E39A7D /* SGVRViewport.m in Sources */, + 9CD79ED52190068E00E39A7D /* SGAudioFrame.m in Sources */, + 9C8D6B5322C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */, + 9C17554E22C5B5B3003A93BC /* SGRenderTimer.m in Sources */, + 9CC2AD8322A660080095A081 /* SGPaddingSegment.m in Sources */, + 9CD79ED72190068E00E39A7D /* SGAsset.m in Sources */, + 9CD79ED82190068E00E39A7D /* SGOptions.m in Sources */, + 9CE7192E219C48AC00256485 /* SGDemuxerFunnel.m in Sources */, + 9C8D6B6222C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */, + 9CD79ED92190068E00E39A7D /* SGTime.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9CEFA6ED1E7125CC00835CAB /* Sources */ = { + 9CEFA6D11E7122BF00835CAB /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C5AB6931E88B2AD0021F460 /* SGGLViewController.m in Sources */, - 9C2536151FAB151500BBFA5C /* SGFFFrameQueue.m in Sources */, - 9C4792F41E713B4900AD4289 /* SGGLNormalModel.m in Sources */, - 9C5AB7071E88F0560021F460 /* SGGLProgramYUV420.m in Sources */, - 9C2535F71FAB151500BBFA5C /* SGFFAudioFrame.m in Sources */, - 9C47930C1E713B4900AD4289 /* SGGLProgram.m in Sources */, - 9C4792E81E713B4900AD4289 /* SGDisplayView.m in Sources */, - 9C478F0A1E713A3200AD4289 /* SGPlayerAction.m in Sources */, - 9C478F101E713A3200AD4289 /* SGPlayerDecoder.m in Sources */, - 9C4792FA1E713B4900AD4289 /* SGGLVRModel.m in Sources */, - 9C2536271FAB151500BBFA5C /* SGFFTools.m in Sources */, - 9C5AB6E71E88E8F20021F460 /* SGGLTextureNV12.m in Sources */, - 9C2536331FAB151500BBFA5C /* SGFFVideoDecoder.m in Sources */, - 9C5AB6FF1E88F0400021F460 /* SGGLProgramNV12.m in Sources */, - 9C25362D1FAB151500BBFA5C /* SGFFTrack.m in Sources */, - 9C478F5C1E713ABB00AD4289 /* SGFingerRotation.m in Sources */, - 9C4793301E713B4900AD4289 /* SGDistortionRenderer.m in Sources */, - 9C4792EE1E713B4900AD4289 /* SGGLModel.m in Sources */, - 9C2536551FAB199500BBFA5C /* SGFFPlayer.m in Sources */, - 9C5AB6F71E88EB720021F460 /* SGGLFrame.m in Sources */, - 9C2536391FAB151500BBFA5C /* SGFFVideoFrame.m in Sources */, - 9C47932A1E713B4900AD4289 /* SGDistortionModel.m in Sources */, - 9C2535FD1FAB151500BBFA5C /* SGFFDecoder.m in Sources */, - 9C2535F11FAB151500BBFA5C /* SGFFAudioDecoder.m in Sources */, - 9C5AB6EF1E88E90B0021F460 /* SGGLTextureYUV420.m in Sources */, - 9C2536031FAB151500BBFA5C /* SGFFFormatContext.m in Sources */, - 9C4793391E713B5400AD4289 /* SGAudioManager.m in Sources */, - 9C478F451E713AA800AD4289 /* SGPlayerNotification.m in Sources */, - 9C478F511E713AA800AD4289 /* SGYUVTools.m in Sources */, - 9C25360F1FAB151500BBFA5C /* SGFFFramePool.m in Sources */, - 9C25361B1FAB151500BBFA5C /* SGFFMetadata.m in Sources */, - 9C2536091FAB151500BBFA5C /* SGFFFrame.m in Sources */, - 9C478F161E713A3200AD4289 /* SGPlayerTrack.m in Sources */, - 9C5AB6DF1E88E7980021F460 /* SGGLTexture.m in Sources */, - 9C478F4B1E713AA800AD4289 /* SGPlayer+DisplayView.m in Sources */, - 9C4792E21E713B4900AD4289 /* SGAVPlayer.m in Sources */, - 9C2536211FAB151500BBFA5C /* SGFFPacketQueue.m in Sources */, - 9C25363F1FAB151500BBFA5C /* SGFFVideoToolBox.m in Sources */, - 9C478F621E713ABB00AD4289 /* SGMatrix.m in Sources */, - 9C478F041E713A3200AD4289 /* SGPlayerImp.m in Sources */, + 9C262A3622B344D3006C8542 /* SGDemuxerOptions.m in Sources */, + 9C8D4E4B200DFFC700ED8A58 /* SGPlayerItem.m in Sources */, + 9CA3CDB420E1F74300B852D0 /* SGFrame.m in Sources */, + 9C8D6B6022C4A19500985D55 /* SGMetalYUVRenderPipeline.m in Sources */, + 9C2C55B02015D1D200131E15 /* SGPacket.m in Sources */, + 9C8D6B5122C4A19500985D55 /* SGMetalRenderPipelinePool.m in Sources */, + 9C8D6B6622C4A19500985D55 /* SGMetalPlaneModel.m in Sources */, + 9C2C55962015911600131E15 /* SGObjectPool.m in Sources */, + 9C853F1521BFD85D005552C6 /* SGVideoDescriptor.m in Sources */, + 9C2C559E2015B87400131E15 /* SGVideoFrame.m in Sources */, + 9C5C98FE20D26BE10089C112 /* SGClock.m in Sources */, + 9CE6F5432004D97D00D1F4C8 /* SGPLFImage.m in Sources */, + 9C1378B323026B3A00FE0CFD /* SGTrackSelection.m in Sources */, + 9C2C55B82015D92100131E15 /* SGObjectQueue.m in Sources */, + 9CE71918219C3F7900256485 /* SGURLSegment.m in Sources */, + 9C8D6B5422C4A19500985D55 /* SGMetalTextureLoader.m in Sources */, + 9C03E5F1212E645B001F0E1B /* SGVRProjection.m in Sources */, + 9C525D5421AEC421005C5708 /* SGAudioDescriptor.m in Sources */, + 9C11816822C4E23200A12FD4 /* SGMetalViewport.m in Sources */, + 9C262A3E22B3450F006C8542 /* SGDecoderOptions.m in Sources */, + 9C43D51221872D3F00235169 /* SGLock.m in Sources */, + 9C1378BF23029F2E00FE0CFD /* SGProcessorOptions.m in Sources */, + 9CF15E0A2011AE0700585326 /* SGAudioRenderer.m in Sources */, + 9CE71920219C408300256485 /* SGSegment.m in Sources */, + 9C8D6B8D22C4A19500985D55 /* SGMetalRenderer.m in Sources */, + 9CE68433200DD12F007BD834 /* SGAudioPlayer.m in Sources */, + 9CF52CFA200F45D700950B81 /* SGTrack.m in Sources */, + 9C8D6B9322C4A19500985D55 /* SGMetalShader.metal in Sources */, + 9C0A6F37219C33EA0027D5B1 /* SGTrackDemuxer.m in Sources */, + 9CC2AD7922A65C7B0095A081 /* SGPaddingDemuxer.m in Sources */, + 9C2536531FAB199500BBFA5C /* SGPlayer.m in Sources */, + 9C1D222D201B1DA3005147FB /* SGMapping.m in Sources */, + 9C262A4622B359CC006C8542 /* SGRendererOptions.m in Sources */, + 9C29D113217D741500343975 /* SGFrameOutput.m in Sources */, + 9C4190F821AFF17700134099 /* SGAudioMixerUnit.m in Sources */, + 9C8D6B6C22C4A19500985D55 /* SGMetalBGRARenderPipeline.m in Sources */, + 9C6F902C219BE154001051CE /* SGMutableAsset.m in Sources */, + 9CC64A002181A8C000453B3E /* SGCapacity.m in Sources */, + 9CA57935219DAA270061093B /* SGCodecDescriptor.m in Sources */, + 9C329AAE2005E3F800252B10 /* SGActivity.m in Sources */, + 9C3A685E21CB76B20031DDE1 /* sonic.c in Sources */, + 9C8D4E83200E1ACA00ED8A58 /* SGError.m in Sources */, + 9CE7192C219C48AC00256485 /* SGDemuxerFunnel.m in Sources */, + 9C8D6B5A22C4A19500985D55 /* SGMetalNV12RenderPipeline.m in Sources */, + 9C95D2BD2152335400079B38 /* SGURLDemuxer.m in Sources */, + 9C8D6B5722C4A19500985D55 /* SGMetalModel.m in Sources */, + 9C3082C4212518EC00B44298 /* SGVideoDecoder.m in Sources */, + 9C66E1FF2188550D00B70DAA /* SGSWResample.m in Sources */, + 9C2C55A62015C1E100131E15 /* SGVideoRenderer.m in Sources */, + 9CE6F54F2004D97D00D1F4C8 /* SGPLFScreen.m in Sources */, + 9C66E1FB2188526200B70DAA /* SGAudioFormatter.m in Sources */, + 9CB61F622112B93C00F5BE6B /* SGFFmpeg.m in Sources */, + 9C82EEB421AE356D00E9D523 /* SGAudioProcessor.m in Sources */, + 9CC2AD8122A660080095A081 /* SGPaddingSegment.m in Sources */, + 9C1F2DEA21AF8F1A00D42158 /* SGAudioMixer.m in Sources */, + 9CA57925219D69580061093B /* SGTimeLayout.m in Sources */, + 9C0A6F3F219C36300027D5B1 /* SGSegmentDemuxer.m in Sources */, + 9C8D4E66200E0ACC00ED8A58 /* SGPacketOutput.m in Sources */, + 9C41910021B00FC600134099 /* SGMutableTrack.m in Sources */, + 9CE6F5332004D97D00D1F4C8 /* SGPLFColor.m in Sources */, + 9C03E5ED212E616B001F0E1B /* SGMotionSensor.m in Sources */, + 9CE6F5572004D97D00D1F4C8 /* SGPLFView.m in Sources */, + 9C8D6B6322C4A19500985D55 /* SGMetalRenderPipeline.m in Sources */, + 9C37487C2135521D00572166 /* SGSWScale.m in Sources */, + 9C65F5B522C5EC2B00AE27DE /* SGMetalProjection.m in Sources */, + 9C3082D1212521AB00B44298 /* SGAudioDecoder.m in Sources */, + 9C95D2C22152386C00079B38 /* SGURLAsset.m in Sources */, + 9C3082C821251AC200B44298 /* SGCodecContext.m in Sources */, + 9C8D6B4B22C4A19500985D55 /* SGMetalSphereModel.m in Sources */, + 9CF15DE820118E1100585326 /* SGDecodeLoop.m in Sources */, + 9C3A686621CB77010031DDE1 /* SGSonic.m in Sources */, + 9CAAC9A22133A6800065E364 /* SGVRViewport.m in Sources */, + 9CB01C96219E863D00B36CFA /* SGMutilDemuxer.m in Sources */, + 9CF15E222011BC5400585326 /* SGAudioFrame.m in Sources */, + 9CF63FC3211D8E33001B2684 /* SGAsset.m in Sources */, + 9C43D50E2187037200235169 /* SGOptions.m in Sources */, + 9C4663CD20D0F83600CADDA7 /* SGTime.m in Sources */, + 9C1378AB2302681C00FE0CFD /* SGVideoProcessor.m in Sources */, + 9C17554C22C5B5B3003A93BC /* SGRenderTimer.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 9C2CEFF81F10CA930099247F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "SGPlatform iOS"; - targetProxy = 9C2CEFF71F10CA930099247F /* PBXContainerItemProxy */; - }; - 9C2CEFFD1F10CA970099247F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "SGPlatform macOS"; - targetProxy = 9C2CEFFC1F10CA970099247F /* PBXContainerItemProxy */; - }; - 9C2CEFFF1F10CA9B0099247F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "SGPlatform tvOS"; - targetProxy = 9C2CEFFE1F10CA9B0099247F /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin XCBuildConfiguration section */ + 9C8638A321904A0900D730EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/macOS/universal/include"; + INFOPLIST_FILE = SGPlayer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/macOS/universal/lib"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.macOS; + PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "i386 x86_64"; + }; + name = Debug; + }; + 9C8638A421904A0900D730EC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/macOS/universal/include"; + INFOPLIST_FILE = SGPlayer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/macOS/universal/lib"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.macOS; + PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "i386 x86_64"; + }; + name = Release; + }; + 9CD79FA42190068E00E39A7D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/tvOS/universal/include"; + INFOPLIST_FILE = SGPlayer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/tvOS/universal/lib"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.tvOS; + PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 10.2; + }; + name = Debug; + }; + 9CD79FA52190068E00E39A7D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = NO; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/tvOS/universal/include"; + INFOPLIST_FILE = SGPlayer/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/tvOS/universal/lib"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.tvOS; + PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 10.2; + }; + name = Release; + }; 9CEFA6DC1E7122BF00835CAB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2166,6 +2435,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -2173,6 +2443,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -2222,6 +2493,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -2229,6 +2501,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -2261,27 +2534,30 @@ 9CEFA6DF1E7122BF00835CAB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; + DEFINES_MODULE = NO; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/iOS/universal/include"; INFOPLIST_FILE = SGPlayer/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/iOS/universal/lib"; MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.iOS; PRODUCT_NAME = SGPlayer; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2292,27 +2568,30 @@ 9CEFA6E01E7122BF00835CAB /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; + DEFINES_MODULE = NO; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/iOS/universal/include"; INFOPLIST_FILE = SGPlayer/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/build/build/iOS/universal/lib"; MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; + MODULEMAP_FILE = "$(PROJECT_DIR)/SGPlayer/module.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer.iOS; PRODUCT_NAME = SGPlayer; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -2320,165 +2599,41 @@ }; name = Release; }; - 9CEFA6E81E7125C800835CAB /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; - INFOPLIST_FILE = SGPlayer/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - ); - MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; - PRODUCT_NAME = SGPlayer; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 9CEFA6E91E7125C800835CAB /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; - INFOPLIST_FILE = SGPlayer/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - ); - MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; - PRODUCT_NAME = SGPlayer; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 9CEFA6F31E7125CC00835CAB /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; - INFOPLIST_FILE = SGPlayer/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - ); - MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; - PRODUCT_NAME = SGPlayer; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - }; - name = Debug; - }; - 9CEFA6F41E7125CC00835CAB /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include\""; - INFOPLIST_FILE = SGPlayer/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "\"$(SRCROOT)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS\"", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS", - "$(PROJECT_DIR)/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS", - ); - MACH_O_TYPE = staticlib; - PRODUCT_BUNDLE_IDENTIFIER = com.libobjc.SGPlayer; - PRODUCT_NAME = SGPlayer; - PROVISIONING_PROFILE_SPECIFIER = ""; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 9CEFA6D01E7122BF00835CAB /* Build configuration list for PBXProject "SGPlayer" */ = { + 9C8638A221904A0900D730EC /* Build configuration list for PBXNativeTarget "SGPlayer macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9CEFA6DC1E7122BF00835CAB /* Debug */, - 9CEFA6DD1E7122BF00835CAB /* Release */, + 9C8638A321904A0900D730EC /* Debug */, + 9C8638A421904A0900D730EC /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9CEFA6DE1E7122BF00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer iOS" */ = { + 9CD79FA32190068E00E39A7D /* Build configuration list for PBXNativeTarget "SGPlayer tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9CEFA6DF1E7122BF00835CAB /* Debug */, - 9CEFA6E01E7122BF00835CAB /* Release */, + 9CD79FA42190068E00E39A7D /* Debug */, + 9CD79FA52190068E00E39A7D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9CEFA6E71E7125C800835CAB /* Build configuration list for PBXNativeTarget "SGPlayer macOS" */ = { + 9CEFA6D01E7122BF00835CAB /* Build configuration list for PBXProject "SGPlayer" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9CEFA6E81E7125C800835CAB /* Debug */, - 9CEFA6E91E7125C800835CAB /* Release */, + 9CEFA6DC1E7122BF00835CAB /* Debug */, + 9CEFA6DD1E7122BF00835CAB /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9CEFA6F21E7125CC00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer tvOS" */ = { + 9CEFA6DE1E7122BF00835CAB /* Build configuration list for PBXNativeTarget "SGPlayer iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9CEFA6F31E7125CC00835CAB /* Debug */, - 9CEFA6F41E7125CC00835CAB /* Release */, + 9CEFA6DF1E7122BF00835CAB /* Debug */, + 9CEFA6E01E7122BF00835CAB /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/SGPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SGPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/SGPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer iOS.xcscheme b/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer iOS.xcscheme index 1d1d473e..11b46a99 100644 --- a/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer iOS.xcscheme +++ b/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer iOS.xcscheme @@ -1,6 +1,6 @@ @@ -41,11 +41,13 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUFrameCaptureMode = "3" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> @@ -63,7 +65,7 @@ diff --git a/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer tvOS.xcscheme b/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer tvOS.xcscheme index 2784df52..27c61d74 100644 --- a/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer tvOS.xcscheme +++ b/SGPlayer.xcodeproj/xcshareddata/xcschemes/SGPlayer tvOS.xcscheme @@ -1,6 +1,6 @@ @@ -41,11 +41,13 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUFrameCaptureMode = "3" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> @@ -63,7 +65,7 @@ diff --git a/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.h b/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.h deleted file mode 100644 index 88af5219..00000000 --- a/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// SGAVPlayer.h -// SGPlayer -// -// Created by Single on 16/6/28. -// Copyright © 2016年 single. All rights reserved. -// - -#import "SGPlayerImp.h" -#import - -@protocol SGAVPlayerOutput - -- (AVPlayer *)playerOutputGetAVPlayer; -- (CVPixelBufferRef)playerOutputGetPixelBufferAtCurrentTime; -- (SGPLFImage *)playerOutputGetSnapshotAtCurrentTime; - -@end - -@interface SGAVPlayer : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -+ (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer; - -@property (nonatomic, weak, readonly) SGPlayer * abstractPlayer; -@property (nonatomic, strong, readonly) AVPlayer * avPlayer; - -@property (nonatomic, assign, readonly) SGPlayerState state; -@property (nonatomic, assign, readonly) CGSize presentationSize; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval progress; -@property (nonatomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval playableTime; -@property (nonatomic, assign, readonly) BOOL seeking; - -- (void)replaceVideo; -- (void)reloadVolume; - -- (void)play; -- (void)pause; -- (void)stop; - -@property (nonatomic, assign, readonly) BOOL seekEnable; -- (void)seekToTime:(NSTimeInterval)time; -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void(^)(BOOL finished))completeHandler; - - -#pragma mark - track info - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGPlayerTrack * videoTrack; -@property (nonatomic, strong, readonly) SGPlayerTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -- (void)selectAudioTrackIndex:(int)audioTrackIndex; - -@end diff --git a/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.m b/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.m deleted file mode 100644 index 0676712b..00000000 --- a/SGPlayer/Classes/Core/SGAVPlayer/SGAVPlayer.m +++ /dev/null @@ -1,748 +0,0 @@ -// -// SGAVPlayer.m -// SGPlayer -// -// Created by Single on 16/6/28. -// Copyright © 2016年 single. All rights reserved. -// - -#import "SGAVPlayer.h" -#import "SGPlayer+DisplayView.h" -#import "SGPlayerMacro.h" -#import "SGPlayerNotification.h" -#import - -static CGFloat const PixelBufferRequestInterval = 0.03f; -static NSString * const AVMediaSelectionOptionTrackIDKey = @"MediaSelectionOptionsPersistentID"; - -@interface SGAVPlayer () - -@property (nonatomic, weak) SGPlayer * abstractPlayer; - -@property (nonatomic, assign) SGPlayerState state; -@property (nonatomic, assign) NSTimeInterval playableTime; -@property (nonatomic, assign) BOOL seeking; - -@property (atomic, strong) id playBackTimeObserver; -@property (nonatomic, strong) AVPlayer * avPlayer; -@property (nonatomic, strong) AVPlayerItem * avPlayerItem; -@property (atomic, strong) AVURLAsset * avAsset; -@property (atomic, strong) AVPlayerItemVideoOutput * avOutput; -@property (atomic, assign) NSTimeInterval readyToPlayTime; - -@property (atomic, assign) BOOL playing; -@property (atomic, assign) BOOL buffering; -@property (atomic, assign) BOOL hasPixelBuffer; - -@property (nonatomic, assign) SGPlayerState stateBeforBuffering; - - -#pragma mark - track info - -@property (nonatomic, assign) BOOL videoEnable; -@property (nonatomic, assign) BOOL audioEnable; - -@property (nonatomic, strong) SGPlayerTrack * videoTrack; -@property (nonatomic, strong) SGPlayerTrack * audioTrack; - -@property (nonatomic, strong) NSArray * videoTracks; -@property (nonatomic, strong) NSArray * audioTracks; - -@end - -@implementation SGAVPlayer - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - return [[self alloc] initWithAbstractPlayer:abstractPlayer]; -} - -- (instancetype)initWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - if (self = [super init]) { - self.abstractPlayer = abstractPlayer; - self.abstractPlayer.displayView.playerOutputAV = self; - } - return self; -} - -#pragma mark - play control - -- (void)play -{ - self.playing = YES; - - switch (self.state) { - case SGPlayerStateFinished: - [self.avPlayer seekToTime:kCMTimeZero]; - self.state = SGPlayerStatePlaying; - break; - case SGPlayerStateFailed: - [self replaceEmpty]; - [self replaceVideo]; - break; - case SGPlayerStateNone: - self.state = SGPlayerStateBuffering; - break; - case SGPlayerStateSuspend: - if (self.buffering) { - self.state = SGPlayerStateBuffering; - } else { - self.state = SGPlayerStatePlaying; - } - break; - case SGPlayerStateReadyToPlay: - self.state = SGPlayerStatePlaying; - break; - default: - break; - } - - [self.avPlayer play]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - switch (self.state) { - case SGPlayerStateBuffering: - case SGPlayerStatePlaying: - case SGPlayerStateReadyToPlay: - [self.avPlayer play]; - default: - break; - } - }); -} - -- (void)startBuffering -{ - if (self.playing) { - [self.avPlayer pause]; - } - self.buffering = YES; - if (self.state != SGPlayerStateBuffering) { - self.stateBeforBuffering = self.state; - } - self.state = SGPlayerStateBuffering; -} - -- (void)stopBuffering -{ - self.buffering = NO; -} - -- (void)resumeStateAfterBuffering -{ - if (self.playing) { - [self.avPlayer play]; - self.state = SGPlayerStatePlaying; - } else if (self.state == SGPlayerStateBuffering) { - self.state = self.stateBeforBuffering; - } -} - -- (BOOL)playIfNeed -{ - if (self.playing) { - [self.avPlayer play]; - self.state = SGPlayerStatePlaying; - return YES; - } - return NO; -} - -- (void)pause -{ - [self.avPlayer pause]; - self.playing = NO; - if (self.state == SGPlayerStateFailed) return; - self.state = SGPlayerStateSuspend; -} - -- (BOOL)seekEnable -{ - if (self.duration <= 0 || self.avPlayerItem.status != AVPlayerItemStatusReadyToPlay) { - return NO; - } - return YES; -} - -- (void)seekToTime:(NSTimeInterval)time -{ - [self seekToTime:time completeHandler:nil]; -} - -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void (^)(BOOL))completeHandler -{ - if (!self.seekEnable || self.avPlayerItem.status != AVPlayerItemStatusReadyToPlay) { - if (completeHandler) { - completeHandler(NO); - } - return; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - self.seeking = YES; - [self startBuffering]; - SGWeakSelf - [self.avPlayerItem seekToTime:CMTimeMakeWithSeconds(time, NSEC_PER_SEC) completionHandler:^(BOOL finished) { - dispatch_async(dispatch_get_main_queue(), ^{ - SGStrongSelf - self.seeking = NO; - [strongSelf stopBuffering]; - [strongSelf resumeStateAfterBuffering]; - if (completeHandler) { - completeHandler(finished); - } - SGPlayerLog(@"SGAVPlayer seek success"); - }); - }]; - }); -} - -- (void)stop -{ - [self replaceEmpty]; -} - -- (NSTimeInterval)progress -{ - CMTime currentTime = self.avPlayerItem.currentTime; - Boolean indefinite = CMTIME_IS_INDEFINITE(currentTime); - Boolean invalid = CMTIME_IS_INVALID(currentTime); - if (indefinite || invalid) { - return 0; - } - return CMTimeGetSeconds(self.avPlayerItem.currentTime); -} - -- (NSTimeInterval)duration -{ - CMTime duration = self.avPlayerItem.duration; - Boolean indefinite = CMTIME_IS_INDEFINITE(duration); - Boolean invalid = CMTIME_IS_INVALID(duration); - if (indefinite || invalid) { - return 0; - } - return CMTimeGetSeconds(self.avPlayerItem.duration);; -} - -- (double)percentForTime:(NSTimeInterval)time duration:(NSTimeInterval)duration -{ - double percent = 0; - if (time > 0) { - if (duration <= 0) { - percent = 1; - } else { - percent = time / duration; - } - } - return percent; -} - -- (NSTimeInterval)bitrate -{ - return 0; -} - -#pragma mark - Setter/Getter - -- (void)setState:(SGPlayerState)state -{ - if (_state != state) { - SGPlayerState temp = _state; - _state = state; - switch (self.state) { - case SGPlayerStateFinished: - self.playing = NO; - break; - case SGPlayerStateFailed: - self.playing = NO; - break; - default: - break; - } - if (_state != SGPlayerStateFailed) { - self.abstractPlayer.error = nil; - } - [SGPlayerNotification postPlayer:self.abstractPlayer statePrevious:temp current:_state]; - } -} - -- (void)reloadVolume -{ - self.avPlayer.volume = self.abstractPlayer.volume; -} - -- (void)reloadPlayableTime -{ - if (self.avPlayerItem.status == AVPlayerItemStatusReadyToPlay) { - CMTimeRange range = [self.avPlayerItem.loadedTimeRanges.firstObject CMTimeRangeValue]; - if (CMTIMERANGE_IS_VALID(range)) { - NSTimeInterval start = CMTimeGetSeconds(range.start); - NSTimeInterval duration = CMTimeGetSeconds(range.duration); - self.playableTime = (start + duration); - } - } else { - self.playableTime = 0; - } -} - -- (void)setPlayableTime:(NSTimeInterval)playableTime -{ - if (_playableTime != playableTime) { - _playableTime = playableTime; - CGFloat duration = self.duration; - double percent = [self percentForTime:_playableTime duration:duration]; - [SGPlayerNotification postPlayer:self.abstractPlayer playablePercent:@(percent) current:@(playableTime) total:@(duration)]; - } -} - -- (CGSize)presentationSize -{ - if (self.avPlayerItem) { - return self.avPlayerItem.presentationSize; - } - return CGSizeZero; -} - - -#pragma mark - SGAVPlayerOutput - -- (AVPlayer *)playerOutputGetAVPlayer -{ - return self.avPlayer; -} - -- (CVPixelBufferRef)playerOutputGetPixelBufferAtCurrentTime -{ - if (self.seeking) return nil; - - BOOL hasNewPixelBuffer = [self.avOutput hasNewPixelBufferForItemTime:self.avPlayerItem.currentTime]; - if (!hasNewPixelBuffer) { - if (self.hasPixelBuffer) return nil; - [self trySetupOutput]; - return nil; - } - - CVPixelBufferRef pixelBuffer = [self.avOutput copyPixelBufferForItemTime:self.avPlayerItem.currentTime itemTimeForDisplay:nil]; - if (!pixelBuffer) { - [self trySetupOutput]; - } else { - self.hasPixelBuffer = YES; - } - return pixelBuffer; -} - -- (SGPLFImage *)playerOutputGetSnapshotAtCurrentTime -{ - switch (self.abstractPlayer.videoType) { - case SGVideoTypeNormal: - { - AVAssetImageGenerator * imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:self.avAsset]; - imageGenerator.appliesPreferredTrackTransform = YES; - imageGenerator.requestedTimeToleranceBefore = kCMTimeZero; - imageGenerator.requestedTimeToleranceAfter = kCMTimeZero; - - NSError * error = nil; - CMTime time = self.avPlayerItem.currentTime; - CMTime actualTime; - CGImageRef cgImage = [imageGenerator copyCGImageAtTime:time actualTime:&actualTime error:&error]; - SGPLFImage * image = SGPLFImageWithCGImage(cgImage); - return image; - } - break; - case SGVideoTypeVR: - { - return nil; - } - break; - } -} - - -#pragma mark - play state change - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - if (object == self.avPlayerItem) { - if ([keyPath isEqualToString:@"status"]) - { - switch (self.avPlayerItem.status) { - case AVPlayerItemStatusUnknown: - { - [self startBuffering]; - SGPlayerLog(@"SGAVPlayer item status unknown"); - } - break; - case AVPlayerItemStatusReadyToPlay: - { - [self stopBuffering]; - [self setupTrackInfo]; - SGPlayerLog(@"SGAVPlayer item status ready to play"); - self.readyToPlayTime = [NSDate date].timeIntervalSince1970; - if (![self playIfNeed]) { - switch (self.state) { - case SGPlayerStateSuspend: - case SGPlayerStateFinished: - case SGPlayerStateFailed: - break; - default: - self.state = SGPlayerStateReadyToPlay; - break; - } - } - } - break; - case AVPlayerItemStatusFailed: - { - SGPlayerLog(@"SGAVPlayer item status failed"); - [self stopBuffering]; - self.readyToPlayTime = 0; - SGError * error = [[SGError alloc] init]; - if (self.avPlayerItem.error) { - error.error = self.avPlayerItem.error; - if (self.avPlayerItem.errorLog.extendedLogData.length > 0) { - error.extendedLogData = self.avPlayerItem.errorLog.extendedLogData; - error.extendedLogDataStringEncoding = self.avPlayerItem.errorLog.extendedLogDataStringEncoding; - } - if (self.avPlayerItem.errorLog.events.count > 0) { - NSMutableArray * array = [NSMutableArray arrayWithCapacity:self.avPlayerItem.errorLog.events.count]; - for (AVPlayerItemErrorLogEvent * obj in self.avPlayerItem.errorLog.events) { - SGErrorEvent * event = [[SGErrorEvent alloc] init]; - event.date = obj.date; - event.URI = obj.URI; - event.serverAddress = obj.serverAddress; - event.playbackSessionID = obj.playbackSessionID; - event.errorStatusCode = obj.errorStatusCode; - event.errorDomain = obj.errorDomain; - event.errorComment = obj.errorComment; - [array addObject:event]; - } - error.errorEvents = array; - } - } else if (self.avPlayer.error) { - error.error = self.avPlayer.error; - } else { - error.error = [NSError errorWithDomain:@"AVPlayer playback error" code:-1 userInfo:nil]; - } - self.abstractPlayer.error = error; - self.state = SGPlayerStateFailed; - [SGPlayerNotification postPlayer:self.abstractPlayer error:error]; - } - break; - } - } - else if ([keyPath isEqualToString:@"playbackBufferEmpty"]) - { - if (self.avPlayerItem.playbackBufferEmpty) { - [self startBuffering]; - } - } - else if ([keyPath isEqualToString:@"loadedTimeRanges"]) - { - [self reloadPlayableTime]; - NSTimeInterval interval = self.playableTime - self.progress; - NSTimeInterval residue = self.duration - self.progress; - if (residue <= -1.5) { - residue = 2; - } - if (interval > self.abstractPlayer.playableBufferInterval) { - [self stopBuffering]; - [self resumeStateAfterBuffering]; - } else if (interval < 0.3 && residue > 1.5) { - [self startBuffering]; - } - } - } -} - -- (void)avplayerItemDidPlayToEnd:(NSNotification *)notification -{ - self.state = SGPlayerStateFinished; -} - -- (void)avAssetPrepareFailed:(NSError *)error -{ - SGPlayerLog(@"%s", __func__); -} - -#pragma mark - replace video - -- (void)replaceVideo -{ - [self replaceEmpty]; - if (!self.abstractPlayer.contentURL) return; - - [self.abstractPlayer.displayView playerOutputTypeAV]; - [self startBuffering]; - self.avAsset = [AVURLAsset assetWithURL:self.abstractPlayer.contentURL]; - switch (self.abstractPlayer.videoType) { - case SGVideoTypeNormal: - [self setupAVPlayerItemAutoLoadedAsset:YES]; - [self setupAVPlayer]; - [self.abstractPlayer.displayView rendererTypeAVPlayerLayer]; - break; - case SGVideoTypeVR: - { - [self setupAVPlayerItemAutoLoadedAsset:NO]; - [self setupAVPlayer]; - [self.abstractPlayer.displayView rendererTypeOpenGL]; - SGWeakSelf - [self.avAsset loadValuesAsynchronouslyForKeys:[self.class AVAssetloadKeys] completionHandler:^{ - SGStrongSelf - dispatch_async(dispatch_get_main_queue(), ^{ - for (NSString * loadKey in [strongSelf.class AVAssetloadKeys]) { - NSError * error = nil; - AVKeyValueStatus keyStatus = [strongSelf.avAsset statusOfValueForKey:loadKey error:&error]; - if (keyStatus == AVKeyValueStatusFailed) { - [strongSelf avAssetPrepareFailed:error]; - SGPlayerLog(@"AVAsset load failed"); - return; - } - } - NSError * error = nil; - AVKeyValueStatus trackStatus = [strongSelf.avAsset statusOfValueForKey:@"tracks" error:&error]; - if (trackStatus == AVKeyValueStatusLoaded) { - [strongSelf setupOutput]; - } else { - SGPlayerLog(@"AVAsset load failed"); - } - }); - }]; - } - break; - } -} - - -#pragma mark - setup/clean - -- (void)setupAVPlayer -{ - self.avPlayer = [AVPlayer playerWithPlayerItem:self.avPlayerItem]; - /* - if ([UIDevice currentDevice].systemVersion.floatValue >= 10.0) { - self.avPlayer.automaticallyWaitsToMinimizeStalling = NO; - } - */ - SGWeakSelf - self.playBackTimeObserver = [self.avPlayer addPeriodicTimeObserverForInterval:CMTimeMake(1, 1) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) { - SGStrongSelf - if (strongSelf.state == SGPlayerStatePlaying) { - CGFloat current = CMTimeGetSeconds(time); - CGFloat duration = strongSelf.duration; - double percent = [strongSelf percentForTime:current duration:duration]; - [SGPlayerNotification postPlayer:strongSelf.abstractPlayer progressPercent:@(percent) current:@(current) total:@(duration)]; - } - }]; - [self.abstractPlayer.displayView reloadPlayerConfig]; - [self reloadVolume]; -} - -- (void)cleanAVPlayer -{ - [self.avPlayer pause]; - [self.avPlayer cancelPendingPrerolls]; - [self.avPlayer replaceCurrentItemWithPlayerItem:nil]; - - if (self.playBackTimeObserver) { - [self.avPlayer removeTimeObserver:self.playBackTimeObserver]; - self.playBackTimeObserver = nil; - } - self.avPlayer = nil; - [self.abstractPlayer.displayView reloadPlayerConfig]; -} - -- (void)setupAVPlayerItemAutoLoadedAsset:(BOOL)autoLoadedAsset -{ - if (autoLoadedAsset) { - self.avPlayerItem = [AVPlayerItem playerItemWithAsset:self.avAsset automaticallyLoadedAssetKeys:[self.class AVAssetloadKeys]]; - } else { - self.avPlayerItem = [AVPlayerItem playerItemWithAsset:self.avAsset]; - } - - [self.avPlayerItem addObserver:self forKeyPath:@"status" options:0 context:NULL]; - [self.avPlayerItem addObserver:self forKeyPath:@"playbackBufferEmpty" options:NSKeyValueObservingOptionNew context:NULL]; - [self.avPlayerItem addObserver:self forKeyPath:@"loadedTimeRanges" options:NSKeyValueObservingOptionNew context:NULL]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(avplayerItemDidPlayToEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:_avPlayerItem]; -} - -- (void)cleanAVPlayerItem -{ - if (self.avPlayerItem) { - [self.avPlayerItem cancelPendingSeeks]; - [self.avPlayerItem removeObserver:self forKeyPath:@"status"]; - [self.avPlayerItem removeObserver:self forKeyPath:@"playbackBufferEmpty"]; - [self.avPlayerItem removeObserver:self forKeyPath:@"loadedTimeRanges"]; - [self.avPlayerItem removeOutput:self.avOutput]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:self.avPlayerItem]; - self.avPlayerItem = nil; - } -} - -- (void)trySetupOutput -{ - BOOL isReadyToPlay = self.avPlayerItem.status == AVPlayerStatusReadyToPlay && self.readyToPlayTime > 10 && (([NSDate date].timeIntervalSince1970 - self.readyToPlayTime) > 0.3); - if (isReadyToPlay) { - [self setupOutput]; - } -} - -- (void)setupOutput -{ - [self cleanOutput]; - - NSDictionary * pixelBuffer = @{(id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange)}; - self.avOutput = [[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:pixelBuffer]; - [self.avOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:PixelBufferRequestInterval]; - [self.avPlayerItem addOutput:self.avOutput]; - - SGPlayerLog(@"SGAVPlayer add output success"); -} - -- (void)cleanOutput -{ - if (self.avPlayerItem) { - [self.avPlayerItem removeOutput:self.avOutput]; - } - self.avOutput = nil; - self.hasPixelBuffer = NO; -} - -- (void)replaceEmpty -{ - [SGPlayerNotification postPlayer:self.abstractPlayer playablePercent:@(0) current:@(0) total:@(0)]; - [SGPlayerNotification postPlayer:self.abstractPlayer progressPercent:@(0) current:@(0) total:@(0)]; - [self.avAsset cancelLoading]; - self.avAsset = nil; - [self cleanOutput]; - [self cleanAVPlayerItem]; - [self cleanAVPlayer]; - [self cleanTrackInfo]; - self.state = SGPlayerStateNone; - self.stateBeforBuffering = SGPlayerStateNone; - self.seeking = NO; - self.playableTime = 0; - self.readyToPlayTime = 0; - self.buffering = NO; - self.playing = NO; - [self.abstractPlayer.displayView playerOutputTypeEmpty]; - [self.abstractPlayer.displayView rendererTypeEmpty]; -} - -+ (NSArray *)AVAssetloadKeys -{ - static NSArray * keys = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - keys =@[@"tracks", @"playable"]; - }); - return keys; -} - -- (void)dealloc -{ - SGPlayerLog(@"SGAVPlayer release"); - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [self replaceEmpty]; - [self cleanAVPlayer]; -} - - -#pragma mark - track info - -- (void)setupTrackInfo -{ - if (self.videoEnable || self.audioEnable) return; - - NSMutableArray * videoTracks = [NSMutableArray array]; - NSMutableArray * audioTracks = [NSMutableArray array]; - - for (AVAssetTrack * obj in self.avAsset.tracks) { - if ([obj.mediaType isEqualToString:AVMediaTypeVideo]) { - self.videoEnable = YES; - [videoTracks addObject:[self playerTrackFromAVTrack:obj]]; - } else if ([obj.mediaType isEqualToString:AVMediaTypeAudio]) { - self.audioEnable = YES; - [audioTracks addObject:[self playerTrackFromAVTrack:obj]]; - } - } - - if (videoTracks.count > 0) { - self.videoTracks = videoTracks; - AVMediaSelectionGroup * videoGroup = [self.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicVisual]; - if (videoGroup) { - int trackID = [[videoGroup.defaultOption.propertyList objectForKey:AVMediaSelectionOptionTrackIDKey] intValue]; - for (SGPlayerTrack * obj in self.audioTracks) { - if (obj.index == (int)trackID) { - self.videoTrack = obj; - } - } - if (!self.videoTrack) { - self.videoTrack = self.videoTracks.firstObject; - } - } else { - self.videoTrack = self.videoTracks.firstObject; - } - } - if (audioTracks.count > 0) { - self.audioTracks = audioTracks; - AVMediaSelectionGroup * audioGroup = [self.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; - if (audioGroup) { - int trackID = [[audioGroup.defaultOption.propertyList objectForKey:AVMediaSelectionOptionTrackIDKey] intValue]; - for (SGPlayerTrack * obj in self.audioTracks) { - if (obj.index == (int)trackID) { - self.audioTrack = obj; - } - } - if (!self.audioTrack) { - self.audioTrack = self.audioTracks.firstObject; - } - } else { - self.audioTrack = self.audioTracks.firstObject; - } - } -} - -- (void)cleanTrackInfo -{ - self.videoEnable = NO; - self.videoTrack = nil; - self.videoTracks = nil; - - self.audioEnable = NO; - self.audioTrack = nil; - self.audioTracks = nil; -} - -- (void)selectAudioTrackIndex:(int)audioTrackIndex -{ - if (self.audioTrack.index == audioTrackIndex) return; - AVMediaSelectionGroup * group = [self.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; - if (group) { - for (AVMediaSelectionOption * option in group.options) { - int trackID = [[option.propertyList objectForKey:AVMediaSelectionOptionTrackIDKey] intValue]; - if (audioTrackIndex == trackID) { - [self.avPlayerItem selectMediaOption:option inMediaSelectionGroup:group]; - for (SGPlayerTrack * track in self.audioTracks) { - if (track.index == audioTrackIndex) { - self.audioTrack = track; - break; - } - } - break; - } - } - } -} - -- (SGPlayerTrack *)playerTrackFromAVTrack:(AVAssetTrack *)track -{ - if (track) { - SGPlayerTrack * obj = [[SGPlayerTrack alloc] init]; - obj.index = (int)track.trackID; - obj.name = track.languageCode; - return obj; - } - return nil; -} - -@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGAsset+Internal.h b/SGPlayer/Classes/Core/SGAsset/SGAsset+Internal.h new file mode 100644 index 00000000..e39bb574 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGAsset+Internal.h @@ -0,0 +1,19 @@ +// +// SGAsset+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/9/25. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAsset.h" +#import "SGDemuxable.h" + +@interface SGAsset () + +/** + * + */ +- (id)newDemuxable; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGAsset.h b/SGPlayer/Classes/Core/SGAsset/SGAsset.h new file mode 100644 index 00000000..c71209f3 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGAsset.h @@ -0,0 +1,13 @@ +// +// SGAsset.h +// SGPlayer iOS +// +// Created by Single on 2018/8/10. +// Copyright © 2018 single. All rights reserved. +// + +#import + +@interface SGAsset : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGAsset.m b/SGPlayer/Classes/Core/SGAsset/SGAsset.m new file mode 100644 index 00000000..e765ad1d --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGAsset.m @@ -0,0 +1,25 @@ +// +// SGAsset.m +// SGPlayer iOS +// +// Created by Single on 2018/8/10. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAsset.h" +#import "SGAsset+Internal.h" + +@implementation SGAsset + +- (id)copyWithZone:(NSZone *)zone +{ + SGAsset *obj = [[self.class alloc] init]; + return obj; +} + +- (id)newDemuxable +{ + return nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.h b/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.h new file mode 100644 index 00000000..45121a52 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.h @@ -0,0 +1,25 @@ +// +// SGMutableAsset.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAsset.h" +#import "SGDefines.h" +#import "SGMutableTrack.h" + +@interface SGMutableAsset : SGAsset + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +- (SGMutableTrack *)addTrack:(SGMediaType)type; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.m b/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.m new file mode 100644 index 00000000..370824f1 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGMutableAsset.m @@ -0,0 +1,63 @@ +// +// SGMutableAsset.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGMutableAsset.h" +#import "SGAsset+Internal.h" +#import "SGTrack+Internal.h" +#import "SGTrackDemuxer.h" +#import "SGMutilDemuxer.h" + +@interface SGMutableAsset () + +{ + NSMutableArray *_tracks; +} + +@end + +@implementation SGMutableAsset + +- (id)copyWithZone:(NSZone *)zone +{ + SGMutableAsset *obj = [super copyWithZone:zone]; + obj->_tracks = [self->_tracks mutableCopy]; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_tracks = [NSMutableArray array]; + } + return self; +} + +- (NSArray *)tracks +{ + return [self->_tracks copy]; +} + +- (SGMutableTrack *)addTrack:(SGMediaType)type +{ + NSInteger index = self->_tracks.count; + SGMutableTrack *obj = [[SGMutableTrack alloc] initWithType:type index:index]; + [self->_tracks addObject:obj]; + return obj; +} + +- (id)newDemuxable +{ + NSMutableArray *demuxables = [NSMutableArray array]; + for (SGMutableTrack *obj in self->_tracks) { + SGTrackDemuxer *demuxer = [[SGTrackDemuxer alloc] initWithTrack:obj]; + [demuxables addObject:demuxer]; + } + return [[SGMutilDemuxer alloc] initWithDemuxables:demuxables]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.h b/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.h new file mode 100644 index 00000000..71e8da4d --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.h @@ -0,0 +1,25 @@ +// +// SGMutableTrack.h +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGSegment.h" +#import "SGTrack.h" + +@interface SGMutableTrack : SGTrack + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *segments; + +/** + * + */ +- (BOOL)appendSegment:(SGSegment *)segment; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.m b/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.m new file mode 100644 index 00000000..6344d586 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGMutableTrack.m @@ -0,0 +1,48 @@ +// +// SGMutableTrack.m +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGMutableTrack.h" +#import "SGTrack+Internal.h" + +@interface SGMutableTrack () + +{ + NSMutableArray *_segments; +} + +@end + +@implementation SGMutableTrack + +- (id)copyWithZone:(NSZone *)zone +{ + SGMutableTrack *obj = [super copyWithZone:zone]; + obj->_segments = [self->_segments mutableCopy]; + return obj; +} + +- (instancetype)initWithType:(SGMediaType)type index:(NSInteger)index +{ + if (self = [super initWithType:type index:index]) { + self->_segments = [NSMutableArray array]; + } + return self; +} + +- (NSArray *)segments +{ + return [self->_segments copy]; +} + +- (BOOL)appendSegment:(SGSegment *)segment +{ + [self->_segments addObject:segment]; + return YES; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.h b/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.h new file mode 100644 index 00000000..76043774 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.h @@ -0,0 +1,18 @@ +// +// SGPaddingSegment.h +// SGPlayer +// +// Created by Single on 2019/6/4. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGSegment.h" + +@interface SGPaddingSegment : SGSegment + +/** + * + */ +- (instancetype)initWithDuration:(CMTime)duration; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.m b/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.m new file mode 100644 index 00000000..2a80dad1 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGPaddingSegment.m @@ -0,0 +1,34 @@ +// +// SGPaddingSegment.m +// SGPlayer +// +// Created by Single on 2019/6/4. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGPaddingSegment.h" +#import "SGSegment+Internal.h" +#import "SGPaddingDemuxer.h" + +@implementation SGPaddingSegment + +- (id)copyWithZone:(NSZone *)zone +{ + SGPaddingSegment *obj = [super copyWithZone:zone]; + return obj; +} + +- (instancetype)initWithDuration:(CMTime)duration +{ + if (self = [super initWithTimeRange:CMTimeRangeMake(kCMTimeZero, duration) scale:kCMTimeInvalid]) { + + } + return self; +} + +- (id)newDemuxable +{ + return [[SGPaddingDemuxer alloc] initWithDuration:self.timeRange.duration]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGSegment+Internal.h b/SGPlayer/Classes/Core/SGAsset/SGSegment+Internal.h new file mode 100644 index 00000000..a093fda2 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGSegment+Internal.h @@ -0,0 +1,24 @@ +// +// SGSegment+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/9/25. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSegment.h" +#import "SGDemuxable.h" + +@interface SGSegment () + +/** + * + */ +- (instancetype)initWithTimeRange:(CMTimeRange)timeRange scale:(CMTime)scale; + +/** + * + */ +- (id)newDemuxable; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGSegment.h b/SGPlayer/Classes/Core/SGAsset/SGSegment.h new file mode 100644 index 00000000..68d837ad --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGSegment.h @@ -0,0 +1,30 @@ +// +// SGSegment.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import + +@interface SGSegment : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +@property (nonatomic, readonly) CMTimeRange timeRange; + +/** + * + */ +@property (nonatomic, readonly) CMTime scale; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGSegment.m b/SGPlayer/Classes/Core/SGAsset/SGSegment.m new file mode 100644 index 00000000..d6410547 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGSegment.m @@ -0,0 +1,40 @@ +// +// SGSegment.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSegment.h" +#import "SGSegment+Internal.h" +#import "SGTime.h" + +@implementation SGSegment + +- (id)copyWithZone:(NSZone *)zone +{ + SGSegment *obj = [[self.class alloc] init]; + obj->_timeRange = self->_timeRange; + obj->_scale = self->_scale; + return obj; +} + +- (instancetype)initWithTimeRange:(CMTimeRange)timeRange scale:(CMTime)scale +{ + if (self = [super init]) { + self->_timeRange = timeRange; + self->_scale = SGCMTimeValidate(scale, CMTimeMake(1, 1), NO); + NSAssert(CMTimeCompare(self->_scale, CMTimeMake(1, 10)) >= 0, @"Invalid Scale."); + NSAssert(CMTimeCompare(self->_scale, CMTimeMake(10, 1)) <= 0, @"Invalid Scale."); + } + return self; +} + +- (id)newDemuxable +{ + NSAssert(NO, @"Subclass only."); + return nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGTrack+Internal.h b/SGPlayer/Classes/Core/SGAsset/SGTrack+Internal.h new file mode 100644 index 00000000..a631afcc --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGTrack+Internal.h @@ -0,0 +1,18 @@ +// +// SGTrack+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/10/23. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGTrack.h" + +@interface SGTrack () + +/** + * + */ +- (instancetype)initWithType:(SGMediaType)type index:(NSInteger)index; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGTrack.h b/SGPlayer/Classes/Core/SGAsset/SGTrack.h new file mode 100644 index 00000000..04bcd430 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGTrack.h @@ -0,0 +1,30 @@ +// +// SGTrack.h +// SGPlayer +// +// Created by Single on 2018/1/17. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGDefines.h" + +@interface SGTrack : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +@property (nonatomic, readonly) SGMediaType type; + +/** + * + */ +@property (nonatomic, readonly) NSInteger index; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGTrack.m b/SGPlayer/Classes/Core/SGAsset/SGTrack.m new file mode 100644 index 00000000..9f3c38f7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGTrack.m @@ -0,0 +1,31 @@ +// +// SGTrack.m +// SGPlayer +// +// Created by Single on 2018/1/17. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGTrack.h" +#import "SGTrack+Internal.h" + +@implementation SGTrack + +- (id)copyWithZone:(NSZone *)zone +{ + SGTrack *obj = [[self.class alloc] init]; + obj->_type = self->_type; + obj->_index = self->_index; + return obj; +} + +- (instancetype)initWithType:(SGMediaType)type index:(NSInteger)index +{ + if (self = [super init]) { + self->_type = type; + self->_index = index; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.h b/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.h new file mode 100644 index 00000000..09b183ec --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.h @@ -0,0 +1,32 @@ +// +// SGTrackSelection.h +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import +#import "SGTrack.h" + +/** + * + */ +typedef NS_OPTIONS(NSUInteger, SGTrackSelectionAction) { + SGTrackSelectionActionTracks = 1 << 0, + SGTrackSelectionActionWeights = 1 << 1, +}; + +@interface SGTrackSelection : NSObject + +/** + * + */ +@property (nonatomic, copy) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy) NSArray *weights; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.m b/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.m new file mode 100644 index 00000000..45fc854d --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGTrackSelection.m @@ -0,0 +1,21 @@ +// +// SGTrackSelection.m +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGTrackSelection.h" + +@implementation SGTrackSelection + +- (id)copyWithZone:(NSZone *)zone +{ + SGTrackSelection *obj = [[SGTrackSelection alloc] init]; + obj->_tracks = self->_tracks; + obj->_weights = self->_weights; + return obj; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGURLAsset.h b/SGPlayer/Classes/Core/SGAsset/SGURLAsset.h new file mode 100644 index 00000000..fa2aa54f --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGURLAsset.h @@ -0,0 +1,29 @@ +// +// SGURLAsset.h +// SGPlayer iOS +// +// Created by Single on 2018/9/19. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAsset.h" + +@interface SGURLAsset : SGAsset + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithURL:(NSURL *)URL; + +/** + * + */ +@property (nonatomic, copy, readonly) NSURL *URL; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGURLAsset.m b/SGPlayer/Classes/Core/SGAsset/SGURLAsset.m new file mode 100644 index 00000000..c6d47836 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGURLAsset.m @@ -0,0 +1,35 @@ +// +// SGURLAsset.m +// SGPlayer iOS +// +// Created by Single on 2018/9/19. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGURLAsset.h" +#import "SGAsset+Internal.h" +#import "SGURLDemuxer.h" + +@implementation SGURLAsset + +- (id)copyWithZone:(NSZone *)zone +{ + SGURLAsset *obj = [super copyWithZone:zone]; + obj->_URL = [self->_URL copy]; + return obj; +} + +- (instancetype)initWithURL:(NSURL *)URL +{ + if (self = [super init]) { + self->_URL = [URL copy]; + } + return self; +} + +- (id)newDemuxable +{ + return [[SGURLDemuxer alloc] initWithURL:self->_URL]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGURLSegment.h b/SGPlayer/Classes/Core/SGAsset/SGURLSegment.h new file mode 100644 index 00000000..46adb778 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGURLSegment.h @@ -0,0 +1,33 @@ +// +// SGURLSegment.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSegment.h" + +@interface SGURLSegment : SGSegment + +/** + * + */ +- (instancetype)initWithURL:(NSURL *)URL index:(NSInteger)index; + +/** + * + */ +- (instancetype)initWithURL:(NSURL *)URL index:(NSInteger)index timeRange:(CMTimeRange)timeRange scale:(CMTime)scale; + +/** + * + */ +@property (nonatomic, copy, readonly) NSURL *URL; + +/** + * + */ +@property (nonatomic, readonly) NSInteger index; + +@end diff --git a/SGPlayer/Classes/Core/SGAsset/SGURLSegment.m b/SGPlayer/Classes/Core/SGAsset/SGURLSegment.m new file mode 100644 index 00000000..488916ea --- /dev/null +++ b/SGPlayer/Classes/Core/SGAsset/SGURLSegment.m @@ -0,0 +1,45 @@ +// +// SGURLSegment.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGURLSegment.h" +#import "SGSegment+Internal.h" +#import "SGDemuxerFunnel.h" +#import "SGURLDemuxer.h" + +@implementation SGURLSegment + +- (id)copyWithZone:(NSZone *)zone +{ + SGURLSegment *obj = [super copyWithZone:zone]; + obj->_URL = [self->_URL copy]; + obj->_index = self->_index; + return obj; +} + +- (instancetype)initWithURL:(NSURL *)URL index:(NSInteger)index +{ + return [self initWithURL:URL index:index timeRange:kCMTimeRangeInvalid scale:kCMTimeInvalid]; +} + +- (instancetype)initWithURL:(NSURL *)URL index:(NSInteger)index timeRange:(CMTimeRange)timeRange scale:(CMTime)scale +{ + if (self = [super initWithTimeRange:timeRange scale:scale]) { + self->_URL = [URL copy]; + self->_index = index; + } + return self; +} + +- (id)newDemuxable +{ + SGURLDemuxer *demuxable = [[SGURLDemuxer alloc] initWithURL:self->_URL]; + SGDemuxerFunnel *obj = [[SGDemuxerFunnel alloc] initWithDemuxable:demuxable index:self.index timeRange:self.timeRange]; + return obj; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGAudioManager.h b/SGPlayer/Classes/Core/SGAudio/SGAudioManager.h deleted file mode 100644 index 3176e7a5..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGAudioManager.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// SGAudioManager.h -// SGPlayer -// -// Created by Single on 09/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, SGAudioManagerInterruptionType) { - SGAudioManagerInterruptionTypeBegin, - SGAudioManagerInterruptionTypeEnded, -}; - -typedef NS_ENUM(NSUInteger, SGAudioManagerInterruptionOption) { - SGAudioManagerInterruptionOptionNone, - SGAudioManagerInterruptionOptionShouldResume, -}; - -typedef NS_ENUM(NSUInteger, SGAudioManagerRouteChangeReason) { - SGAudioManagerRouteChangeReasonOldDeviceUnavailable, -}; - -@class SGAudioManager; - -@protocol SGAudioManagerDelegate -- (void)audioManager:(SGAudioManager *)audioManager outputData:(float *)outputData numberOfFrames:(UInt32)numberOfFrames numberOfChannels:(UInt32)numberOfChannels; -@end - -typedef void (^SGAudioManagerInterruptionHandler)(id handlerTarget, SGAudioManager * audioManager, SGAudioManagerInterruptionType type, SGAudioManagerInterruptionOption option); -typedef void (^SGAudioManagerRouteChangeHandler)(id handlerTarget, SGAudioManager * audioManager, SGAudioManagerRouteChangeReason reason); - -@interface SGAudioManager : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)manager; - -@property (nonatomic, assign) float volume; - -@property (nonatomic, weak, readonly) id delegate; -@property (nonatomic, assign, readonly) BOOL playing; - -@property (nonatomic, assign, readonly) Float64 samplingRate; -@property (nonatomic, assign, readonly) UInt32 numberOfChannels; - -- (void)setHandlerTarget:(id)handlerTarget - interruption:(SGAudioManagerInterruptionHandler)interruptionHandler - routeChange:(SGAudioManagerRouteChangeHandler)routeChangeHandler; -- (void)removeHandlerTarget:(id)handlerTarget; - -- (void)playWithDelegate:(id )delegate; -- (void)pause; - -- (BOOL)registerAudioSession; -- (void)unregisterAudioSession; - -@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGAudioManager.m b/SGPlayer/Classes/Core/SGAudio/SGAudioManager.m deleted file mode 100644 index 9849e455..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGAudioManager.m +++ /dev/null @@ -1,615 +0,0 @@ -// -// SGAudioManager.m -// SGPlayer -// -// Created by Single on 09/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGAudioManager.h" -#import -#import -#import -#import "SGPlayerMacro.h" - -#if SGPLATFORM_TARGET_OS_MAC -#import "SGMacAudioSession.h" -#endif - -static int const max_frame_size = 4096; -static int const max_chan = 2; - -typedef struct -{ - AUNode node; - AudioUnit audioUnit; -} -SGAudioNodeContext; - -typedef struct -{ - AUGraph graph; - SGAudioNodeContext converterNodeContext; - SGAudioNodeContext mixerNodeContext; - SGAudioNodeContext outputNodeContext; - AudioStreamBasicDescription commonFormat; -} -SGAudioOutputContext; - -@interface SGAudioManager () - -{ - float * _outData; -} - -@property (nonatomic, assign) SGAudioOutputContext * outputContext; - -@property (nonatomic, weak) id handlerTarget; -@property (nonatomic, copy) SGAudioManagerInterruptionHandler interruptionHandler; -@property (nonatomic, copy) SGAudioManagerRouteChangeHandler routeChangeHandler; - -@property (nonatomic, assign) BOOL registered; - -#if SGPLATFORM_TARGET_OS_MAC -@property (nonatomic, strong) SGMacAudioSession * audioSession; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV -@property (nonatomic, strong) AVAudioSession * audioSession; -#endif - -@property (nonatomic, strong) NSError * error; -@property (nonatomic, strong) NSError * warning; - -@end - -@implementation SGAudioManager - -+ (instancetype)manager -{ - static SGAudioManager * manager = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - manager = [[self alloc] init]; - }); - return manager; -} - -- (instancetype)init -{ - if (self = [super init]) - { - self->_outData = (float *)calloc(max_frame_size * max_chan, sizeof(float)); - -#if SGPLATFORM_TARGET_OS_MAC - self.audioSession = [SGMacAudioSession sharedInstance]; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - self.audioSession = [AVAudioSession sharedInstance]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionInterruptionHandler:) name:AVAudioSessionInterruptionNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionRouteChangeHandler:) name:AVAudioSessionRouteChangeNotification object:nil]; -#endif - } - return self; -} - -- (void)setHandlerTarget:(id)handlerTarget - interruption:(SGAudioManagerInterruptionHandler)interruptionHandler - routeChange:(SGAudioManagerRouteChangeHandler)routeChangeHandler -{ - self.handlerTarget = handlerTarget; - self.interruptionHandler = interruptionHandler; - self.routeChangeHandler = routeChangeHandler; -} - -- (void)removeHandlerTarget:(id)handlerTarget -{ - if (self.handlerTarget == handlerTarget || !self.handlerTarget) { - self.handlerTarget = nil; - self.interruptionHandler = nil; - self.routeChangeHandler = nil; - } -} - -#if SGPLATFORM_TARGET_OS_MAC - - - -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - -- (void)audioSessionInterruptionHandler:(NSNotification *)notification -{ - if (self.handlerTarget && self.interruptionHandler) { - AVAudioSessionInterruptionType avType = [[notification.userInfo objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; - SGAudioManagerInterruptionType type = SGAudioManagerInterruptionTypeBegin; - if (avType == AVAudioSessionInterruptionTypeEnded) { - type = SGAudioManagerInterruptionTypeEnded; - } - SGAudioManagerInterruptionOption option = SGAudioManagerInterruptionOptionNone; - id avOption = [notification.userInfo objectForKey:AVAudioSessionInterruptionOptionKey]; - if (avOption) { - AVAudioSessionInterruptionOptions temp = [avOption unsignedIntegerValue]; - if (temp == AVAudioSessionInterruptionOptionShouldResume) { - option = SGAudioManagerInterruptionOptionShouldResume; - } - } - self.interruptionHandler(self.handlerTarget, self, type, option); - } -} - -- (void)audioSessionRouteChangeHandler:(NSNotification *)notification -{ - if (self.handlerTarget && self.routeChangeHandler) { - AVAudioSessionRouteChangeReason avReason = [[notification.userInfo objectForKey:AVAudioSessionRouteChangeReasonKey] unsignedIntegerValue]; - switch (avReason) { - case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: - { - self.routeChangeHandler(self.handlerTarget, self, SGAudioManagerRouteChangeReasonOldDeviceUnavailable); - } - break; - default: - break; - } - - } -} - -#endif - -- (BOOL)registerAudioSession -{ - if (!self.registered) { - if ([self setupAudioUnit]) { - self.registered = YES; - } - } -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [self.audioSession setActive:YES error:nil]; -#endif - return self.registered; -} - -- (void)unregisterAudioSession -{ - if (self.registered) { - self.registered = NO; - OSStatus result = AUGraphUninitialize(self.outputContext->graph); - self.warning = checkError(result, @"graph uninitialize error"); - if (self.warning) { - [self delegateWarningCallback]; - } - result = AUGraphClose(self.outputContext->graph); - self.warning = checkError(result, @"graph close error"); - if (self.warning) { - [self delegateWarningCallback]; - } - result = DisposeAUGraph(self.outputContext->graph); - self.warning = checkError(result, @"graph dispose error"); - if (self.warning) { - [self delegateWarningCallback]; - } - if (self.outputContext) { - free(self.outputContext); - self.outputContext = NULL; - } - } -} - -- (BOOL)setupAudioUnit -{ - OSStatus result; - UInt32 audioStreamBasicDescriptionSize = sizeof(AudioStreamBasicDescription);; - - self.outputContext = (SGAudioOutputContext *)malloc(sizeof(SGAudioOutputContext)); - memset(self.outputContext, 0, sizeof(SGAudioOutputContext)); - - result = NewAUGraph(&self.outputContext->graph); - self.error = checkError(result, @"create graph error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - AudioComponentDescription converterDescription; - converterDescription.componentType = kAudioUnitType_FormatConverter; - converterDescription.componentSubType = kAudioUnitSubType_AUConverter; - converterDescription.componentManufacturer = kAudioUnitManufacturer_Apple; - result = AUGraphAddNode(self.outputContext->graph, &converterDescription, &self.outputContext->converterNodeContext.node); - self.error = checkError(result, @"graph add converter node error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - AudioComponentDescription mixerDescription; - mixerDescription.componentType = kAudioUnitType_Mixer; -#if SGPLATFORM_TARGET_OS_MAC - mixerDescription.componentSubType = kAudioUnitSubType_StereoMixer; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - mixerDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer; -#endif - mixerDescription.componentManufacturer = kAudioUnitManufacturer_Apple; - result = AUGraphAddNode(self.outputContext->graph, &mixerDescription, &self.outputContext->mixerNodeContext.node); - self.error = checkError(result, @"graph add mixer node error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - AudioComponentDescription outputDescription; - outputDescription.componentType = kAudioUnitType_Output; -#if SGPLATFORM_TARGET_OS_MAC - outputDescription.componentSubType = kAudioUnitSubType_DefaultOutput; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - outputDescription.componentSubType = kAudioUnitSubType_RemoteIO; -#endif - outputDescription.componentManufacturer = kAudioUnitManufacturer_Apple; - result = AUGraphAddNode(self.outputContext->graph, &outputDescription, &self.outputContext->outputNodeContext.node); - self.error = checkError(result, @"graph add output node error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphOpen(self.outputContext->graph); - self.error = checkError(result, @"open graph error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphConnectNodeInput(self.outputContext->graph, - self.outputContext->converterNodeContext.node, - 0, - self.outputContext->mixerNodeContext.node, - 0); - self.error = checkError(result, @"graph connect converter and mixer error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphConnectNodeInput(self.outputContext->graph, - self.outputContext->mixerNodeContext.node, - 0, - self.outputContext->outputNodeContext.node, - 0); - self.error = checkError(result, @"graph connect converter and mixer error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphNodeInfo(self.outputContext->graph, - self.outputContext->converterNodeContext.node, - &converterDescription, - &self.outputContext->converterNodeContext.audioUnit); - self.error = checkError(result, @"graph get converter audio unit error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphNodeInfo(self.outputContext->graph, - self.outputContext->mixerNodeContext.node, - &mixerDescription, - &self.outputContext->mixerNodeContext.audioUnit); - self.error = checkError(result, @"graph get minxer audio unit error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AUGraphNodeInfo(self.outputContext->graph, - self.outputContext->outputNodeContext.node, - &outputDescription, - &self.outputContext->outputNodeContext.audioUnit); - self.error = checkError(result, @"graph get output audio unit error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - AURenderCallbackStruct converterCallback; - converterCallback.inputProc = renderCallback; - converterCallback.inputProcRefCon = (__bridge void *)(self); - result = AUGraphSetNodeInputCallback(self.outputContext->graph, - self.outputContext->converterNodeContext.node, - 0, - &converterCallback); - self.error = checkError(result, @"graph add converter input callback error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AudioUnitGetProperty(self.outputContext->outputNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, 0, - &self.outputContext->commonFormat, - &audioStreamBasicDescriptionSize); - self.warning = checkError(result, @"get hardware output stream format error"); - if (self.warning) { - [self delegateWarningCallback]; - } else { - if (self.audioSession.sampleRate != self.outputContext->commonFormat.mSampleRate) { - self.outputContext->commonFormat.mSampleRate = self.audioSession.sampleRate; - result = AudioUnitSetProperty(self.outputContext->outputNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 0, - &self.outputContext->commonFormat, - audioStreamBasicDescriptionSize); - self.warning = checkError(result, @"set hardware output stream format error"); - if (self.warning) { - [self delegateWarningCallback]; - } - } - } - - result = AudioUnitSetProperty(self.outputContext->converterNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 0, - &self.outputContext->commonFormat, - audioStreamBasicDescriptionSize); - self.error = checkError(result, @"graph set converter input format error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AudioUnitSetProperty(self.outputContext->converterNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, - 0, - &self.outputContext->commonFormat, - audioStreamBasicDescriptionSize); - self.error = checkError(result, @"graph set converter output format error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AudioUnitSetProperty(self.outputContext->mixerNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 0, - &self.outputContext->commonFormat, - audioStreamBasicDescriptionSize); - self.error = checkError(result, @"graph set converter input format error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AudioUnitSetProperty(self.outputContext->mixerNodeContext.audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Output, - 0, - &self.outputContext->commonFormat, - audioStreamBasicDescriptionSize); - self.error = checkError(result, @"graph set converter output format error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - result = AudioUnitSetProperty(self.outputContext->mixerNodeContext.audioUnit, - kAudioUnitProperty_MaximumFramesPerSlice, - kAudioUnitScope_Global, - 0, - &max_frame_size, - sizeof(max_frame_size)); - self.warning = checkError(result, @"graph set mixer max frames per slice size error"); - if (self.warning) { - [self delegateWarningCallback]; - } - - result = AUGraphInitialize(self.outputContext->graph); - self.error = checkError(result, @"graph initialize error"); - if (self.error) { - [self delegateErrorCallback]; - return NO; - } - - return YES; -} - -- (OSStatus)renderFrames:(UInt32)numberOfFrames ioData:(AudioBufferList *)ioData -{ - if (!self.registered) { - return noErr; - } - - for (int iBuffer = 0; iBuffer < ioData->mNumberBuffers; iBuffer++) { - memset(ioData->mBuffers[iBuffer].mData, 0, ioData->mBuffers[iBuffer].mDataByteSize); - } - - if (self.playing && self.delegate) - { - [self.delegate audioManager:self outputData:self->_outData numberOfFrames:numberOfFrames numberOfChannels:self.numberOfChannels]; - - UInt32 numBytesPerSample = self.outputContext->commonFormat.mBitsPerChannel / 8; - if (numBytesPerSample == 4) { - float zero = 0.0; - for (int iBuffer = 0; iBuffer < ioData->mNumberBuffers; iBuffer++) { - int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels; - for (int iChannel = 0; iChannel < thisNumChannels; iChannel++) { - vDSP_vsadd(self->_outData + iChannel, - self.numberOfChannels, - &zero, - (float *)ioData->mBuffers[iBuffer].mData, - thisNumChannels, - numberOfFrames); - } - } - } - else if (numBytesPerSample == 2) - { - float scale = (float)INT16_MAX; - vDSP_vsmul(self->_outData, 1, &scale, self->_outData, 1, numberOfFrames * self.numberOfChannels); - - for (int iBuffer = 0; iBuffer < ioData->mNumberBuffers; iBuffer++) { - int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels; - for (int iChannel = 0; iChannel < thisNumChannels; iChannel++) { - vDSP_vfix16(self->_outData + iChannel, - self.numberOfChannels, - (SInt16 *)ioData->mBuffers[iBuffer].mData + iChannel, - thisNumChannels, - numberOfFrames); - } - } - } - } - - return noErr; -} - -- (void)playWithDelegate:(id)delegate -{ - self->_delegate = delegate; - [self play]; -} - -- (void)play -{ - if (!self->_playing) { - if ([self registerAudioSession]) { - OSStatus result = AUGraphStart(self.outputContext->graph); - self.error = checkError(result, @"graph start error"); - if (self.error) { - [self delegateErrorCallback]; - } else { - self->_playing = YES; - } - } - } -} - -- (void)pause -{ - if (self->_playing) { - OSStatus result = AUGraphStop(self.outputContext->graph); - self.error = checkError(result, @"graph stop error"); - if (self.error) { - [self delegateErrorCallback]; - } - self->_playing = NO; - } -} - -- (float)volume -{ - if (self.registered) { - AudioUnitParameterID param; -#if SGPLATFORM_TARGET_OS_MAC - param = kStereoMixerParam_Volume; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - param = kMultiChannelMixerParam_Volume; -#endif - AudioUnitParameterValue volume; - OSStatus result = AudioUnitGetParameter(self.outputContext->mixerNodeContext.audioUnit, - param, - kAudioUnitScope_Input, - 0, - &volume); - self.warning = checkError(result, @"graph get mixer volum error"); - if (self.warning) { - [self delegateWarningCallback]; - } else { - return volume; - } - } - return 1.f; -} - -- (void)setVolume:(float)volume -{ - if (self.registered) { - AudioUnitParameterID param; -#if SGPLATFORM_TARGET_OS_MAC - param = kStereoMixerParam_Volume; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - param = kMultiChannelMixerParam_Volume; -#endif - OSStatus result = AudioUnitSetParameter(self.outputContext->mixerNodeContext.audioUnit, - param, - kAudioUnitScope_Input, - 0, - volume, - 0); - self.warning = checkError(result, @"graph set mixer volum error"); - if (self.warning) { - [self delegateWarningCallback]; - } - } -} - -- (Float64)samplingRate -{ - if (!self.registered) { - return 0; - } - Float64 number = self.outputContext->commonFormat.mSampleRate; - if (number > 0) { - return number; - } - return (Float64)self.audioSession.sampleRate; -} - -- (UInt32)numberOfChannels -{ - if (!self.registered) { - return 0; - } - UInt32 number = self.outputContext->commonFormat.mChannelsPerFrame; - if (number > 0) { - return number; - } - return (UInt32)self.audioSession.outputNumberOfChannels; -} - -- (void)delegateErrorCallback -{ - if (self.error) { - SGPlayerLog(@"SGAudioManager did error : %@", self.error); - } -} - -- (void)delegateWarningCallback -{ - if (self.warning) { - SGPlayerLog(@"SGAudioManager did warning : %@", self.warning); - } -} - -- (void)dealloc -{ - [self unregisterAudioSession]; - if (self->_outData) { - free(self->_outData); - self->_outData = NULL; - } - self->_playing = NO; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - SGPlayerLog(@"SGAudioManager release"); -} - -static NSError * checkError(OSStatus result, NSString * domain) -{ - if (result == noErr) return nil; - NSError * error = [NSError errorWithDomain:domain code:result userInfo:nil]; - return error; -} - -static OSStatus renderCallback(void * inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inOutputBusNumber, - UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - SGAudioManager * manager = (__bridge SGAudioManager *)inRefCon; - return [manager renderFrames:inNumberFrames ioData:ioData]; -} - -@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.h b/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.h new file mode 100644 index 00000000..458b9c88 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.h @@ -0,0 +1,76 @@ +// +// SGAudioPlayer.h +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import + +@class SGAudioPlayer; + +@protocol SGAudioPlayerDelegate + +/** + * + */ +- (void)audioPlayer:(SGAudioPlayer *)player render:(const AudioTimeStamp *)timeStamp data:(AudioBufferList *)data numberOfFrames:(UInt32)numberOfFrames; + +@optional +/** + * + */ +- (void)audioPlayer:(SGAudioPlayer *)player willRender:(const AudioTimeStamp *)timestamp; + +/** + * + */ +- (void)audioPlayer:(SGAudioPlayer *)player didRender:(const AudioTimeStamp *)timestamp; + +@end + +@interface SGAudioPlayer : NSObject + +/** + * Delegate. + */ +@property (nonatomic, weak) id delegate; + +/** + * Rate. + */ +@property (nonatomic) float rate; + +/** + * Volume. + */ +@property (nonatomic) float volume; + +/** + * ASBD. + */ +@property (nonatomic) AudioStreamBasicDescription asbd; + +/** + * Playback. + */ +- (BOOL)isPlaying; + +/** + * Play. + */ +- (void)play; + +/** + * Pause. + */ +- (void)pause; + +/** + * Flush. + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.m b/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.m new file mode 100644 index 00000000..1b5b4d49 --- /dev/null +++ b/SGPlayer/Classes/Core/SGAudio/SGAudioPlayer.m @@ -0,0 +1,277 @@ +// +// SGAudioPlayer.m +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGAudioPlayer.h" +#import "SGPLFTargets.h" + +@interface SGAudioPlayer () + +{ + AUGraph _graph; + AUNode _mixerNode; + AUNode _outputNode; + AUNode _timePitchNode; + AudioUnit _mixerUnit; + AudioUnit _outputUnit; + AudioUnit _timePitchUnit; +} + +@end + +@implementation SGAudioPlayer + ++ (AudioComponentDescription)mixerACD +{ + AudioComponentDescription acd; + acd.componentType = kAudioUnitType_Mixer; +#if SGPLATFORM_TARGET_OS_MAC + acd.componentSubType = kAudioUnitSubType_StereoMixer; +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + acd.componentSubType = kAudioUnitSubType_MultiChannelMixer; +#endif + acd.componentManufacturer = kAudioUnitManufacturer_Apple; + return acd; +} + ++ (AudioComponentDescription)outputACD +{ + AudioComponentDescription acd; + acd.componentType = kAudioUnitType_Output; +#if SGPLATFORM_TARGET_OS_MAC + acd.componentSubType = kAudioUnitSubType_DefaultOutput; +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + acd.componentSubType = kAudioUnitSubType_RemoteIO; +#endif + acd.componentManufacturer = kAudioUnitManufacturer_Apple; + return acd; +} + ++ (AudioComponentDescription)timePitchACD +{ + AudioComponentDescription acd; + acd.componentType = kAudioUnitType_FormatConverter; + acd.componentSubType = kAudioUnitSubType_NewTimePitch; + acd.componentManufacturer = kAudioUnitManufacturer_Apple; + return acd; +} + ++ (AudioStreamBasicDescription)commonASBD +{ + UInt32 byteSize = sizeof(float); + AudioStreamBasicDescription asbd; + asbd.mBitsPerChannel = byteSize * 8; + asbd.mBytesPerFrame = byteSize; + asbd.mChannelsPerFrame = 2; + asbd.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsNonInterleaved; + asbd.mFormatID = kAudioFormatLinearPCM; + asbd.mFramesPerPacket = 1; + asbd.mBytesPerPacket = asbd.mFramesPerPacket * asbd.mBytesPerFrame; + asbd.mSampleRate = 44100.0f; + return asbd; +} + +- (instancetype)init +{ + if (self = [super init]) { + [self setup]; + } + return self; +} + +- (void)dealloc +{ + [self destroy]; +} + +#pragma mark - Setup/Destory + +- (void)setup +{ + AudioStreamBasicDescription asbd = [self.class commonASBD]; + AudioComponentDescription mixerACD = [self.class mixerACD]; + AudioComponentDescription outputACD = [self.class outputACD]; + AudioComponentDescription timePitchACD = [self.class timePitchACD]; + + NewAUGraph(&_graph); + AUGraphAddNode(_graph, &mixerACD, &_mixerNode); + AUGraphAddNode(_graph, &outputACD, &_outputNode); + AUGraphAddNode(_graph, &timePitchACD, &_timePitchNode); + + AUGraphOpen(_graph); + AUGraphNodeInfo(_graph, _mixerNode, &mixerACD, &_mixerUnit); + AUGraphNodeInfo(_graph, _outputNode, &outputACD, &_outputUnit); + AUGraphNodeInfo(_graph, _timePitchNode, &timePitchACD, &_timePitchUnit); + + UInt32 value = 4096; + UInt32 size = sizeof(value); + AudioUnitScope scope = kAudioUnitScope_Global; + AudioUnitPropertyID param = kAudioUnitProperty_MaximumFramesPerSlice; + AudioUnitSetProperty(_mixerUnit, param, scope, 0, &value, size); + AudioUnitSetProperty(_outputUnit, param, scope, 0, &value, size); + AudioUnitSetProperty(_timePitchUnit, param, scope, 0, &value, size); + + AURenderCallbackStruct inputCallbackStruct; + inputCallbackStruct.inputProc = inputCallback; + inputCallbackStruct.inputProcRefCon = (__bridge void *)self; + AUGraphSetNodeInputCallback(_graph, _mixerNode, 0, &inputCallbackStruct); + AudioUnitAddRenderNotify(_outputUnit, outputCallback, (__bridge void *)self); + + [self setRate:1]; + [self setVolume:1]; + [self setAsbd:asbd]; + + AUGraphInitialize(_graph); +} + +- (void)destroy +{ + AUGraphStop(_graph); + AUGraphUninitialize(_graph); + AUGraphClose(_graph); + DisposeAUGraph(_graph); +} + +- (void)disconnectNodeInput:(AUNode)sourceNode destNode:(AUNode)destNode +{ + UInt32 count = 8; + AUNodeInteraction interactions[8]; + if (AUGraphGetNodeInteractions(_graph, destNode, &count, interactions) == noErr) { + for (UInt32 i = 0; i < MIN(count, 8); i++) { + AUNodeInteraction interaction = interactions[i]; + if (interaction.nodeInteractionType == kAUNodeInteraction_Connection) { + AUNodeConnection connection = interaction.nodeInteraction.connection; + if (connection.sourceNode == sourceNode) { + AUGraphDisconnectNodeInput(_graph, connection.destNode, connection.destInputNumber); + break; + } + } + } + } +} + +#pragma mark - Interface + +- (void)play +{ + if ([self isPlaying] == NO) { + AUGraphStart(_graph); + } +} + +- (void)pause +{ + if ([self isPlaying] == YES) { + AUGraphStop(_graph); + } +} + +- (void)flush +{ + AudioUnitReset(_mixerUnit, kAudioUnitScope_Global, 0); + AudioUnitReset(_outputUnit, kAudioUnitScope_Global, 0); + AudioUnitReset(_timePitchUnit, kAudioUnitScope_Global, 0); +} + +#pragma mark - Setter & Getter + +- (BOOL)isPlaying +{ + Boolean ret = FALSE; + AUGraphIsRunning(_graph, &ret); + return ret == TRUE ? YES : NO; +} + +- (void)setVolume:(float)volume +{ + AudioUnitParameterID param; +#if SGPLATFORM_TARGET_OS_MAC + param = kStereoMixerParam_Volume; +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + param = kMultiChannelMixerParam_Volume; +#endif + if (AudioUnitSetParameter(_mixerUnit, param, kAudioUnitScope_Input, 0, volume, 0) == noErr) { + _volume = volume; + } +} + +- (void)setRate:(float)rate +{ + if (_rate == rate) { + return; + } + if (AudioUnitSetParameter(_timePitchUnit, kNewTimePitchParam_Rate, kAudioUnitScope_Global, 0, rate, 0) == noErr) { + if (_rate == 1.0 || rate == 1.0) { + if (rate == 1.0) { + [self disconnectNodeInput:_mixerNode destNode:_timePitchNode]; + [self disconnectNodeInput:_timePitchNode destNode:_outputNode]; + AUGraphConnectNodeInput(_graph, _mixerNode, 0, _outputNode, 0); + } else { + [self disconnectNodeInput:_mixerNode destNode:_outputNode]; + AUGraphConnectNodeInput(_graph, _mixerNode, 0, _timePitchNode, 0); + AUGraphConnectNodeInput(_graph, _timePitchNode, 0, _outputNode, 0); + } + AUGraphUpdate(_graph, NULL); + } + _rate = rate; + } +} + +- (void)setAsbd:(AudioStreamBasicDescription)asbd +{ + UInt32 size = sizeof(AudioStreamBasicDescription); + AudioUnitPropertyID param = kAudioUnitProperty_StreamFormat; + if (AudioUnitSetProperty(_mixerUnit, param, kAudioUnitScope_Global, 0, &asbd, size) == noErr && + AudioUnitSetProperty(_outputUnit, param, kAudioUnitScope_Input, 0, &asbd, size) == noErr && + AudioUnitSetProperty(_timePitchUnit, param, kAudioUnitScope_Global, 0, &asbd, size) == noErr) { + _asbd = asbd; + } else { + AudioUnitSetProperty(_mixerUnit, param, kAudioUnitScope_Global, 0, &_asbd, size); + AudioUnitSetProperty(_outputUnit, param, kAudioUnitScope_Input, 0, &_asbd, size); + AudioUnitSetProperty(_timePitchUnit, param, kAudioUnitScope_Global, 0, &_asbd, size); + } +} + +#pragma mark - Callback + +static OSStatus inputCallback(void *inRefCon, + AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + UInt32 inNumberFrames, + AudioBufferList *ioData) +{ + @autoreleasepool { + SGAudioPlayer *self = (__bridge SGAudioPlayer *)inRefCon; + [self.delegate audioPlayer:self render:inTimeStamp data:ioData numberOfFrames:inNumberFrames]; + } + return noErr; +} + +static OSStatus outputCallback(void *inRefCon, + AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + UInt32 inNumberFrames, + AudioBufferList *ioData) +{ + @autoreleasepool { + SGAudioPlayer *self = (__bridge SGAudioPlayer *)inRefCon; + if ((*ioActionFlags) & kAudioUnitRenderAction_PreRender) { + if ([self.delegate respondsToSelector:@selector(audioPlayer:willRender:)]) { + [self.delegate audioPlayer:self willRender:inTimeStamp]; + } + } else if ((*ioActionFlags) & kAudioUnitRenderAction_PostRender) { + if ([self.delegate respondsToSelector:@selector(audioPlayer:didRender:)]) { + [self.delegate audioPlayer:self didRender:inTimeStamp]; + } + } + } + return noErr; +} + +@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.h b/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.h deleted file mode 100644 index 9ed6841b..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SGAudioDevice.h -// audio-mac -// -// Created by Single on 2017/2/23. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import - -@interface SGMacAudioDevice : NSObject - -@property (nonatomic, assign) AudioDeviceID deviceID; -@property (nonatomic, copy) NSString * manufacturer; -@property (nonatomic, copy) NSString * name; -@property (nonatomic, assign) NSInteger inputChannelCount; -@property (nonatomic, assign) NSInteger outputChannelCount; -@property (nonatomic, copy) NSString * UID; - -@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.m b/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.m deleted file mode 100644 index e4f8fb23..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGMacAudioDevice.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGAudioDevice.m -// SGPlayer -// -// Created by Single on 2017/2/23. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGMacAudioDevice.h" - -@implementation SGMacAudioDevice - -@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.h b/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.h deleted file mode 100644 index 4c5af560..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// SGMacAudioSession.h -// audio-mac -// -// Created by Single on 2017/2/23. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGMacAudioDevice.h" - -@interface SGMacAudioSession : NSObject - -+ (instancetype)sharedInstance; - -- (NSArray *)devices; -- (SGMacAudioDevice *)currentDevice; - -- (double)sampleRate; -- (NSInteger)outputNumberOfChannels; - -@end diff --git a/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.m b/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.m deleted file mode 100644 index ed5fa23c..00000000 --- a/SGPlayer/Classes/Core/SGAudio/SGMacAudioSession.m +++ /dev/null @@ -1,173 +0,0 @@ -// -// SGMacAudioSession.m -// SGPlayer -// -// Created by Single on 2017/2/23. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGMacAudioSession.h" -#import - -@implementation SGMacAudioSession - -+ (instancetype)sharedInstance -{ - static SGMacAudioSession * audioSession = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - audioSession = [[SGMacAudioSession alloc] init]; - }); - return audioSession; -} - -- (double)sampleRate -{ - return 44100; -} - -- (NSInteger)outputNumberOfChannels -{ - return self.currentDevice.outputChannelCount; -} - -- (NSArray *)devices -{ - return [self audioDevicesForPropertySelector:kAudioHardwarePropertyDevices]; -} - -- (SGMacAudioDevice *)currentDevice -{ - return [self audioDevicesForPropertySelector:kAudioHardwarePropertyDefaultOutputDevice].firstObject; -} - -- (NSArray *)audioDevicesForPropertySelector:(AudioObjectPropertySelector)selector -{ - NSMutableArray * devices = [NSMutableArray array]; - - AudioObjectPropertyAddress address = [self addressForPropertySelector:selector]; - UInt32 devicesDataSize; - [self checkResult:AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, - &address, - 0, - NULL, - &devicesDataSize) - operation:"Failed to get data size"]; - - NSInteger count = devicesDataSize / sizeof(AudioDeviceID); - AudioDeviceID * deviceIDs = (AudioDeviceID *)malloc(devicesDataSize); - - [self checkResult:AudioObjectGetPropertyData(kAudioObjectSystemObject, - &address, - 0, - NULL, - &devicesDataSize, - deviceIDs) - operation:"Failed to get device IDs for available devices on OSX"]; - - for (UInt32 i = 0; i < count; i++) - { - AudioDeviceID deviceID = deviceIDs[i]; - SGMacAudioDevice * device = [[SGMacAudioDevice alloc] init]; - device.deviceID = deviceID; - device.manufacturer = [self manufacturerForDeviceID:deviceID]; - device.name = [self namePropertyForDeviceID:deviceID]; - device.UID = [self UIDPropertyForDeviceID:deviceID]; - device.inputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeInput forDeviceID:deviceID]; - device.outputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeOutput forDeviceID:deviceID]; - [devices addObject:device]; - } - - free(deviceIDs); - - return devices; -} - -- (AudioObjectPropertyAddress)addressForPropertySelector:(AudioObjectPropertySelector)selector -{ - AudioObjectPropertyAddress address; - address.mScope = kAudioObjectPropertyScopeGlobal; - address.mElement = kAudioObjectPropertyElementMaster; - address.mSelector = selector; - return address; -} - -- (NSString *)stringPropertyForSelector:(AudioObjectPropertySelector)selector - withDeviceID:(AudioDeviceID)deviceID -{ - AudioObjectPropertyAddress address = [self addressForPropertySelector:selector]; - CFStringRef string; - UInt32 propSize = sizeof(CFStringRef); - NSString *errorString = [NSString stringWithFormat:@"Failed to get device property (%u)",(unsigned int)selector]; - [self checkResult:AudioObjectGetPropertyData(deviceID, - &address, - 0, - NULL, - &propSize, - &string) - operation:errorString.UTF8String]; - return (__bridge_transfer NSString *)string; -} - -- (NSInteger)channelCountForScope:(AudioObjectPropertyScope)scope - forDeviceID:(AudioDeviceID)deviceID -{ - AudioObjectPropertyAddress address; - address.mScope = scope; - address.mElement = kAudioObjectPropertyElementMaster; - address.mSelector = kAudioDevicePropertyStreamConfiguration; - - AudioBufferList streamConfiguration; - UInt32 propSize = sizeof(streamConfiguration); - [self checkResult:AudioObjectGetPropertyData(deviceID, - &address, - 0, - NULL, - &propSize, - &streamConfiguration) - operation:"Failed to get frame size"]; - - NSInteger channelCount = 0; - for (NSInteger i = 0; i < streamConfiguration.mNumberBuffers; i++) - { - channelCount += streamConfiguration.mBuffers[i].mNumberChannels; - } - - return channelCount; -} - -- (NSString *)manufacturerForDeviceID:(AudioDeviceID)deviceID -{ - return [self stringPropertyForSelector:kAudioDevicePropertyDeviceManufacturerCFString - withDeviceID:deviceID]; -} - -- (NSString *)namePropertyForDeviceID:(AudioDeviceID)deviceID -{ - return [self stringPropertyForSelector:kAudioDevicePropertyDeviceNameCFString - withDeviceID:deviceID]; -} - -- (NSString *)UIDPropertyForDeviceID:(AudioDeviceID)deviceID -{ - return [self stringPropertyForSelector:kAudioDevicePropertyDeviceUID - withDeviceID:deviceID]; -} - -- (void)checkResult:(OSStatus)result operation:(const char *)operation -{ - if (result == noErr) return; - char errorString[20]; - // see if it appears to be a 4-char-code - *(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(result); - if (isprint(errorString[1]) && isprint(errorString[2]) && isprint(errorString[3]) && isprint(errorString[4])) - { - errorString[0] = errorString[5] = '\''; - errorString[6] = '\0'; - } else - // no, format it as an integer - sprintf(errorString, "%d", (int)result); - fprintf(stderr, "Error: %s (%s)\n", operation, errorString); -} - -@end diff --git a/SGPlayer/Classes/Core/SGCommon/SGActivity.h b/SGPlayer/Classes/Core/SGCommon/SGActivity.h new file mode 100644 index 00000000..185bc400 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGActivity.h @@ -0,0 +1,23 @@ +// +// SGPlayerActivity.h +// SGPlayer +// +// Created by Single on 2018/1/10. +// Copyright © 2018年 single. All rights reserved. +// + +#import + +@interface SGActivity : NSObject + +/** + * + */ ++ (void)addTarget:(id)target; + +/** + * + */ ++ (void)removeTarget:(id)target; + +@end diff --git a/SGPlayer/Classes/Core/SGCommon/SGActivity.m b/SGPlayer/Classes/Core/SGCommon/SGActivity.m new file mode 100644 index 00000000..b5c2a5b9 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGActivity.m @@ -0,0 +1,90 @@ +// +// SGPlayerActivity.m +// SGPlayer +// +// Created by Single on 2018/1/10. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGActivity.h" + +@interface SGActivity () + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) NSMutableSet *targets; + +@end + +@implementation SGActivity + ++ (void)addTarget:(id)target +{ + [[SGActivity activity] addTarget:target]; +} + ++ (void)removeTarget:(id)target +{ + [[SGActivity activity] removeTarget:target]; +} + ++ (instancetype)activity +{ + static SGActivity *obj = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + obj = [[SGActivity alloc] init]; + }); + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_targets = [NSMutableSet set]; + } + return self; +} + +- (void)addTarget:(id)target +{ + if (!target) { + return; + } + [self->_lock lock]; + if (![self->_targets containsObject:[self token:target]]) { + [self->_targets addObject:[self token:target]]; + } + [self reload]; + [self->_lock unlock]; +} + +- (void)removeTarget:(id)target +{ + if (!target) { + return; + } + [self->_lock lock]; + if ([self->_targets containsObject:[self token:target]]) { + [self->_targets removeObject:[self token:target]]; + } + [self reload]; + [self->_lock unlock]; +} + +- (void)reload +{ +#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV + BOOL disable = self.objects.count <= 0; + dispatch_async(dispatch_get_main_queue(), ^{ + [UIApplication sharedApplication].idleTimerDisabled = disable; + }); +#endif +} + +- (id)token:(id)target +{ + return [NSString stringWithFormat:@"%p", target]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGCommon/SGDefines.h b/SGPlayer/Classes/Core/SGCommon/SGDefines.h new file mode 100644 index 00000000..64340430 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGDefines.h @@ -0,0 +1,75 @@ +// +// SGDefines.h +// SGPlayer +// +// Created by Single on 2018/6/25. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import + +#if defined(__cplusplus) +#define SGPLAYER_EXTERN extern "C" +#else +#define SGPLAYER_EXTERN extern +#endif + +typedef NS_ENUM(NSUInteger, SGMediaType) { + SGMediaTypeUnknown = 0, + SGMediaTypeAudio = 1, + SGMediaTypeVideo = 2, + SGMediaTypeSubtitle = 3, +}; + +typedef NS_ENUM(NSUInteger, SGPlayerState) { + SGPlayerStateNone = 0, + SGPlayerStatePreparing = 1, + SGPlayerStateReady = 2, + SGPlayerStateFailed = 3, +}; + +typedef NS_OPTIONS(NSUInteger, SGPlaybackState) { + SGPlaybackStateNone = 0, + SGPlaybackStatePlaying = 1 << 0, + SGPlaybackStateSeeking = 1 << 1, + SGPlaybackStateFinished = 1 << 2, +}; + +typedef NS_ENUM(NSUInteger, SGLoadingState) { + SGLoadingStateNone = 0, + SGLoadingStatePlaybale = 1, + SGLoadingStateStalled = 2, + SGLoadingStateFinished = 3, +}; + +typedef NS_OPTIONS(NSUInteger, SGInfoAction) { + SGInfoActionNone = 0, + SGInfoActionTimeCached = 1 << 1, + SGInfoActionTimePlayback = 1 << 2, + SGInfoActionTimeDuration = 1 << 3, + SGInfoActionTime = SGInfoActionTimeCached | SGInfoActionTimePlayback | SGInfoActionTimeDuration, + SGInfoActionStatePlayer = 1 << 4, + SGInfoActionStateLoading = 1 << 5, + SGInfoActionStatePlayback = 1 << 6, + SGInfoActionState = SGInfoActionStatePlayer | SGInfoActionStateLoading | SGInfoActionStatePlayback, +}; + +typedef struct { + CMTime cached; + CMTime playback; + CMTime duration; +} SGTimeInfo; + +typedef struct { + SGPlayerState player; + SGLoadingState loading; + SGPlaybackState playback; +} SGStateInfo; + +@class SGPlayer; + +typedef void (^SGBlock)(void); +typedef void (^SGHandler)(SGPlayer *player); +typedef BOOL (^SGTimeReader)(CMTime *desire, BOOL *drop); +typedef void (^SGSeekResult)(CMTime time, NSError *error); diff --git a/SGPlayer/Classes/Core/SGCommon/SGError.h b/SGPlayer/Classes/Core/SGCommon/SGError.h new file mode 100644 index 00000000..2a0a379b --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGError.h @@ -0,0 +1,53 @@ +// +// SGError.h +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGErrorCode) { + SGErrorCodeUnknown = 0, + SGErrorImmediateExitRequested, + SGErrorCodeNoValidFormat, + SGErrorCodeFormatNotSeekable, + SGErrorCodePacketOutputCancelSeek, + SGErrorCodeURLDemuxerFunnelFinished, + SGErrorCodeMutilDemuxerEndOfFile, + SGErrorCodeDemuxerEndOfFile, + SGErrorCodeInvlidTime, +}; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGActionCode) { + SGActionCodeUnknown = 0, + SGActionCodeFormatCreate, + SGActionCodeFormatOpenInput, + SGActionCodeFormatFindStreamInfo, + SGActionCodeFormatSeekFrame, + SGActionCodeFormatReadFrame, + SGActionCodeFormatGetSeekable, + SGActionCodeCodecSetParametersToContext, + SGActionCodeCodecOpen2, + SGActionCodePacketOutputSeek, + SGActionCodeURLDemuxerFunnelNext, + SGActionCodeMutilDemuxerNext, + SGActionCodeSegmentDemuxerNext, +}; + +/** + * + */ +NSError * SGGetFFError(int result, SGActionCode operation); + +/** + * + */ +NSError * SGCreateError(NSUInteger code, SGActionCode operation); diff --git a/SGPlayer/Classes/Core/SGCommon/SGError.m b/SGPlayer/Classes/Core/SGCommon/SGError.m new file mode 100644 index 00000000..05c2319e --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGError.m @@ -0,0 +1,34 @@ +// +// SGError.m +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGError.h" +#import "SGFFmpeg.h" + +static NSString * const SGErrorUserInfoKeyOperation = @"SGErrorUserInfoKeyOperation"; + +NSError * SGGetFFError(int result, SGActionCode operation) +{ + if (result >= 0) { + return nil; + } + char *data = malloc(256); + av_strerror(result, data, 256); + NSString *domain = [NSString stringWithFormat:@"SGPlayer-Error-FFmpeg code : %d, msg : %s", result, data]; + free(data); + if (result == AVERROR_EXIT) { + result = SGErrorImmediateExitRequested; + } else if (result == AVERROR_EOF) { + result = SGErrorCodeDemuxerEndOfFile; + } + return [NSError errorWithDomain:domain code:result userInfo:@{SGErrorUserInfoKeyOperation : @(operation)}]; +} + +NSError * SGCreateError(NSUInteger code, SGActionCode operation) +{ + return [NSError errorWithDomain:@"SGPlayer-Error-SGErrorCode" code:(NSInteger)code userInfo:@{SGErrorUserInfoKeyOperation : @(operation)}]; +} diff --git a/SGPlayer/Classes/Core/SGCommon/SGLock.h b/SGPlayer/Classes/Core/SGCommon/SGLock.h new file mode 100644 index 00000000..7eaf3ce2 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGLock.h @@ -0,0 +1,18 @@ +// +// SGLock.h +// SGPlayer iOS +// +// Created by Single on 2018/10/29. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGDefines.h" + +BOOL SGLockEXE00(id locking, void (^run)(void)); +BOOL SGLockEXE10(id locking, SGBlock (^run)(void)); +BOOL SGLockEXE11(id locking, SGBlock (^run)(void), BOOL (^finish)(SGBlock block)); + +BOOL SGLockCondEXE00(id locking, BOOL (^verify)(void), void (^run)(void)); +BOOL SGLockCondEXE10(id locking, BOOL (^verify)(void), SGBlock (^run)(void)); +BOOL SGLockCondEXE11(id locking, BOOL (^verify)(void), SGBlock (^run)(void), BOOL (^finish)(SGBlock block)); diff --git a/SGPlayer/Classes/Core/SGCommon/SGLock.m b/SGPlayer/Classes/Core/SGCommon/SGLock.m new file mode 100644 index 00000000..229159cd --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGLock.m @@ -0,0 +1,113 @@ +// +// SGLock.m +// SGPlayer iOS +// +// Created by Single on 2018/10/29. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGLock.h" + +BOOL SGLockEXE00(id locking, void (^run)(void)) +{ + [locking lock]; + if (run) { + run(); + } + [locking unlock]; + return YES; +} + +BOOL SGLockEXE10(id locking, SGBlock (^run)(void)) +{ + [locking lock]; + SGBlock r = nil; + if (run) { + r = run(); + } + [locking unlock]; + if (r) { + r(); + } + return YES; +} + +BOOL SGLockEXE11(id locking, SGBlock (^run)(void), BOOL (^finish)(SGBlock block)) +{ + [locking lock]; + SGBlock r = nil; + if (run) { + r = run(); + } + [locking unlock]; + if (finish) { + return finish(r ? r : ^{}); + } else if (r) { + r(); + } + return YES; +} + +BOOL SGLockCondEXE00(id locking, BOOL (^verify)(void), void (^run)(void)) +{ + [locking lock]; + BOOL s = YES; + if (verify) { + s = verify(); + } + if (!s) { + [locking unlock]; + return NO; + } + if (run) { + run(); + } + [locking unlock]; + return YES; +} + +BOOL SGLockCondEXE10(id locking, BOOL (^verify)(void), SGBlock (^run)(void)) +{ + [locking lock]; + BOOL s = YES; + if (verify) { + s = verify(); + } + if (!s) { + [locking unlock]; + return NO; + } + SGBlock r = nil; + if (run) { + r = run(); + } + [locking unlock]; + if (r) { + r(); + } + return YES; +} + +BOOL SGLockCondEXE11(id locking, BOOL (^verify)(void), SGBlock (^run)(void), BOOL (^finish)(SGBlock block)) +{ + [locking lock]; + BOOL s = YES; + if (verify) { + s = verify(); + } + if (!s) { + [locking unlock]; + return NO; + } + SGBlock r = nil; + if (run) { + r = run(); + } + [locking unlock]; + if (finish) { + return finish(r ? r : ^{}); + } else if (r) { + r(); + } + return YES; +} diff --git a/SGPlayer/Classes/Core/SGCommon/SGTime.h b/SGPlayer/Classes/Core/SGCommon/SGTime.h new file mode 100644 index 00000000..aa045f80 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGTime.h @@ -0,0 +1,50 @@ +// +// SGTime.h +// SGPlayer +// +// Created by Single on 2018/6/13. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import + +/** + * + */ +BOOL SGCMTimeIsValid(CMTime time, BOOL infinity); + +/** + * + */ +CMTime SGCMTimeValidate(CMTime time, CMTime defaultTime, BOOL infinity); + +/** + * + */ +CMTime SGCMTimeMakeWithSeconds(Float64 seconds); + +/** + * + */ +CMTime SGCMTimeMultiply(CMTime time, CMTime multiplier); + +/** + * + */ +CMTime SGCMTimeDivide(CMTime time, CMTime divisor); + +/** + * + */ +CMTime SGCMTimeDivide(CMTime time, CMTime divisor); + +/** + * + */ +CMTimeRange SGCMTimeRangeFit(CMTimeRange timeRange); + +/** + * + */ +CMTimeRange SGCMTimeRangeGetIntersection(CMTimeRange timeRange1, CMTimeRange timeRange2); diff --git a/SGPlayer/Classes/Core/SGCommon/SGTime.m b/SGPlayer/Classes/Core/SGCommon/SGTime.m new file mode 100644 index 00000000..ff0e7178 --- /dev/null +++ b/SGPlayer/Classes/Core/SGCommon/SGTime.m @@ -0,0 +1,67 @@ +// +// SGTime.m +// SGPlayer +// +// Created by Single on 2018/6/13. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGTime.h" +#import "SGFFmpeg.h" + +BOOL SGCMTimeIsValid(CMTime time, BOOL infinity) +{ + return + CMTIME_IS_VALID(time) && + (infinity || (!CMTIME_IS_NEGATIVE_INFINITY(time) && + !CMTIME_IS_POSITIVE_INFINITY(time))); +} + +CMTime SGCMTimeValidate(CMTime time, CMTime defaultTime, BOOL infinity) +{ + if (SGCMTimeIsValid(time, infinity)) { + return time; + } + NSCAssert(SGCMTimeIsValid(defaultTime, infinity), @"Invalid Default Time."); + return defaultTime; +} + +CMTime SGCMTimeMakeWithSeconds(Float64 seconds) +{ + return CMTimeMakeWithSeconds(seconds, AV_TIME_BASE); +} + +CMTime SGCMTimeMultiply(CMTime time, CMTime multiplier) +{ + int64_t maxV = ABS(time.value == 0 ? INT64_MAX : INT64_MAX / time.value); + int32_t maxT = ABS(time.timescale == 0 ? INT32_MAX : INT32_MAX / time.timescale); + if (multiplier.value > maxV || multiplier.value < -maxV || multiplier.timescale > maxT || multiplier.timescale < -maxT) { + return CMTimeMultiplyByFloat64(time, CMTimeGetSeconds(multiplier)); + } + return CMTimeMake(time.value * multiplier.value, time.timescale * multiplier.timescale); +} + +CMTime SGCMTimeDivide(CMTime time, CMTime divisor) +{ + int64_t maxV = ABS(time.value == 0 ? INT64_MAX : INT64_MAX / time.value); + int32_t maxT = ABS(time.timescale == 0 ? INT32_MAX : INT32_MAX / time.timescale); + if (divisor.timescale > maxV || divisor.timescale < -maxV || divisor.value > maxT || divisor.value < -maxT) { + return CMTimeMultiplyByFloat64(time, 1.0 / CMTimeGetSeconds(divisor)); + } + return CMTimeMake(time.value * divisor.timescale, time.timescale * (int32_t)divisor.value); +} + +CMTimeRange SGCMTimeRangeFit(CMTimeRange timeRange) +{ + return CMTimeRangeMake(SGCMTimeValidate(timeRange.start, kCMTimeNegativeInfinity, YES), + SGCMTimeValidate(timeRange.duration, kCMTimePositiveInfinity, YES)); +} + +CMTimeRange SGCMTimeRangeGetIntersection(CMTimeRange timeRange1, CMTimeRange timeRange2) +{ + CMTime start1 = SGCMTimeValidate(timeRange1.start, kCMTimeNegativeInfinity, YES); + CMTime start2 = SGCMTimeValidate(timeRange2.start, kCMTimeNegativeInfinity, YES); + CMTime end1 = SGCMTimeValidate(CMTimeRangeGetEnd(timeRange1), kCMTimePositiveInfinity, YES); + CMTime end2 = SGCMTimeValidate(CMTimeRangeGetEnd(timeRange2), kCMTimePositiveInfinity, YES); + return CMTimeRangeFromTimeToTime(CMTimeMaximum(start1, start2), CMTimeMinimum(end1, end2)); +} diff --git a/SGPlayer/Classes/Core/SGContainer/SGObjectPool.h b/SGPlayer/Classes/Core/SGContainer/SGObjectPool.h new file mode 100644 index 00000000..50a9612e --- /dev/null +++ b/SGPlayer/Classes/Core/SGContainer/SGObjectPool.h @@ -0,0 +1,31 @@ +// +// SGObjectPool.h +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGData.h" + +@interface SGObjectPool : NSObject + ++ (instancetype)sharedPool; + +/** + * + */ +- (__kindof id)objectWithClass:(Class)class reuseName:(NSString *)reuseName; + +/** + * + */ +- (void)comeback:(id)object; + +/** + * + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGContainer/SGObjectPool.m b/SGPlayer/Classes/Core/SGContainer/SGObjectPool.m new file mode 100644 index 00000000..3fda837b --- /dev/null +++ b/SGPlayer/Classes/Core/SGContainer/SGObjectPool.m @@ -0,0 +1,77 @@ +// +// SGObjectPool.m +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGObjectPool.h" + +@interface SGObjectPool () + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) NSMutableDictionary> *> *pool; + +@end + +@implementation SGObjectPool + ++ (instancetype)sharedPool +{ + static SGObjectPool *obj = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + obj = [[SGObjectPool alloc] init]; + }); + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_pool = [NSMutableDictionary dictionary]; + } + return self; +} + +- (id)objectWithClass:(Class)class reuseName:(NSString *)reuseName +{ + [self->_lock lock]; + NSMutableSet > *set = [self->_pool objectForKey:reuseName]; + if (!set) { + set = [NSMutableSet set]; + [self->_pool setObject:set forKey:reuseName]; + } + id object = set.anyObject; + if (object) { + [set removeObject:object]; + } else { + object = [[class alloc] init]; + } + [object lock]; + object.reuseName = reuseName; + [self->_lock unlock]; + return object; +} + +- (void)comeback:(id)object +{ + [self->_lock lock]; + NSMutableSet > *set = [self->_pool objectForKey:object.reuseName]; + if (![set containsObject:object]) { + [set addObject:object]; + [object clear]; + } + [self->_lock unlock]; +} + +- (void)flush +{ + [self->_lock lock]; + [self->_pool removeAllObjects]; + [self->_lock unlock]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.h b/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.h new file mode 100644 index 00000000..bc159b5b --- /dev/null +++ b/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.h @@ -0,0 +1,64 @@ +// +// SGObjectQueue.h +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGCapacity.h" +#import "SGDefines.h" +#import "SGData.h" + +@interface SGObjectQueue : NSObject + +/** + * + */ +- (instancetype)initWithMaxCount:(uint64_t)maxCount; + +/** + * + */ +@property (nonatomic) BOOL shouldSortObjects; + +/** + * + */ +- (SGCapacity)capacity; + +/** + * + */ +- (BOOL)putObjectSync:(id)object; +- (BOOL)putObjectSync:(id)object before:(SGBlock)before after:(SGBlock)after; + +/** + * + */ +- (BOOL)putObjectAsync:(id)object; + +/** + * + */ +- (BOOL)getObjectSync:(id *)object; +- (BOOL)getObjectSync:(id *)object before:(SGBlock)before after:(SGBlock)after; + +/** + * + */ +- (BOOL)getObjectAsync:(id *)object; +- (BOOL)getObjectAsync:(id *)object timeReader:(SGTimeReader)timeReader discarded:(uint64_t *)discarded; + +/** + * + */ +- (BOOL)flush; + +/** + * + */ +- (BOOL)destroy; + +@end diff --git a/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.m b/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.m new file mode 100644 index 00000000..878a6d68 --- /dev/null +++ b/SGPlayer/Classes/Core/SGContainer/SGObjectQueue.m @@ -0,0 +1,269 @@ +// +// SGObjectQueue.m +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGObjectQueue.h" + +@interface SGObjectQueue () + +{ + struct { + int size; + BOOL destoryed; + CMTime duration; + uint64_t maxCount; + } _flags; +} + +@property (nonatomic, strong, readonly) NSCondition *wakeup; +@property (nonatomic, strong, readonly) id puttingObject; +@property (nonatomic, strong, readonly) NSMutableArray> *objects; + +@end + +@implementation SGObjectQueue + +- (instancetype)init +{ + return [self initWithMaxCount:UINT64_MAX]; +} + +- (instancetype)initWithMaxCount:(uint64_t)maxCount +{ + if (self = [super init]) { + self->_flags.maxCount = maxCount; + self->_flags.duration = kCMTimeZero; + self->_objects = [NSMutableArray array]; + self->_wakeup = [[NSCondition alloc] init]; + } + return self; +} + +- (void)dealloc +{ + [self destroy]; +} + +- (SGCapacity)capacity +{ + [self->_wakeup lock]; + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return SGCapacityCreate(); + } + SGCapacity ret = SGCapacityCreate(); + ret.size = self->_flags.size; + ret.count = (int)self->_objects.count; + ret.duration = self->_flags.duration; + [self->_wakeup unlock]; + return ret; +} + +- (BOOL)putObjectSync:(id)object +{ + return [self putObjectSync:object before:nil after:nil]; +} + +- (BOOL)putObjectSync:(id)object before:(SGBlock)before after:(SGBlock)after +{ + [self->_wakeup lock]; + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return NO; + } + while (self->_objects.count >= self->_flags.maxCount) { + self->_puttingObject = object; + if (before) { + before(); + } + [self->_wakeup wait]; + if (after) { + after(); + } + if (!self->_puttingObject) { + [self->_wakeup unlock]; + return NO; + } + self->_puttingObject = nil; + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return NO; + } + } + [self putObject:object]; + [self->_wakeup signal]; + [self->_wakeup unlock]; + return YES; +} + +- (BOOL)putObjectAsync:(id)object +{ + [self->_wakeup lock]; + if (self->_flags.destoryed || (self->_objects.count >= self->_flags.maxCount)) { + [self->_wakeup unlock]; + return NO; + } + [self putObject:object]; + [self->_wakeup signal]; + [self->_wakeup unlock]; + return YES; +} + +- (void)putObject:(id)object +{ + [object lock]; + [self->_objects addObject:object]; + if (self->_shouldSortObjects) { + [self->_objects sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { + return CMTimeCompare(obj1.timeStamp, obj2.timeStamp) < 0 ? NSOrderedAscending : NSOrderedDescending; + }]; + } + NSAssert(CMTIME_IS_VALID(object.duration), @"Objcet duration is invalid."); + self->_flags.duration = CMTimeAdd(self->_flags.duration, object.duration); + self->_flags.size += object.size; +} + +- (BOOL)getObjectSync:(id *)object +{ + return [self getObjectSync:object before:nil after:nil]; +} + +- (BOOL)getObjectSync:(id *)object before:(SGBlock)before after:(SGBlock)after +{ + [self->_wakeup lock]; + while (self->_objects.count <= 0) { + if (before) { + before(); + } + [self->_wakeup wait]; + if (after) { + after(); + } + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return NO; + } + } + *object = [self getObject]; + [self->_wakeup signal]; + [self->_wakeup unlock]; + return YES; +} + +- (BOOL)getObjectAsync:(id *)object +{ + [self->_wakeup lock]; + if (self->_flags.destoryed || self->_objects.count <= 0) { + [self->_wakeup unlock]; + return NO; + } + *object = [self getObject]; + [self->_wakeup signal]; + [self->_wakeup unlock]; + return YES; +} + +- (BOOL)getObjectAsync:(id *)object timeReader:(SGTimeReader)timeReader discarded:(uint64_t *)discarded +{ + [self->_wakeup lock]; + if (self->_flags.destoryed || self->_objects.count <= 0) { + [self->_wakeup unlock]; + return NO; + } + *object = [self getObjectWithTimeReader:timeReader discarded:discarded]; + if (*object) { + [self->_wakeup signal]; + } + [self->_wakeup unlock]; + return *object != nil; +} + +- (id)getObjectWithTimeReader:(SGTimeReader)timeReader discarded:(uint64_t *)discarded +{ + CMTime desire = kCMTimeZero; + BOOL drop = NO; + if (!timeReader || !timeReader(&desire, &drop)) { + return [self getObject]; + } + *discarded = 0; + id object = nil; + do { + CMTime first = self->_objects.firstObject.timeStamp; + if (CMTimeCompare(first, desire) <= 0) { + if (object) { + *discarded += 1; + [object unlock]; + } + object = [self getObject]; + if (!object) { + break; + } + continue; + } + break; + } while (drop); + return object; +} + +- (id)getObject +{ + if (!self->_objects.firstObject) { + return nil; + } + id object = self->_objects.firstObject; + [self->_objects removeObjectAtIndex:0]; + self->_flags.duration = CMTimeSubtract(self->_flags.duration, object.duration); + if (CMTimeCompare(self->_flags.duration, kCMTimeZero) < 0 || self->_objects.count <= 0) { + self->_flags.duration = kCMTimeZero; + } + self->_flags.size -= object.size; + if (self->_flags.size <= 0 || self->_objects.count <= 0) { + self->_flags.size = 0; + } + return object; +} + +- (BOOL)flush +{ + [self->_wakeup lock]; + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return NO; + } + for (id obj in self->_objects) { + [obj unlock]; + } + [self->_objects removeAllObjects]; + self->_flags.size = 0; + self->_flags.duration = kCMTimeZero; + self->_puttingObject = nil; + [self->_wakeup broadcast]; + [self->_wakeup unlock]; + return YES; +} + +- (BOOL)destroy +{ + [self->_wakeup lock]; + if (self->_flags.destoryed) { + [self->_wakeup unlock]; + return NO; + } + self->_flags.destoryed = YES; + for (id obj in self->_objects) { + [obj unlock]; + } + [self->_objects removeAllObjects]; + self->_flags.size = 0; + self->_flags.duration = kCMTimeZero; + self->_puttingObject = nil; + [self->_wakeup broadcast]; + [self->_wakeup unlock]; + return YES; +} + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGAudioFrame.h b/SGPlayer/Classes/Core/SGData/SGAudioFrame.h new file mode 100644 index 00000000..28db3c97 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGAudioFrame.h @@ -0,0 +1,39 @@ +// +// SGAudioFrame.h +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGFrame.h" +#import "SGAudioDescriptor.h" + +@interface SGAudioFrame : SGFrame + +/** + * + */ ++ (NSString *)commonReuseName; + +/** + * + */ +@property (nonatomic, strong, readonly) SGAudioDescriptor *descriptor; + +/** + * + */ +@property (nonatomic, readonly) int numberOfSamples; + +/** + * + */ +- (int *)linesize; + +/** + * + */ +- (uint8_t **)data; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGAudioFrame.m b/SGPlayer/Classes/Core/SGData/SGAudioFrame.m new file mode 100644 index 00000000..798b6040 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGAudioFrame.m @@ -0,0 +1,116 @@ +// +// SGAudioFrame.m +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGAudioFrame.h" +#import "SGFrame+Internal.h" +#import "SGDescriptor+Internal.h" +#import "SGObjectPool.h" + +@interface SGAudioFrame () + +{ + int _linesize[SGFramePlaneCount]; + uint8_t *_data[SGFramePlaneCount]; +} + +@end + +@implementation SGAudioFrame + ++ (instancetype)audioFrameWithDescriptor:(SGAudioDescriptor *)descriptor numberOfSamples:(int)numberOfSamples +{ + SGAudioFrame *frame = [[SGObjectPool sharedPool] objectWithClass:[SGAudioFrame class] reuseName:[SGAudioFrame commonReuseName]]; + frame.core->format = descriptor.format; + frame.core->sample_rate = descriptor.sampleRate; + frame.core->channels = descriptor.numberOfChannels; + frame.core->channel_layout = descriptor.channelLayout; + frame.core->nb_samples = numberOfSamples; + int linesize = [descriptor linesize:numberOfSamples]; + int numberOfPlanes = descriptor.numberOfPlanes; + for (int i = 0; i < numberOfPlanes; i++) { + uint8_t *data = av_mallocz(linesize); + memset(data, 0, linesize); + AVBufferRef *buffer = av_buffer_create(data, linesize, av_buffer_default_free, NULL, 0); + frame.core->buf[i] = buffer; + frame.core->data[i] = buffer->data; + frame.core->linesize[i] = buffer->size; + } + return frame; +} + +#pragma mark - Setter & Getter + ++ (NSString *)commonReuseName +{ + static NSString *ret = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + ret = NSStringFromClass(self.class); + }); + return ret; +} + +- (SGMediaType)type +{ + return SGMediaTypeAudio; +} + +- (int *)linesize +{ + return self->_linesize; +} + +- (uint8_t **)data +{ + return self->_data; +} + +#pragma mark - Data + +- (void)clear +{ + [super clear]; + self->_numberOfSamples = 0; + for (int i = 0; i < SGFramePlaneCount; i++) { + self->_data[i] = nil; + self->_linesize[i] = 0; + } + self->_descriptor = nil; +} + +#pragma mark - Control + +- (void)fill +{ + AVFrame *frame = self.core; + AVRational timebase = self.codecDescriptor.timebase; + SGCodecDescriptor *cd = self.codecDescriptor; + CMTime duration = CMTimeMake(frame->nb_samples, frame->sample_rate); + CMTime timeStamp = CMTimeMake(frame->best_effort_timestamp * timebase.num, timebase.den); + CMTime decodeTimeStamp = CMTimeMake(frame->pkt_dts * timebase.num, timebase.den); + for (SGTimeLayout *obj in cd.timeLayouts) { + duration = [obj convertDuration:duration]; + timeStamp = [obj convertTimeStamp:timeStamp]; + decodeTimeStamp = [obj convertTimeStamp:decodeTimeStamp]; + } + [self fillWithTimeStamp:timeStamp decodeTimeStamp:decodeTimeStamp duration:duration]; +} + +- (void)fillWithTimeStamp:(CMTime)timeStamp decodeTimeStamp:(CMTime)decodeTimeStamp duration:(CMTime)duration +{ + [super fillWithTimeStamp:timeStamp decodeTimeStamp:decodeTimeStamp duration:duration]; + AVFrame *frame = self.core; + self->_numberOfSamples = frame->nb_samples; + self->_descriptor = [[SGAudioDescriptor alloc] initWithFrame:frame]; + for (int i = 0; i < SGFramePlaneCount; i++) { + self->_data[i] = frame->data[i]; + self->_linesize[i] = frame->linesize[i]; + } +} + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGCapacity.h b/SGPlayer/Classes/Core/SGData/SGCapacity.h new file mode 100644 index 00000000..df3039c5 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGCapacity.h @@ -0,0 +1,51 @@ +// +// SGCapacity.h +// SGPlayer iOS +// +// Created by Single on 2018/10/25. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGTime.h" + +typedef struct SGCapacity { + int size; + int count; + CMTime duration; +} SGCapacity; + +/** + * + */ +SGCapacity SGCapacityCreate(void); + +/** + * + */ +SGCapacity SGCapacityAdd(SGCapacity c1, SGCapacity c2); + +/** + * + */ +SGCapacity SGCapacityMinimum(SGCapacity c1, SGCapacity c2); + +/** + * + */ +SGCapacity SGCapacityMaximum(SGCapacity c1, SGCapacity c2); + +/** + * + */ +BOOL SGCapacityIsEqual(SGCapacity c1, SGCapacity c2); + +/** + * + */ +BOOL SGCapacityIsEnough(SGCapacity c1); + +/** + * + */ +BOOL SGCapacityIsEmpty(SGCapacity c1); diff --git a/SGPlayer/Classes/Core/SGData/SGCapacity.m b/SGPlayer/Classes/Core/SGData/SGCapacity.m new file mode 100644 index 00000000..ebb1ab7e --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGCapacity.m @@ -0,0 +1,94 @@ +// +// SGCapacity.m +// SGPlayer iOS +// +// Created by Single on 2018/10/25. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGCapacity.h" + +SGCapacity SGCapacityCreate(void) +{ + SGCapacity ret; + ret.size = 0; + ret.count = 0; + ret.duration = kCMTimeZero; + return ret; +} + +SGCapacity SGCapacityAdd(SGCapacity c1, SGCapacity c2) +{ + SGCapacity ret = SGCapacityCreate(); + ret.size = c1.size + c2.size; + ret.count = c1.count + c2.count; + ret.duration = CMTimeAdd(c1.duration, c2.duration); + return ret; +} + +SGCapacity SGCapacityMinimum(SGCapacity c1, SGCapacity c2) +{ + if (CMTimeCompare(c1.duration, c2.duration) < 0) { + return c1; + } else if (CMTimeCompare(c1.duration, c2.duration) > 0) { + return c1; + } + if (c1.count < c2.count) { + return c1; + } else if (c1.count > c2.count) { + return c2; + } + if (c1.size < c2.size) { + return c1; + } else if (c1.size > c2.size) { + return c2; + } + return c1; +} + +SGCapacity SGCapacityMaximum(SGCapacity c1, SGCapacity c2) +{ + if (CMTimeCompare(c1.duration, c2.duration) < 0) { + return c2; + } else if (CMTimeCompare(c1.duration, c2.duration) > 0) { + return c1; + } + if (c1.count < c2.count) { + return c2; + } else if (c1.count > c2.count) { + return c1; + } + if (c1.size < c2.size) { + return c2; + } else if (c1.size > c2.size) { + return c1; + } + return c1; +} + +BOOL SGCapacityIsEqual(SGCapacity c1, SGCapacity c2) +{ + return + c1.size == c2.size && + c1.count == c2.count && + CMTimeCompare(c1.duration, c2.duration) == 0; +} + +BOOL SGCapacityIsEnough(SGCapacity c1) +{ + /* + return + c1.count >= 30 && + CMTimeCompare(c1.duration, CMTimeMake(1, 1)) > 0; + */ + return + c1.count >= 50000; +} + +BOOL SGCapacityIsEmpty(SGCapacity c1) +{ + return + c1.size == 0 && + c1.count == 0 && + CMTimeCompare(c1.duration, kCMTimeZero) == 0; +} diff --git a/SGPlayer/Classes/Core/SGData/SGData.h b/SGPlayer/Classes/Core/SGData/SGData.h new file mode 100644 index 00000000..8c54e688 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGData.h @@ -0,0 +1,49 @@ +// +// SGDemuxable.h +// SGPlayer iOS +// +// Created by Single on 2018/9/25. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import + +@protocol SGData + +/** + * + */ +@property (nonatomic, copy) NSString *reuseName; + +/** + * + */ +- (void)lock; + +/** + * + */ +- (void)unlock; + +/** + * + */ +- (void)clear; + +/** + * + */ +- (CMTime)duration; + +/** + * + */ +- (CMTime)timeStamp; + +/** + * + */ +- (int)size; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGFrame+Internal.h b/SGPlayer/Classes/Core/SGData/SGFrame+Internal.h new file mode 100644 index 00000000..7a502f2c --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGFrame+Internal.h @@ -0,0 +1,44 @@ +// +// SGFrame+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/10/23. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGFrame.h" +#import "SGAudioFrame.h" +#import "SGCodecDescriptor.h" + +@interface SGFrame () + +/** + * + */ +@property (nonatomic, readonly) AVFrame *core; + +/** + * + */ +@property (nonatomic, strong) SGCodecDescriptor *codecDescriptor; + +/** + * + */ +- (void)fill; + +/** + * + */ +- (void)fillWithTimeStamp:(CMTime)timeStamp decodeTimeStamp:(CMTime)decodeTimeStamp duration:(CMTime)duration; + +@end + +@interface SGAudioFrame () + +/** + * + */ ++ (instancetype)audioFrameWithDescriptor:(SGAudioDescriptor *)descriptor numberOfSamples:(int)numberOfSamples; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGFrame.h b/SGPlayer/Classes/Core/SGData/SGFrame.h new file mode 100644 index 00000000..b5eb4f6d --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGFrame.h @@ -0,0 +1,52 @@ +// +// SGFrame.h +// SGPlayer +// +// Created by Single on 2018/1/18. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGTrack.h" +#import "SGData.h" + +static int const SGFramePlaneCount = 8; + +@interface SGFrame : NSObject + +/** + * + */ +@property (nonatomic, readonly) void * coreptr; + +/** + * + */ +@property (nonatomic, strong, readonly) SGTrack *track; + +/** + * + */ +@property (nonatomic, strong, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +@property (nonatomic, readonly) CMTime timeStamp; + +/** + * + */ +@property (nonatomic, readonly) CMTime decodeTimeStamp; + +/** + * + */ +@property (nonatomic, readonly) int size; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGFrame.m b/SGPlayer/Classes/Core/SGData/SGFrame.m new file mode 100644 index 00000000..a51bfe2b --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGFrame.m @@ -0,0 +1,129 @@ +// +// SGFrame.m +// SGPlayer +// +// Created by Single on 2018/6/26. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGFrame.h" +#import "SGFrame+Internal.h" +#import "SGObjectPool.h" + +@interface SGFrame () + +{ + NSLock *_lock; + NSUInteger _lockingCount; +} + +@end + +@implementation SGFrame + +@synthesize reuseName = _reuseName; + +- (instancetype)init +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_core = av_frame_alloc(); + self->_coreptr = self->_core; + [self clear]; + } + return self; +} + +- (void)dealloc +{ + NSAssert(self->_lockingCount == 0, @"SGFrame, Invalid locking count"); + [self clear]; + if (self->_core) { + av_frame_free(&self->_core); + self->_core = nil; + } +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p>, track: %d, pts: %f, end: %f, duration: %f", + NSStringFromClass(self.class), self, + (int)self->_track.index, + CMTimeGetSeconds(self->_timeStamp), + CMTimeGetSeconds(CMTimeAdd(self->_timeStamp, self->_duration)), + CMTimeGetSeconds(self->_duration)]; +} + +#pragma mark - Setter & Getter + +- (SGMediaType)type +{ + return SGMediaTypeUnknown; +} + +#pragma mark - Data + +- (void)lock +{ + [self->_lock lock]; + self->_lockingCount += 1; + [self->_lock unlock]; +} + +- (void)unlock +{ + [self->_lock lock]; + self->_lockingCount -= 1; + BOOL comeback = self->_lockingCount == 0; + [self->_lock unlock]; + if (comeback) { + [[SGObjectPool sharedPool] comeback:self]; + } +} + +- (void)clear +{ + if (self->_core) { + av_frame_unref(self->_core); + } + self->_size = 0; + self->_track = nil; + self->_duration = kCMTimeZero; + self->_timeStamp = kCMTimeZero; + self->_decodeTimeStamp = kCMTimeZero; + self->_codecDescriptor = nil; +} + +#pragma mark - Control + +- (void)fill +{ + AVFrame *frame = self->_core; + AVRational timebase = self->_codecDescriptor.timebase; + SGCodecDescriptor *cd = self->_codecDescriptor; + self->_size = frame->pkt_size; + self->_track = cd.track; + self->_metadata = cd.metadata; + self->_duration = CMTimeMake(frame->pkt_duration * timebase.num, timebase.den); + self->_timeStamp = CMTimeMake(frame->best_effort_timestamp * timebase.num, timebase.den); + self->_decodeTimeStamp = CMTimeMake(frame->pkt_dts * timebase.num, timebase.den); + for (SGTimeLayout *obj in cd.timeLayouts) { + self->_duration = [obj convertDuration:self->_duration]; + self->_timeStamp = [obj convertTimeStamp:self->_timeStamp]; + self->_decodeTimeStamp = [obj convertTimeStamp:self->_decodeTimeStamp]; + } +} + +- (void)fillWithTimeStamp:(CMTime)timeStamp decodeTimeStamp:(CMTime)decodeTimeStamp duration:(CMTime)duration +{ + AVFrame *frame = self->_core; + SGCodecDescriptor *cd = self->_codecDescriptor; + self->_size = frame->pkt_size; + self->_track = cd.track; + self->_metadata = cd.metadata; + self->_duration = duration; + self->_timeStamp = timeStamp; + self->_decodeTimeStamp = decodeTimeStamp; +} + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGPacket+Internal.h b/SGPlayer/Classes/Core/SGData/SGPacket+Internal.h new file mode 100644 index 00000000..131e7fd4 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGPacket+Internal.h @@ -0,0 +1,29 @@ +// +// SGPacket+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/10/23. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGPacket.h" +#import "SGCodecDescriptor.h" + +@interface SGPacket () + +/** + * + */ +@property (nonatomic, readonly) AVPacket *core; + +/** + * + */ +@property (nonatomic, strong) SGCodecDescriptor *codecDescriptor; + +/** + * + */ +- (void)fill; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGPacket.h b/SGPlayer/Classes/Core/SGData/SGPacket.h new file mode 100644 index 00000000..21577787 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGPacket.h @@ -0,0 +1,55 @@ +// +// SGPacket.h +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGTrack.h" +#import "SGData.h" + +@interface SGPacket : NSObject + +/** + * + */ ++ (NSString *)commonReuseName; + +/** + * + */ +@property (nonatomic, readonly) void *coreptr; + +/** + * + */ +@property (nonatomic, strong, readonly) SGTrack *track; + +/** + * + */ +@property (nonatomic, strong, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +@property (nonatomic, readonly) CMTime timeStamp; + +/** + * + */ +@property (nonatomic, readonly) CMTime decodeTimeStamp; + +/** + * + */ +@property (nonatomic, readonly) int size; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGPacket.m b/SGPlayer/Classes/Core/SGData/SGPacket.m new file mode 100644 index 00000000..9de59b79 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGPacket.m @@ -0,0 +1,125 @@ +// +// SGPacket.m +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGPacket.h" +#import "SGPacket+Internal.h" +#import "SGObjectPool.h" + +@interface SGPacket () + +{ + NSLock *_lock; + uint64_t _lockingCount; +} + +@end + +@implementation SGPacket + +@synthesize reuseName = _reuseName; + +- (instancetype)init +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_core = av_packet_alloc(); + self->_coreptr = self->_core; + [self clear]; + } + return self; +} + +- (void)dealloc +{ + NSAssert(self->_lockingCount == 0, @"SGPacket, Invalid locking count"); + [self clear]; + if (self->_core) { + av_packet_free(&self->_core); + self->_core = nil; + } +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p>, track: %d, pts: %f, end: %f, duration: %f", + NSStringFromClass(self.class), self, + (int)self->_codecDescriptor.track.index, + CMTimeGetSeconds(self->_timeStamp), + CMTimeGetSeconds(CMTimeAdd(self->_timeStamp, self->_duration)), + CMTimeGetSeconds(self->_duration)]; +} + +#pragma mark - Setter & Getter + ++ (NSString *)commonReuseName +{ + static NSString *ret = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + ret = NSStringFromClass(self.class); + }); + return ret; +} + +#pragma mark - Data + +- (void)lock +{ + [self->_lock lock]; + self->_lockingCount += 1; + [self->_lock unlock]; +} + +- (void)unlock +{ + [self->_lock lock]; + self->_lockingCount -= 1; + BOOL comeback = self->_lockingCount == 0; + [self->_lock unlock]; + if (comeback) { + [[SGObjectPool sharedPool] comeback:self]; + } +} + +- (void)clear +{ + if (self->_core) { + av_packet_unref(self->_core); + } + self->_size = 0; + self->_track = nil; + self->_duration = kCMTimeZero; + self->_timeStamp = kCMTimeZero; + self->_decodeTimeStamp = kCMTimeZero; + self->_codecDescriptor = nil; +} + +#pragma mark - Control + +- (void)fill +{ + AVPacket *pkt = self->_core; + AVRational timebase = self->_codecDescriptor.timebase; + SGCodecDescriptor *cd = self->_codecDescriptor; + if (pkt->pts == AV_NOPTS_VALUE) { + pkt->pts = pkt->dts; + } + self->_size = pkt->size; + self->_track = cd.track; + self->_metadata = cd.metadata; + self->_duration = CMTimeMake(pkt->duration * timebase.num, timebase.den); + self->_timeStamp = CMTimeMake(pkt->pts * timebase.num, timebase.den); + self->_decodeTimeStamp = CMTimeMake(pkt->dts * timebase.num, timebase.den); + for (SGTimeLayout *obj in cd.timeLayouts) { + self->_duration = [obj convertDuration:self->_duration]; + self->_timeStamp = [obj convertTimeStamp:self->_timeStamp]; + self->_decodeTimeStamp = [obj convertTimeStamp:self->_decodeTimeStamp]; + } +} + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGTimeLayout.h b/SGPlayer/Classes/Core/SGData/SGTimeLayout.h new file mode 100644 index 00000000..b78752c2 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGTimeLayout.h @@ -0,0 +1,50 @@ +// +// SGTimeLayout.h +// SGPlayer +// +// Created by Single on 2018/11/15. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGTime.h" + +@interface SGTimeLayout : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithStart:(CMTime)start scale:(CMTime)scale; + +/** + * + */ +@property (nonatomic, readonly) CMTime start; + +/** + * + */ +@property (nonatomic, readonly) CMTime scale; + +/** + * + */ +- (CMTime)convertTimeStamp:(CMTime)timeStamp; + +/** + * + */ +- (CMTime)convertDuration:(CMTime)duration; + +/** + * + */ +- (BOOL)isEqualToTimeLayout:(SGTimeLayout *)timeLayout; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGTimeLayout.m b/SGPlayer/Classes/Core/SGData/SGTimeLayout.m new file mode 100644 index 00000000..191a43b3 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGTimeLayout.m @@ -0,0 +1,57 @@ +// +// SGTimeLayout.m +// SGPlayer +// +// Created by Single on 2018/11/15. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGTimeLayout.h" + +@implementation SGTimeLayout + +- (id)copyWithZone:(NSZone *)zone +{ + SGTimeLayout *obj = [[SGTimeLayout alloc] initWithStart:self->_start scale:self->_scale]; + return obj; +} + +- (instancetype)init +{ + return [self initWithStart:kCMTimeInvalid scale:kCMTimeInvalid]; +} + +- (instancetype)initWithStart:(CMTime)start scale:(CMTime)scale +{ + if (self = [super init]) { + self->_start = SGCMTimeValidate(start, kCMTimeZero, NO); + self->_scale = SGCMTimeValidate(scale, CMTimeMake(1, 1), NO); + } + return self; +} + +- (CMTime)convertTimeStamp:(CMTime)timeStamp +{ + return CMTimeAdd(SGCMTimeMultiply(timeStamp, self->_scale), self->_start); +} + +- (CMTime)convertDuration:(CMTime)duration +{ + return SGCMTimeMultiply(duration, self->_scale); +} + +- (BOOL)isEqualToTimeLayout:(SGTimeLayout *)timeLayout +{ + if (!timeLayout) { + return NO; + } + if (CMTimeCompare(timeLayout->_start, self->_start) != 0) { + return NO; + } + if (CMTimeCompare(timeLayout->_scale, self->_scale) != 0) { + return NO; + } + return YES; +} + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGVideoFrame.h b/SGPlayer/Classes/Core/SGData/SGVideoFrame.h new file mode 100644 index 00000000..eeaf9907 --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGVideoFrame.h @@ -0,0 +1,45 @@ +// +// SGVideoFrame.h +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGFrame.h" +#import "SGPLFImage.h" +#import "SGVideoDescriptor.h" + +@interface SGVideoFrame : SGFrame + +/** + * + */ ++ (NSString *)commonReuseName; + +/** + * + */ +@property (nonatomic, strong, readonly) SGVideoDescriptor *descriptor; + +/** + * + */ +- (int *)linesize; + +/** + * + */ +- (uint8_t **)data; + +/** + * + */ +- (CVPixelBufferRef)pixelBuffer; + +/** + * + */ +- (SGPLFImage *)image; + +@end diff --git a/SGPlayer/Classes/Core/SGData/SGVideoFrame.m b/SGPlayer/Classes/Core/SGData/SGVideoFrame.m new file mode 100644 index 00000000..c4f3996f --- /dev/null +++ b/SGPlayer/Classes/Core/SGData/SGVideoFrame.m @@ -0,0 +1,182 @@ +// +// SGVideoFrame.m +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGVideoFrame.h" +#import "SGFrame+Internal.h" +#import "SGDescriptor+Internal.h" +#import "SGMapping.h" +#import "SGSWScale.h" + +@interface SGVideoFrame () + +{ + CVPixelBufferRef _pixelBuffer; + int _linesize[SGFramePlaneCount]; + uint8_t *_data[SGFramePlaneCount]; +} + +@end + +@implementation SGVideoFrame + +#pragma mark - Setter & Getter + ++ (NSString *)commonReuseName +{ + static NSString *ret = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + ret = NSStringFromClass(self.class); + }); + return ret; +} + +- (SGMediaType)type +{ + return SGMediaTypeVideo; +} + +- (int *)linesize +{ + return self->_linesize; +} + +- (uint8_t **)data +{ + return self->_data; +} + +- (CVPixelBufferRef)pixelBuffer +{ + return self->_pixelBuffer; +} + +- (SGPLFImage *)image +{ + if (self->_descriptor.width == 0 || self->_descriptor.height == 0) { + return nil; + } + SGVideoDescriptor *inputDescriptor = [self->_descriptor copy]; + SGVideoDescriptor *outputDescriptor = [self->_descriptor copy]; + outputDescriptor.format = AV_PIX_FMT_RGB24; + + const uint8_t *src_data[SGFramePlaneCount] = {nil}; + uint8_t *dst_data[SGFramePlaneCount] = {nil}; + int src_linesize[SGFramePlaneCount] = {0}; + int dst_linesize[SGFramePlaneCount] = {0}; + + if (inputDescriptor.format == AV_PIX_FMT_VIDEOTOOLBOX) { + if (!self->_pixelBuffer) { + return nil; + } + OSType type = CVPixelBufferGetPixelFormatType(self->_pixelBuffer); + inputDescriptor.format = SGPixelFormatAV2FF(type); + + CVReturn error = CVPixelBufferLockBaseAddress(self->_pixelBuffer, kCVPixelBufferLock_ReadOnly); + if (error != kCVReturnSuccess) { + return nil; + } + if (CVPixelBufferIsPlanar(self->_pixelBuffer)) { + int planes = (int)CVPixelBufferGetPlaneCount(self->_pixelBuffer); + for (int i = 0; i < planes; i++) { + src_data[i] = CVPixelBufferGetBaseAddressOfPlane(self->_pixelBuffer, i); + src_linesize[i] = (int)CVPixelBufferGetBytesPerRowOfPlane(self->_pixelBuffer, i); + } + } else { + src_data[0] = CVPixelBufferGetBaseAddress(self->_pixelBuffer); + src_linesize[0] = (int)CVPixelBufferGetBytesPerRow(self->_pixelBuffer); + } + CVPixelBufferUnlockBaseAddress(self->_pixelBuffer, kCVPixelBufferLock_ReadOnly); + } else { + for (int i = 0; i < SGFramePlaneCount; i++) { + AVFrame *frame = self.core; + src_data[i] = frame->data[i]; + src_linesize[i] = frame->linesize[i]; + } + } + + if (inputDescriptor.format == AV_PIX_FMT_NONE || + !src_data[0] || + !src_linesize[0]) { + return nil; + } + + SGSWScale *context = [[SGSWScale alloc] init]; + context.inputDescriptor = inputDescriptor; + context.outputDescriptor = outputDescriptor; + if (![context open]) { + return nil; + } + + int result = av_image_alloc(dst_data, + (int *)dst_linesize, + outputDescriptor.width, + outputDescriptor.height, + outputDescriptor.format, + 1); + if (result < 0) { + return nil; + } + result = [context convert:src_data + inputLinesize:src_linesize + outputData:dst_data + outputLinesize:dst_linesize]; + if (result < 0) { + av_freep(dst_data); + return nil; + } + SGPLFImage *image = SGPLFImageWithRGBData(dst_data[0], + dst_linesize[0], + outputDescriptor.width, + outputDescriptor.height); + av_freep(dst_data); + return image; +} + +#pragma mark - Data + +- (void)clear +{ + [super clear]; + for (int i = 0; i < SGFramePlaneCount; i++) { + self->_data[i] = nil; + self->_linesize[i] = 0; + } + self->_pixelBuffer = nil; + self->_descriptor = nil; +} + +#pragma mark - Control + +- (void)fill +{ + [super fill]; + [self fillData]; +} + +- (void)fillWithTimeStamp:(CMTime)timeStamp decodeTimeStamp:(CMTime)decodeTimeStamp duration:(CMTime)duration +{ + [super fillWithTimeStamp:timeStamp decodeTimeStamp:decodeTimeStamp duration:duration]; + [self fillData]; +} + +- (void)fillData +{ + AVFrame *frame = self.core; + self->_descriptor = [[SGVideoDescriptor alloc] initWithFrame:frame]; + if (frame->format == AV_PIX_FMT_VIDEOTOOLBOX) { + self->_pixelBuffer = (CVPixelBufferRef)(frame->data[3]); + self->_descriptor.cv_format = CVPixelBufferGetPixelFormatType(self->_pixelBuffer); + } + for (int i = 0; i < SGFramePlaneCount; i++) { + self->_data[i] = frame->data[i]; + self->_linesize[i] = frame->linesize[i]; + } +} + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.h b/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.h new file mode 100644 index 00000000..4e35ce6a --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.h @@ -0,0 +1,13 @@ +// +// SGAudioDecoder.h +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDecodable.h" + +@interface SGAudioDecoder : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.m b/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.m new file mode 100644 index 00000000..307671a5 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGAudioDecoder.m @@ -0,0 +1,251 @@ +// +// SGAudioDecoder.m +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioDecoder.h" +#import "SGFrame+Internal.h" +#import "SGPacket+Internal.h" +#import "SGDescriptor+Internal.h" +#import "SGCodecContext.h" +#import "SGAudioFrame.h" +#import "SGSonic.h" + +@interface SGAudioDecoder () + +{ + struct { + BOOL needsAlignment; + BOOL needsResetSonic; + int64_t nextTimeStamp; + } _flags; +} + +@property (nonatomic, strong, readonly) SGSonic *sonic; +@property (nonatomic, strong, readonly) SGCodecContext *codecContext; +@property (nonatomic, strong, readonly) SGCodecDescriptor *codecDescriptor; +@property (nonatomic, strong, readonly) SGAudioDescriptor *audioDescriptor; + +@end + +@implementation SGAudioDecoder + +@synthesize options = _options; + +- (void)setup +{ + self->_flags.nextTimeStamp = 0; + self->_flags.needsAlignment = YES; + self->_flags.needsResetSonic = YES; + self->_codecContext = [[SGCodecContext alloc] initWithTimebase:self->_codecDescriptor.timebase + codecpar:self->_codecDescriptor.codecpar + frameClass:[SGAudioFrame class] + frameReuseName:[SGAudioFrame commonReuseName]]; + self->_codecContext.options = self->_options; + [self->_codecContext open]; +} + +- (void)destroy +{ + self->_flags.nextTimeStamp = 0; + self->_flags.needsAlignment = YES; + self->_flags.needsResetSonic = YES; + [self->_codecContext close]; + self->_codecContext = nil; + self->_audioDescriptor = nil; +} + +#pragma mark - Control + +- (void)flush +{ + self->_flags.nextTimeStamp = 0; + self->_flags.needsAlignment = YES; + self->_flags.needsResetSonic = YES; + [self->_codecContext flush]; +} + +- (NSArray<__kindof SGFrame *> *)decode:(SGPacket *)packet +{ + NSMutableArray *ret = [NSMutableArray array]; + SGCodecDescriptor *cd = packet.codecDescriptor; + NSAssert(cd, @"Invalid codec descriptor."); + if (![cd isEqualCodecContextToDescriptor:self->_codecDescriptor]) { + NSArray *objs = [self finish]; + for (SGFrame *obj in objs) { + [ret addObject:obj]; + } + self->_codecDescriptor = [cd copy]; + [self destroy]; + [self setup]; + } + [cd fillToDescriptor:self->_codecDescriptor]; + switch (packet.codecDescriptor.type) { + case SGCodecTypeDecode: { + NSArray *objs = [self processPacket:packet]; + for (SGFrame *obj in objs) { + [ret addObject:obj]; + } + } + break; + case SGCodecTypePadding: { + SGAudioDescriptor *ad = self->_audioDescriptor; + if (ad == nil) { + ad = [[SGAudioDescriptor alloc] init]; + } + CMTime start = packet.timeStamp; + CMTime duration = packet.duration; + int nb_samples = (int)CMTimeConvertScale(duration, ad.sampleRate, kCMTimeRoundingMethod_RoundTowardZero).value; + if (nb_samples > 0) { + duration = CMTimeMake(nb_samples, ad.sampleRate); + SGAudioFrame *obj = [SGAudioFrame audioFrameWithDescriptor:ad numberOfSamples:nb_samples]; + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = packet.track; + [obj setCodecDescriptor:cd]; + [obj fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + [ret addObject:obj]; + } + } + break; + } + return ret; +} + +- (NSArray<__kindof SGFrame *> *)finish +{ + return [self processPacket:nil]; +} + +#pragma mark - Process + +- (NSArray<__kindof SGFrame *> *)processPacket:(SGPacket *)packet +{ + if (!self->_codecContext || !self->_codecDescriptor) { + return nil; + } + SGCodecDescriptor *cd = self->_codecDescriptor; + NSArray *objs = [self->_codecContext decode:packet]; + objs = [self processFrames:objs done:!packet]; + objs = [self clipFrames:objs timeRange:cd.timeRange]; + return objs; +} + +- (NSArray<__kindof SGFrame *> *)processFrames:(NSArray<__kindof SGFrame *> *)frames done:(BOOL)done +{ + NSMutableArray *ret = [NSMutableArray array]; + for (SGAudioFrame *obj in frames) { + AVFrame *frame = obj.core; + if (self->_audioDescriptor == nil) { + self->_audioDescriptor = [[SGAudioDescriptor alloc] initWithFrame:frame]; + } + self->_flags.nextTimeStamp = frame->best_effort_timestamp + frame->pkt_duration; + SGAudioDescriptor *ad = self->_audioDescriptor; + SGCodecDescriptor *cd = self->_codecDescriptor; + if (CMTimeCompare(cd.scale, CMTimeMake(1, 1)) != 0) { + if (self->_flags.needsResetSonic) { + self->_flags.needsResetSonic = NO; + self->_sonic = [[SGSonic alloc] initWithDescriptor:ad]; + self->_sonic.speed = 1.0 / CMTimeGetSeconds(cd.scale); + [self->_sonic open]; + } + int64_t input = av_rescale_q(self->_sonic.samplesInput, av_make_q(1, ad.sampleRate), cd.timebase); + int64_t pts = frame->best_effort_timestamp - input; + if ([self->_sonic write:frame->data nb_samples:frame->nb_samples]) { + [ret addObject:[self readSonicFrame:pts]]; + } + [obj unlock]; + } else { + [obj setCodecDescriptor:[cd copy]]; + [obj fill]; + [ret addObject:obj]; + } + } + if (done) { + SGAudioDescriptor *ad = self->_audioDescriptor; + SGCodecDescriptor *cd = self->_codecDescriptor; + int64_t input = av_rescale_q(self->_sonic.samplesInput, av_make_q(1, ad.sampleRate), cd.timebase); + int64_t pts = self->_flags.nextTimeStamp - input; + if ([self->_sonic flush]) { + [ret addObject:[self readSonicFrame:pts]]; + } + } + return ret; +} + +- (NSArray<__kindof SGFrame *> *)clipFrames:(NSArray<__kindof SGFrame *> *)frames timeRange:(CMTimeRange)timeRange +{ + if (!SGCMTimeIsValid(timeRange.start, NO) || + !SGCMTimeIsValid(timeRange.duration, NO)) { + return frames; + } + NSMutableArray *ret = [NSMutableArray array]; + for (SGAudioFrame *obj in frames) { + if (CMTimeCompare(obj.timeStamp, timeRange.start) < 0) { + [obj unlock]; + continue; + } + if (CMTimeCompare(obj.timeStamp, CMTimeRangeGetEnd(timeRange)) >= 0) { + [obj unlock]; + continue; + } + SGAudioDescriptor *ad = obj.descriptor; + if (self->_flags.needsAlignment) { + self->_flags.needsAlignment = NO; + CMTime start = timeRange.start; + CMTime duration = CMTimeSubtract(obj.timeStamp, start); + int nb_samples = (int)CMTimeConvertScale(duration, ad.sampleRate, kCMTimeRoundingMethod_RoundTowardZero).value; + if (nb_samples > 0) { + duration = CMTimeMake(nb_samples, ad.sampleRate); + SGAudioFrame *obj1 = [SGAudioFrame audioFrameWithDescriptor:ad numberOfSamples:nb_samples]; + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = obj.track; + [obj1 setCodecDescriptor:cd]; + [obj1 fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + [ret addObject:obj1]; + } + } + CMTime start = obj.timeStamp; + CMTime duration = CMTimeSubtract(CMTimeRangeGetEnd(timeRange), obj.timeStamp); + int nb_samples = (int)CMTimeConvertScale(duration, ad.sampleRate, kCMTimeRoundingMethod_RoundTowardZero).value; + if (nb_samples < obj.numberOfSamples) { + duration = CMTimeMake(nb_samples, ad.sampleRate); + SGAudioFrame *obj1 = [SGAudioFrame audioFrameWithDescriptor:ad numberOfSamples:nb_samples]; + for (int i = 0; i < ad.numberOfPlanes; i++) { + memcpy(obj1.core->data[i], obj.core->data[i], obj1.core->linesize[i]); + } + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = obj.track; + [obj1 setCodecDescriptor:cd]; + [obj1 fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + [ret addObject:obj1]; + [obj unlock]; + continue; + } + [ret addObject:obj]; + } + return ret; +} + +- (SGAudioFrame *)readSonicFrame:(int64_t)pts +{ + int nb_samples = [self->_sonic samplesAvailable]; + SGAudioDescriptor *ad = self->_audioDescriptor; + SGCodecDescriptor *cd = self->_codecDescriptor; + CMTime start = CMTimeMake(pts * cd.timebase.num, cd.timebase.den); + CMTime duration = CMTimeMake(nb_samples, ad.sampleRate); + for (SGTimeLayout *obj in cd.timeLayouts) { + start = [obj convertTimeStamp:start]; + } + SGAudioFrame *obj = [SGAudioFrame audioFrameWithDescriptor:ad numberOfSamples:nb_samples]; + [self->_sonic read:obj.core->data nb_samples:nb_samples]; + SGCodecDescriptor *cd1 = [[SGCodecDescriptor alloc] init]; + cd1.track = cd.track; + [obj setCodecDescriptor:cd1]; + [obj fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + return obj; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.h b/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.h new file mode 100644 index 00000000..d33254fa --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.h @@ -0,0 +1,53 @@ +// +// SGCodecContext.h +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGCodecDescriptor.h" +#import "SGDecoderOptions.h" +#import "SGPacket.h" +#import "SGFrame.h" + +@interface SGCodecContext : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithTimebase:(AVRational)timebase + codecpar:(AVCodecParameters *)codecpar + frameClass:(Class)frameClass + frameReuseName:(NSString *)frameReuseName; + +/** + * + */ +@property (nonatomic, strong) SGDecoderOptions *options; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (void)close; + +/** + * + */ +- (void)flush; + +/** + * + */ +- (NSArray<__kindof SGFrame *> *)decode:(SGPacket *)packet; + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.m b/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.m new file mode 100644 index 00000000..bac64116 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGCodecContext.m @@ -0,0 +1,188 @@ +// +// SGCodecContext.m +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGCodecContext.h" +#import "SGFrame+Internal.h" +#import "SGPacket+Internal.h" +#import "SGOptions.h" +#import "SGObjectPool.h" +#import "SGMapping.h" +#import "SGError.h" +#import "SGMacro.h" + +@interface SGCodecContext () + +@property (nonatomic, copy, readonly) Class frameClass; +@property (nonatomic, copy, readonly) NSString *frameReuseName; +@property (nonatomic, assign, readonly) AVRational timebase; +@property (nonatomic, assign, readonly) AVCodecParameters *codecpar; +@property (nonatomic, assign, readonly) AVCodecContext *codecContext; + +@end + +@implementation SGCodecContext + +- (instancetype)initWithTimebase:(AVRational)timebase + codecpar:(AVCodecParameters *)codecpar + frameClass:(Class)frameClass + frameReuseName:(NSString *)frameReuseName +{ + if (self = [super init]) { + self->_timebase = timebase; + self->_codecpar = codecpar; + self->_frameClass = frameClass; + self->_frameReuseName = frameReuseName; + self->_options = [SGOptions sharedOptions].decoder.copy; + } + return self; +} + +- (void)dealloc +{ + [self close]; +} + +#pragma mark - Interface + +- (BOOL)open +{ + if (!self->_codecpar) { + return NO; + } + self->_codecContext = [self createCcodecContext]; + if (!self->_codecContext) { + return NO; + } + return YES; +} + +- (void)close +{ + if (self->_codecContext) { + avcodec_free_context(&self->_codecContext); + self->_codecContext = nil; + } +} + +- (void)flush +{ + if (self->_codecContext) { + avcodec_flush_buffers(self->_codecContext); + } +} + +- (NSArray<__kindof SGFrame *> *)decode:(SGPacket *)packet +{ + if (!self->_codecContext) { + return nil; + } + int result = avcodec_send_packet(self->_codecContext, packet ? packet.core : NULL); + if (result < 0) { + return nil; + } + NSMutableArray *array = [NSMutableArray array]; + while (result != AVERROR(EAGAIN)) { + __kindof SGFrame *frame = [[SGObjectPool sharedPool] objectWithClass:self->_frameClass reuseName:self->_frameReuseName]; + result = avcodec_receive_frame(self->_codecContext, frame.core); + if (result < 0) { + [frame unlock]; + break; + } else { + [array addObject:frame]; + } + } + return array; +} + +#pragma mark - AVCodecContext + +- (AVCodecContext *)createCcodecContext +{ + AVCodecContext *codecContext = avcodec_alloc_context3(NULL); + if (!codecContext) { + return nil; + } + codecContext->opaque = (__bridge void *)self; + + int result = avcodec_parameters_to_context(codecContext, self->_codecpar); + NSError *error = SGGetFFError(result, SGActionCodeCodecSetParametersToContext); + if (error) { + avcodec_free_context(&codecContext); + return nil; + } + codecContext->pkt_timebase = self->_timebase; + if ((self->_options.hardwareDecodeH264 && self->_codecpar->codec_id == AV_CODEC_ID_H264) || + (self->_options.hardwareDecodeH265 && self->_codecpar->codec_id == AV_CODEC_ID_H265)) { + codecContext->get_format = SGCodecContextGetFormat; + } + + AVCodec *codec = avcodec_find_decoder(codecContext->codec_id); + if (!codec) { + avcodec_free_context(&codecContext); + return nil; + } + codecContext->codec_id = codec->id; + + AVDictionary *opts = SGDictionaryNS2FF(self->_options.options); + if (self->_options.threadsAuto && + !av_dict_get(opts, "threads", NULL, 0)) { + av_dict_set(&opts, "threads", "auto", 0); + } + if (self->_options.refcountedFrames && + !av_dict_get(opts, "refcounted_frames", NULL, 0) && + (codecContext->codec_type == AVMEDIA_TYPE_VIDEO || codecContext->codec_type == AVMEDIA_TYPE_AUDIO)) { + av_dict_set(&opts, "refcounted_frames", "1", 0); + } + + result = avcodec_open2(codecContext, codec, &opts); + + if (opts) { + av_dict_free(&opts); + } + + error = SGGetFFError(result, SGActionCodeCodecOpen2); + if (error) { + avcodec_free_context(&codecContext); + return nil; + } + + return codecContext; +} + +static enum AVPixelFormat SGCodecContextGetFormat(struct AVCodecContext *s, const enum AVPixelFormat *fmt) +{ + SGCodecContext *self = (__bridge SGCodecContext *)s->opaque; + for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) { + if (fmt[i] == AV_PIX_FMT_VIDEOTOOLBOX) { + AVBufferRef *device_ctx = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VIDEOTOOLBOX); + if (!device_ctx) { + break; + } + AVBufferRef *frames_ctx = av_hwframe_ctx_alloc(device_ctx); + av_buffer_unref(&device_ctx); + if (!frames_ctx) { + break; + } + AVHWFramesContext *frames_ctx_data = (AVHWFramesContext *)frames_ctx->data; + frames_ctx_data->format = AV_PIX_FMT_VIDEOTOOLBOX; + frames_ctx_data->sw_format = SGPixelFormatAV2FF(self->_options.preferredPixelFormat); + frames_ctx_data->width = s->width; + frames_ctx_data->height = s->height; + int err = av_hwframe_ctx_init(frames_ctx); + if (err < 0) { + av_buffer_unref(&frames_ctx); + break; + } + s->hw_frames_ctx = frames_ctx; + return fmt[i]; + } + } + return fmt[0]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGDecodable.h b/SGPlayer/Classes/Core/SGDecoder/SGDecodable.h new file mode 100644 index 00000000..d4560e8e --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGDecodable.h @@ -0,0 +1,36 @@ +// +// SGDecodable.h +// SGPlayer +// +// Created by Single on 2018/10/22. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGDecoderOptions.h" +#import "SGPacket.h" +#import "SGFrame.h" + +@protocol SGDecodable + +/** + * + */ +@property (nonatomic, strong) SGDecoderOptions *options; + +/** + * + */ +- (NSArray<__kindof SGFrame *> *)decode:(SGPacket *)packet; + +/** + * + */ +- (NSArray<__kindof SGFrame *> *)finish; + +/** + * + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.h b/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.h new file mode 100644 index 00000000..2a4f2756 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.h @@ -0,0 +1,105 @@ +// +// SGDecodeLoop.h +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGDecodable.h" +#import "SGCapacity.h" + +@protocol SGDecodeLoopDelegate; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGDecodeLoopState) { + SGDecodeLoopStateNone = 0, + SGDecodeLoopStateDecoding = 1, + SGDecodeLoopStateStalled = 2, + SGDecodeLoopStatePaused = 3, + SGDecodeLoopStateClosed = 4, +}; + +@interface SGDecodeLoop : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithDecodableClass:(Class)decodableClass; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, copy) SGDecoderOptions *options; + +/** + * + */ +- (SGDecodeLoopState)state; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)pause; + +/** + * + */ +- (BOOL)resume; + +/** + * + */ +- (BOOL)flush; + +/** + * + */ +- (BOOL)finish:(NSArray *)tracks; + +/** + * + */ +- (BOOL)putPacket:(SGPacket *)packet; + +@end + +@protocol SGDecodeLoopDelegate + +/** + * + */ +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didChangeState:(SGDecodeLoopState)state; + +/** + * + */ +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didChangeCapacity:(SGCapacity)capacity; + +/** + * + */ +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didOutputFrame:(__kindof SGFrame *)frame; + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.m b/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.m new file mode 100644 index 00000000..10bd5e49 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGDecodeLoop.m @@ -0,0 +1,331 @@ +// +// SGDecodeLoop.m +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGDecodeLoop.h" +#import "SGObjectQueue.h" +#import "SGMacro.h" +#import "SGLock.h" + +@interface SGDecodeLoop () + +{ + struct { + SGDecodeLoopState state; + } _flags; + SGCapacity _capacity; +} + +@property (nonatomic, copy, readonly) Class decodableClass; +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) NSCondition *wakeup; +@property (nonatomic, strong, readonly) NSOperationQueue *operationQueue; +@property (nonatomic, strong, readonly) NSMutableDictionary *timeStamps; +@property (nonatomic, strong, readonly) NSMutableDictionary *flushFlags; +@property (nonatomic, strong, readonly) NSMutableDictionary> *decodables; +@property (nonatomic, strong, readonly) NSMutableDictionary *packetQueues; + +@end + +@implementation SGDecodeLoop + +static SGPacket *gFlushPacket = nil; +static SGPacket *gFinishPacket = nil; + +- (instancetype)initWithDecodableClass:(Class)decodableClass +{ + if (self = [super init]) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + gFlushPacket = [[SGPacket alloc] init]; + gFinishPacket = [[SGPacket alloc] init]; + [gFlushPacket lock]; + [gFinishPacket lock]; + }); + self->_decodableClass = decodableClass; + self->_lock = [[NSLock alloc] init]; + self->_wakeup = [[NSCondition alloc] init]; + self->_capacity = SGCapacityCreate(); + self->_timeStamps = [[NSMutableDictionary alloc] init]; + self->_flushFlags = [[NSMutableDictionary alloc] init]; + self->_decodables = [[NSMutableDictionary alloc] init]; + self->_packetQueues = [[NSMutableDictionary alloc] init]; + self->_operationQueue = [[NSOperationQueue alloc] init]; + self->_operationQueue.maxConcurrentOperationCount = 1; + self->_operationQueue.qualityOfService = NSQualityOfServiceUserInteractive; + } + return self; +} + +- (void)dealloc +{ + SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGDecodeLoopStateClosed; + }, ^SGBlock { + [self setState:SGDecodeLoopStateClosed]; + [self->_packetQueues enumerateKeysAndObjectsUsingBlock:^(id key, SGObjectQueue *obj, BOOL *stop) { + [obj destroy]; + }]; + [self->_operationQueue cancelAllOperations]; + [self->_operationQueue waitUntilAllOperationsAreFinished]; + return nil; + }); +} + +#pragma mark - Setter & Getter + +- (SGBlock)setState:(SGDecodeLoopState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + SGDecodeLoopState previous = self->_flags.state; + self->_flags.state = state; + if (previous == SGDecodeLoopStatePaused || + previous == SGDecodeLoopStateStalled) { + [self->_wakeup lock]; + [self->_wakeup broadcast]; + [self->_wakeup unlock]; + } + return ^{ + [self->_delegate decodeLoop:self didChangeState:state]; + }; +} + +- (SGDecodeLoopState)state +{ + __block SGDecodeLoopState ret = SGDecodeLoopStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (SGBlock)setCapacityIfNeeded +{ + __block SGCapacity capacity = SGCapacityCreate(); + [self->_packetQueues enumerateKeysAndObjectsUsingBlock:^(id key, SGObjectQueue *obj, BOOL *stop) { + capacity = SGCapacityMaximum(capacity, obj.capacity); + }]; + if (SGCapacityIsEqual(capacity, self->_capacity)) { + return ^{}; + } + self->_capacity = capacity; + return ^{ + [self->_delegate decodeLoop:self didChangeCapacity:capacity]; + }; +} + +#pragma mark - Interface + +- (BOOL)open +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGDecodeLoopStateNone; + }, ^SGBlock { + return [self setState:SGDecodeLoopStateDecoding]; + }, ^BOOL(SGBlock block) { + block(); + NSOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(runningThread) object:nil]; + self->_operationQueue = [[NSOperationQueue alloc] init]; + self->_operationQueue.qualityOfService = NSQualityOfServiceUserInteractive; + [self->_operationQueue addOperation:operation]; + return YES; + }); +} + +- (BOOL)close +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state != SGDecodeLoopStateClosed; + }, ^SGBlock { + return [self setState:SGDecodeLoopStateClosed]; + }, ^BOOL(SGBlock block) { + block(); + [self->_packetQueues enumerateKeysAndObjectsUsingBlock:^(id key, SGObjectQueue *obj, BOOL *stop) { + [obj destroy]; + }]; + [self->_operationQueue cancelAllOperations]; + [self->_operationQueue waitUntilAllOperationsAreFinished]; + return YES; + }); +} + +- (BOOL)pause +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state == SGDecodeLoopStateDecoding; + }, ^SGBlock { + return [self setState:SGDecodeLoopStatePaused]; + }); +} + +- (BOOL)resume +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state == SGDecodeLoopStatePaused; + }, ^SGBlock { + return [self setState:SGDecodeLoopStateDecoding]; + }); +} + +- (BOOL)flush +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGDecodeLoopStateClosed; + }, ^SGBlock { + [self->_packetQueues enumerateKeysAndObjectsUsingBlock:^(id key, SGObjectQueue *obj, BOOL *stop) { + [obj flush]; + [obj putObjectSync:gFlushPacket]; + self->_flushFlags[key] = @(YES); + }]; + [self->_timeStamps removeAllObjects]; + SGBlock b1 = ^{}; + SGBlock b2 = [self setCapacityIfNeeded]; + if (self->_flags.state == SGDecodeLoopStateStalled) { + b1 = [self setState:SGDecodeLoopStateDecoding]; + } + return ^{ + b1(); b2(); + }; + }); +} + +- (BOOL)finish:(NSArray *)tracks +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGDecodeLoopStateClosed; + }, ^SGBlock { + for (SGTrack *obj in tracks) { + [self->_packetQueues[@(obj.index)] putObjectSync:gFinishPacket]; + } + SGBlock b1 = ^{}; + SGBlock b2 = [self setCapacityIfNeeded]; + if (self->_flags.state == SGDecodeLoopStateStalled) { + b1 = [self setState:SGDecodeLoopStateDecoding]; + } + return ^{ + b1(); b2(); + }; + }); +} + +- (BOOL)putPacket:(SGPacket *)packet +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGDecodeLoopStateClosed; + }, ^SGBlock { + SGObjectQueue *queue = self->_packetQueues[@(packet.track.index)]; + if (!queue) { + queue = [[SGObjectQueue alloc] init]; + id obj = [[self->_decodableClass alloc] init]; + obj.options = self->_options; + [self->_decodables setObject:obj forKey:@(packet.track.index)]; + [self->_packetQueues setObject:queue forKey:@(packet.track.index)]; + } + [queue putObjectSync:packet]; + SGBlock b1 = ^{}; + SGBlock b2 = [self setCapacityIfNeeded]; + if (self->_flags.state == SGDecodeLoopStateStalled) { + b1 = [self setState:SGDecodeLoopStateDecoding]; + } + return ^{ + b1(); b2(); + }; + }); +} + +#pragma mark - Thread + +- (void)runningThread +{ + while (YES) { + @autoreleasepool { + [self->_lock lock]; + if (self->_flags.state == SGDecodeLoopStateNone || + self->_flags.state == SGDecodeLoopStateClosed) { + [self->_lock unlock]; + break; + } else if (self->_flags.state == SGDecodeLoopStatePaused || + self->_flags.state == SGDecodeLoopStateStalled) { + [self->_wakeup lock]; + [self->_lock unlock]; + [self->_wakeup wait]; + [self->_wakeup unlock]; + continue; + } else if (self->_flags.state == SGDecodeLoopStateDecoding) { + NSNumber *index = nil; + CMTime minimum = kCMTimePositiveInfinity; + for (NSNumber *key in self->_packetQueues) { + SGObjectQueue *obj = self->_packetQueues[key]; + if (obj.capacity.count == 0) { + continue; + } + NSValue *value = self->_timeStamps[key]; + if (!value) { + index = key; + break; + } + CMTime dts = kCMTimeZero; + [value getValue:&dts]; + if (CMTimeCompare(dts, minimum) < 0) { + minimum = dts; + index = key; + continue; + } + } + if (!index) { + self->_flags.state = SGDecodeLoopStateStalled; + [self->_lock unlock]; + continue; + } + SGObjectQueue *queue = self->_packetQueues[index]; + id decodable = self->_decodables[index]; + SGPacket *packet = nil; + [queue getObjectAsync:&packet]; + NSAssert(packet, @"Invalid Packet."); + if (packet == gFlushPacket) { + self->_flushFlags[index] = @(NO); + [self->_lock unlock]; + [decodable flush]; + [self->_lock lock]; + } else { + NSArray *objs = nil; + if (packet == gFinishPacket) { + [self->_lock unlock]; + objs = [decodable finish]; + } else { + CMTime dts = packet.decodeTimeStamp; + [self->_timeStamps setObject:[NSValue value:&dts withObjCType:@encode(CMTime)] forKey:index]; + [self->_lock unlock]; + objs = [decodable decode:packet]; + } + [self->_lock lock]; + if (self->_flushFlags[index].boolValue) { + for (SGFrame *obj in objs) { + [obj unlock]; + } + } else { + [self->_lock unlock]; + for (SGFrame *obj in objs) { + [self->_delegate decodeLoop:self didOutputFrame:obj]; + [obj unlock]; + } + [self->_lock lock]; + } + } + SGBlock b1 = [self setCapacityIfNeeded]; + [self->_lock unlock]; + [packet unlock]; + b1(); + continue; + } + } + } +} + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.h b/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.h new file mode 100644 index 00000000..82a01f21 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.h @@ -0,0 +1,13 @@ +// +// SGVideoDecoder.h +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDecodable.h" + +@interface SGVideoDecoder : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.m b/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.m new file mode 100644 index 00000000..42121f9d --- /dev/null +++ b/SGPlayer/Classes/Core/SGDecoder/SGVideoDecoder.m @@ -0,0 +1,161 @@ +// +// SGVideoDecoder.m +// SGPlayer iOS +// +// Created by Single on 2018/8/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGVideoDecoder.h" +#import "SGFrame+Internal.h" +#import "SGPacket+Internal.h" +#import "SGCodecContext.h" +#import "SGVideoFrame.h" + +@interface SGVideoDecoder () + +{ + struct { + BOOL needsAlignment; + } _flags; +} + +@property (nonatomic, strong, readonly) SGCodecContext *codecContext; +@property (nonatomic, strong, readonly) SGCodecDescriptor *codecDescriptor; + +@end + +@implementation SGVideoDecoder + +@synthesize options = _options; + +- (void)setup +{ + self->_flags.needsAlignment = YES; + self->_codecContext = [[SGCodecContext alloc] initWithTimebase:self->_codecDescriptor.timebase + codecpar:self->_codecDescriptor.codecpar + frameClass:[SGVideoFrame class] + frameReuseName:[SGVideoFrame commonReuseName]]; + self->_codecContext.options = self->_options; + [self->_codecContext open]; +} + +- (void)destroy +{ + self->_flags.needsAlignment = YES; + [self->_codecContext close]; + self->_codecContext = nil; +} + +#pragma mark - Control + +- (void)flush +{ + self->_flags.needsAlignment = YES; + [self->_codecContext flush]; +} + +- (NSArray<__kindof SGFrame *> *)decode:(SGPacket *)packet +{ + NSMutableArray *ret = [NSMutableArray array]; + SGCodecDescriptor *cd = packet.codecDescriptor; + NSAssert(cd, @"Invalid Codec Descriptor."); + if (![cd isEqualCodecContextToDescriptor:self->_codecDescriptor]) { + NSArray *objs = [self processPacket:nil]; + for (SGFrame *obj in objs) { + [ret addObject:obj]; + } + self->_codecDescriptor = [cd copy]; + [self destroy]; + [self setup]; + } + [cd fillToDescriptor:self->_codecDescriptor]; + switch (packet.codecDescriptor.type) { + case SGCodecTypeDecode: { + NSArray *objs = [self processPacket:packet]; + for (SGFrame *obj in objs) { + [ret addObject:obj]; + } + } + break; + case SGCodecTypePadding: { + + } + break; + } + return ret; +} + +- (NSArray<__kindof SGFrame *> *)finish +{ + return [self processPacket:nil]; +} + +#pragma mark - Process + +- (NSArray<__kindof SGFrame *> *)processPacket:(SGPacket *)packet +{ + if (!self->_codecContext || !self->_codecDescriptor) { + return nil; + } + SGCodecDescriptor *cd = self->_codecDescriptor; + NSArray *objs = [self->_codecContext decode:packet]; + objs = [self processFrames:objs done:!packet]; + objs = [self clipFrames:objs timeRange:cd.timeRange]; + return objs; +} + +- (NSArray<__kindof SGFrame *> *)processFrames:(NSArray<__kindof SGFrame *> *)frames done:(BOOL)done +{ + NSMutableArray *ret = [NSMutableArray array]; + for (SGAudioFrame *obj in frames) { + [obj setCodecDescriptor:[self->_codecDescriptor copy]]; + [obj fill]; + [ret addObject:obj]; + } + return ret; +} + +- (NSArray<__kindof SGFrame *> *)clipFrames:(NSArray<__kindof SGFrame *> *)frames timeRange:(CMTimeRange)timeRange +{ + if (!SGCMTimeIsValid(timeRange.start, NO) || + !SGCMTimeIsValid(timeRange.duration, NO)) { + return frames; + } + NSMutableArray *ret = [NSMutableArray array]; + for (SGFrame *obj in frames) { + if (CMTimeCompare(obj.timeStamp, timeRange.start) < 0) { + [obj unlock]; + continue; + } + if (CMTimeCompare(obj.timeStamp, CMTimeRangeGetEnd(timeRange)) >= 0) { + [obj unlock]; + continue; + } + if (self->_flags.needsAlignment) { + self->_flags.needsAlignment = NO; + CMTime start = timeRange.start; + CMTime duration = CMTimeSubtract(CMTimeAdd(obj.timeStamp, obj.duration), start); + if (CMTimeCompare(obj.timeStamp, start) > 0) { + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = obj.track; + cd.metadata = obj.codecDescriptor.metadata; + [obj setCodecDescriptor:cd]; + [obj fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + } + } + CMTime start = obj.timeStamp; + CMTime duration = CMTimeSubtract(CMTimeRangeGetEnd(timeRange), obj.timeStamp); + if (CMTimeCompare(obj.duration, duration) > 0) { + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = obj.track; + cd.metadata = obj.codecDescriptor.metadata; + [obj setCodecDescriptor:cd]; + [obj fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + } + [ret addObject:obj]; + } + return ret; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDefine/SGMacro.h b/SGPlayer/Classes/Core/SGDefine/SGMacro.h new file mode 100644 index 00000000..4927451f --- /dev/null +++ b/SGPlayer/Classes/Core/SGDefine/SGMacro.h @@ -0,0 +1,33 @@ +// +// SGMacro.h +// SGPlayer +// +// Created by Single on 16/6/29. +// Copyright © 2016年 single. All rights reserved. +// + +#ifndef SGMacro_h +#define SGMacro_h + +#import + +#define SGWeakify(obj) __weak typeof(obj) weak_obj = obj; +#define SGStrongify(obj) __strong typeof(weak_obj) obj = weak_obj; + +#ifdef DEBUG +#define SGPlayerLog(...) NSLog(__VA_ARGS__) +#else +#define SGPlayerLog(...) +#endif + +#define SGGet0Map(ret, name0, obj) - (ret)name0 {return obj.name0;} +#define SGGet1Map(ret, name0, t0, obj) - (ret)name0:(t0)n0 {return [obj name0:n0];} +#define SGGet00Map(ret, name0, name00, obj) - (ret)name0 {return obj.name00;} +#define SGGet11Map(ret, name0, name00, t0, obj) - (ret)name0:(t0)n0 {return [obj name00:n0];} + +#define SGSet1Map(ret, name0, t0, obj) - (ret)name0:(t0)n0 {[obj name0:n0];} +#define SGSet2Map(ret, name0, t0, name1, t1, obj) - (ret)name0:(t0)n0 name1:(t1)n1 {[obj name0:n0 name1:n1];} +#define SGSet11Map(ret, name0, name00, t0, obj) - (ret)name0:(t0)n0 {[obj name00:n0];} +#define SGSet22Map(ret, name0, name00, t0, name1, name11, t1, obj) - (ret)name0:(t0)n0 name1:(t1)n1 {[obj name00:n0 name11:n1];} + +#endif diff --git a/SGPlayer/Classes/Core/SGDefine/SGMapping.h b/SGPlayer/Classes/Core/SGDefine/SGMapping.h new file mode 100644 index 00000000..34737063 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDefine/SGMapping.h @@ -0,0 +1,28 @@ +// +// SGMapping.h +// SGPlayer +// +// Created by Single on 2018/1/26. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGVideoRenderer.h" +#import "SGMetalViewport.h" +#import "SGFFmpeg.h" + +// SG <-> SGMetal +SGMetalViewportMode SGScaling2Viewport(SGScalingMode mode); +SGScalingMode SGViewport2Scaling(SGMetalViewportMode mode); + +// FF <-> SG +SGMediaType SGMediaTypeFF2SG(enum AVMediaType mediaType); +enum AVMediaType SGMediaTypeSG2FF(SGMediaType mediaType); + +// FF <-> AV +OSType SGPixelFormatFF2AV(enum AVPixelFormat format); +enum AVPixelFormat SGPixelFormatAV2FF(OSType format); + +// FF <-> NS +AVDictionary * SGDictionaryNS2FF(NSDictionary *dictionary); +NSDictionary * SGDictionaryFF2NS(AVDictionary *dictionary); diff --git a/SGPlayer/Classes/Core/SGDefine/SGMapping.m b/SGPlayer/Classes/Core/SGDefine/SGMapping.m new file mode 100644 index 00000000..b2ac094b --- /dev/null +++ b/SGPlayer/Classes/Core/SGDefine/SGMapping.m @@ -0,0 +1,125 @@ +// +// SGMapping.m +// SGPlayer +// +// Created by Single on 2018/1/26. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGMapping.h" + +SGMetalViewportMode SGScaling2Viewport(SGScalingMode mode) +{ + switch (mode) { + case SGScalingModeResize: + return SGMetalViewportModeResize; + case SGScalingModeResizeAspect: + return SGMetalViewportModeResizeAspect; + case SGScalingModeResizeAspectFill: + return SGMetalViewportModeResizeAspectFill; + } + return SGMetalViewportModeResizeAspect; +} + +SGScalingMode SGViewport2Scaling(SGMetalViewportMode mode) +{ + switch (mode) { + case SGMetalViewportModeResize: + return SGScalingModeResize; + case SGMetalViewportModeResizeAspect: + return SGScalingModeResizeAspect; + case SGMetalViewportModeResizeAspectFill: + return SGScalingModeResizeAspectFill; + } + return SGScalingModeResizeAspect; +} + +SGMediaType SGMediaTypeFF2SG(enum AVMediaType mediaType) +{ + switch (mediaType) { + case AVMEDIA_TYPE_AUDIO: + return SGMediaTypeAudio; + case AVMEDIA_TYPE_VIDEO: + return SGMediaTypeVideo; + case AVMEDIA_TYPE_SUBTITLE: + return SGMediaTypeSubtitle; + default: + return SGMediaTypeUnknown; + } +} + +enum AVMediaType SGMediaTypeSG2FF(SGMediaType mediaType) +{ + switch (mediaType) { + case SGMediaTypeAudio: + return AVMEDIA_TYPE_AUDIO; + case SGMediaTypeVideo: + return AVMEDIA_TYPE_VIDEO; + case SGMediaTypeSubtitle: + return AVMEDIA_TYPE_SUBTITLE; + default: + return AVMEDIA_TYPE_UNKNOWN; + } +} + +OSType SGPixelFormatFF2AV(enum AVPixelFormat format) +{ + switch (format) { + case AV_PIX_FMT_YUV420P: + return kCVPixelFormatType_420YpCbCr8Planar; + case AV_PIX_FMT_UYVY422: + return kCVPixelFormatType_422YpCbCr8; + case AV_PIX_FMT_BGRA: + return kCVPixelFormatType_32BGRA; + case AV_PIX_FMT_NV12: + return kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; + default: + return 0; + } + return 0; +} + +enum AVPixelFormat SGPixelFormatAV2FF(OSType format) +{ + switch (format) { + case kCVPixelFormatType_420YpCbCr8Planar: + return AV_PIX_FMT_YUV420P; + case kCVPixelFormatType_422YpCbCr8: + return AV_PIX_FMT_UYVY422; + case kCVPixelFormatType_32BGRA: + return AV_PIX_FMT_BGRA; + case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange: + return AV_PIX_FMT_NV12; + default: + return AV_PIX_FMT_NONE; + } + return AV_PIX_FMT_NONE; +} + +AVDictionary * SGDictionaryNS2FF(NSDictionary *dictionary) +{ + __block AVDictionary *ret = NULL; + [dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + if ([obj isKindOfClass:[NSNumber class]]) { + av_dict_set_int(&ret, [key UTF8String], [obj integerValue], 0); + } else if ([obj isKindOfClass:[NSString class]]) { + av_dict_set(&ret, [key UTF8String], [obj UTF8String], 0); + } + }]; + return ret; +} + +NSDictionary * SGDictionaryFF2NS(AVDictionary *dictionary) +{ + NSMutableDictionary *ret = [NSMutableDictionary dictionary]; + AVDictionaryEntry *entry = NULL; + while ((entry = av_dict_get(dictionary, "", entry, AV_DICT_IGNORE_SUFFIX))) { + NSString *key = [NSString stringWithUTF8String:entry->key]; + NSString *value = [NSString stringWithUTF8String:entry->value]; + [ret setObject:value forKey:key]; + } + if (ret.count <= 0) { + ret = nil; + } + return [ret copy]; +} diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGDemuxable.h b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxable.h new file mode 100644 index 00000000..18a74669 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxable.h @@ -0,0 +1,76 @@ +// +// SGDemuxable.h +// SGPlayer iOS +// +// Created by Single on 2018/9/25. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGDemuxerOptions.h" +#import "SGPacket.h" + +@protocol SGDemuxableDelegate; + +@protocol SGDemuxable + +/** + * + */ +@property (nonatomic, strong) SGDemuxerOptions *options; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +- (NSError *)open; + +/** + * + */ +- (NSError *)close; + +/** + * + */ +- (NSError *)seekable; + +/** + * + */ +- (NSError *)seekToTime:(CMTime)time; + +/** + * + */ +- (NSError *)nextPacket:(SGPacket **)packet; + +@end + +@protocol SGDemuxableDelegate + +/** + * + */ +- (BOOL)demuxableShouldAbortBlockingFunctions:(id)demuxable; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.h b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.h new file mode 100644 index 00000000..5f42906f --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.h @@ -0,0 +1,39 @@ +// +// SGDemuxerFunnel.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxable.h" + +@interface SGDemuxerFunnel : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithDemuxable:(id)demuxable index:(NSInteger)index timeRange:(CMTimeRange)timeRange; + +/** + * + */ +@property (nonatomic, readonly) NSInteger index; + +/** + * + */ +@property (nonatomic, readonly) CMTimeRange timeRange; + +/** + * + */ +@property (nonatomic) BOOL overgop; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.m b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.m new file mode 100644 index 00000000..68cdc541 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGDemuxerFunnel.m @@ -0,0 +1,199 @@ +// +// SGDemuxerFunnel.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxerFunnel.h" +#import "SGPacket+Internal.h" +#import "SGObjectQueue.h" +#import "SGError.h" +#import "SGMacro.h" + +@interface SGDemuxerFunnel () + +{ + struct { + BOOL finished; + BOOL inputting; + BOOL outputting; + } _flags; +} + +@property (nonatomic, strong, readonly) SGTrack *track; +@property (nonatomic, strong, readonly) SGTimeLayout *timeLayout; +@property (nonatomic, strong, readonly) id demuxable; +@property (nonatomic, strong, readonly) SGObjectQueue *packetQueue; + +@end + +@implementation SGDemuxerFunnel + +@synthesize tracks = _tracks; +@synthesize duration = _duration; + +- (instancetype)initWithDemuxable:(id)demuxable index:(NSInteger)index timeRange:(CMTimeRange)timeRange +{ + if (self = [super init]) { + self->_overgop = YES; + self->_index = index; + self->_demuxable = demuxable; + self->_timeRange = SGCMTimeRangeFit(timeRange); + self->_packetQueue = [[SGObjectQueue alloc] init]; + } + return self; +} + +#pragma mark - Mapping + +SGGet0Map(id, delegate, self->_demuxable) +SGSet1Map(void, setDelegate, id, self->_demuxable) +SGGet0Map(SGDemuxerOptions *, options, self->_demuxable) +SGSet1Map(void, setOptions, SGDemuxerOptions *, self->_demuxable) +SGGet0Map(NSDictionary *, metadata, self->_demuxable) +SGGet0Map(NSError *, close, self->_demuxable) +SGGet0Map(NSError *, seekable, self->_demuxable) + +#pragma mark - Control + +- (NSError *)open +{ + NSError *error = [self->_demuxable open]; + if (error) { + return error; + } + for (SGTrack *obj in self->_demuxable.tracks) { + if (self->_index == obj.index) { + self->_track = obj; + self->_tracks = @[obj]; + break; + } + } + CMTime start = CMTimeMaximum(self->_timeRange.start, kCMTimeZero); + CMTime duration = CMTimeMinimum(self->_timeRange.duration, CMTimeSubtract(self->_demuxable.duration, start)); + self->_duration = duration; + self->_timeRange = CMTimeRangeMake(start, duration); + self->_timeLayout = [[SGTimeLayout alloc] initWithStart:CMTimeMultiply(start, -1) scale:kCMTimeInvalid]; + return nil; +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + NSError *error = [self->_demuxable seekToTime:CMTimeSubtract(time, self->_timeLayout.start)]; + if (error) { + return error; + } + [self->_packetQueue flush]; + self->_flags.finished = NO; + self->_flags.inputting = NO; + self->_flags.outputting = NO; + return nil; +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + if (!self->_overgop) { + return [self nextPacketInternal:packet]; + } + return [self nextPacketInternalOvergop:packet]; +} + +- (NSError *)nextPacketInternal:(SGPacket **)packet +{ + NSError *error = nil; + while (YES) { + SGPacket *pkt = nil; + error = [self->_demuxable nextPacket:&pkt]; + if (error) { + break; + } + if (self->_index != pkt.track.index) { + [pkt unlock]; + continue; + } + if (CMTimeCompare(pkt.timeStamp, self->_timeRange.start) < 0) { + [pkt unlock]; + continue; + } + if (CMTimeCompare(pkt.timeStamp, CMTimeRangeGetEnd(self->_timeRange)) >= 0) { + [pkt unlock]; + error = SGCreateError(SGErrorCodeURLDemuxerFunnelFinished, SGActionCodeURLDemuxerFunnelNext); + break; + } + [pkt.codecDescriptor appendTimeLayout:self->_timeLayout]; + [pkt.codecDescriptor appendTimeRange:self->_timeRange]; + [pkt fill]; + *packet = pkt; + break; + } + return error; +} + +- (NSError *)nextPacketInternalOvergop:(SGPacket **)packet +{ + NSError *error = nil; + while (YES) { + SGPacket *pkt = nil; + if (self->_flags.outputting) { + [self->_packetQueue getObjectAsync:&pkt]; + if (pkt) { + [pkt.codecDescriptor appendTimeLayout:self->_timeLayout]; + [pkt.codecDescriptor appendTimeRange:self->_timeRange]; + [pkt fill]; + *packet = pkt; + break; + } + } + if (self->_flags.finished) { + error = SGCreateError(SGErrorCodeURLDemuxerFunnelFinished, SGActionCodeURLDemuxerFunnelNext); + break; + } + error = [self->_demuxable nextPacket:&pkt]; + if (error) { + if (error.code == SGErrorImmediateExitRequested) { + break; + } + self->_flags.finished = YES; + continue; + } + if (self->_index != pkt.track.index) { + [pkt unlock]; + continue; + } + if (CMTimeCompare(pkt.timeStamp, self->_timeRange.start) < 0) { + if (pkt.core->flags & AV_PKT_FLAG_KEY) { + [self->_packetQueue flush]; + self->_flags.inputting = YES; + } + if (self->_flags.inputting) { + [self->_packetQueue putObjectSync:pkt]; + } + [pkt unlock]; + continue; + } + if (CMTimeCompare(pkt.timeStamp, CMTimeRangeGetEnd(self->_timeRange)) >= 0) { + if (pkt.core->flags & AV_PKT_FLAG_KEY) { + self->_flags.finished = YES; + } else { + [self->_packetQueue putObjectSync:pkt]; + } + [pkt unlock]; + continue; + } + if (!self->_flags.outputting && pkt.core->flags & AV_PKT_FLAG_KEY) { + [self->_packetQueue flush]; + } + self->_flags.outputting = YES; + [self->_packetQueue putObjectSync:pkt]; + [pkt unlock]; + continue; + } + return error; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.h b/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.h new file mode 100644 index 00000000..9c19ca36 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.h @@ -0,0 +1,24 @@ +// +// SGMutilDemuxer.h +// SGPlayer +// +// Created by Single on 2018/11/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxable.h" + +@interface SGMutilDemuxer : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithDemuxables:(NSArray> *)demuxables; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.m b/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.m new file mode 100644 index 00000000..44b5635b --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGMutilDemuxer.m @@ -0,0 +1,170 @@ +// +// SGMutilDemuxer.m +// SGPlayer +// +// Created by Single on 2018/11/16. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGMutilDemuxer.h" +#import "SGError.h" + +@interface SGMutilDemuxer () + +@property (nonatomic, strong, readonly) NSArray> *demuxables; +@property (nonatomic, strong, readonly) NSMutableArray> *finishedDemuxables; +@property (nonatomic, strong, readonly) NSMutableDictionary *timeStamps; + +@end + +@implementation SGMutilDemuxer + +@synthesize tracks = _tracks; +@synthesize duration = _duration; +@synthesize metadata = _metadata; + +- (instancetype)initWithDemuxables:(NSArray> *)demuxables +{ + if (self = [super init]) { + self->_demuxables = demuxables; + self->_finishedDemuxables = [NSMutableArray array]; + } + return self; +} + +#pragma mark - Setter & Getter + +- (void)setDelegate:(id)delegate +{ + for (id obj in self->_demuxables) { + obj.delegate = delegate; + } +} + +- (id)delegate +{ + return self->_demuxables.firstObject.delegate; +} + +- (void)setOptions:(SGDemuxerOptions *)options +{ + for (id obj in self->_demuxables) { + obj.options = options; + } +} + +- (SGDemuxerOptions *)options +{ + return self->_demuxables.firstObject.options; +} + +#pragma mark - Control + +- (NSError *)open +{ + for (id obj in self->_demuxables) { + NSError *error = [obj open]; + if (error) { + return error; + } + } + CMTime duration = kCMTimeZero; + NSMutableArray *tracks = [NSMutableArray array]; + for (id obj in self->_demuxables) { + NSAssert(CMTIME_IS_VALID(obj.duration), @"Invalid Duration."); + duration = CMTimeMaximum(duration, obj.duration); + [tracks addObjectsFromArray:obj.tracks]; + } + self->_duration = duration; + self->_tracks = [tracks copy]; + NSMutableArray *indexes = [NSMutableArray array]; + for (SGTrack *obj in self->_tracks) { + NSAssert(![indexes containsObject:@(obj.index)], @"Invalid Track Indexes"); + [indexes addObject:@(obj.index)]; + } + self->_timeStamps = [NSMutableDictionary dictionary]; + return nil; +} + +- (NSError *)close +{ + for (id obj in self->_demuxables) { + NSError *error = [obj close]; + if (error) { + return error; + } + } + return nil; +} + +- (NSError *)seekable +{ + for (id obj in self->_demuxables) { + NSError *error = [obj seekable]; + if (error) { + return error; + } + } + return nil; +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + for (id obj in self->_demuxables) { + NSError *error = [obj seekToTime:time]; + if (error) { + return error; + } + } + [self->_timeStamps removeAllObjects]; + [self->_finishedDemuxables removeAllObjects]; + return nil; +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + NSError *error = nil; + while (YES) { + id demuxable = nil; + CMTime minimumTime = kCMTimePositiveInfinity; + for (id obj in self->_demuxables) { + if ([self->_finishedDemuxables containsObject:obj]) { + continue; + } + NSString *key = [NSString stringWithFormat:@"%p", obj]; + NSValue *value = [self->_timeStamps objectForKey:key]; + if (!value) { + demuxable = obj; + break; + } + CMTime time = kCMTimePositiveInfinity; + [value getValue:&time]; + if (CMTimeCompare(time, minimumTime) < 0) { + minimumTime = time; + demuxable = obj; + } + } + if (!demuxable) { + return SGCreateError(SGErrorCodeMutilDemuxerEndOfFile, SGActionCodeMutilDemuxerNext); + } + error = [demuxable nextPacket:packet]; + if (error) { + if (error.code == SGErrorImmediateExitRequested) { + break; + } + [self->_finishedDemuxables addObject:demuxable]; + continue; + } + CMTime decodeTimeStamp = (*packet).decodeTimeStamp; + NSString *key = [NSString stringWithFormat:@"%p", demuxable]; + NSValue *value = [NSValue value:&decodeTimeStamp withObjCType:@encode(CMTime)]; + [self->_timeStamps setObject:value forKey:key]; + break; + } + return error; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.h b/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.h new file mode 100644 index 00000000..3ca19939 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.h @@ -0,0 +1,24 @@ +// +// SGPaddingDemuxer.h +// SGPlayer +// +// Created by Single on 2019/6/4. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGDemuxable.h" + +@interface SGPaddingDemuxer : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithDuration:(CMTime)duration; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.m b/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.m new file mode 100644 index 00000000..b424308a --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGPaddingDemuxer.m @@ -0,0 +1,89 @@ +// +// SGPaddingDemuxer.m +// SGPlayer +// +// Created by Single on 2019/6/4. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGPaddingDemuxer.h" +#import "SGPacket+Internal.h" +#import "SGObjectPool.h" +#import "SGError.h" + +@interface SGPaddingDemuxer () + +@property (nonatomic, readonly) CMTime basetime; +@property (nonatomic, readonly) CMTime lasttime; + +@end + +@implementation SGPaddingDemuxer + +@synthesize tracks = _tracks; +@synthesize options = _options; +@synthesize delegate = _delegate; +@synthesize metadata = _metadata; +@synthesize duration = _duration; + +- (instancetype)initWithDuration:(CMTime)duration +{ + if (self = [super init]) { + self->_duration = duration; + [self seekToTime:kCMTimeZero]; + } + return self; +} + +#pragma mark - Control + +- (NSError *)open +{ + return nil; +} + +- (NSError *)close +{ + return nil; +} + +- (NSError *)seekable +{ + return nil; +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + time = CMTimeMaximum(time, kCMTimeZero); + time = CMTimeMinimum(time, self->_duration); + self->_basetime = time; + self->_lasttime = time; + return nil; +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + if (CMTimeCompare(self->_lasttime, self->_duration) >= 0) { + return SGCreateError(SGErrorCodeDemuxerEndOfFile, SGActionCodeFormatReadFrame); + } + CMTime timeStamp = self->_lasttime; + CMTime duration = CMTimeSubtract(self->_duration, self->_lasttime); + SGPacket *pkt = [[SGObjectPool sharedPool] objectWithClass:[SGPacket class] reuseName:[SGPacket commonReuseName]]; + pkt.core->size = 1; + pkt.core->pts = av_rescale(AV_TIME_BASE, timeStamp.value, timeStamp.timescale); + pkt.core->dts = av_rescale(AV_TIME_BASE, timeStamp.value, timeStamp.timescale); + pkt.core->duration = av_rescale(AV_TIME_BASE, duration.value, duration.timescale); + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.type = SGCodecTypePadding; + cd.timebase = AV_TIME_BASE_Q; + [pkt setCodecDescriptor:cd]; + [pkt fill]; + *packet = pkt; + self->_lasttime = self->_duration; + return nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.h b/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.h new file mode 100644 index 00000000..8e2304ec --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.h @@ -0,0 +1,35 @@ +// +// SGSegmentDemuxer.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxable.h" +#import "SGSegment.h" + +@interface SGSegmentDemuxer : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithSegment:(SGSegment *)segment basetime:(CMTime)basetime; + +/** + * + */ +@property (nonatomic, strong, readonly) SGSegment *segment; + +/** + * + */ +@property (nonatomic, readonly) CMTime basetime; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.m b/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.m new file mode 100644 index 00000000..f80df864 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGSegmentDemuxer.m @@ -0,0 +1,99 @@ +// +// SGSegmentDemuxer.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSegmentDemuxer.h" +#import "SGPacket+Internal.h" +#import "SGSegment+Internal.h" +#import "SGError.h" +#import "SGMacro.h" + +@interface SGSegmentDemuxer () + +@property (nonatomic, strong, readonly) SGTimeLayout *timeLayout; +@property (nonatomic, strong, readonly) id demuxable; + +@end + +@implementation SGSegmentDemuxer + +@synthesize duration = _duration; + +- (instancetype)initWithSegment:(SGSegment *)segment basetime:(CMTime)basetime +{ + if (self = [super init]) { + self->_segment = segment; + self->_basetime = basetime; + self->_demuxable = [segment newDemuxable]; + self->_timeLayout = [[SGTimeLayout alloc] initWithStart:basetime scale:segment.scale]; + } + return self; +} + +- (void)dealloc +{ + [self close]; +} + +#pragma mark - Mapping + +SGGet0Map(id, delegate, self->_demuxable) +SGSet1Map(void, setDelegate, id, self->_demuxable) +SGGet0Map(SGDemuxerOptions *, options, self->_demuxable) +SGSet1Map(void, setOptions, SGDemuxerOptions *, self->_demuxable) +SGGet0Map(NSDictionary *, metadata, self->_demuxable) +SGGet0Map(NSArray *, tracks, self->_demuxable) +SGGet0Map(NSError *, close, self->_demuxable) +SGGet0Map(NSError *, seekable, self->_demuxable) + +#pragma mark - Control + +- (NSError *)open +{ + if (!self->_demuxable) { + CMTime duration = self->_segment.timeRange.duration; + NSAssert(SGCMTimeIsValid(duration, NO), @"Invaild Duration."); + self->_duration = SGCMTimeMultiply(duration, self->_segment.scale); + return nil; + } + NSError *error = [self->_demuxable open]; + if (error) { + return error; + } + CMTime duration = self->_demuxable.duration; + NSAssert(SGCMTimeIsValid(duration, NO), @"Invaild Duration."); + self->_duration = SGCMTimeMultiply(duration, self->_segment.scale); + return nil; +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + if (!self->_demuxable) { + return nil; + } + time = SGCMTimeDivide(time, self->_segment.scale); + return [self->_demuxable seekToTime:time]; +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + if (!self->_demuxable) { + return SGCreateError(SGErrorCodeDemuxerEndOfFile, SGActionCodeSegmentDemuxerNext); + } + NSError *error = [self->_demuxable nextPacket:packet]; + if (error) { + return error; + } + [(*packet).codecDescriptor appendTimeLayout:self->_timeLayout]; + [(*packet) fill]; + return nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.h b/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.h new file mode 100644 index 00000000..efcdb108 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.h @@ -0,0 +1,25 @@ +// +// SGTrackDemuxer.h +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxable.h" +#import "SGMutableTrack.h" + +@interface SGTrackDemuxer : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithTrack:(SGMutableTrack *)track; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.m b/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.m new file mode 100644 index 00000000..c11a652e --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGTrackDemuxer.m @@ -0,0 +1,140 @@ +// +// SGTrackDemuxer.m +// SGPlayer +// +// Created by Single on 2018/11/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGTrackDemuxer.h" +#import "SGSegmentDemuxer.h" +#import "SGPacket+Internal.h" +#import "SGError.h" + +@interface SGTrackDemuxer () + +@property (nonatomic, strong, readonly) SGMutableTrack *track; +@property (nonatomic, strong, readonly) SGSegmentDemuxer *currentSegment; +@property (nonatomic, strong, readonly) NSMutableArray> *segments; + +@end + +@implementation SGTrackDemuxer + +@synthesize tracks = _tracks; +@synthesize duration = _duration; +@synthesize metadata = _metadata; + +- (instancetype)initWithTrack:(SGMutableTrack *)track +{ + if (self = [super init]) { + self->_track = [track copy]; + self->_tracks = @[self->_track]; + self->_segments = [NSMutableArray array]; + } + return self; +} + +#pragma mark - Setter & Getter + +- (void)setDelegate:(id)delegate +{ + for (SGSegmentDemuxer *obj in self->_segments) { + obj.delegate = delegate; + } +} + +- (id)delegate +{ + return self->_segments.firstObject.delegate; +} + +- (void)setOptions:(SGDemuxerOptions *)options +{ + for (SGSegmentDemuxer *obj in self->_segments) { + obj.options = options; + } +} + +- (SGDemuxerOptions *)options +{ + return self->_segments.firstObject.options; +} + +#pragma mark - Control + +- (NSError *)open +{ + CMTime basetime = kCMTimeZero; + for (SGSegment *obj in self->_track.segments) { + SGSegmentDemuxer *segment = [[SGSegmentDemuxer alloc] initWithSegment:obj basetime:basetime]; + [self->_segments addObject:segment]; + NSError *error = [segment open]; + if (error) { + return error; + } + NSAssert(CMTIME_IS_VALID(segment.duration), @"Invaild Duration."); + NSAssert(!segment.tracks.firstObject || segment.tracks.firstObject.type == self->_track.type, @"Invaild mediaType."); + basetime = CMTimeAdd(basetime, segment.duration); + } + self->_duration = basetime; + self->_currentSegment = self->_segments.firstObject; + [self->_currentSegment seekToTime:kCMTimeZero]; + return nil; +} + +- (NSError *)close +{ + for (SGSegmentDemuxer *obj in self->_segments) { + [obj close]; + } + return nil; +} + +- (NSError *)seekable +{ + return nil; +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + time = CMTimeMaximum(time, kCMTimeZero); + time = CMTimeMinimum(time, self->_duration); + SGSegmentDemuxer *unit = nil; + for (SGSegmentDemuxer *obj in self->_segments) { + if (CMTimeCompare(time, CMTimeAdd(obj.basetime, obj.duration)) <= 0) { + unit = obj; + break; + } + } + self->_currentSegment = unit ? unit : self->_segments.lastObject; + return [self->_currentSegment seekToTime:CMTimeSubtract(time, self->_currentSegment.basetime)]; +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + NSError *error = nil; + while (YES) { + error = [self->_currentSegment nextPacket:packet]; + if (error) { + if (error.code == SGErrorImmediateExitRequested) { + break; + } + if (self->_currentSegment == self->_segments.lastObject) { + break; + } + self->_currentSegment = [self->_segments objectAtIndex:[self->_segments indexOfObject:self->_currentSegment] + 1]; + [self->_currentSegment seekToTime:kCMTimeZero]; + continue; + } + (*packet).codecDescriptor.track = self->_track; + [(*packet) fill]; + break; + } + return error; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.h b/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.h new file mode 100644 index 00000000..6b9cf6e2 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.h @@ -0,0 +1,29 @@ +// +// SGURLDemuxer.h +// SGPlayer iOS +// +// Created by Single on 2018/8/13. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGDemuxable.h" + +@interface SGURLDemuxer : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithURL:(NSURL *)URL; + +/** + * + */ +@property (nonatomic, copy, readonly) NSURL *URL; + +@end diff --git a/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.m b/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.m new file mode 100644 index 00000000..7f4d098e --- /dev/null +++ b/SGPlayer/Classes/Core/SGDemuxer/SGURLDemuxer.m @@ -0,0 +1,195 @@ +// +// SGURLDemuxer.m +// SGPlayer iOS +// +// Created by Single on 2018/8/13. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGURLDemuxer.h" +#import "SGPacket+Internal.h" +#import "SGTrack+Internal.h" +#import "SGOptions.h" +#import "SGObjectPool.h" +#import "SGMapping.h" +#import "SGFFmpeg.h" +#import "SGError.h" + +@interface SGURLDemuxer () + +@property (nonatomic, readonly) CMTime basetime; +@property (nonatomic, readonly) AVFormatContext *context; + +@end + +@implementation SGURLDemuxer + +@synthesize tracks = _tracks; +@synthesize options = _options; +@synthesize delegate = _delegate; +@synthesize metadata = _metadata; +@synthesize duration = _duration; + +- (instancetype)initWithURL:(NSURL *)URL +{ + if (self = [super init]) { + self->_URL = [URL copy]; + self->_options = [SGOptions sharedOptions].demuxer.copy; + self->_basetime = kCMTimeNegativeInfinity; + self->_duration = kCMTimeInvalid; + } + return self; +} + +- (void)dealloc +{ + NSAssert(!self->_context, @"AVFormatContext is not released."); +} + +#pragma mark - Control + +- (NSError *)open +{ + if (self->_context) { + return nil; + } + SGFFmpegSetupIfNeeded(); + NSError *error = SGCreateFormatContext(&self->_context, self->_URL, self->_options.options, (__bridge void *)self, SGURLDemuxerInterruptHandler); + if (error) { + return error; + } + if (self->_context->duration > 0) { + self->_duration = CMTimeMake(self->_context->duration, AV_TIME_BASE); + } + if (self->_context->metadata) { + self->_metadata = SGDictionaryFF2NS(self->_context->metadata); + } + NSMutableArray *tracks = [NSMutableArray array]; + for (int i = 0; i < self->_context->nb_streams; i++) { + AVStream *stream = self->_context->streams[i]; + SGMediaType type = SGMediaTypeFF2SG(stream->codecpar->codec_type); + if (type == SGMediaTypeVideo && stream->disposition & AV_DISPOSITION_ATTACHED_PIC) { + type = SGMediaTypeUnknown; + } + SGTrack *obj = [[SGTrack alloc] initWithType:type index:i]; + [tracks addObject:obj]; + } + self->_tracks = [tracks copy]; + return nil; +} + +- (NSError *)close +{ + if (self->_context) { + avformat_close_input(&self->_context); + self->_context = NULL; + } + return nil; +} + +- (NSError *)seekable +{ + if (self->_context) { + if (self->_context->pb && self->_context->pb->seekable > 0) { + return nil; + } + return SGCreateError(SGErrorCodeFormatNotSeekable, SGActionCodeFormatGetSeekable); + } + return SGCreateError(SGErrorCodeNoValidFormat, SGActionCodeFormatGetSeekable); +} + +- (NSError *)seekToTime:(CMTime)time +{ + if (!CMTIME_IS_NUMERIC(time)) { + return SGCreateError(SGErrorCodeInvlidTime, SGActionCodeFormatSeekFrame); + } + NSError *error = [self seekable]; + if (error) { + return error; + } + if (self->_context) { + int64_t timeStamp = CMTimeConvertScale(time, AV_TIME_BASE, kCMTimeRoundingMethod_RoundTowardZero).value; + int ret = av_seek_frame(self->_context, -1, timeStamp, AVSEEK_FLAG_BACKWARD); + if (ret >= 0) { + self->_basetime = time; + } + return SGGetFFError(ret, SGActionCodeFormatSeekFrame); + } + return SGCreateError(SGErrorCodeNoValidFormat, SGActionCodeFormatSeekFrame); +} + +- (NSError *)nextPacket:(SGPacket **)packet +{ + if (self->_context) { + SGPacket *pkt = [[SGObjectPool sharedPool] objectWithClass:[SGPacket class] reuseName:[SGPacket commonReuseName]]; + int ret = av_read_frame(self->_context, pkt.core); + if (ret < 0) { + [pkt unlock]; + } else { + AVStream *stream = self->_context->streams[pkt.core->stream_index]; + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = [self->_tracks objectAtIndex:pkt.core->stream_index]; + cd.metadata = SGDictionaryFF2NS(stream->metadata); + cd.timebase = stream->time_base; + cd.codecpar = stream->codecpar; + [cd appendTimeRange:CMTimeRangeMake(self->_basetime, kCMTimePositiveInfinity)]; + [pkt setCodecDescriptor:cd]; + [pkt fill]; + *packet = pkt; + } + return SGGetFFError(ret, SGActionCodeFormatReadFrame); + } + return SGCreateError(SGErrorCodeNoValidFormat, SGActionCodeFormatReadFrame); +} + +#pragma mark - AVFormatContext + +static NSError * SGCreateFormatContext(AVFormatContext **formatContext, NSURL *URL, NSDictionary *options, void *opaque, int (*callback)(void *)) +{ + AVFormatContext *ctx = avformat_alloc_context(); + if (!ctx) { + return SGCreateError(SGErrorCodeNoValidFormat, SGActionCodeFormatCreate); + } + ctx->interrupt_callback.callback = callback; + ctx->interrupt_callback.opaque = opaque; + NSString *URLString = URL.isFileURL ? URL.path : URL.absoluteString; + AVDictionary *opts = SGDictionaryNS2FF(options); + if ([URLString.lowercaseString hasPrefix:@"rtmp"] || + [URLString.lowercaseString hasPrefix:@"rtsp"]) { + av_dict_set(&opts, "timeout", NULL, 0); + } + int success = avformat_open_input(&ctx, URLString.UTF8String, NULL, &opts); + if (opts) { + av_dict_free(&opts); + } + NSError *error = SGGetFFError(success, SGActionCodeFormatOpenInput); + if (error) { + if (ctx) { + avformat_free_context(ctx); + } + return error; + } + success = avformat_find_stream_info(ctx, NULL); + error = SGGetFFError(success, SGActionCodeFormatFindStreamInfo); + if (error) { + if (ctx) { + avformat_close_input(&ctx); + avformat_free_context(ctx); + } + return error; + } + *formatContext = ctx; + return nil; +} + +static int SGURLDemuxerInterruptHandler(void *demuxer) +{ + SGURLDemuxer *self = (__bridge SGURLDemuxer *)demuxer; + if ([self->_delegate respondsToSelector:@selector(demuxableShouldAbortBlockingFunctions:)]) { + BOOL ret = [self->_delegate demuxableShouldAbortBlockingFunctions:self]; + return ret ? 1 : 0; + } + return 0; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.h b/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.h new file mode 100644 index 00000000..3d371ef7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.h @@ -0,0 +1,58 @@ +// +// SGAudioDescriptor.h +// SGPlayer +// +// Created by Single on 2018/11/28. +// Copyright © 2018 single. All rights reserved. +// + +#import + +@interface SGAudioDescriptor : NSObject + +/** + * AVSampleFormat + */ +@property (nonatomic) int format; + +/** + * + */ +@property (nonatomic) int sampleRate; + +/** + * + */ +@property (nonatomic) int numberOfChannels; + +/** + * + */ +@property (nonatomic) uint64_t channelLayout; + +/** + * + */ +- (BOOL)isPlanar; + +/** + * + */ +- (int)bytesPerSample; + +/** + * + */ +- (int)numberOfPlanes; + +/** + * + */ +- (int)linesize:(int)numberOfSamples; + +/** + * + */ +- (BOOL)isEqualToDescriptor:(SGAudioDescriptor *)descriptor; + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.m b/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.m new file mode 100644 index 00000000..9d4a593e --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGAudioDescriptor.m @@ -0,0 +1,81 @@ +// +// SGAudioDescriptor.m +// SGPlayer +// +// Created by Single on 2018/11/28. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioDescriptor.h" +#import "SGDescriptor+Internal.h" +#import "SGFFmpeg.h" + +@implementation SGAudioDescriptor + +- (id)copyWithZone:(NSZone *)zone +{ + SGAudioDescriptor *obj = [[SGAudioDescriptor alloc] init]; + obj->_format = self->_format; + obj->_sampleRate = self->_sampleRate; + obj->_numberOfChannels = self->_numberOfChannels; + obj->_channelLayout = self->_channelLayout; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_format = AV_SAMPLE_FMT_FLTP; + self->_sampleRate = 44100; + self->_numberOfChannels = 2; + self->_channelLayout = av_get_default_channel_layout(2); + } + return self; +} + +- (instancetype)initWithFrame:(AVFrame *)frame +{ + if (self = [super init]) { + self->_format = frame->format; + self->_sampleRate = frame->sample_rate; + self->_numberOfChannels = frame->channels; + self->_channelLayout = frame->channel_layout ? frame->channel_layout : av_get_default_channel_layout(frame->channels); + } + return self; +} + +- (BOOL)isPlanar +{ + return av_sample_fmt_is_planar(self->_format); +} + +- (int)bytesPerSample +{ + return av_get_bytes_per_sample(self->_format); +} + +- (int)numberOfPlanes +{ + return av_sample_fmt_is_planar(self->_format) ? self->_numberOfChannels : 1; +} + +- (int)linesize:(int)numberOfSamples +{ + int linesize = av_get_bytes_per_sample(self->_format) * numberOfSamples; + linesize *= av_sample_fmt_is_planar(self->_format) ? 1 : self->_numberOfChannels; + return linesize; +} + +- (BOOL)isEqualToDescriptor:(SGAudioDescriptor *)descriptor +{ + if (!descriptor) { + return NO; + } + return + self->_format == descriptor->_format && + self->_sampleRate == descriptor->_sampleRate && + self->_numberOfChannels == descriptor->_numberOfChannels && + self->_channelLayout == descriptor->_channelLayout; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.h b/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.h new file mode 100644 index 00000000..255367c6 --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.h @@ -0,0 +1,86 @@ +// +// SGCodecDescriptor.h +// SGPlayer +// +// Created by Single on 2018/11/15. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGTimeLayout.h" +#import "SGFFmpeg.h" +#import "SGTrack.h" + +typedef NS_ENUM(NSUInteger, SGCodecType) { + SGCodecTypeDecode = 0, + SGCodecTypePadding = 1, +}; + +@interface SGCodecDescriptor : NSObject + +/** + * + */ +@property (nonatomic) SGCodecType type; + +/** + * + */ +@property (nonatomic) AVRational timebase; + +/** + * + */ +@property (nonatomic) AVCodecParameters *codecpar; + +/** + * + */ +@property (nonatomic, strong) SGTrack *track; + +/** + * + */ +@property (nonatomic, strong) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTimeRange timeRange; + +/** + * + */ +@property (nonatomic, readonly) CMTime scale; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *timeLayouts; + +/** + * + */ +- (void)appendTimeRange:(CMTimeRange)timeRange; + +/** + * + */ +- (void)appendTimeLayout:(SGTimeLayout *)timeLayout; + +/** + * + */ +- (void)fillToDescriptor:(SGCodecDescriptor *)descriptor; + +/** + * + */ +- (BOOL)isEqualToDescriptor:(SGCodecDescriptor *)descriptor; + +/** + * + */ +- (BOOL)isEqualCodecContextToDescriptor:(SGCodecDescriptor *)descriptor; + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.m b/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.m new file mode 100644 index 00000000..8a70b37b --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGCodecDescriptor.m @@ -0,0 +1,103 @@ +// +// SGCodecDescriptor.m +// SGPlayer +// +// Created by Single on 2018/11/15. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGCodecDescriptor.h" + +@implementation SGCodecDescriptor + +- (id)copyWithZone:(NSZone *)zone +{ + SGCodecDescriptor *obj = [[SGCodecDescriptor alloc] init]; + [self fillToDescriptor:obj]; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_type = SGCodecTypeDecode; + self->_scale = CMTimeMake(1, 1); + self->_timebase = AV_TIME_BASE_Q; + self->_timeRange = CMTimeRangeMake(kCMTimeNegativeInfinity, kCMTimePositiveInfinity); + } + return self; +} + +- (void)appendTimeLayout:(SGTimeLayout *)timeLayout +{ + NSMutableArray *timeLayouts = [NSMutableArray arrayWithArray:self->_timeLayouts]; + [timeLayouts addObject:timeLayout]; + CMTime scale = CMTimeMake(1, 1); + for (SGTimeLayout *obj in timeLayouts) { + scale = SGCMTimeMultiply(scale, obj.scale); + } + self->_scale = scale; + self->_timeLayouts = timeLayouts; + self->_timeRange = CMTimeRangeMake([timeLayout convertTimeStamp:self->_timeRange.start], + [timeLayout convertDuration:self->_timeRange.duration]); +} + +- (void)appendTimeRange:(CMTimeRange)timeRange +{ + for (SGTimeLayout *obj in self->_timeLayouts) { + timeRange = CMTimeRangeMake([obj convertTimeStamp:timeRange.start], + [obj convertDuration:timeRange.duration]); + } + self->_timeRange = SGCMTimeRangeGetIntersection(self->_timeRange, timeRange); +} + +- (void)fillToDescriptor:(SGCodecDescriptor *)descriptor +{ + descriptor->_track = self->_track; + descriptor->_scale = self->_scale; + descriptor->_metadata = self->_metadata; + descriptor->_timebase = self->_timebase; + descriptor->_codecpar = self->_codecpar; + descriptor->_timeRange = self->_timeRange; + descriptor->_timeLayouts = [self->_timeLayouts copy]; +} + +- (BOOL)isEqualToDescriptor:(SGCodecDescriptor *)descriptor +{ + if (![self isEqualCodecContextToDescriptor:descriptor]) { + return NO; + } + if (!CMTimeRangeEqual(descriptor->_timeRange, self->_timeRange)) { + return NO; + } + if (descriptor->_timeLayouts.count != self->_timeLayouts.count) { + return NO; + } + for (int i = 0; i < descriptor->_timeLayouts.count; i++) { + SGTimeLayout *t1 = [descriptor->_timeLayouts objectAtIndex:i]; + SGTimeLayout *t2 = [self->_timeLayouts objectAtIndex:i]; + if (![t1 isEqualToTimeLayout:t2]) { + return NO; + } + } + return YES; +} + +- (BOOL)isEqualCodecContextToDescriptor:(SGCodecDescriptor *)descriptor +{ + if (!descriptor) { + return NO; + } + if (descriptor.track != self->_track) { + return NO; + } + if (descriptor->_codecpar != self->_codecpar) { + return NO; + } + if (av_cmp_q(descriptor->_timebase, self->_timebase) != 0) { + return NO; + } + return YES; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGDescriptor+Internal.h b/SGPlayer/Classes/Core/SGDescription/SGDescriptor+Internal.h new file mode 100644 index 00000000..f45b451c --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGDescriptor+Internal.h @@ -0,0 +1,24 @@ +// +// SGPacket+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/10/23. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGPacket.h" +#import "SGFFmpeg.h" +#import "SGAudioDescriptor.h" +#import "SGVideoDescriptor.h" + +@interface SGAudioDescriptor () + +- (instancetype)initWithFrame:(AVFrame *)frame; + +@end + +@interface SGVideoDescriptor () + +- (instancetype)initWithFrame:(AVFrame *)frame; + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.h b/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.h new file mode 100644 index 00000000..a01849ca --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.h @@ -0,0 +1,43 @@ +// +// SGVideoDescriptor.h +// SGPlayer +// +// Created by Single on 2018/12/11. +// Copyright © 2018 single. All rights reserved. +// + +#import + +@interface SGVideoDescriptor : NSObject + +/** + * AVPixelFormat + */ +@property (nonatomic) int format; + +/** + * kCVPixelFormatType_XXX + */ +@property (nonatomic) OSType cv_format; + +/** + * + */ +@property (nonatomic) int width; + +/** + * + */ +@property (nonatomic) int height; + +/** + * AVColorSpace + */ +@property (nonatomic) int colorspace; + +/** + * + */ +- (BOOL)isEqualToDescriptor:(SGVideoDescriptor *)descriptor; + +@end diff --git a/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.m b/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.m new file mode 100644 index 00000000..9a1793df --- /dev/null +++ b/SGPlayer/Classes/Core/SGDescription/SGVideoDescriptor.m @@ -0,0 +1,63 @@ +// +// SGVideoDescriptor.m +// SGPlayer +// +// Created by Single on 2018/12/11. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGVideoDescriptor.h" +#import "SGMapping.h" +#import "SGFFmpeg.h" + +@implementation SGVideoDescriptor + +- (id)copyWithZone:(NSZone *)zone +{ + SGVideoDescriptor *obj = [[SGVideoDescriptor alloc] init]; + obj->_format = self->_format; + obj->_cv_format = self->_cv_format; + obj->_width = self->_width; + obj->_height = self->_height; + obj->_colorspace = self->_colorspace; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_format = AV_PIX_FMT_NONE; + self->_cv_format = SGPixelFormatFF2AV(self->_format); + self->_width = 0; + self->_height = 0; + self->_colorspace = AVCOL_SPC_RGB; + } + return self; +} + +- (instancetype)initWithFrame:(AVFrame *)frame +{ + if (self = [super init]) { + self->_format = frame->format; + self->_cv_format = SGPixelFormatFF2AV(self->_format); + self->_width = frame->width; + self->_height = frame->height; + self->_colorspace = frame->colorspace; + } + return self; +} + +- (BOOL)isEqualToDescriptor:(SGVideoDescriptor *)descriptor +{ + if (!descriptor) { + return NO; + } + return + self->_format == descriptor->_format && + self->_cv_format == descriptor->_cv_format && + self->_width == descriptor->_width && + self->_height == descriptor->_height && + self->_colorspace == descriptor->_colorspace; +} + +@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.h b/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.h deleted file mode 100644 index 8fe267e5..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// SGDisplayView.h -// SGPlayer -// -// Created by Single on 12/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGPlayerBuildConfig.h" -#import "SGPlayerImp.h" -#import "SGAVPlayer.h" -#import "SGFFPlayer.h" - -@class SGFingerRotation; -@class SGGLFrame; - -typedef NS_ENUM(NSUInteger, SGDisplayRendererType) { - SGDisplayRendererTypeEmpty, - SGDisplayRendererTypeAVPlayerLayer, - SGDisplayRendererTypeOpenGL, -}; - -typedef NS_ENUM(NSUInteger, SGDisplayPlayerOutputType) { - SGDisplayPlayerOutputTypeEmpty, - SGDisplayPlayerOutputTypeFF, - SGDisplayPlayerOutputTypeAV, -}; - -@interface SGDisplayView : SGPLFView - - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; - -+ (instancetype)displayViewWithAbstractPlayer:(SGPlayer *)abstractPlayer; - - -@property (nonatomic, weak, readonly) SGPlayer * abstractPlayer; -@property (nonatomic, strong, readonly) SGFingerRotation * fingerRotation; - - -// player output type -@property (nonatomic, assign, readonly) SGDisplayPlayerOutputType playerOutputType; -@property (nonatomic, weak) id playerOutputAV; -- (void)playerOutputTypeAV; -- (void)playerOutputTypeEmpty; - -#if SGPlayerBuildConfig_FFmpeg_Enable -@property (nonatomic, weak) id playerOutputFF; -- (void)playerOutputTypeFF; -#endif - - -// renderer type -@property (nonatomic, assign, readonly) SGDisplayRendererType rendererType; -- (void)rendererTypeEmpty; -- (void)rendererTypeAVPlayerLayer; -- (void)rendererTypeOpenGL; - - -// reload -- (void)reloadGravityMode; -- (void)reloadPlayerConfig; -- (void)reloadVideoFrameForGLFrame:(SGGLFrame *)glFrame; - -- (SGPLFImage *)snapshot; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.m b/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.m deleted file mode 100644 index 346f7bbe..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGDisplayView.m +++ /dev/null @@ -1,338 +0,0 @@ -// -// SGDisplayView.m -// SGPlayer -// -// Created by Single on 12/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGDisplayView.h" -#import "SGPlayerMacro.h" -#import "SGGLViewController.h" -#import "SGGLFrame.h" -#import "SGFingerRotation.h" - -@interface SGDisplayView () - -@property (nonatomic, weak) SGPlayer * abstractPlayer; - -@property (nonatomic, assign) BOOL avplayerLayerToken; -@property (nonatomic, strong) AVPlayerLayer * avplayerLayer; -@property (nonatomic, strong) SGGLViewController * glViewController; - -@end - -@implementation SGDisplayView - -+ (instancetype)displayViewWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - return [[self alloc] initWithAbstractPlayer:abstractPlayer]; -} - -- (instancetype)initWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - if (self = [super initWithFrame:CGRectZero]) { - self.abstractPlayer = abstractPlayer; - self->_fingerRotation = [SGFingerRotation fingerRotation]; - SGPLFViewSetBackgroundColor(self, [SGPLFColor blackColor]); - [self setupEventHandler]; - } - return self; -} - -- (void)playerOutputTypeEmpty -{ - self->_playerOutputType = SGDisplayPlayerOutputTypeEmpty; -} - -- (void)playerOutputTypeFF -{ - self->_playerOutputType = SGDisplayPlayerOutputTypeFF; -} - -- (void)playerOutputTypeAV -{ - self->_playerOutputType = SGDisplayPlayerOutputTypeAV; -} - -- (void)rendererTypeEmpty -{ - if (self.rendererType != SGDisplayRendererTypeEmpty) { - self->_rendererType = SGDisplayRendererTypeEmpty; - [self reloadView]; - } -} - -- (void)rendererTypeAVPlayerLayer -{ - if (self.rendererType != SGDisplayRendererTypeAVPlayerLayer) { - self->_rendererType = SGDisplayRendererTypeAVPlayerLayer; - [self reloadView]; - } -} - -- (void)rendererTypeOpenGL -{ - if (self.rendererType != SGDisplayRendererTypeOpenGL) { - self->_rendererType = SGDisplayRendererTypeOpenGL; - [self reloadView]; - } -} - -- (void)reloadView -{ - [self cleanView]; - switch (self.rendererType) { - case SGDisplayRendererTypeEmpty: - break; - case SGDisplayRendererTypeAVPlayerLayer: - { - self.avplayerLayer = [AVPlayerLayer playerLayerWithPlayer:nil]; - [self reloadPlayerConfig]; - self.avplayerLayerToken = NO; - [self.layer insertSublayer:self.avplayerLayer atIndex:0]; - [self reloadGravityMode]; - } - break; - case SGDisplayRendererTypeOpenGL: - { - self.glViewController = [SGGLViewController viewControllerWithDisplayView:self]; - dispatch_async(dispatch_get_main_queue(), ^{ - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self.glViewController); - SGPLFViewInsertSubview(self, glView, 0); - }); - } - break; - } - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateDisplayViewLayout:self.bounds]; - }); -} - -- (void)reloadGravityMode -{ - if (self.avplayerLayer) { - switch (self.abstractPlayer.viewGravityMode) { - case SGGravityModeResize: - self.avplayerLayer.videoGravity = AVLayerVideoGravityResize; - break; - case SGGravityModeResizeAspect: - self.avplayerLayer.videoGravity = AVLayerVideoGravityResizeAspect; - break; - case SGGravityModeResizeAspectFill: - self.avplayerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; - break; - } - } -} - -- (void)reloadPlayerConfig -{ - if (self.avplayerLayer && self.playerOutputType == SGDisplayPlayerOutputTypeAV) { -#if SGPLATFORM_TARGET_OS_MAC - self.avplayerLayer.player = [self.playerOutputAV playerOutputGetAVPlayer]; -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - if ([self.playerOutputAV playerOutputGetAVPlayer] && [UIApplication sharedApplication].applicationState != UIApplicationStateBackground) { - self.avplayerLayer.player = [self.playerOutputAV playerOutputGetAVPlayer]; - } else { - self.avplayerLayer.player = nil; - } -#endif - } -} - -- (void)reloadVideoFrameForGLFrame:(SGGLFrame *)glFrame -{ - switch (self.playerOutputType) { - case SGDisplayPlayerOutputTypeEmpty: - break; - case SGDisplayPlayerOutputTypeAV: - { - CVPixelBufferRef pixelBuffer = [self.playerOutputAV playerOutputGetPixelBufferAtCurrentTime]; - if (pixelBuffer) { - [glFrame updateWithCVPixelBuffer:pixelBuffer]; - } - } - break; - case SGDisplayPlayerOutputTypeFF: - { -#if SGPlayerBuildConfig_FFmpeg_Enable - SGFFVideoFrame * videoFrame = [self.playerOutputFF playerOutputGetVideoFrameWithCurrentPostion:glFrame.currentPosition - currentDuration:glFrame.currentDuration]; - if (videoFrame) { - [glFrame updateWithSGFFVideoFrame:videoFrame]; - glFrame.rotateType = videoFrame.rotateType; - } -#endif - } - break; - } -} - -- (SGPLFImage *)snapshot -{ - switch (self.rendererType) { - case SGDisplayRendererTypeEmpty: - return nil; - case SGDisplayRendererTypeAVPlayerLayer: - return [self.playerOutputAV playerOutputGetSnapshotAtCurrentTime]; - case SGDisplayRendererTypeOpenGL: - return [self.glViewController snapshot]; - } -} - -- (void)cleanView -{ - if (self.avplayerLayer) { - [self.avplayerLayer removeFromSuperlayer]; - self.avplayerLayer.player = nil; - self.avplayerLayer = nil; - } - if (self.glViewController) { - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self.glViewController); - [glView removeFromSuperview]; - self.glViewController = nil; - } - self.avplayerLayerToken = NO; - [self.fingerRotation clean]; -} - -- (void)updateDisplayViewLayout:(CGRect)frame -{ - if (self.avplayerLayer) { - self.avplayerLayer.frame = frame; - if (self.abstractPlayer.viewAnimationHidden || !self.avplayerLayerToken) { - [self.avplayerLayer removeAllAnimations]; - self.avplayerLayerToken = YES; - } - } - if (self.glViewController) { - [self.glViewController reloadViewport]; - } -} - -#pragma mark - Event Handler - -- (void)setupEventHandler -{ -#if SGPLATFORM_TARGET_OS_MAC - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(macOS_updateFrameAction:) name:NSViewFrameDidChangeNotification object:self]; - -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(iOS_applicationDidEnterBackgroundAction:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(iOS_applicationWillEnterForegroundAction:) name:UIApplicationWillEnterForegroundNotification object:nil]; - - UITapGestureRecognizer * tapGestureRecigbuzer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(iOS_tapGestureRecigbuzerAction:)]; - [self addGestureRecognizer:tapGestureRecigbuzer]; - -#endif -} - -#if SGPLATFORM_TARGET_OS_MAC - -static BOOL mouse_dragged = NO; - -- (void)mouseDragged:(NSEvent *)event -{ - mouse_dragged = YES; - switch (self.rendererType) { - case SGDisplayRendererTypeEmpty: - case SGDisplayRendererTypeAVPlayerLayer: - return; - default: - { - float m = 0.005; - if (self.bounds.size.width > 700) { - m = 0.003; - } - float distanceX = event.deltaX; - float distanceY = event.deltaY; - distanceX *= m; - distanceY *= m; - self.fingerRotation.x += distanceY * [SGFingerRotation degress] / 100; - self.fingerRotation.y -= distanceX * [SGFingerRotation degress] / 100; - } - break; - } -} - -- (void)mouseUp:(NSEvent *)event -{ - if (!mouse_dragged && self.abstractPlayer.viewTapAction) { - self.abstractPlayer.viewTapAction(self.abstractPlayer, self.abstractPlayer.view); - } - mouse_dragged = NO; -} - -- (void)mouseDown:(NSEvent *)event -{ - mouse_dragged = NO; -} - -- (void)macOS_updateFrameAction:(NSNotification *)notification -{ - [self updateDisplayViewLayout:self.bounds]; -} - -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - -- (void)iOS_applicationDidEnterBackgroundAction:(NSNotification *)notification -{ - if (_avplayerLayer) { - _avplayerLayer.player = nil; - } -} - -- (void)iOS_applicationWillEnterForegroundAction:(NSNotification *)notification -{ - if (_avplayerLayer) { - _avplayerLayer.player = [self.playerOutputAV playerOutputGetAVPlayer]; - } -} - -- (void)iOS_tapGestureRecigbuzerAction:(UITapGestureRecognizer *)tapGestureRecognizer -{ - if (self.abstractPlayer.viewTapAction) { - self.abstractPlayer.viewTapAction(self.abstractPlayer, self.abstractPlayer.view); - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (self.abstractPlayer.displayMode == SGDisplayModeBox) return; - switch (self.rendererType) { - case SGDisplayRendererTypeEmpty: - case SGDisplayRendererTypeAVPlayerLayer: - return; - default: - { - UITouch * touch = [touches anyObject]; - float distanceX = [touch locationInView:touch.view].x - [touch previousLocationInView:touch.view].x; - float distanceY = [touch locationInView:touch.view].y - [touch previousLocationInView:touch.view].y; - distanceX *= 0.005; - distanceY *= 0.005; - self.fingerRotation.x += distanceY * [SGFingerRotation degress] / 100; - self.fingerRotation.y -= distanceX * [SGFingerRotation degress] / 100; - } - break; - } -} - -- (void)layoutSublayersOfLayer:(CALayer *)layer -{ - [super layoutSublayersOfLayer:layer]; - [self updateDisplayViewLayout:layer.bounds]; -} - -#endif - --(void)dealloc -{ - [self cleanView]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - SGPlayerLog(@"SGDisplayView release"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.h b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.h deleted file mode 100644 index 4dbaa547..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// SGGLModel.h -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, SGGLModelTextureRotateType) { - SGGLModelTextureRotateType0, - SGGLModelTextureRotateType90, - SGGLModelTextureRotateType180, - SGGLModelTextureRotateType270, -}; - -@interface SGGLModel : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)model; - -@property (nonatomic, assign) GLuint index_id; -@property (nonatomic, assign) GLuint vertex_id; -@property (nonatomic, assign) GLuint texture_id; - -@property (nonatomic, assign) int index_count; -@property (nonatomic, assign) int vertex_count; - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation; - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation - textureRotateType:(SGGLModelTextureRotateType)textureRotateType; - -#pragma mark - subclass override - -- (void)setupModel; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.m b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.m deleted file mode 100644 index e4a27894..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLModel.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// SGGLModel.m -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLModel.h" -#import "SGPlayerMacro.h" - -@implementation SGGLModel - -+ (instancetype)model -{ - return [[self alloc] init]; -} - -- (instancetype)init -{ - if (self = [super init]) { - [self setupModel]; - } - return self; -} - -- (void)dealloc -{ - SGPlayerLog(@"%@ release", self.class); -} - -#pragma mark - subclass override - -- (void)setupModel {} -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation {} -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation - textureRotateType:(SGGLModelTextureRotateType)textureRotateType {} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.h b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.h deleted file mode 100644 index 7ecdbda5..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGGLNormalModel.h -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLModel.h" - -@interface SGGLNormalModel : SGGLModel - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.m b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.m deleted file mode 100644 index 9fa77bfc..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLNormalModel.m +++ /dev/null @@ -1,121 +0,0 @@ -// -// SGGLNormalModel.m -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLNormalModel.h" - -static GLKVector3 vertex_buffer_data[] = { - {-1, 1, 0.0}, - {1, 1, 0.0}, - {1, -1, 0.0}, - {-1, -1, 0.0}, -}; - -static GLushort index_buffer_data[] = { - 0, 1, 2, 0, 2, 3 -}; - -static GLKVector2 texture_buffer_data_r0[] = { - {0.0, 0.0}, - {1.0, 0.0}, - {1.0, 1.0}, - {0.0, 1.0}, -}; - -static GLKVector2 texture_buffer_data_r90[] = { - {0.0, 1.0}, - {0.0, 0.0}, - {1.0, 0.0}, - {1.0, 1.0}, -}; - -static GLKVector2 texture_buffer_data_r180[] = { - {1.0, 1.0}, - {0.0, 1.0}, - {0.0, 0.0}, - {1.0, 0.0}, -}; - -static GLKVector2 texture_buffer_data_r270[] = { - {1.0, 0.0}, - {1.0, 1.0}, - {0.0, 1.0}, - {0.0, 0.0}, -}; - -static GLuint vertex_buffer_id = 0; -static GLuint index_buffer_id = 0; -static GLuint texture_buffer_id = 0; - -static int const index_count = 6; -static int const vertex_count = 4; - -@implementation SGGLNormalModel - -void setup_normal() -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - glGenBuffers(1, &index_buffer_id); - glGenBuffers(1, &vertex_buffer_id); - glGenBuffers(1, &texture_buffer_id); - }); -} - -- (void)setupModel -{ - setup_normal(); - self.index_count = index_count; - self.vertex_count = vertex_count; - self.index_id = index_buffer_id; - self.vertex_id = vertex_buffer_id; - self.texture_id = texture_buffer_id; -} - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation -{ - [self bindPositionLocation:position_location - textureCoordLocation:textureCoordLocation - textureRotateType:SGGLModelTextureRotateType0]; -} - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation - textureRotateType:(SGGLModelTextureRotateType)textureRotateType -{ - // index - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.index_id); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, self.index_count * sizeof(GLushort), index_buffer_data, GL_STATIC_DRAW); - - // vertex - glBindBuffer(GL_ARRAY_BUFFER, self.vertex_id); - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 3 * sizeof(GLfloat), vertex_buffer_data, GL_STATIC_DRAW); - glEnableVertexAttribArray(position_location); - glVertexAttribPointer(position_location, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), NULL); - - // texture coord - glBindBuffer(GL_ARRAY_BUFFER, self.texture_id); - switch (textureRotateType) { - case SGGLModelTextureRotateType0: - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 2 * sizeof(GLfloat), texture_buffer_data_r0, GL_DYNAMIC_DRAW); - break; - case SGGLModelTextureRotateType90: - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 2 * sizeof(GLfloat), texture_buffer_data_r90, GL_DYNAMIC_DRAW); - break; - case SGGLModelTextureRotateType180: - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 2 * sizeof(GLfloat), texture_buffer_data_r180, GL_DYNAMIC_DRAW); - break; - case SGGLModelTextureRotateType270: - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 2 * sizeof(GLfloat), texture_buffer_data_r270, GL_DYNAMIC_DRAW); - break; - } - glEnableVertexAttribArray(textureCoordLocation); - glVertexAttribPointer(textureCoordLocation, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, NULL); -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.h b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.h deleted file mode 100644 index 67fa600b..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGGLVRModel.h -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLModel.h" - -@interface SGGLVRModel : SGGLModel - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.m b/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.m deleted file mode 100644 index c7b9b49e..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLModel/SGGLVRModel.m +++ /dev/null @@ -1,120 +0,0 @@ -// -// SGGLVRModel.m -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLVRModel.h" - -@implementation SGGLVRModel - -static GLuint vertex_buffer_id = 0; -static GLuint index_buffer_id = 0; -static GLuint texture_buffer_id = 0; - -static GLfloat * vertex_buffer_data = NULL; -static GLushort * index_buffer_data = NULL; -static GLfloat * texture_buffer_data = NULL; - -static int const slices_count = 200; -static int const parallels_count = slices_count / 2; - -static int const index_count = slices_count * parallels_count * 6; -static int const vertex_count = (slices_count + 1) * (parallels_count + 1); - -void setup_vr() -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - - float const step = (2.0f * M_PI) / (float)slices_count; - float const radius = 1.0f; - - // model - index_buffer_data = malloc(sizeof(GLushort) * index_count); - vertex_buffer_data = malloc(sizeof(GLfloat) * 3 * vertex_count); - texture_buffer_data = malloc(sizeof(GLfloat) * 2 * vertex_count); - - int runCount = 0; - for (int i = 0; i < parallels_count + 1; i++) - { - for (int j = 0; j < slices_count + 1; j++) - { - int vertex = (i * (slices_count + 1) + j) * 3; - - if (vertex_buffer_data) - { - vertex_buffer_data[vertex + 0] = radius * sinf(step * (float)i) * cosf(step * (float)j); - vertex_buffer_data[vertex + 1] = radius * cosf(step * (float)i); - vertex_buffer_data[vertex + 2] = radius * sinf(step * (float)i) * sinf(step * (float)j); - } - - if (texture_buffer_data) - { - int textureIndex = (i * (slices_count + 1) + j) * 2; - texture_buffer_data[textureIndex + 0] = (float)j / (float)slices_count; - texture_buffer_data[textureIndex + 1] = ((float)i / (float)parallels_count); - } - - if (index_buffer_data && i < parallels_count && j < slices_count) - { - index_buffer_data[runCount++] = i * (slices_count + 1) + j; - index_buffer_data[runCount++] = (i + 1) * (slices_count + 1) + j; - index_buffer_data[runCount++] = (i + 1) * (slices_count + 1) + (j + 1); - - index_buffer_data[runCount++] = i * (slices_count + 1) + j; - index_buffer_data[runCount++] = (i + 1) * (slices_count + 1) + (j + 1); - index_buffer_data[runCount++] = i * (slices_count + 1) + (j + 1); - } - } - } - - glGenBuffers(1, &index_buffer_id); - glGenBuffers(1, &vertex_buffer_id); - glGenBuffers(1, &texture_buffer_id); - }); -} - -- (void)setupModel -{ - setup_vr(); - self.index_count = index_count; - self.vertex_count = vertex_count; - self.index_id = index_buffer_id; - self.vertex_id = vertex_buffer_id; - self.texture_id = texture_buffer_id; -} - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation -{ - [self bindPositionLocation:position_location - textureCoordLocation:textureCoordLocation - textureRotateType:SGGLModelTextureRotateType0]; -} - -- (void)bindPositionLocation:(GLint)position_location - textureCoordLocation:(GLint)textureCoordLocation - textureRotateType:(SGGLModelTextureRotateType)textureRotateType -{ - // index - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.index_id); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, self.index_count * sizeof(GLushort), index_buffer_data, GL_STATIC_DRAW); - - // vertex - glBindBuffer(GL_ARRAY_BUFFER, self.vertex_id); - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 3 * sizeof(GLfloat), vertex_buffer_data, GL_STATIC_DRAW); - glEnableVertexAttribArray(position_location); - glVertexAttribPointer(position_location, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), NULL); - - // texture coord - glBindBuffer(GL_ARRAY_BUFFER, self.texture_id); - glBufferData(GL_ARRAY_BUFFER, self.vertex_count * 2 * sizeof(GLfloat), texture_buffer_data, GL_DYNAMIC_DRAW); - glEnableVertexAttribArray(textureCoordLocation); - glVertexAttribPointer(textureCoordLocation, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*2, NULL); -} - - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.h b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.h deleted file mode 100644 index 98cadfbd..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// SGGLProgram.h -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -@interface SGGLProgram : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)programWithVertexShader:(NSString *)vertexShader fragmentShader:(NSString *)fragmentShader; - -@property (nonatomic, assign) GLint program_id; - -@property (nonatomic, assign) GLint position_location; -@property (nonatomic, assign) GLint texture_coord_location; -@property (nonatomic, assign) GLint matrix_location; - -- (void)use; -- (void)updateMatrix:(GLKMatrix4)matrix; - -#pragma mark - subclass override - -- (void)setupVariable; -- (void)bindVariable; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.m b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.m deleted file mode 100644 index 0197a002..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgram.m +++ /dev/null @@ -1,155 +0,0 @@ -// -// SGGLProgram.m -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGGLProgram.h" -#import "SGPlayerMacro.h" - -@interface SGGLProgram () - -{ - GLuint _vertexShader_id; - GLuint _fragmentShader_id; -} - -@property (nonatomic, copy) NSString * vertexShaderString; -@property (nonatomic, copy) NSString * fragmentShaderString; - -@end - -@implementation SGGLProgram - -+ (instancetype)programWithVertexShader:(NSString *)vertexShader fragmentShader:(NSString *)fragmentShader -{ - return [[self alloc] initWithVertexShader:vertexShader fragmentShader:fragmentShader]; -} - -- (instancetype)initWithVertexShader:(NSString *)vertexShader fragmentShader:(NSString *)fragmentShader -{ - if (self = [super init]) { - self.vertexShaderString = vertexShader; - self.fragmentShaderString = fragmentShader; - [self setup]; - [self use]; - [self bindVariable]; - } - return self; -} - -- (void)use -{ - glUseProgram(_program_id); -} - -- (void)updateMatrix:(GLKMatrix4)matrix -{ - glUniformMatrix4fv(self.matrix_location, 1, GL_FALSE, matrix.m); -} - -- (void)setup -{ - [self setupProgram]; - [self setupShader]; - [self linkProgram]; - [self setupVariable]; -} - -- (void)setupProgram -{ - _program_id = glCreateProgram(); -} - -- (void)setupShader -{ - // setup shader - if (![self compileShader:&_vertexShader_id type:GL_VERTEX_SHADER string:self.vertexShaderString.UTF8String]) - { - SGPlayerLog(@"load vertex shader failure"); - } - if (![self compileShader:&_fragmentShader_id type:GL_FRAGMENT_SHADER string:self.fragmentShaderString.UTF8String]) - { - SGPlayerLog(@"load fragment shader failure"); - } - glAttachShader(_program_id, _vertexShader_id); - glAttachShader(_program_id, _fragmentShader_id); -} - -- (BOOL)linkProgram -{ - GLint status; - glLinkProgram(_program_id); - - glGetProgramiv(_program_id, GL_LINK_STATUS, &status); - if (status == GL_FALSE) - return NO; - - [self clearShader]; - - return YES; -} - -- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type string:(const char *)shaderString -{ - if (!shaderString) - { - SGPlayerLog(@"Failed to load shader"); - return NO; - } - - GLint status; - - * shader = glCreateShader(type); - glShaderSource(* shader, 1, &shaderString, NULL); - glCompileShader(* shader); - glGetShaderiv(* shader, GL_COMPILE_STATUS, &status); - if (status != GL_TRUE) - { - GLint logLength; - glGetShaderiv(* shader, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { - GLchar * log = (GLchar *)malloc(logLength); - glGetShaderInfoLog(* shader, logLength, &logLength, log); - SGPlayerLog(@"Shader compile log:\n%s", log); - free(log); - } - } - - return status == GL_TRUE; -} - -- (void)clearShader -{ - if (_vertexShader_id) { - glDeleteShader(_vertexShader_id); - } - - if (_fragmentShader_id) { - glDeleteShader(_fragmentShader_id); - } -} - -- (void)clearProgram -{ - if (_program_id) { - glDeleteProgram(_program_id); - _program_id = 0; - } -} - -- (void)dealloc -{ - [self clearShader]; - [self clearProgram]; - SGPlayerLog(@"%@ release", self.class); -} - -#pragma mark - subclass override - -- (void)bindVariable {} -- (void)setupVariable {} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.h b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.h deleted file mode 100644 index 7901e4bc..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// SGGLProgramNV12.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLProgram.h" - -@interface SGGLProgramNV12 : SGGLProgram - -+ (instancetype)program; - -@property (nonatomic, assign) GLint samplerY_location; -@property (nonatomic, assign) GLint samplerUV_location; -@property (nonatomic, assign) GLint colorConversionMatrix_location; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.m b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.m deleted file mode 100644 index 2379b785..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramNV12.m +++ /dev/null @@ -1,107 +0,0 @@ -// -// SGGLProgramNV12.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLProgramNV12.h" - -#define SG_GLES_STRINGIZE(x) #x - -static const char vertexShaderString[] = SG_GLES_STRINGIZE -( - attribute vec4 position; - attribute vec2 textureCoord; - uniform mat4 mpv_matrix; - varying vec2 v_textureCoord; - - void main() - { - v_textureCoord = textureCoord; - gl_Position = mpv_matrix * position; - } - ); - -#if SGPLATFORM_TARGET_OS_MAC -static const char fragmentShaderString[] = SG_GLES_STRINGIZE -( - uniform sampler2D SamplerY; - uniform sampler2D SamplerUV; - uniform mat3 colorConversionMatrix; - varying vec2 v_textureCoord; - - void main() - { - vec3 yuv; - - yuv.x = texture2D(SamplerY, v_textureCoord).r - (16.0/255.0); - yuv.yz = texture2D(SamplerUV, v_textureCoord).ra - vec2(0.5, 0.5); - - vec3 rgb = colorConversionMatrix * yuv; - - gl_FragColor = vec4(rgb, 1.0); - } - ); -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV -static const char fragmentShaderString[] = SG_GLES_STRINGIZE -( - precision mediump float; - - uniform sampler2D SamplerY; - uniform sampler2D SamplerUV; - uniform mat3 colorConversionMatrix; - varying mediump vec2 v_textureCoord; - - void main() - { - mediump vec3 yuv; - - yuv.x = texture2D(SamplerY, v_textureCoord).r - (16.0/255.0); - yuv.yz = texture2D(SamplerUV, v_textureCoord).rg - vec2(0.5, 0.5); - - lowp vec3 rgb = colorConversionMatrix * yuv; - - gl_FragColor = vec4(rgb, 1); - } - ); -#endif - -@implementation SGGLProgramNV12 - -+ (instancetype)program -{ - return [self programWithVertexShader:[NSString stringWithUTF8String:vertexShaderString] - fragmentShader:[NSString stringWithUTF8String:fragmentShaderString]]; -} - -- (void)bindVariable -{ - glEnableVertexAttribArray(self.position_location); - glEnableVertexAttribArray(self.texture_coord_location); - - static GLfloat colorConversion709[] = { - 1.164, 1.164, 1.164, - 0.0, -0.213, 2.112, - 1.793, -0.533, 0.0, - }; - glUniformMatrix3fv(self.colorConversionMatrix_location, 1, GL_FALSE, colorConversion709); - - glUniform1i(self.samplerY_location, 0); - glUniform1i(self.samplerUV_location, 1); -} - -- (void)setupVariable -{ - self.position_location = glGetAttribLocation(self.program_id, "position"); - self.texture_coord_location = glGetAttribLocation(self.program_id, "textureCoord"); - self.matrix_location = glGetUniformLocation(self.program_id, "mpv_matrix"); - - self.samplerY_location = glGetUniformLocation(self.program_id, "SamplerY"); - self.samplerUV_location = glGetUniformLocation(self.program_id, "SamplerUV"); - self.colorConversionMatrix_location = glGetUniformLocation(self.program_id, "colorConversionMatrix"); -} - -@end - diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.h b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.h deleted file mode 100644 index 314b5e2f..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// SGGLProgramYUV420.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLProgram.h" - -@interface SGGLProgramYUV420 : SGGLProgram - -+ (instancetype)program; - -@property (nonatomic, assign) GLint samplerY_location; -@property (nonatomic, assign) GLint samplerU_location; -@property (nonatomic, assign) GLint samplerV_location; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.m b/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.m deleted file mode 100644 index 068b4793..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLProgram/SGGLProgramYUV420.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// SGGLProgramYUV420.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLProgramYUV420.h" - -#define SG_GLES_STRINGIZE(x) #x - -static const char vertexShaderString[] = SG_GLES_STRINGIZE -( - attribute vec4 position; - attribute vec2 textureCoord; - uniform mat4 mvp_matrix; - varying vec2 v_textureCoord; - - void main() - { - v_textureCoord = textureCoord; - gl_Position = mvp_matrix * position; - } - ); - -#if SGPLATFORM_TARGET_OS_MAC -static const char fragmentShaderString[] = SG_GLES_STRINGIZE -( - uniform sampler2D SamplerY; - uniform sampler2D SamplerU; - uniform sampler2D SamplerV; - varying vec2 v_textureCoord; - - void main() - { - float y = texture2D(SamplerY, v_textureCoord).r; - float u = texture2D(SamplerU, v_textureCoord).r - 0.5; - float v = texture2D(SamplerV, v_textureCoord).r - 0.5; - - float r = y + 1.402 * v; - float g = y - 0.344 * u - 0.714 * v; - float b = y + 1.772 * u; - - gl_FragColor = vec4(r , g, b, 1.0); - } - ); -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV -static const char fragmentShaderString[] = SG_GLES_STRINGIZE -( - uniform sampler2D SamplerY; - uniform sampler2D SamplerU; - uniform sampler2D SamplerV; - varying mediump vec2 v_textureCoord; - - void main() - { - highp float y = texture2D(SamplerY, v_textureCoord).r; - highp float u = texture2D(SamplerU, v_textureCoord).r - 0.5; - highp float v = texture2D(SamplerV, v_textureCoord).r - 0.5; - - highp float r = y + 1.402 * v; - highp float g = y - 0.344 * u - 0.714 * v; - highp float b = y + 1.772 * u; - - gl_FragColor = vec4(r , g, b, 1.0); - } - ); -#endif - -@implementation SGGLProgramYUV420 - -+ (instancetype)program -{ - return [self programWithVertexShader:[NSString stringWithUTF8String:vertexShaderString] - fragmentShader:[NSString stringWithUTF8String:fragmentShaderString]]; -} - -- (void)bindVariable -{ - glEnableVertexAttribArray(self.position_location); - glEnableVertexAttribArray(self.texture_coord_location); - - glUniform1i(self.samplerY_location, 0); - glUniform1i(self.samplerU_location, 1); - glUniform1i(self.samplerV_location, 2); -} - -- (void)setupVariable -{ - self.position_location = glGetAttribLocation(self.program_id, "position"); - self.texture_coord_location = glGetAttribLocation(self.program_id, "textureCoord"); - self.matrix_location = glGetUniformLocation(self.program_id, "mvp_matrix"); - self.samplerY_location = glGetUniformLocation(self.program_id, "SamplerY"); - self.samplerU_location = glGetUniformLocation(self.program_id, "SamplerU"); - self.samplerV_location = glGetUniformLocation(self.program_id, "SamplerV"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.h b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.h deleted file mode 100644 index a526654d..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// SGGLTexture.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import -#import "SGGLFrame.h" - -@interface SGGLTexture : NSObject - -- (BOOL)updateTextureWithGLFrame:(SGGLFrame *)glFrame aspect:(CGFloat *)aspect; -- (void)flush; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.m b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.m deleted file mode 100644 index 2749072b..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTexture.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// SGGLTexture.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLTexture.h" - -@implementation SGGLTexture - -- (BOOL)updateTextureWithGLFrame:(SGGLFrame *)glFrame aspect:(CGFloat *)aspect -{ - return NO; -} - -- (void)flush -{ - -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.h b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.h deleted file mode 100644 index 2646665d..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SGGLTextureNV12.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLTexture.h" - -@interface SGGLTextureNV12 : SGGLTexture - -- (instancetype)initWithContext:(SGPLFGLContext *)context; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.m b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.m deleted file mode 100644 index 79bee4fa..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureNV12.m +++ /dev/null @@ -1,304 +0,0 @@ -// -// SGGLTextureNV12.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGGLTextureNV12.h" -#import "SGPlayerMacro.h" -#import "SGYUVTools.h" - -#if SGPLATFORM_TARGET_OS_MAC - -#import -#import - -@interface SGGLTextureNV12 () - -{ - UInt8 * _texture_data_y; - UInt8 * _texture_data_uv; - size_t _texture_datasize_y; - size_t _texture_datasize_uv; -} - -@property (nonatomic, assign) CGFloat textureAspect; -@property (nonatomic, assign) BOOL didBindTexture; - -@end - -@implementation SGGLTextureNV12 - -static GLuint texture_id_y = 0; -static GLuint texture_id_uv = 0; - -- (instancetype)initWithContext:(SGPLFGLContext *)context -{ - if (self = [super init]) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - glGenTextures(1, &texture_id_y); - glGenTextures(1, &texture_id_uv); - }); - } - return self; -} - -- (BOOL)updateTextureWithGLFrame:(SGGLFrame *)glFrame aspect:(CGFloat *)aspect -{ - CVPixelBufferRef pixelBuffer = [glFrame pixelBufferForNV12]; - if (pixelBuffer == nil) { - if (self.didBindTexture) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texture_id_y); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, texture_id_uv); - * aspect = self.textureAspect; - return YES; - } else { - return NO; - } - } - - CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); - - void * data_y = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0); - int linesize_y = (int)CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 0); - int width_y = (int)CVPixelBufferGetWidthOfPlane(pixelBuffer, 0); - int height_y = (int)CVPixelBufferGetHeightOfPlane(pixelBuffer, 0); - - self.textureAspect = (width_y * 1.0) / (height_y * 1.0); - * aspect = self.textureAspect; - - void * data_uv = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1); - int linesize_uv = (int)CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 1); - int width_uv = (int)CVPixelBufferGetWidthOfPlane(pixelBuffer, 1); - int height_uv = (int)CVPixelBufferGetHeightOfPlane(pixelBuffer, 1); - - size_t size_y = SGYUVChannelFilterNeedSize(linesize_y, width_y, height_y, 1); - if (_texture_datasize_y < size_y) { - if (_texture_datasize_y > 0 && _texture_data_y != NULL) { - free(_texture_data_y); - } - _texture_datasize_y = size_y; - _texture_data_y = malloc(_texture_datasize_y); - } - size_t size_uv = SGYUVChannelFilterNeedSize(linesize_uv, width_uv, height_uv, 2); - if (_texture_datasize_uv < size_uv) { - if (_texture_datasize_uv > 0 && _texture_data_uv != NULL) { - free(_texture_data_uv); - } - _texture_datasize_uv = size_uv; - _texture_data_uv = malloc(_texture_datasize_uv); - } - - SGYUVChannelFilter(data_y, linesize_y, width_y, height_y, _texture_data_y, _texture_datasize_y, 1); - SGYUVChannelFilter(data_uv, linesize_uv, width_uv, height_uv, _texture_data_uv, _texture_datasize_uv, 2); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texture_id_y); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width_y, height_y, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, _texture_data_y); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE0); - - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, texture_id_uv); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width_uv, height_uv, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, _texture_data_uv); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE1); - - CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); - - self.didBindTexture = YES; - return YES; -} - -- (void)cleanTextures -{ - if (_texture_datasize_y > 0 && _texture_data_y != NULL) { - free(_texture_data_y); - } - if (_texture_datasize_uv > 0 && _texture_data_uv != NULL) { - free(_texture_data_uv); - } - _texture_data_y = NULL; - _texture_data_uv = NULL; - _texture_datasize_y = 0; - _texture_datasize_uv = 0; -} - -- (void)dealloc -{ - [self cleanTextures]; - SGPlayerLog(@"SGGLAVTexture release"); -} - -@end - -#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV - -#import -#import - -@interface SGGLTextureNV12 () - -@property (nonatomic, strong) SGPLFGLContext * context; - -@property (nonatomic, assign) CVOpenGLESTextureRef lumaTexture; -@property (nonatomic, assign) CVOpenGLESTextureRef chromaTexture; -@property (nonatomic, assign) CVOpenGLESTextureCacheRef videoTextureCache; - -@property (nonatomic, assign) CGFloat textureAspect; -@property (nonatomic, assign) BOOL didBindTexture; - -@end - -@implementation SGGLTextureNV12 - -- (instancetype)initWithContext:(SGPLFGLContext *)context -{ - if (self = [super init]) { - self.context = context; - [self setupVideoCache]; - } - return self; -} - -- (void)setupVideoCache -{ - if (!self.videoTextureCache) { - CVReturn result = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, NULL, self.context, NULL, &_videoTextureCache); - if (result != noErr) { - SGPlayerLog(@"create CVOpenGLESTextureCacheCreate failure %d", result); - return; - } - } -} - -- (BOOL)updateTextureWithGLFrame:(SGGLFrame *)glFrame aspect:(CGFloat *)aspect -{ - CVPixelBufferRef pixelBuffer = [glFrame pixelBufferForNV12]; - if (pixelBuffer == nil) { - if (self.lumaTexture && self.chromaTexture) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(CVOpenGLESTextureGetTarget(self.lumaTexture), CVOpenGLESTextureGetName(self.lumaTexture)); - glActiveTexture(GL_TEXTURE1); - glBindTexture(CVOpenGLESTextureGetTarget(self.chromaTexture), CVOpenGLESTextureGetName(self.chromaTexture)); - * aspect = self.textureAspect; - return YES; - } else { - return NO; - } - } - - if (!self.videoTextureCache) { - SGPlayerLog(@"no video texture cache"); - return NO; - } - - GLsizei textureWidth = (GLsizei)CVPixelBufferGetWidth(pixelBuffer); - GLsizei textureHeight = (GLsizei)CVPixelBufferGetHeight(pixelBuffer); - self.textureAspect = (textureWidth * 1.0) / (textureHeight * 1.0); - * aspect = self.textureAspect; - - [self cleanTextures]; - - CVReturn result; - // Y-plane - glActiveTexture(GL_TEXTURE0); - result = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, - self.videoTextureCache, - pixelBuffer, - NULL, - GL_TEXTURE_2D, - GL_RED_EXT, - textureWidth, - textureHeight, - GL_RED_EXT, - GL_UNSIGNED_BYTE, - 0, - &_lumaTexture); - - if (result == kCVReturnSuccess) { - glBindTexture(CVOpenGLESTextureGetTarget(self.lumaTexture), CVOpenGLESTextureGetName(self.lumaTexture)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } else { - SGPlayerLog(@"create CVOpenGLESTextureCacheCreateTextureFromImage failure 1 %d", result); - } - - // UV-plane. - glActiveTexture(GL_TEXTURE1); - result = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, - self.videoTextureCache, - pixelBuffer, - NULL, - GL_TEXTURE_2D, - GL_RG_EXT, - textureWidth/2, - textureHeight/2, - GL_RG_EXT, - GL_UNSIGNED_BYTE, - 1, - &_chromaTexture); - - if (result == kCVReturnSuccess) { - glBindTexture(CVOpenGLESTextureGetTarget(self.chromaTexture), CVOpenGLESTextureGetName(self.chromaTexture)); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } else { - SGPlayerLog(@"create CVOpenGLESTextureCacheCreateTextureFromImage failure 2 %d", result); - } - - self.didBindTexture = YES; - return YES; -} - -- (void)clearVideoCache -{ - if (_videoTextureCache) { - CFRelease(_videoTextureCache); - self.videoTextureCache = nil; - } -} - -- (void)cleanTextures -{ - if (self.lumaTexture) { - CFRelease(_lumaTexture); - self.lumaTexture = NULL; - } - - if (self.chromaTexture) { - CFRelease(_chromaTexture); - self.chromaTexture = NULL; - } - - self.textureAspect = 16.0 / 9.0; - CVOpenGLESTextureCacheFlush(_videoTextureCache, 0); -} - -- (void)dealloc -{ - [self clearVideoCache]; - [self cleanTextures]; - SGPlayerLog(@"SGAVGLTexture release"); -} - -@end - -#endif - diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.h b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.h deleted file mode 100644 index 69c0f4d7..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGGLTextureYUV420.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLTexture.h" - -@interface SGGLTextureYUV420 : SGGLTexture - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.m b/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.m deleted file mode 100644 index 5003a26a..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLTexture/SGGLTextureYUV420.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// SGGLTextureYUV420.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLTextureYUV420.h" -#import "SGPlayerBuildConfig.h" - -@interface SGGLTextureYUV420 () - - -@end - -@implementation SGGLTextureYUV420 - -static GLuint gl_texture_ids[3]; - -- (instancetype)init -{ - if (self = [super init]) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - glGenTextures(3, gl_texture_ids); - }); - } - return self; -} - -- (BOOL)updateTextureWithGLFrame:(SGGLFrame *)glFrame aspect:(CGFloat *)aspect -{ -#if SGPlayerBuildConfig_FFmpeg_Enable - SGFFAVYUVVideoFrame * videoFrame = [glFrame pixelBufferForYUV420]; - - if (!videoFrame) { - return NO; - } - - const int frameWidth = videoFrame.width; - const int frameHeight = videoFrame.height; - * aspect = (frameWidth * 1.0) / (frameHeight * 1.0); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - const int widths[3] = { - frameWidth, - frameWidth / 2, - frameWidth / 2 - }; - const int heights[3] = { - frameHeight, - frameHeight / 2, - frameHeight / 2 - }; - - for (SGYUVChannel channel = SGYUVChannelLuma; channel < SGYUVChannelCount; channel++) - { - glActiveTexture(GL_TEXTURE0 + channel); - glBindTexture(GL_TEXTURE_2D, gl_texture_ids[channel]); - glTexImage2D(GL_TEXTURE_2D, - 0, - GL_LUMINANCE, - widths[channel], - heights[channel], - 0, - GL_LUMINANCE, - GL_UNSIGNED_BYTE, - videoFrame->channel_pixels[channel]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - - return YES; -#else - return NO; -#endif -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.h b/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.h deleted file mode 100644 index 5e16ddd4..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// SGGLFrame.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import -#import "SGPlayerBuildConfig.h" -#import "SGFFVideoFrame.h" - -typedef NS_ENUM(NSUInteger, SGGLFrameType) { - SGGLFrameTypeNV12, - SGGLFrameTypeYUV420, -}; - -@interface SGGLFrame : NSObject - -+ (instancetype)frame; - -@property (nonatomic, assign, readonly) SGGLFrameType type; - -@property (nonatomic, assign, readonly) BOOL hasData; -@property (nonatomic, assign, readonly) BOOL hasUpate; -@property (nonatomic, assign, readonly) BOOL hasUpdateRotateType; - -- (void)didDraw; -- (void)didUpdateRotateType; -- (void)flush; - -- (void)updateWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer; -- (CVPixelBufferRef)pixelBufferForNV12; - -#if SGPlayerBuildConfig_FFmpeg_Enable - -- (void)updateWithSGFFVideoFrame:(SGFFVideoFrame *)videoFrame; -- (SGFFAVYUVVideoFrame *)pixelBufferForYUV420; - -@property (nonatomic, assign) SGFFVideoFrameRotateType rotateType; - -#endif - -- (NSTimeInterval)currentPosition; -- (NSTimeInterval)currentDuration; - -- (SGPLFImage *)imageFromVideoFrame; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.m b/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.m deleted file mode 100644 index 00a2f20a..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLFrame.m +++ /dev/null @@ -1,157 +0,0 @@ -// -// SGGLFrame.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLFrame.h" - -@interface SGGLFrame () - -@property (nonatomic, assign) CVPixelBufferRef pixelBuffer; - -#if SGPlayerBuildConfig_FFmpeg_Enable -@property (nonatomic, strong) SGFFVideoFrame * videoFrame; -#endif - -@end - -@implementation SGGLFrame - -+ (instancetype)frame -{ - return [[self alloc] init]; -} - -- (void)updateWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer; -{ - [self flush]; - - self->_type = SGGLFrameTypeNV12; - self.pixelBuffer = pixelBuffer; - - self->_hasData = YES; - self->_hasUpate = YES; -} - -- (CVPixelBufferRef)pixelBufferForNV12 -{ - if (self.pixelBuffer) { - return self.pixelBuffer; - } else { -#if SGPlayerBuildConfig_FFmpeg_Enable - return [(SGFFCVYUVVideoFrame *)self.videoFrame pixelBuffer]; -#endif - } - return nil; -} - - -#if SGPlayerBuildConfig_FFmpeg_Enable - -- (void)updateWithSGFFVideoFrame:(SGFFVideoFrame *)videoFrame; -{ - [self flush]; - - self.videoFrame = videoFrame; - if ([videoFrame isKindOfClass:[SGFFCVYUVVideoFrame class]]) { - self->_type = SGGLFrameTypeNV12; - } else { - self->_type = SGGLFrameTypeYUV420; - } - [self.videoFrame startPlaying]; - - self->_hasData = YES; - self->_hasUpate = YES; -} - -- (SGFFAVYUVVideoFrame *)pixelBufferForYUV420 -{ - return (SGFFAVYUVVideoFrame *)self.videoFrame; -} - -- (void)setRotateType:(SGFFVideoFrameRotateType)rotateType -{ - if (_rotateType != rotateType) { - _rotateType = rotateType; - self->_hasUpdateRotateType = YES; - } -} - -#endif - - -- (NSTimeInterval)currentPosition -{ -#if SGPlayerBuildConfig_FFmpeg_Enable - if (self.videoFrame) { - return self.videoFrame.position; - } -#endif - return -1; -} - -- (NSTimeInterval)currentDuration -{ -#if SGPlayerBuildConfig_FFmpeg_Enable - if (self.videoFrame) { - return self.videoFrame.duration; - } -#endif - return -1; -} - -- (SGPLFImage *)imageFromVideoFrame -{ -#if SGPlayerBuildConfig_FFmpeg_Enable - if ([self.videoFrame isKindOfClass:[SGFFAVYUVVideoFrame class]]) { - SGFFAVYUVVideoFrame * frame = (SGFFAVYUVVideoFrame *)self.videoFrame; - SGPLFImage * image = frame.image; - if (image) return image; - } else if ([self.videoFrame isKindOfClass:[SGFFCVYUVVideoFrame class]]) { - SGFFCVYUVVideoFrame * frame = (SGFFCVYUVVideoFrame *)self.videoFrame; - if (frame.pixelBuffer) { - SGPLFImage * image = SGPLFImageWithCVPixelBuffer(frame.pixelBuffer); - if (image) return image; - } - } -#endif - return nil; -} - -- (void)didDraw -{ - self->_hasUpate = NO; -} - -- (void)didUpdateRotateType -{ - self->_hasUpdateRotateType = NO; -} - -- (void)flush -{ - self->_hasData = NO; - self->_hasUpate = NO; - self->_hasUpdateRotateType = NO; - if (self.pixelBuffer) { - CVPixelBufferRelease(self.pixelBuffer); - self.pixelBuffer = NULL; - } - -#if SGPlayerBuildConfig_FFmpeg_Enable - if (self.videoFrame) { - [self.videoFrame stopPlaying]; - self.videoFrame = nil; - } -#endif -} - -- (void)dealloc -{ - [self flush]; -} - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.h b/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.h deleted file mode 100644 index c337dc15..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// SGGLViewController.h -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGDisplayView.h" - -@interface SGGLViewController : SGPLFGLViewController - -+ (instancetype)viewControllerWithDisplayView:(SGDisplayView *)displayView; - -@property (nonatomic, weak, readonly) SGDisplayView * displayView; - -- (void)reloadViewport; -- (void)flushClearColor; -- (SGPLFImage *)snapshot; - -@end diff --git a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.m b/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.m deleted file mode 100644 index 94f25b1a..00000000 --- a/SGPlayer/Classes/Core/SGDisplay/SGGLView/SGGLViewController.m +++ /dev/null @@ -1,389 +0,0 @@ -// -// SGGLViewController.m -// SGPlayer -// -// Created by Single on 2017/3/27. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGGLViewController.h" -#import "SGPlayerMacro.h" -#import "SGGLFrame.h" -#import "SGGLProgramNV12.h" -#import "SGGLProgramYUV420.h" -#import "SGGLTextureNV12.h" -#import "SGGLTextureYUV420.h" -#import "SGGLNormalModel.h" -#import "SGGLVRModel.h" -#import "SGMatrix.h" -#import "SGDistortionRenderer.h" -#import "SGPlayerBuildConfig.h" - -@interface SGGLViewController () - -@property (nonatomic, strong) SGGLFrame * currentFrame; - -@property (nonatomic, strong) SGGLTextureNV12 * textureNV12; -@property (nonatomic, strong) SGGLTextureYUV420 * textureYUV420; - -@property (nonatomic, strong) SGGLProgramNV12 * programNV12; -@property (nonatomic, strong) SGGLProgramYUV420 * programYUV420; - -@property (nonatomic, strong) SGGLNormalModel * normalModel; -@property (nonatomic, strong) SGGLVRModel * vrModel; - -@property (nonatomic, strong) SGMatrix * vrMatrix; - -@property (nonatomic, strong) NSLock * openGLLock; -@property (nonatomic, assign) BOOL clearToken; -@property (nonatomic, assign) BOOL drawToekn; -@property (nonatomic, assign) CGFloat aspect; -@property (nonatomic, assign) CGRect viewport; - -#if SGPLATFORM_TARGET_OS_IPHONE -@property (nonatomic, strong) SGDistortionRenderer * distorionRenderer; -#endif - -@end - -@implementation SGGLViewController - -+ (instancetype)viewControllerWithDisplayView:(SGDisplayView *)displayView -{ - return [[self alloc] initWithDisplayView:displayView]; -} - -- (instancetype)initWithDisplayView:(SGDisplayView *)displayView -{ - if (self = [super init]) { - self->_displayView = displayView; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - [self setupOpenGL]; -} - -#if SGPLATFORM_TARGET_OS_IPHONE -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - CGFloat scale = SGPLFScreenGetScale(); - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - self.distorionRenderer.viewportSize = CGSizeMake(CGRectGetWidth(glView.bounds) * scale, CGRectGetHeight(glView.bounds) * scale); -} -#endif - -- (void)setupOpenGL -{ - self.openGLLock = [[NSLock alloc] init]; - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - SGPLFViewSetBackgroundColor(glView, [SGPLFColor blackColor]); - - SGPLFGLContext * context = SGPLFGLContextAllocInit(); - SGPLFGLViewSetContext(glView, context); - SGPLGLContextSetCurrentContext(context); - -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - glView.drawableDepthFormat = GLKViewDrawableDepthFormat24; - glView.contentScaleFactor = [UIScreen mainScreen].scale; - self.pauseOnWillResignActive = NO; - self.resumeOnDidBecomeActive = YES; -#endif -#if SGPLATFORM_TARGET_OS_IPHONE - self.distorionRenderer = [SGDistortionRenderer distortionRenderer]; -#endif - - self.textureNV12 = [[SGGLTextureNV12 alloc] initWithContext:context]; - self.textureYUV420 = [[SGGLTextureYUV420 alloc] init]; - - self.programNV12 = [SGGLProgramNV12 program]; - self.programYUV420 = [SGGLProgramYUV420 program]; - - self.normalModel = [SGGLNormalModel model]; - self.vrModel = [SGGLVRModel model]; - - self.vrMatrix = [[SGMatrix alloc] init]; - self.currentFrame = [SGGLFrame frame]; - self.aspect = 16.0 / 9.0; - - SGVideoType videoType = self.displayView.abstractPlayer.videoType; - switch (videoType) { - case SGVideoTypeNormal: - self.preferredFramesPerSecond = 35; - break; - case SGVideoTypeVR: - self.preferredFramesPerSecond = 60; - break; - } -} - -- (void)flushClearColor -{ - NSLog(@"flush ....."); - [self.openGLLock lock]; - self.clearToken = YES; - self.drawToekn = NO; - [self.currentFrame flush]; - [self.textureNV12 flush]; - [self.textureYUV420 flush]; - [self.openGLLock unlock]; -} - -- (void)glkView:(SGPLFGLView *)view drawInRect:(CGRect)rect -{ - [self.openGLLock lock]; - SGPLFGLViewPrepareOpenGL(view); - - if (self.clearToken) { - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); - self.clearToken = NO; - SGPLFGLViewFlushBuffer(view); - } else if ([self needDrawOpenGL]) { -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { - [self.openGLLock unlock]; - return; - } -#endif - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - self.viewport = glView.bounds; - [self drawOpenGL]; - [self.currentFrame didDraw]; - self.drawToekn = YES; - SGPLFGLViewFlushBuffer(view); - } - [self.openGLLock unlock]; -} - -- (SGGLProgram *)chooseProgram -{ - switch (self.currentFrame.type) { - case SGGLFrameTypeNV12: - return self.programNV12; - case SGGLFrameTypeYUV420: - return self.programYUV420; - } -} - -- (SGGLTexture *)chooseTexture -{ - switch (self.currentFrame.type) { - case SGGLFrameTypeNV12: - return self.textureNV12; - case SGGLFrameTypeYUV420: - return self.textureYUV420; - } -} - -- (SGGLModelTextureRotateType)chooseModelTextureRotateType -{ -#if SGPlayerBuildConfig_FFmpeg_Enable - switch (self.currentFrame.rotateType) { - case SGFFVideoFrameRotateType0: - return SGGLModelTextureRotateType0; - case SGFFVideoFrameRotateType90: - return SGGLModelTextureRotateType90; - case SGFFVideoFrameRotateType180: - return SGGLModelTextureRotateType180; - case SGFFVideoFrameRotateType270: - return SGGLModelTextureRotateType270; - } -#endif - return SGGLModelTextureRotateType0; -} - -- (BOOL)needDrawOpenGL -{ - [self.displayView reloadVideoFrameForGLFrame:self.currentFrame]; - if (!self.currentFrame.hasData) { - return NO; - } - if (self.displayView.abstractPlayer.videoType != SGVideoTypeVR && !self.currentFrame.hasUpate && self.drawToekn) { - return NO; - } - - SGGLTexture * texture = [self chooseTexture]; - CGFloat aspect = 16.0 / 9.0; - if (![texture updateTextureWithGLFrame:self.currentFrame aspect:&aspect]) { - return NO; - } - - if (self.displayView.abstractPlayer.videoType == SGVideoTypeVR) { - self.aspect = 16.0 / 9.0; - } else { - self.aspect = aspect; - } - if (self.currentFrame.hasUpdateRotateType) { - [self reloadViewport]; - } - return YES; -} - -- (void)drawOpenGL -{ - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); - - SGVideoType videoType = self.displayView.abstractPlayer.videoType; - SGDisplayMode displayMode = self.displayView.abstractPlayer.displayMode; - -#if SGPLATFORM_TARGET_OS_IPHONE - if (videoType == SGVideoTypeVR && displayMode == SGDisplayModeBox) { - [self.distorionRenderer beforDrawFrame]; - } -#endif - - SGGLProgram * program = [self chooseProgram]; - [program use]; - [program bindVariable]; - - CGFloat scale = SGPLFScreenGetScale(); - CGRect rect = CGRectMake(0, 0, self.viewport.size.width * scale, self.viewport.size.height * scale); - switch (videoType) { - case SGVideoTypeNormal: - { - [self.normalModel bindPositionLocation:program.position_location textureCoordLocation:program.texture_coord_location textureRotateType:[self chooseModelTextureRotateType]]; - glViewport(rect.origin.x, rect.origin.y, CGRectGetWidth(rect), CGRectGetHeight(rect)); - [program updateMatrix:GLKMatrix4Identity]; - glDrawElements(GL_TRIANGLES, self.normalModel.index_count, GL_UNSIGNED_SHORT, 0); - } - break; - case SGVideoTypeVR: - { - [self.vrModel bindPositionLocation:program.position_location textureCoordLocation:program.texture_coord_location]; - switch (displayMode) { - case SGDisplayModeNormal: - { - GLKMatrix4 matrix; - BOOL success = [self.vrMatrix singleMatrixWithSize:rect.size matrix:&matrix fingerRotation:self.displayView.fingerRotation]; - if (success) { - glViewport(rect.origin.x, rect.origin.y, CGRectGetWidth(rect), CGRectGetHeight(rect)); - [program updateMatrix:matrix]; - glDrawElements(GL_TRIANGLES, self.vrModel.index_count, GL_UNSIGNED_SHORT, 0); - } - } - break; - case SGDisplayModeBox: - { - GLKMatrix4 leftMatrix; - GLKMatrix4 rightMatrix; - BOOL success = [self.vrMatrix doubleMatrixWithSize:rect.size leftMatrix:&leftMatrix rightMatrix:&rightMatrix]; - if (success) { - glViewport(rect.origin.x, rect.origin.y, CGRectGetWidth(rect)/2, CGRectGetHeight(rect)); - [program updateMatrix:leftMatrix]; - glDrawElements(GL_TRIANGLES, self.vrModel.index_count, GL_UNSIGNED_SHORT, 0); - - glViewport(CGRectGetWidth(rect)/2 + rect.origin.x, rect.origin.y, CGRectGetWidth(rect)/2, CGRectGetHeight(rect)); - [program updateMatrix:rightMatrix]; - glDrawElements(GL_TRIANGLES, self.vrModel.index_count, GL_UNSIGNED_SHORT, 0); - } - } - break; - } - } - break; - } - -#if SGPLATFORM_TARGET_OS_IPHONE - if (videoType == SGVideoTypeVR && displayMode == SGDisplayModeBox) { - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - SGPLFGLViewBindFrameBuffer(glView); - [self.distorionRenderer afterDrawFrame]; - } -#endif -} - -- (void)reloadViewport -{ - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - CGRect superviewFrame = glView.superview.bounds; - CGFloat superviewAspect = superviewFrame.size.width / superviewFrame.size.height; - - if (self.aspect <= 0) { - glView.frame = superviewFrame; - return; - } - - CGFloat resultAspect = self.aspect; -#if SGPlayerBuildConfig_FFmpeg_Enable - switch (self.currentFrame.rotateType) { - case SGFFVideoFrameRotateType90: - case SGFFVideoFrameRotateType270: - resultAspect = 1 / self.aspect; - break; - case SGFFVideoFrameRotateType0: - case SGFFVideoFrameRotateType180: - break; - } -#endif - - SGGravityMode gravityMode = self.displayView.abstractPlayer.viewGravityMode; - switch (gravityMode) { - case SGGravityModeResize: - glView.frame = superviewFrame; - break; - case SGGravityModeResizeAspect: - if (superviewAspect < resultAspect) { - CGFloat height = superviewFrame.size.width / resultAspect; - glView.frame = CGRectMake(0, (superviewFrame.size.height - height) / 2, superviewFrame.size.width, height); - } else if (superviewAspect > resultAspect) { - CGFloat width = superviewFrame.size.height * resultAspect; - glView.frame = CGRectMake((superviewFrame.size.width - width) / 2, 0, width, superviewFrame.size.height); - } else { - glView.frame = superviewFrame; - } - break; - case SGGravityModeResizeAspectFill: - if (superviewAspect < resultAspect) { - CGFloat width = superviewFrame.size.height * resultAspect; - glView.frame = CGRectMake(-(width - superviewFrame.size.width) / 2, 0, width, superviewFrame.size.height); - } else if (superviewAspect > resultAspect) { - CGFloat height = superviewFrame.size.width / resultAspect; - glView.frame = CGRectMake(0, -(height - superviewFrame.size.height) / 2, superviewFrame.size.width, height); - } else { - glView.frame = superviewFrame; - } - break; - default: - glView.frame = superviewFrame; - break; - } - self.drawToekn = NO; - [self.currentFrame didUpdateRotateType]; -} - -- (void)setAspect:(CGFloat)aspect -{ - if (_aspect != aspect) { - _aspect = aspect; - [self reloadViewport]; - } -} - -- (SGPLFImage *)snapshot -{ - if (self.displayView.abstractPlayer.videoType == SGVideoTypeVR) { - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - return SGPLFGLViewGetCurrentSnapshot(glView); - } else { - SGPLFImage * image = [self.currentFrame imageFromVideoFrame]; - if (image) { - return image; - } - } - SGPLFGLView * glView = SGPLFGLViewControllerGetGLView(self); - return SGPLFGLViewGetCurrentSnapshot(glView); -} - -- (void)dealloc -{ - SGPLGLContextSetCurrentContext(nil); - SGPlayerLog(@"%@ release", self.class); -} - -@end diff --git a/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.h b/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.h deleted file mode 100644 index 24778a30..00000000 --- a/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// SGDistortionModel.h -// DistortionDemo -// -// Created by Single on 26/12/2016. -// Copyright © 2016 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, SGDistortionModelType) { - SGDistortionModelTypeLeft, - SGDistortionModelTypeRight, -}; - -@interface SGDistortionModel : NSObject - -+ (instancetype)modelWithModelType:(SGDistortionModelType)modelType; - -@property (nonatomic, assign, readonly) SGDistortionModelType modelType; - -@property (nonatomic, assign) int index_count; -@property (nonatomic, assign) GLint index_buffer_id; -@property (nonatomic, assign) GLint vertex_buffer_id; - -@end diff --git a/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.m b/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.m deleted file mode 100644 index e400b2ed..00000000 --- a/SGPlayer/Classes/Core/SGDistortion/SGDistortionModel.m +++ /dev/null @@ -1,214 +0,0 @@ -// -// SGDistortionModel.m -// DistortionDemo -// -// Created by Single on 26/12/2016. -// Copyright © 2016 single. All rights reserved. -// - -#import "SGDistortionModel.h" - -@implementation SGDistortionModel - -+ (instancetype)modelWithModelType:(SGDistortionModelType)modelType -{ - return [[self alloc] initWithModelType:modelType]; -} - -- (instancetype)initWithModelType:(SGDistortionModelType)modelType -{ - if (self = [super init]) { - _modelType = modelType; - [self setupBufferData]; - } - return self; -} - -- (void)setupBufferData -{ - float xEyeOffsetScreen = 0.523064613; - float yEyeOffsetScreen = 0.80952388; - - float viewportWidthTexture = 1.43138313; - float viewportHeightTexture = 1.51814604; - - float viewportXTexture = 0; - float viewportYTexture = 0; - - float textureWidth = 2.86276627; - float textureHeight = 1.51814604; - - float xEyeOffsetTexture = 0.592283607; - float yEyeOffsetTexture = 0.839099586; - - float screenWidth = 2.47470069; - float screenHeight = 1.39132345; - - switch (self.modelType) { - case SGDistortionModelTypeLeft: - break; - case SGDistortionModelTypeRight: - xEyeOffsetScreen = 1.95163608; - viewportXTexture = 1.43138313; - xEyeOffsetTexture = 2.27048278; - break; - } - - GLfloat vertexData[14400]; - - int vertexOffset = 0; - - const int rows = 40; - const int cols = 40; - - const float vignetteSizeTanAngle = 0.05f; - - for (int row = 0; row < rows; row++) - { - for (int col = 0; col < cols; col++) - { - const float uTextureBlue = col / 39.0f * (viewportWidthTexture / textureWidth) + viewportXTexture / textureWidth; - const float vTextureBlue = row / 39.0f * (viewportHeightTexture / textureHeight) + viewportYTexture / textureHeight; - - const float xTexture = uTextureBlue * textureWidth - xEyeOffsetTexture; - const float yTexture = vTextureBlue * textureHeight - yEyeOffsetTexture; - const float rTexture = sqrtf(xTexture * xTexture + yTexture * yTexture); - - const float textureToScreenBlue = (rTexture > 0.0f) ? [self blueDistortInverse:rTexture] / rTexture : 1.0f; - - const float xScreen = xTexture * textureToScreenBlue; - const float yScreen = yTexture * textureToScreenBlue; - - const float uScreen = (xScreen + xEyeOffsetScreen) / screenWidth; - const float vScreen = (yScreen + yEyeOffsetScreen) / screenHeight; - const float rScreen = rTexture * textureToScreenBlue; - - const float screenToTextureGreen = (rScreen > 0.0f) ? [self distortionFactor:rScreen] : 1.0f; - const float uTextureGreen = (xScreen * screenToTextureGreen + xEyeOffsetTexture) / textureWidth; - const float vTextureGreen = (yScreen * screenToTextureGreen + yEyeOffsetTexture) / textureHeight; - - const float screenToTextureRed = (rScreen > 0.0f) ? [self distortionFactor:rScreen] : 1.0f; - const float uTextureRed = (xScreen * screenToTextureRed + xEyeOffsetTexture) / textureWidth; - const float vTextureRed = (yScreen * screenToTextureRed + yEyeOffsetTexture) / textureHeight; - - const float vignetteSizeTexture = vignetteSizeTanAngle / textureToScreenBlue; - - const float dxTexture = xTexture + xEyeOffsetTexture - clamp(xTexture + xEyeOffsetTexture, - viewportXTexture + vignetteSizeTexture, - viewportXTexture + viewportWidthTexture - vignetteSizeTexture); - const float dyTexture = yTexture + yEyeOffsetTexture - clamp(yTexture + yEyeOffsetTexture, - viewportYTexture + vignetteSizeTexture, - viewportYTexture + viewportHeightTexture - vignetteSizeTexture); - const float drTexture = sqrtf(dxTexture * dxTexture + dyTexture * dyTexture); - - float vignette = 1.0f; - - bool vignetteEnabled = true; - if (vignetteEnabled) - { - vignette = 1.0f - clamp(drTexture / vignetteSizeTexture, 0.0f, 1.0f); - } - - vertexData[(vertexOffset + 0)] = 2.0f * uScreen - 1.0f; - vertexData[(vertexOffset + 1)] = 2.0f * vScreen - 1.0f; - vertexData[(vertexOffset + 2)] = vignette; - vertexData[(vertexOffset + 3)] = uTextureRed; - vertexData[(vertexOffset + 4)] = vTextureRed; - vertexData[(vertexOffset + 5)] = uTextureGreen; - vertexData[(vertexOffset + 6)] = vTextureGreen; - vertexData[(vertexOffset + 7)] = uTextureBlue; - vertexData[(vertexOffset + 8)] = vTextureBlue; - - vertexOffset += 9; - } - } - - self.index_count = 3158; - GLshort indexData[self.index_count]; - - int indexOffset = 0; - vertexOffset = 0; - for (int row = 0; row < rows-1; row++) - { - if (row > 0) - { - indexData[indexOffset] = indexData[(indexOffset - 1)]; - indexOffset++; - } - for (int col = 0; col < cols; col++) - { - if (col > 0) - { - if (row % 2 == 0) - { - vertexOffset++; - } - else - { - vertexOffset--; - } - } - indexData[(indexOffset++)] = vertexOffset; - indexData[(indexOffset++)] = (vertexOffset + 40); - } - vertexOffset += 40; - } - - GLuint bufferIDs[2] = { 0, 0 }; - glGenBuffers(2, bufferIDs); - self.vertex_buffer_id = bufferIDs[0]; - self.index_buffer_id = bufferIDs[1]; - - glBindBuffer(GL_ARRAY_BUFFER, self.vertex_buffer_id); - glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.index_buffer_id); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indexData), indexData, GL_STATIC_DRAW); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); -} - -- (float)blueDistortInverse:(float)radius -{ - float r0 = radius / 0.9f; - float r = radius * 0.9f; - float dr0 = radius - [self distort:r0]; - while (fabsf(r - r0) > 0.0001f) - { - float dr = radius - [self distort:r]; - float r2 = r - dr * ((r - r0) / (dr - dr0)); - r0 = r; - r = r2; - dr0 = dr; - } - return r; -} - -- (float)distort:(float)radius -{ - return radius * [self distortionFactor:radius]; -} - -- (float)distortionFactor:(float)radius -{ - int s_numberOfCoefficients = 2; - static float _coefficients[2] = {0.441000015, 0.156000003}; - - float result = 1.0f; - float rFactor = 1.0f; - float squaredRadius = radius * radius; - for (int i = 0; i < s_numberOfCoefficients; i++) - { - rFactor *= squaredRadius; - result += _coefficients[i] * rFactor; - } - return result; -} - -float clamp(float val, float min, float max) -{ - return MAX(min, MIN(max, val)); -} - -@end diff --git a/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.h b/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.h deleted file mode 100644 index d5568d2a..00000000 --- a/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SGDistortionRenderer.h -// SGTextureTest -// -// Created by Single on 26/12/2016. -// Copyright © 2016 single. All rights reserved. -// - -#import - -@interface SGDistortionRenderer : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)distortionRenderer; -- (instancetype)initWithViewportSize:(CGSize)viewportSize; - -@property (nonatomic, assign) CGSize viewportSize; - -- (void)beforDrawFrame; -- (void)afterDrawFrame; - -@end diff --git a/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.m b/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.m deleted file mode 100644 index f3a32400..00000000 --- a/SGPlayer/Classes/Core/SGDistortion/SGDistortionRenderer.m +++ /dev/null @@ -1,343 +0,0 @@ -// -// SGDistortionRenderer.m -// SGTextureTest -// -// Created by Single on 26/12/2016. -// Copyright © 2016 single. All rights reserved. -// - -#import "SGDistortionRenderer.h" -#import "SGDistortionModel.h" -#import "SGPlayerMacro.h" - -#define SG_GLES_STRINGIZE(x) #x - -static const char vertexShaderString[] = SG_GLES_STRINGIZE -( - attribute vec2 aPosition; - attribute float aVignette; - attribute vec2 aRedTextureCoord; - attribute vec2 aGreenTextureCoord; - attribute vec2 aBlueTextureCoord; - varying vec2 vRedTextureCoord; - varying vec2 vBlueTextureCoord; - varying vec2 vGreenTextureCoord; - varying float vVignette; - uniform float uTextureCoordScale; - void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); - vRedTextureCoord = aRedTextureCoord.xy * uTextureCoordScale; - vGreenTextureCoord = aGreenTextureCoord.xy * uTextureCoordScale; - vBlueTextureCoord = aBlueTextureCoord.xy * uTextureCoordScale; - vVignette = aVignette; - } -); - -static const char fragmentShaderString[] = SG_GLES_STRINGIZE -( - precision mediump float; - varying vec2 vRedTextureCoord; - varying vec2 vBlueTextureCoord; - varying vec2 vGreenTextureCoord; - varying float vVignette; - uniform sampler2D uTextureSampler; - void main() { - gl_FragColor = vVignette * vec4(texture2D(uTextureSampler, vRedTextureCoord).r, - texture2D(uTextureSampler, vGreenTextureCoord).g, - texture2D(uTextureSampler, vBlueTextureCoord).b, 1.0); - } -); - -@interface SGDistortionRenderer () - -{ - GLuint frame_buffer_id; - GLuint color_render_id; - GLuint frame_texture_id; - - GLuint index_buffer_id; - GLuint vertex_buffer_id; - GLuint texture_buffer_id; - - GLuint program_id; - GLuint vertex_shader_id; - GLuint fragment_shader_id; - - GLint position_shader_location; - GLint vignette_shader_location; - GLint redTextureCoord_shader_location; - GLint greenTextureCoord_shader_location; - GLint blueTextureCoord_shader_location; - GLint uTextureCoordScale_shader_location; - GLint uTextureSampler_shader_location; -} - -@property (nonatomic, strong) SGDistortionModel * leftEye; -@property (nonatomic, strong) SGDistortionModel * rightEye; - -@end - -@implementation SGDistortionRenderer - -+ (instancetype)distortionRenderer -{ - return [[self alloc] initWithViewportSize:CGSizeZero]; -} - -- (instancetype)initWithViewportSize:(CGSize)viewportSize -{ - if (self = [super init]) { - self.viewportSize = viewportSize; - [self setup]; - } - return self; -} - -- (void)setViewportSize:(CGSize)viewportSize -{ - if (!CGSizeEqualToSize(_viewportSize, viewportSize)) { - _viewportSize = viewportSize; - [self resetFrameBufferSize]; - } -} - -- (void)beforDrawFrame -{ - glBindFramebuffer(GL_FRAMEBUFFER, frame_buffer_id); -} - -- (void)afterDrawFrame -{ - glViewport(0, 0, self.viewportSize.width, self.viewportSize.height); - - glDisable(GL_CULL_FACE); - glDisable(GL_SCISSOR_TEST); - - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glEnable(GL_SCISSOR_TEST); - - glScissor(0, 0, self.viewportSize.width / 2, self.viewportSize.height); - [self draw:self.leftEye]; - glScissor(self.viewportSize.width / 2, 0, self.viewportSize.width / 2, self.viewportSize.height); - [self draw:self.rightEye]; - - glDisable(GL_SCISSOR_TEST); -} - -- (SGDistortionModel *)leftEye -{ - if (!_leftEye) { - _leftEye = [SGDistortionModel modelWithModelType:SGDistortionModelTypeLeft]; - } - return _leftEye; -} - -- (SGDistortionModel *)rightEye -{ - if (!_rightEye) { - _rightEye = [SGDistortionModel modelWithModelType:SGDistortionModelTypeRight]; - } - return _rightEye; -} - -- (void)draw:(SGDistortionModel *)eye -{ - [self useProgram]; - - glBindBuffer(GL_ARRAY_BUFFER, eye.vertex_buffer_id); - glVertexAttribPointer(position_shader_location, 2, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (void *)(0 * sizeof(float))); - glEnableVertexAttribArray(position_shader_location); - glVertexAttribPointer(vignette_shader_location, 1, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (void *)(2 * sizeof(float))); - glEnableVertexAttribArray(vignette_shader_location); - glVertexAttribPointer(blueTextureCoord_shader_location, 2, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (void *)(7 * sizeof(float))); - glEnableVertexAttribArray(blueTextureCoord_shader_location); - - if (YES) { - glVertexAttribPointer(redTextureCoord_shader_location, 2, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (void *)(3 * sizeof(float))); - glEnableVertexAttribArray(redTextureCoord_shader_location); - glVertexAttribPointer(greenTextureCoord_shader_location, 2, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (void *)(5 * sizeof(float))); - glEnableVertexAttribArray(greenTextureCoord_shader_location); - } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, frame_texture_id); - - glUniform1i(uTextureSampler_shader_location, 0); - float _resolutionScale = 1; - glUniform1f(uTextureCoordScale_shader_location, _resolutionScale); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, eye.index_buffer_id); - glDrawElements(GL_TRIANGLE_STRIP, eye.index_count, GL_UNSIGNED_SHORT, 0); -} - -- (void)setup -{ - [self setupFrameBuffer]; - [self setupProgramAndShader]; - [self resetFrameBufferSize]; -} - -- (void)useProgram -{ - glUseProgram(program_id); -} - -- (void)setupFrameBuffer -{ - glGenTextures(1, &frame_texture_id); - glBindTexture(GL_TEXTURE_2D, frame_texture_id); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - [self checkGLError]; - - glGenRenderbuffers(1, &color_render_id); - glBindRenderbuffer(GL_RENDERBUFFER, color_render_id); - - [self checkGLError]; - - glGenFramebuffers(1, &frame_buffer_id); - glBindFramebuffer(GL_FRAMEBUFFER, frame_buffer_id); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, frame_texture_id, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, color_render_id); - - [self checkGLError]; -} - -- (void)resetFrameBufferSize -{ - glBindTexture(GL_TEXTURE_2D, frame_texture_id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self.viewportSize.width, self.viewportSize.height, 0, GL_RGB, GL_UNSIGNED_BYTE, nil); - - glBindRenderbuffer(GL_RENDERBUFFER, color_render_id); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, self.viewportSize.width, self.viewportSize.height); -} - -- (void)setupProgramAndShader -{ - program_id = glCreateProgram(); - - if (![self compileShader:&vertex_shader_id type:GL_VERTEX_SHADER string:vertexShaderString]) - { - SGPlayerLog(@"load vertex shader failure"); - } - if (![self compileShader:&fragment_shader_id type:GL_FRAGMENT_SHADER string:fragmentShaderString]) - { - SGPlayerLog(@"load fragment shader failure"); - } - glAttachShader(program_id, vertex_shader_id); - glAttachShader(program_id, fragment_shader_id); - - GLint status; - glLinkProgram(program_id); - - glGetProgramiv(program_id, GL_LINK_STATUS, &status); - - if (status == GL_FALSE) { - SGPlayerLog(@"link program failure"); - } - - [self clearShader]; - - position_shader_location = glGetAttribLocation(program_id, "aPosition"); - if (position_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for aPosition"]; - } - - vignette_shader_location = glGetAttribLocation(program_id, "aVignette"); - if (vignette_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for aVignette"]; - } - - if (YES) - { - redTextureCoord_shader_location = glGetAttribLocation(program_id, "aRedTextureCoord"); - if (redTextureCoord_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for aRedTextureCoord"]; - } - - greenTextureCoord_shader_location = glGetAttribLocation(program_id, "aGreenTextureCoord"); - if (greenTextureCoord_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for aGreenTextureCoord"]; - } - } - - blueTextureCoord_shader_location = glGetAttribLocation(program_id, "aBlueTextureCoord"); - if (blueTextureCoord_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for aBlueTextureCoord"]; - } - - uTextureCoordScale_shader_location = glGetUniformLocation(program_id, "uTextureCoordScale"); - if (uTextureCoordScale_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for uTextureCoordScale"]; - } - - uTextureSampler_shader_location = glGetUniformLocation(program_id, "uTextureSampler"); - if (uTextureSampler_shader_location == -1) - { - [NSException raise:@"DistortionRenderer" format:@"Could not get attrib location for uTextureSampler"]; - } - - [self useProgram]; -} - -- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type string:(const char *)shaderString -{ - if (!shaderString) - { - SGPlayerLog(@"Failed to load shader"); - return NO; - } - - GLint status; - - * shader = glCreateShader(type); - glShaderSource(* shader, 1, &shaderString, NULL); - glCompileShader(* shader); - glGetShaderiv(* shader, GL_COMPILE_STATUS, &status); - if (status != GL_TRUE) - { - GLint logLength; - glGetShaderiv(* shader, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { - GLchar * log = (GLchar *)malloc(logLength); - glGetShaderInfoLog(* shader, logLength, &logLength, log); - SGPlayerLog(@"Shader compile log:\n%s", log); - free(log); - } - } - - return status == GL_TRUE; -} - -- (void)clearShader -{ - if (vertex_shader_id) { - glDeleteShader(vertex_shader_id); - } - - if (fragment_shader_id) { - glDeleteShader(fragment_shader_id); - } -} - -- (void)checkGLError -{ - GLenum err = glGetError(); - if (err != GL_NO_ERROR) - { - SGPlayerLog(@"glError: 0x%04X", err); - } -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.h deleted file mode 100644 index 3b83c412..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// SGFFPlayer.h -// SGPlayer -// -// Created by Single on 03/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGPlayerImp.h" - -@class SGFFVideoFrame; - -@protocol SGFFPlayerOutput - -- (SGFFVideoFrame *)playerOutputGetVideoFrameWithCurrentPostion:(NSTimeInterval)currentPostion - currentDuration:(NSTimeInterval)currentDuration; - -@end - -@interface SGFFPlayer : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -+ (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer; - -@property (nonatomic, weak, readonly) SGPlayer * abstractPlayer; - -@property (nonatomic, assign, readonly) SGPlayerState state; -@property (nonatomic, assign, readonly) CGSize presentationSize; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval progress; -@property (nonatomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval playableTime; -@property (nonatomic, assign, readonly) BOOL seeking; - -- (void)replaceVideo; -- (void)reloadVolume; -- (void)reloadPlayableBufferInterval; - -- (void)play; -- (void)pause; -- (void)stop; - -@property (nonatomic, assign, readonly) BOOL seekEnable; -- (void)seekToTime:(NSTimeInterval)time; -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void(^)(BOOL finished))completeHandler; - -@property (nonatomic, assign, readonly) BOOL videoDecodeOnMainThread; - - -#pragma mark - track info - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGPlayerTrack * videoTrack; -@property (nonatomic, strong, readonly) SGPlayerTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -- (void)selectAudioTrackIndex:(int)audioTrackIndex; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.m deleted file mode 100644 index cc3093a2..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayer.m +++ /dev/null @@ -1,517 +0,0 @@ -// -// SGFFPlayer.m -// SGPlayer -// -// Created by Single on 03/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFPlayer.h" -#import "SGFFDecoder.h" -#import "SGAudioManager.h" -#import "SGPlayerNotification.h" -#import "SGPlayerMacro.h" -#import "SGPlayer+DisplayView.h" - -@interface SGFFPlayer () - -@property (nonatomic, strong) NSLock * stateLock; - -@property (nonatomic, weak) SGPlayer * abstractPlayer; - -@property (nonatomic, strong) SGFFDecoder * decoder; -@property (nonatomic, strong) SGAudioManager * audioManager; - -@property (nonatomic, assign) BOOL prepareToken; -@property (nonatomic, assign) SGPlayerState state; -@property (nonatomic, assign) NSTimeInterval progress; - -@property (nonatomic, assign) NSTimeInterval lastPostProgressTime; -@property (nonatomic, assign) NSTimeInterval lastPostPlayableTime; - -@property (nonatomic, assign) BOOL playing; - -@property (nonatomic, strong) SGFFAudioFrame * currentAudioFrame; - -@end - -@implementation SGFFPlayer - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - return [[self alloc] initWithAbstractPlayer:abstractPlayer]; -} - -- (instancetype)initWithAbstractPlayer:(SGPlayer *)abstractPlayer -{ - if (self = [super init]) { - self.abstractPlayer = abstractPlayer; - self.abstractPlayer.displayView.playerOutputFF = self; - self.stateLock = [[NSLock alloc] init]; - self.audioManager = [SGAudioManager manager]; - [self.audioManager registerAudioSession]; - } - return self; -} - -- (void)play -{ - self.playing = YES; - [self.decoder resume]; - - switch (self.state) { - case SGPlayerStateFinished: - [self seekToTime:0]; - break; - case SGPlayerStateNone: - case SGPlayerStateFailed: - case SGPlayerStateBuffering: - self.state = SGPlayerStateBuffering; - break; - case SGPlayerStateSuspend: - if (self.decoder.buffering) { - self.state = SGPlayerStateBuffering; - } else { - self.state = SGPlayerStatePlaying; - } - break; - case SGPlayerStateReadyToPlay: - case SGPlayerStatePlaying: - self.state = SGPlayerStatePlaying; - break; - } -} - -- (void)pause -{ - self.playing = NO; - [self.decoder pause]; - - switch (self.state) { - case SGPlayerStateNone: - case SGPlayerStateSuspend: - break; - case SGPlayerStateFailed: - case SGPlayerStateReadyToPlay: - case SGPlayerStateFinished: - case SGPlayerStatePlaying: - case SGPlayerStateBuffering: - { - self.state = SGPlayerStateSuspend; - } - break; - } -} - -- (void)stop -{ - [self clean]; -} - -- (BOOL)seekEnable -{ - return self.decoder.seekEnable; -} - -- (void)seekToTime:(NSTimeInterval)time -{ - [self seekToTime:time completeHandler:nil]; -} - -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void (^)(BOOL finished))completeHandler -{ - if (!self.decoder.prepareToDecode) { - if (completeHandler) { - completeHandler(NO); - } - return; - } - [self.decoder seekToTime:time completeHandler:completeHandler]; -} - -- (void)setState:(SGPlayerState)state -{ - [self.stateLock lock]; - if (_state != state) { - SGPlayerState temp = _state; - _state = state; - if (_state != SGPlayerStateFailed) { - self.abstractPlayer.error = nil; - } - if (_state == SGPlayerStatePlaying) { - [self.audioManager playWithDelegate:self]; - } else { - [self.audioManager pause]; - } - [SGPlayerNotification postPlayer:self.abstractPlayer statePrevious:temp current:_state]; - } - [self.stateLock unlock]; -} - -- (double)percentForTime:(NSTimeInterval)time duration:(NSTimeInterval)duration -{ - double percent = 0; - if (time > 0) { - if (duration <= 0) { - percent = 1; - } else { - percent = time / duration; - } - } - return percent; -} - -- (void)setProgress:(NSTimeInterval)progress -{ - if (_progress != progress) { - _progress = progress; - NSTimeInterval duration = self.duration; - double percent = [self percentForTime:_progress duration:duration]; - if (_progress <= 0.000001 || _progress == duration) { - [SGPlayerNotification postPlayer:self.abstractPlayer progressPercent:@(percent) current:@(_progress) total:@(duration)]; - } else { - NSTimeInterval currentTime = [NSDate date].timeIntervalSince1970; - if (currentTime - self.lastPostProgressTime >= 1) { - self.lastPostProgressTime = currentTime; - /* - if (!self.decoder.seekEnable && duration <= 0) { - duration = _progress; - } - */ - [SGPlayerNotification postPlayer:self.abstractPlayer progressPercent:@(percent) current:@(_progress) total:@(duration)]; - } - } - } -} - -- (void)setPlayableTime:(NSTimeInterval)playableTime -{ - NSTimeInterval duration = self.duration; - if (playableTime > duration) { - playableTime = duration; - } else if (playableTime < 0) { - playableTime = 0; - } - - if (_playableTime != playableTime) { - _playableTime = playableTime; - double percent = [self percentForTime:_playableTime duration:duration]; - if (_playableTime == 0 || _playableTime == duration) { - [SGPlayerNotification postPlayer:self.abstractPlayer playablePercent:@(percent) current:@(_playableTime) total:@(duration)]; - } else if (!self.decoder.endOfFile && self.decoder.seekEnable) { - NSTimeInterval currentTime = [NSDate date].timeIntervalSince1970; - if (currentTime - self.lastPostPlayableTime >= 1) { - self.lastPostPlayableTime = currentTime; - [SGPlayerNotification postPlayer:self.abstractPlayer playablePercent:@(percent) current:@(_playableTime) total:@(duration)]; - } - } - } -} - -- (NSTimeInterval)duration -{ - return self.decoder.duration; -} - -- (CGSize)presentationSize -{ - if (self.decoder.prepareToDecode) { - return self.decoder.presentationSize; - } - return CGSizeZero; -} - -- (NSTimeInterval)bitrate -{ - if (self.decoder.prepareToDecode) { - return self.decoder.bitrate; - } - return 0; -} - -- (BOOL)videoDecodeOnMainThread -{ - return self.decoder.videoDecodeOnMainThread; -} - -- (void)reloadVolume -{ - self.audioManager.volume = self.abstractPlayer.volume; -} - -- (void)reloadPlayableBufferInterval -{ - self.decoder.minBufferedDruation = self.abstractPlayer.playableBufferInterval; -} - -#pragma mark - replace video - -- (void)replaceVideo -{ - [self clean]; - if (!self.abstractPlayer.contentURL) return; - - [self.abstractPlayer.displayView playerOutputTypeFF]; - self.decoder = [SGFFDecoder decoderWithContentURL:self.abstractPlayer.contentURL - delegate:self - videoOutputConfig:self - audioOutputConfig:self]; - self.decoder.formatContextOptions = [self.abstractPlayer.decoder FFmpegFormatContextOptions]; - self.decoder.codecContextOptions = [self.abstractPlayer.decoder FFmpegCodecContextOptions]; - self.decoder.hardwareAccelerateEnable = self.abstractPlayer.decoder.hardwareAccelerateEnableForFFmpeg; - [self.decoder open]; - [self reloadVolume]; - [self reloadPlayableBufferInterval]; -} - -#pragma mark - SGFFDecoderDelegate - -- (void)decoderWillOpenInputStream:(SGFFDecoder *)decoder -{ - self.state = SGPlayerStateBuffering; -} - -- (void)decoderDidPrepareToDecodeFrames:(SGFFDecoder *)decoder -{ - if (self.decoder.videoEnable) { - [self.abstractPlayer.displayView rendererTypeOpenGL]; - } -} - -- (void)decoderDidEndOfFile:(SGFFDecoder *)decoder -{ - self.playableTime = self.duration; -} - -- (void)decoderDidPlaybackFinished:(SGFFDecoder *)decoder -{ - self.state = SGPlayerStateFinished; -} - -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfBuffering:(BOOL)buffering -{ - if (buffering) { - self.state = SGPlayerStateBuffering; - } else { - if (self.playing) { - self.state = SGPlayerStatePlaying; - } else if (!self.prepareToken) { - self.state = SGPlayerStateReadyToPlay; - self.prepareToken = YES; - } else { - self.state = SGPlayerStateSuspend; - } - } -} - -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfBufferedDuration:(NSTimeInterval)bufferedDuration -{ - self.playableTime = self.progress + bufferedDuration; -} - -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfProgress:(NSTimeInterval)progress -{ - self.progress = progress; -} - -- (void)decoder:(SGFFDecoder *)decoder didError:(NSError *)error -{ - [self errorHandler:error]; -} - -- (void)errorHandler:(NSError *)error -{ - SGError * obj = [[SGError alloc] init]; - obj.error = error; - self.abstractPlayer.error = obj; - self.state = SGPlayerStateFailed; - [SGPlayerNotification postPlayer:self.abstractPlayer error:obj]; -} - -#pragma mark - clean - -- (void)clean -{ - [self cleanDecoder]; - [self cleanFrame]; - [self cleanPlayer]; -} - -- (void)cleanPlayer -{ - self.playing = NO; - self.state = SGPlayerStateNone; - self.progress = 0; - self.playableTime = 0; - self.prepareToken = NO; - self.lastPostProgressTime = 0; - self.lastPostPlayableTime = 0; - [self.abstractPlayer.displayView playerOutputTypeEmpty]; - [self.abstractPlayer.displayView rendererTypeEmpty]; -} - -- (void)cleanFrame -{ - [self.currentAudioFrame stopPlaying]; - self.currentAudioFrame = nil; -} - -- (void)cleanDecoder -{ - if (self.decoder) { - [self.decoder closeFile]; - self.decoder = nil; - } -} - -- (void)dealloc -{ - [self clean]; - [self.audioManager unregisterAudioSession]; - SGPlayerLog(@"SGFFPlayer release"); -} - - -#pragma mark - SGFFPlayerOutput - -- (SGFFVideoFrame *)playerOutputGetVideoFrameWithCurrentPostion:(NSTimeInterval)currentPostion - currentDuration:(NSTimeInterval)currentDuration -{ - if (self.decoder) { - return [self.decoder decoderVideoOutputGetVideoFrameWithCurrentPostion:currentPostion - currentDuration:currentDuration]; - } - return nil; -} - - -#pragma mark - Video Config - -- (void)decoderVideoOutputConfigDidUpdateMaxPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond -{ - -} - -- (BOOL)decoderVideoOutputConfigAVCodecContextDecodeAsync -{ - if (self.abstractPlayer.videoType == SGVideoTypeVR) { - return NO; - } - return YES; -} - - -#pragma mark - Audio Config - -- (Float64)decoderAudioOutputConfigGetSamplingRate -{ - return self.audioManager.samplingRate; -} - -- (UInt32)decoderAudioOutputConfigGetNumberOfChannels -{ - return self.audioManager.numberOfChannels; -} - -- (void)audioManager:(SGAudioManager *)audioManager outputData:(float *)outputData numberOfFrames:(UInt32)numberOfFrames numberOfChannels:(UInt32)numberOfChannels -{ - if (!self.playing) { - memset(outputData, 0, numberOfFrames * numberOfChannels * sizeof(float)); - return; - } - @autoreleasepool - { - while (numberOfFrames > 0) - { - if (!self.currentAudioFrame) { - self.currentAudioFrame = [self.decoder decoderAudioOutputGetAudioFrame]; - [self.currentAudioFrame startPlaying]; - } - if (!self.currentAudioFrame) { - memset(outputData, 0, numberOfFrames * numberOfChannels * sizeof(float)); - return; - } - - const Byte * bytes = (Byte *)self.currentAudioFrame->samples + self.currentAudioFrame->output_offset; - const NSUInteger bytesLeft = self.currentAudioFrame->length - self.currentAudioFrame->output_offset; - const NSUInteger frameSizeOf = numberOfChannels * sizeof(float); - const NSUInteger bytesToCopy = MIN(numberOfFrames * frameSizeOf, bytesLeft); - const NSUInteger framesToCopy = bytesToCopy / frameSizeOf; - - memcpy(outputData, bytes, bytesToCopy); - numberOfFrames -= framesToCopy; - outputData += framesToCopy * numberOfChannels; - - if (bytesToCopy < bytesLeft) { - self.currentAudioFrame->output_offset += bytesToCopy; - } else { - [self.currentAudioFrame stopPlaying]; - self.currentAudioFrame = nil; - } - } - } -} - - -#pragma mark - Track Info - -- (BOOL)videoEnable -{ - return self.decoder.videoEnable; -} - -- (BOOL)audioEnable -{ - return self.decoder.audioEnable; -} - -- (SGPlayerTrack *)videoTrack -{ - return [self playerTrackFromFFTrack:self.decoder.videoTrack]; -} - -- (SGPlayerTrack *)audioTrack -{ - return [self playerTrackFromFFTrack:self.decoder.audioTrack]; -} - -- (NSArray *)videoTracks -{ - return [self playerTracksFromFFTracks:self.decoder.videoTracks]; -} - -- (NSArray *)audioTracks -{ - return [self playerTracksFromFFTracks:self.decoder.audioTracks];; -} - -- (void)selectAudioTrackIndex:(int)audioTrackIndex -{ - [self.decoder selectAudioTrackIndex:audioTrackIndex]; -} - -- (SGPlayerTrack *)playerTrackFromFFTrack:(SGFFTrack *)track -{ - if (track) { - SGPlayerTrack * obj = [[SGPlayerTrack alloc] init]; - obj.index = track.index; - obj.name = track.metadata.language; - return obj; - } - return nil; -} - -- (NSArray *)playerTracksFromFFTracks:(NSArray *)tracks -{ - NSMutableArray * array = [NSMutableArray array]; - for (SGFFTrack * obj in tracks) { - SGPlayerTrack * track = [self playerTrackFromFFTrack:obj]; - [array addObject:track]; - } - if (array.count > 0) { - return array; - } - return nil; -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.h deleted file mode 100644 index 0b9a8f1d..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// SGFFPlayerShell.h -// SGPlayer -// -// Created by Single on 2017/11/2. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGPlayerImp.h" - -@interface SGFFPlayerShell : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -+ (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer; - -@property (nonatomic, weak, readonly) SGPlayer * abstractPlayer; - -@property (nonatomic, assign, readonly) SGPlayerState state; -@property (nonatomic, assign, readonly) CGSize presentationSize; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval progress; -@property (nonatomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval playableTime; -@property (nonatomic, assign, readonly) BOOL seeking; - -- (void)replaceVideo; -- (void)reloadVolume; -- (void)reloadPlayableBufferInterval; - -- (void)play; -- (void)pause; -- (void)stop; - -@property (nonatomic, assign, readonly) BOOL seekEnable; -- (void)seekToTime:(NSTimeInterval)time; -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void(^)(BOOL finished))completeHandler; - -@property (nonatomic, assign, readonly) BOOL videoDecodeOnMainThread; - - -#pragma mark - track info - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGPlayerTrack * videoTrack; -@property (nonatomic, strong, readonly) SGPlayerTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -- (void)selectAudioTrackIndex:(int)audioTrackIndex; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.m deleted file mode 100644 index 79ce0ea4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFPlayerShell.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// SGFFPlayerShell.m -// SGPlayer -// -// Created by Single on 2017/11/2. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFPlayerShell.h" - -@implementation SGFFPlayerShell - -+ (instancetype)playerWithAbstractPlayer:(SGPlayer *)abstractPlayer {return nil;} - -- (void)replaceVideo {} -- (void)reloadVolume {} -- (void)reloadPlayableBufferInterval {} - -- (void)play {} -- (void)pause {} -- (void)stop {} - -- (void)seekToTime:(NSTimeInterval)time {} -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void(^)(BOOL finished))completeHandler {} - -- (void)selectAudioTrackIndex:(int)audioTrackIndex {} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.h deleted file mode 100644 index cb85d637..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// SGFFAudioDecoder.h -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFAudioFrame.h" -#import "avformat.h" - -@class SGFFAudioDecoder; - -@protocol SGFFAudioDecoderDelegate - -- (void)audioDecoder:(SGFFAudioDecoder *)audioDecoder samplingRate:(Float64 *)samplingRate; -- (void)audioDecoder:(SGFFAudioDecoder *)audioDecoder channelCount:(UInt32 *)channelCount; - -@end - -@interface SGFFAudioDecoder : NSObject - -+ (instancetype)decoderWithCodecContext:(AVCodecContext *)codec_context timebase:(NSTimeInterval)timebase delegate:(id )delegate; - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, assign, readonly) int size; -@property (nonatomic, assign, readonly) BOOL empty; -@property (nonatomic, assign, readonly) NSTimeInterval duration; - -- (SGFFAudioFrame *)getFrameSync; -- (int)putPacket:(AVPacket)packet; - -- (void)flush; -- (void)destroy; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.m deleted file mode 100644 index 9427a4b1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioDecoder.m +++ /dev/null @@ -1,225 +0,0 @@ -// -// SGFFAudioDecoder.m -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFAudioDecoder.h" -#import "SGFFFrameQueue.h" -#import "SGFFFramePool.h" -#import "SGFFTools.h" -#import "SGPlayerMacro.h" -#import -#import "swscale.h" -#import "swresample.h" - -@interface SGFFAudioDecoder () - -{ - AVCodecContext * _codec_context; - AVFrame * _temp_frame; - - NSTimeInterval _timebase; - Float64 _samplingRate; - UInt32 _channelCount; - - SwrContext * _audio_swr_context; - void * _audio_swr_buffer; - int _audio_swr_buffer_size; -} - -@property (nonatomic, strong) SGFFFrameQueue * frameQueue; -@property (nonatomic, strong) SGFFFramePool * framePool; - -@end - -@implementation SGFFAudioDecoder - -+ (instancetype)decoderWithCodecContext:(AVCodecContext *)codec_context timebase:(NSTimeInterval)timebase delegate:(id)delegate -{ - return [[self alloc] initWithCodecContext:codec_context timebase:timebase delegate:delegate]; -} - -- (instancetype)initWithCodecContext:(AVCodecContext *)codec_context timebase:(NSTimeInterval)timebase delegate:(id)delegate -{ - if (self = [super init]) { - self.delegate = delegate; - self->_codec_context = codec_context; - self->_temp_frame = av_frame_alloc(); - self->_timebase = timebase; - [self setup]; - } - return self; -} - -- (void)setup -{ - self.frameQueue = [SGFFFrameQueue frameQueue]; - self.framePool = [SGFFFramePool audioPool]; - [self setupSwsContext]; -} - -- (void)setupSwsContext -{ - [self reloadAudioOuputInfo]; - - _audio_swr_context = swr_alloc_set_opts(NULL, av_get_default_channel_layout(_channelCount), AV_SAMPLE_FMT_S16, _samplingRate, av_get_default_channel_layout(_codec_context->channels), _codec_context->sample_fmt, _codec_context->sample_rate, 0, NULL); - - int result = swr_init(_audio_swr_context); - NSError * error = SGFFCheckError(result); - if (error || !_audio_swr_context) { - if (_audio_swr_context) { - swr_free(&_audio_swr_context); - } - } -} - -- (int)size -{ - return self.frameQueue.packetSize; -} - -- (BOOL)empty -{ - return self.frameQueue.count <= 0; -} - -- (NSTimeInterval)duration -{ - return self.frameQueue.duration; -} - -- (void)flush -{ - [self.frameQueue flush]; - [self.framePool flush]; - if (_codec_context) { - avcodec_flush_buffers(_codec_context); - } -} - -- (void)destroy -{ - [self.frameQueue destroy]; - [self.framePool flush]; -} - -- (SGFFAudioFrame *)getFrameSync -{ - return [self.frameQueue getFrameSync]; -} - -- (int)putPacket:(AVPacket)packet -{ - if (packet.data == NULL) return 0; - - int result = avcodec_send_packet(_codec_context, &packet); - if (result < 0 && result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - return -1; - } - - while (result >= 0) { - result = avcodec_receive_frame(_codec_context, _temp_frame); - if (result < 0) { - if (result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - return -1; - } - break; - } - @autoreleasepool - { - SGFFAudioFrame * frame = [self decode:packet.size]; - if (frame) { - [self.frameQueue putFrame:frame]; - } - } - } - av_packet_unref(&packet); - return 0; -} - -- (SGFFAudioFrame *)decode:(int)packetSize -{ - if (!_temp_frame->data[0]) return nil; - - [self reloadAudioOuputInfo]; - - int numberOfFrames; - void * audioDataBuffer; - - if (_audio_swr_context) { - const int ratio = MAX(1, _samplingRate / _codec_context->sample_rate) * MAX(1, _channelCount / _codec_context->channels) * 2; - const int buffer_size = av_samples_get_buffer_size(NULL, _channelCount, _temp_frame->nb_samples * ratio, AV_SAMPLE_FMT_S16, 1); - - if (!_audio_swr_buffer || _audio_swr_buffer_size < buffer_size) { - _audio_swr_buffer_size = buffer_size; - _audio_swr_buffer = realloc(_audio_swr_buffer, _audio_swr_buffer_size); - } - - Byte * outyput_buffer[2] = {_audio_swr_buffer, 0}; - numberOfFrames = swr_convert(_audio_swr_context, outyput_buffer, _temp_frame->nb_samples * ratio, (const uint8_t **)_temp_frame->data, _temp_frame->nb_samples); - NSError * error = SGFFCheckError(numberOfFrames); - if (error) { - SGFFErrorLog(@"audio codec error : %@", error); - return nil; - } - audioDataBuffer = _audio_swr_buffer; - } else { - if (_codec_context->sample_fmt != AV_SAMPLE_FMT_S16) { - SGFFErrorLog(@"audio format error"); - return nil; - } - audioDataBuffer = _temp_frame->data[0]; - numberOfFrames = _temp_frame->nb_samples; - } - - SGFFAudioFrame * audioFrame = [self.framePool getUnuseFrame]; - audioFrame.packetSize = packetSize; - audioFrame.position = av_frame_get_best_effort_timestamp(_temp_frame) * _timebase; - audioFrame.duration = av_frame_get_pkt_duration(_temp_frame) * _timebase; - - if (audioFrame.duration == 0) { - audioFrame.duration = audioFrame->length / (sizeof(float) * _channelCount * _samplingRate); - } - - const NSUInteger numberOfElements = numberOfFrames * self->_channelCount; - [audioFrame setSamplesLength:numberOfElements * sizeof(float)]; - - float scale = 1.0 / (float)INT16_MAX ; - vDSP_vflt16((SInt16 *)audioDataBuffer, 1, audioFrame->samples, 1, numberOfElements); - vDSP_vsmul(audioFrame->samples, 1, &scale, audioFrame->samples, 1, numberOfElements); - - return audioFrame; -} - -- (void)reloadAudioOuputInfo -{ - if ([self.delegate respondsToSelector:@selector(audioDecoder:samplingRate:)]) { - [self.delegate audioDecoder:self samplingRate:&self->_samplingRate]; - } - if ([self.delegate respondsToSelector:@selector(audioDecoder:channelCount:)]) { - [self.delegate audioDecoder:self channelCount:&self->_channelCount]; - } -} - -- (void)dealloc -{ - if (_audio_swr_buffer) { - free(_audio_swr_buffer); - _audio_swr_buffer = NULL; - _audio_swr_buffer_size = 0; - } - if (_audio_swr_context) { - swr_free(&_audio_swr_context); - _audio_swr_context = NULL; - } - if (_temp_frame) { - av_free(_temp_frame); - _temp_frame = NULL; - } - SGPlayerLog(@"SGFFAudioDecoder release"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.h deleted file mode 100644 index 7fd47ead..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// SGFFAudioFrame.h -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFFrame.h" - -@interface SGFFAudioFrame : SGFFFrame - -{ -@public - float * samples; - int length; - int output_offset; -} - -- (void)setSamplesLength:(NSUInteger)samplesLength; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.m deleted file mode 100644 index c873c052..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFAudioFrame.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// SGFFAudioFrame.m -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFAudioFrame.h" - -@implementation SGFFAudioFrame - -{ - size_t buffer_size; -} - -- (SGFFFrameType)type -{ - return SGFFFrameTypeAudio; -} - -- (int)size -{ - return (int)self->length; -} - -- (void)setSamplesLength:(NSUInteger)samplesLength -{ - if (self->buffer_size < samplesLength) { - if (self->buffer_size > 0 && self->samples != NULL) { - free(self->samples); - } - self->buffer_size = samplesLength; - self->samples = malloc(self->buffer_size); - } - self->length = (int)samplesLength; - self->output_offset = 0; -} - -- (void)dealloc -{ - if (self->buffer_size > 0 && self->samples != NULL) { - free(self->samples); - } -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.h deleted file mode 100644 index 18499300..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.h +++ /dev/null @@ -1,129 +0,0 @@ -// -// SGFFDecoder.h -// SGPlayer -// -// Created by Single on 05/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import -#import "SGFFAudioFrame.h" -#import "SGFFVideoFrame.h" -#import "SGFFTrack.h" - -@class SGFFDecoder; - - -@protocol SGFFDecoderDelegate - -@optional - -- (void)decoderWillOpenInputStream:(SGFFDecoder *)decoder; // open input stream -- (void)decoderDidPrepareToDecodeFrames:(SGFFDecoder *)decoder; // prepare decode frames -- (void)decoderDidEndOfFile:(SGFFDecoder *)decoder; // end of file -- (void)decoderDidPlaybackFinished:(SGFFDecoder *)decoder; -- (void)decoder:(SGFFDecoder *)decoder didError:(NSError *)error; // error callback - -// value change -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfBuffering:(BOOL)buffering; -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfBufferedDuration:(NSTimeInterval)bufferedDuration; -- (void)decoder:(SGFFDecoder *)decoder didChangeValueOfProgress:(NSTimeInterval)progress; - -@end - - -@protocol SGFFDecoderAudioOutput - -- (SGFFAudioFrame *)decoderAudioOutputGetAudioFrame; - -@end - -@protocol SGFFDecoderAudioOutputConfig - -- (Float64)decoderAudioOutputConfigGetSamplingRate; -- (UInt32)decoderAudioOutputConfigGetNumberOfChannels; - -@end - - -@protocol SGFFDecoderVideoOutput - -- (SGFFVideoFrame *)decoderVideoOutputGetVideoFrameWithCurrentPostion:(NSTimeInterval)currentPostion - currentDuration:(NSTimeInterval)currentDuration; - -@end - -@protocol SGFFDecoderVideoOutputConfig - -- (void)decoderVideoOutputConfigDidUpdateMaxPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond; -- (BOOL)decoderVideoOutputConfigAVCodecContextDecodeAsync; - -@end - - -@interface SGFFDecoder : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)decoderWithContentURL:(NSURL *)contentURL - delegate:(id )delegate - videoOutputConfig:(id )videoOutputConfig - audioOutputConfig:(id )audioOutputConfig; - -@property (nonatomic, strong, readonly) NSError * error; - -@property (nonatomic, copy, readonly) NSURL * contentURL; - -@property (nonatomic, copy, readonly) NSDictionary * metadata; -@property (nonatomic, assign, readonly) CGSize presentationSize; -@property (nonatomic, assign, readonly) CGFloat aspect; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval progress; -@property (nonatomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval bufferedDuration; - -@property (nonatomic, assign) NSTimeInterval minBufferedDruation; -@property (nonatomic, assign) BOOL hardwareAccelerateEnable; // default is YES; - -@property (nonatomic, assign, readonly) BOOL buffering; - -@property (nonatomic, assign, readonly) BOOL playbackFinished; -@property (atomic, assign, readonly) BOOL closed; -@property (atomic, assign, readonly) BOOL endOfFile; -@property (atomic, assign, readonly) BOOL paused; -@property (atomic, assign, readonly) BOOL seeking; -@property (atomic, assign, readonly) BOOL reading; -@property (atomic, assign, readonly) BOOL prepareToDecode; - -@property (nonatomic, assign, readonly) BOOL videoDecodeOnMainThread; - -@property (nonatomic, strong) NSDictionary * formatContextOptions; -@property (nonatomic, strong) NSDictionary * codecContextOptions; - -- (void)pause; -- (void)resume; - -@property (nonatomic, assign, readonly) BOOL seekEnable; -- (void)seekToTime:(NSTimeInterval)time; -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void (^)(BOOL finished))completeHandler; - -- (void)open; -- (void)closeFile; // when release of active calls, or when called in dealloc might block the thread - - -#pragma mark - track info - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGFFTrack * videoTrack; -@property (nonatomic, strong, readonly) SGFFTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -- (void)selectAudioTrackIndex:(int)audioTrackIndex; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.m deleted file mode 100644 index cd95aa7c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFDecoder.m +++ /dev/null @@ -1,733 +0,0 @@ - // -// SGFFDecoder.m -// SGPlayer -// -// Created by Single on 05/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFDecoder.h" -#import "SGFFFormatContext.h" -#import "SGFFAudioDecoder.h" -#import "SGFFVideoDecoder.h" -#import "SGFFTools.h" - -@interface SGFFDecoder () - -@property (nonatomic, weak) id delegate; -@property (nonatomic, weak) id videoOutputConfig; -@property (nonatomic, weak) id audioOutputConfig; - -@property (nonatomic, strong) NSOperationQueue * ffmpegOperationQueue; -@property (nonatomic, strong) NSInvocationOperation * openFileOperation; -@property (nonatomic, strong) NSInvocationOperation * readPacketOperation; -@property (nonatomic, strong) NSInvocationOperation * decodeFrameOperation; - -@property (nonatomic, strong) SGFFFormatContext * formatContext; -@property (nonatomic, strong) SGFFAudioDecoder * audioDecoder; -@property (nonatomic, strong) SGFFVideoDecoder * videoDecoder; - -@property (nonatomic, strong) NSError * error; - -@property (nonatomic, copy) NSURL * contentURL; - -@property (nonatomic, assign) NSTimeInterval progress; -@property (nonatomic, assign) NSTimeInterval bufferedDuration; - -@property (nonatomic, assign) BOOL buffering; - -@property (nonatomic, assign) BOOL playbackFinished; -@property (atomic, assign) BOOL closed; -@property (atomic, assign) BOOL endOfFile; -@property (atomic, assign) BOOL paused; -@property (atomic, assign) BOOL seeking; -@property (atomic, assign) BOOL reading; -@property (atomic, assign) BOOL prepareToDecode; - -@property (nonatomic, assign) NSTimeInterval seekToTime; -@property (nonatomic, assign) NSTimeInterval seekMinTime; // default is 0 -@property (nonatomic, copy) void (^seekCompleteHandler)(BOOL finished); - -@property (nonatomic, assign) BOOL selectAudioTrack; -@property (nonatomic, assign) int selectAudioTrackIndex; - -@property (atomic, assign) NSTimeInterval audioFrameTimeClock; -@property (atomic, assign) NSTimeInterval audioFramePosition; -@property (atomic, assign) NSTimeInterval audioFrameDuration; - -@property (atomic, assign) NSTimeInterval videoFrameTimeClock; -@property (atomic, assign) NSTimeInterval videoFramePosition; -@property (atomic, assign) NSTimeInterval videoFrameDuration; - -@end - -@implementation SGFFDecoder - -+ (instancetype)decoderWithContentURL:(NSURL *)contentURL - delegate:(id)delegate - videoOutputConfig:(id)videoOutputConfig - audioOutputConfig:(id)audioOutputConfig -{ - return [[self alloc] initWithContentURL:contentURL - delegate:delegate - videoOutputConfig:videoOutputConfig - audioOutputConfig:audioOutputConfig]; -} - -- (instancetype)initWithContentURL:(NSURL *)contentURL - delegate:(id)delegate - videoOutputConfig:(id)videoOutputConfig - audioOutputConfig:(id)audioOutputConfig -{ - if (self = [super init]) { - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - av_log_set_callback(SGFFLog); - av_register_all(); - avformat_network_init(); - }); - - self.contentURL = contentURL; - self.delegate = delegate; - self.videoOutputConfig = videoOutputConfig; - self.audioOutputConfig = audioOutputConfig; - - self.hardwareAccelerateEnable = YES; - } - return self; -} - -#pragma mark - setup operations - -- (void)open -{ - [self setupOperationQueue]; -} - -- (void)setupOperationQueue -{ - self.ffmpegOperationQueue = [[NSOperationQueue alloc] init]; - self.ffmpegOperationQueue.maxConcurrentOperationCount = 2; - self.ffmpegOperationQueue.qualityOfService = NSQualityOfServiceUserInteractive; - - [self setupOpenFileOperation]; -} - -- (void)setupOpenFileOperation -{ - self.openFileOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(openFormatContext) object:nil]; - self.openFileOperation.queuePriority = NSOperationQueuePriorityVeryHigh; - self.openFileOperation.qualityOfService = NSQualityOfServiceUserInteractive; - - [self.ffmpegOperationQueue addOperation:self.openFileOperation]; -} - -- (void)setupReadPacketOperation -{ - if (self.error) { - [self delegateErrorCallback]; - return; - } - - if (!self.readPacketOperation || self.readPacketOperation.isFinished) { - self.readPacketOperation = [[NSInvocationOperation alloc] initWithTarget:self - selector:@selector(readPacketThread) - object:nil]; - self.readPacketOperation.queuePriority = NSOperationQueuePriorityVeryHigh; - self.readPacketOperation.qualityOfService = NSQualityOfServiceUserInteractive; - [self.readPacketOperation addDependency:self.openFileOperation]; - [self.ffmpegOperationQueue addOperation:self.readPacketOperation]; - } - - if (self.formatContext.videoEnable) { - if (!self.decodeFrameOperation || self.decodeFrameOperation.isFinished) { - self.decodeFrameOperation = [[NSInvocationOperation alloc] initWithTarget:self.videoDecoder - selector:@selector(startDecodeThread) - object:nil]; - self.decodeFrameOperation.queuePriority = NSOperationQueuePriorityVeryHigh; - self.decodeFrameOperation.qualityOfService = NSQualityOfServiceUserInteractive; - [self.decodeFrameOperation addDependency:self.openFileOperation]; - [self.ffmpegOperationQueue addOperation:self.decodeFrameOperation]; - } - } -} - -#pragma mark - open stream - -- (void)openFormatContext -{ - if ([self.delegate respondsToSelector:@selector(decoderWillOpenInputStream:)]) { - [self.delegate decoderWillOpenInputStream:self]; - } - - self.formatContext = [SGFFFormatContext formatContextWithContentURL:self.contentURL delegate:self]; - self.formatContext.formatContextOptions = self.formatContextOptions; - self.formatContext.codecContextOptions = self.codecContextOptions; - [self.formatContext setupSync]; - - if (self.formatContext.error) { - self.error = self.formatContext.error; - [self delegateErrorCallback]; - return; - } - - self.prepareToDecode = YES; - if ([self.delegate respondsToSelector:@selector(decoderDidPrepareToDecodeFrames:)]) { - [self.delegate decoderDidPrepareToDecodeFrames:self]; - } - - if (self.formatContext.videoEnable) { - self.videoDecoder = [SGFFVideoDecoder decoderWithCodecContext:self.formatContext->_video_codec_context - timebase:self.formatContext.videoTimebase - fps:self.formatContext.videoFPS - codecContextAsync:[self.videoOutputConfig decoderVideoOutputConfigAVCodecContextDecodeAsync] - videoToolBoxEnable:self.hardwareAccelerateEnable - rotateType:self.formatContext.videoFrameRotateType - delegate:self]; - } - if (self.formatContext.audioEnable) { - self.audioDecoder = [SGFFAudioDecoder decoderWithCodecContext:self.formatContext->_audio_codec_context - timebase:self.formatContext.audioTimebase - delegate:self]; - } - - [self setupReadPacketOperation]; -} - - -#pragma mark - operation thread - -static int max_packet_buffer_size = 15 * 1024 * 1024; -static NSTimeInterval max_packet_sleep_full_time_interval = 0.1; -static NSTimeInterval max_packet_sleep_full_and_pause_time_interval = 0.5; - -- (void)readPacketThread -{ - [self cleanAudioFrame]; - [self cleanVideoFrame]; - - [self.videoDecoder flush]; - [self.audioDecoder flush]; - - self.reading = YES; - BOOL finished = NO; - AVPacket packet; - while (!finished) { - if (self.closed || self.error) { - SGFFThreadLog(@"read packet thread quit"); - break; - } - if (self.seeking) { - self.endOfFile = NO; - self.playbackFinished = NO; - - [self.formatContext seekFileWithFFTimebase:self.seekToTime]; - - self.buffering = YES; - [self.audioDecoder flush]; - [self.videoDecoder flush]; - self.videoDecoder.paused = NO; - self.videoDecoder.endOfFile = NO; - self.seeking = NO; - self.seekToTime = 0; - if (self.seekCompleteHandler) { - self.seekCompleteHandler(YES); - self.seekCompleteHandler = nil; - } - [self cleanAudioFrame]; - [self cleanVideoFrame]; - [self updateBufferedDurationByVideo]; - [self updateBufferedDurationByAudio]; - continue; - } - if (self.selectAudioTrack) { - NSError * selectResult = [self.formatContext selectAudioTrackIndex:self.selectAudioTrackIndex]; - if (!selectResult) { - [self.audioDecoder destroy]; - self.audioDecoder = [SGFFAudioDecoder decoderWithCodecContext:self.formatContext->_audio_codec_context - timebase:self.formatContext.audioTimebase - delegate:self]; - if (!self.playbackFinished) { - [self seekToTime:self.progress]; - } - } - self.selectAudioTrack = NO; - self.selectAudioTrackIndex = 0; - continue; - } - if (self.audioDecoder.size + self.videoDecoder.size >= max_packet_buffer_size) { - NSTimeInterval interval = 0; - if (self.paused) { - interval = max_packet_sleep_full_and_pause_time_interval; - } else { - interval = max_packet_sleep_full_time_interval; - } - SGFFSleepLog(@"read thread sleep : %f", interval); - [NSThread sleepForTimeInterval:interval]; - continue; - } - - // read frame - int result = [self.formatContext readFrame:&packet]; - if (result < 0) - { - SGFFPacketLog(@"read packet finished"); - self.endOfFile = YES; - self.videoDecoder.endOfFile = YES; - finished = YES; - if ([self.delegate respondsToSelector:@selector(decoderDidEndOfFile:)]) { - [self.delegate decoderDidEndOfFile:self]; - } - break; - } - if (packet.stream_index == self.formatContext.videoTrack.index && self.formatContext.videoEnable) - { - SGFFPacketLog(@"video : put packet"); - [self.videoDecoder putPacket:packet]; - [self updateBufferedDurationByVideo]; - } - else if (packet.stream_index == self.formatContext.audioTrack.index && self.formatContext.audioEnable) - { - SGFFPacketLog(@"audio : put packet"); - int result = [self.audioDecoder putPacket:packet]; - if (result < 0) { - self.error = SGFFCheckErrorCode(result, SGFFDecoderErrorCodeCodecAudioSendPacket); - [self delegateErrorCallback]; - continue; - } - [self updateBufferedDurationByAudio]; - } - } - self.reading = NO; - [self checkBufferingStatus]; -} - -- (void)pause -{ - self.paused = YES; -} - -- (void)resume -{ - self.paused = NO; - if (self.playbackFinished) { - [self seekToTime:0]; - } -} - -- (void)seekToTime:(NSTimeInterval)time -{ - [self seekToTime:time completeHandler:nil]; -} - -- (void)seekToTime:(NSTimeInterval)time completeHandler:(void (^)(BOOL finished))completeHandler -{ - if (!self.seekEnable || self.error) { - if (completeHandler) { - completeHandler(NO); - } - return; - } - NSTimeInterval tempDuration = 8; - if (!self.formatContext.audioEnable) { - tempDuration = 15; - } - - NSTimeInterval seekMaxTime = self.duration - (self.minBufferedDruation + tempDuration); - if (seekMaxTime < self.seekMinTime) { - seekMaxTime = self.seekMinTime; - } - if (time > seekMaxTime) { - time = seekMaxTime; - } else if (time < self.seekMinTime) { - time = self.seekMinTime; - } - self.progress = time; - self.seekToTime = time; - self.seekCompleteHandler = completeHandler; - self.seeking = YES; - self.videoDecoder.paused = YES; - - if (self.endOfFile) { - [self setupReadPacketOperation]; - } -} - -- (SGFFAudioFrame *)decoderAudioOutputGetAudioFrame -{ - BOOL check = self.closed || self.seeking || self.buffering || self.paused || self.playbackFinished || !self.formatContext.audioEnable; - if (check) return nil; - if (self.audioDecoder.empty) { - [self updateBufferedDurationByAudio]; - return nil; - } - SGFFAudioFrame * audioFrame = [self.audioDecoder getFrameSync]; - if (!audioFrame) return nil; - self.audioFramePosition = audioFrame.position; - self.audioFrameDuration = audioFrame.duration; - - if (self.endOfFile) { - [self updateBufferedDurationByAudio]; - } - [self updateProgressByAudio]; - self.audioFrameTimeClock = [NSDate date].timeIntervalSince1970; - return audioFrame; -} - -- (SGFFVideoFrame *)decoderVideoOutputGetVideoFrameWithCurrentPostion:(NSTimeInterval)currentPostion - currentDuration:(NSTimeInterval)currentDuration -{ - if (self.closed || self.error) { - return nil; - } - if (self.seeking || self.buffering) { - return nil; - } - if (self.paused && self.videoFrameTimeClock > 0) { - return nil; - } - if (self.audioEnable && self.audioFrameTimeClock < 0 && self.videoFrameTimeClock > 0) { - return nil; - } - if (self.videoDecoder.empty) { - return nil; - } - - NSTimeInterval timeInterval = [NSDate date].timeIntervalSince1970; - SGFFVideoFrame * videoFrame = nil; - if (self.formatContext.audioEnable) - { - if (self.videoFrameTimeClock < 0) { - videoFrame = [self.videoDecoder getFrameAsync]; - } else { - NSTimeInterval audioTimeClock = self.audioFrameTimeClock; - NSTimeInterval audioTimeClockDelta = timeInterval - audioTimeClock; - NSTimeInterval audioPositionReal = self.audioFramePosition + audioTimeClockDelta; - NSTimeInterval currentStop = currentPostion + currentDuration; - - if (currentStop <= audioPositionReal) { - videoFrame = [self.videoDecoder getFrameAsyncPosistion:currentPostion]; - } - } - } - else if (self.formatContext.videoEnable) - { - if (self.videoFrameTimeClock < 0 || timeInterval >= self.videoFrameTimeClock + self.videoFrameDuration) { - videoFrame = [self.videoDecoder getFrameAsync]; - } - } - if (videoFrame) { - self.videoFrameTimeClock = timeInterval; - self.videoFramePosition = videoFrame.position; - self.videoFrameDuration = videoFrame.duration; - [self updateProgressByVideo]; - if (self.endOfFile) { - [self updateBufferedDurationByVideo]; - } - } - return videoFrame; -} - -#pragma mark - close stream - -- (void)closeFile -{ - [self closeFileAsync:YES]; -} - -- (void)closeFileAsync:(BOOL)async -{ - if (!self.closed) { - self.closed = YES; - [self.videoDecoder destroy]; - [self.audioDecoder destroy]; - if (async) { - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [self.ffmpegOperationQueue cancelAllOperations]; - [self.ffmpegOperationQueue waitUntilAllOperationsAreFinished]; - [self closePropertyValue]; - [self.formatContext destroy]; - [self closeOperation]; - }); - } else { - [self.ffmpegOperationQueue cancelAllOperations]; - [self.ffmpegOperationQueue waitUntilAllOperationsAreFinished]; - [self closePropertyValue]; - [self.formatContext destroy]; - [self closeOperation]; - } - } -} - -- (void)closePropertyValue -{ - self.seeking = NO; - self.buffering = NO; - self.paused = NO; - self.prepareToDecode = NO; - self.endOfFile = NO; - self.playbackFinished = NO; - [self cleanAudioFrame]; - [self cleanVideoFrame]; - self.videoDecoder.paused = NO; - self.videoDecoder.endOfFile = NO; - self.selectAudioTrack = NO; - self.selectAudioTrackIndex = 0; -} - -- (void)closeOperation -{ - self.readPacketOperation = nil; - self.openFileOperation = nil; - self.decodeFrameOperation = nil; - self.ffmpegOperationQueue = nil; -} - -- (void)cleanAudioFrame -{ - self.audioFrameTimeClock = -1; - self.audioFramePosition = -1; - self.audioFrameDuration = -1; -} - -- (void)cleanVideoFrame -{ - self.videoFrameTimeClock = -1; - self.videoFramePosition = -1; - self.videoFrameDuration = -1; -} - -#pragma mark - setter/getter - -- (void)setProgress:(NSTimeInterval)progress -{ - if (_progress != progress) { - _progress = progress; - if ([self.delegate respondsToSelector:@selector(decoder:didChangeValueOfProgress:)]) { - [self.delegate decoder:self didChangeValueOfProgress:_progress]; - } - } -} - -- (void)setBuffering:(BOOL)buffering -{ - if (_buffering != buffering) { - _buffering = buffering; - if ([self.delegate respondsToSelector:@selector(decoder:didChangeValueOfBuffering:)]) { - [self.delegate decoder:self didChangeValueOfBuffering:_buffering]; - } - } -} - -- (void)setPlaybackFinished:(BOOL)playbackFinished -{ - if (_playbackFinished != playbackFinished) { - _playbackFinished = playbackFinished; - if (_playbackFinished) { - self.progress = self.duration; - if ([self.delegate respondsToSelector:@selector(decoderDidPlaybackFinished:)]) { - [self.delegate decoderDidPlaybackFinished:self]; - } - } - } -} - -- (void)setBufferedDuration:(NSTimeInterval)bufferedDuration -{ - if (_bufferedDuration != bufferedDuration) { - _bufferedDuration = bufferedDuration; - if (_bufferedDuration <= 0.000001) { - _bufferedDuration = 0; - } - if ([self.delegate respondsToSelector:@selector(decoder:didChangeValueOfBufferedDuration:)]) { - [self.delegate decoder:self didChangeValueOfBufferedDuration:_bufferedDuration]; - } - if (_bufferedDuration <= 0 && self.endOfFile) { - self.playbackFinished = YES; - } - [self checkBufferingStatus]; - } -} - -- (NSDictionary *)metadata -{ - return self.formatContext.metadata; -} - -- (NSTimeInterval)duration -{ - return self.formatContext.duration; -} - -- (NSTimeInterval)bitrate -{ - return self.formatContext.bitrate; -} - -- (BOOL)seekEnable -{ - return self.formatContext.seekEnable; -} - -- (CGSize)presentationSize -{ - return self.formatContext.videoPresentationSize; -} - -- (CGFloat)aspect -{ - return self.formatContext.videoAspect; -} - -- (BOOL)videoDecodeOnMainThread -{ - return self.videoDecoder.decodeOnMainThread; -} - -#pragma mark - delegate callback - -- (void)checkBufferingStatus -{ - if (self.buffering) { - if (self.bufferedDuration >= self.minBufferedDruation || self.endOfFile) { - self.buffering = NO; - } - } else { - if (self.bufferedDuration <= 0.2 && !self.endOfFile) { - self.buffering = YES; - } - } -} - -- (void)updateBufferedDurationByVideo -{ - if (!self.formatContext.audioEnable) { - self.bufferedDuration = self.videoDecoder.duration; - } -} - -- (void)updateBufferedDurationByAudio -{ - if (self.formatContext.audioEnable) { - self.bufferedDuration = self.audioDecoder.duration; - } -} - -- (void)updateProgressByVideo; -{ - if (!self.formatContext.audioEnable && self.formatContext.videoEnable) { - if (self.videoFramePosition > 0) { - self.progress = self.videoFramePosition; - } else { - self.progress = 0; - } - } -} - -- (void)updateProgressByAudio -{ - if (self.formatContext.audioEnable) { - if (self.audioFramePosition > 0) { - self.progress = self.audioFramePosition; - } else { - self.progress = 0; - } - } -} - -- (void)delegateErrorCallback -{ - if (self.error) { - if ([self.delegate respondsToSelector:@selector(decoder:didError:)]) { - [self.delegate decoder:self didError:self.error]; - } - } -} - -- (void)dealloc -{ - [self closeFileAsync:NO]; - SGPlayerLog(@"SGFFDecoder release"); -} - - -#pragma delegate callback - -- (BOOL)formatContextNeedInterrupt:(SGFFFormatContext *)formatContext -{ - return self.closed; -} - -- (void)audioDecoder:(SGFFAudioDecoder *)audioDecoder samplingRate:(Float64 *)samplingRate -{ - if ([self.audioOutputConfig respondsToSelector:@selector(decoderAudioOutputConfigGetSamplingRate)]) { - * samplingRate = [self.audioOutputConfig decoderAudioOutputConfigGetSamplingRate]; - } -} - -- (void)audioDecoder:(SGFFAudioDecoder *)audioDecoder channelCount:(UInt32 *)channelCount -{ - if ([self.audioOutputConfig respondsToSelector:@selector(decoderAudioOutputConfigGetNumberOfChannels)]) { - * channelCount = [self.audioOutputConfig decoderAudioOutputConfigGetNumberOfChannels]; - } -} - -- (void)videoDecoder:(SGFFVideoDecoder *)videoDecoder didError:(NSError *)error -{ - self.error = error; - [self delegateErrorCallback]; -} - -- (void)videoDecoder:(SGFFVideoDecoder *)videoDecoder didChangePreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond -{ - if ([self.videoOutputConfig respondsToSelector:@selector(decoderVideoOutputConfigDidUpdateMaxPreferredFramesPerSecond:)]) { - [self.videoOutputConfig decoderVideoOutputConfigDidUpdateMaxPreferredFramesPerSecond:preferredFramesPerSecond]; - } -} - - -#pragma mark - track info - -- (BOOL)videoEnable -{ - return self.formatContext.videoEnable; -} - -- (BOOL)audioEnable -{ - return self.formatContext.audioEnable; -} - -- (SGFFTrack *)videoTrack -{ - return self.formatContext.videoTrack; -} - -- (SGFFTrack *)audioTrack -{ - return self.formatContext.audioTrack; -} - -- (NSArray *)videoTracks -{ - return self.formatContext.videoTracks; -} - -- (NSArray *)audioTracks -{ - return self.formatContext.audioTracks; -} - -- (void)selectAudioTrackIndex:(int)audioTrackIndex -{ - if (self.formatContext.audioTrack.index == audioTrackIndex) return; - if (![self.formatContext containAudioTrack:audioTrackIndex]) return; - self.selectAudioTrack = YES; - self.selectAudioTrackIndex = audioTrackIndex; - if (self.endOfFile) { - [self setupReadPacketOperation]; - } -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.h deleted file mode 100644 index a3d6dd0e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.h +++ /dev/null @@ -1,72 +0,0 @@ -// -// SGFFFormatContext.h -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import -#import "SGFFVideoFrame.h" -#import "SGFFTrack.h" - -@class SGFFFormatContext; - -@protocol SGFFFormatContextDelegate - -- (BOOL)formatContextNeedInterrupt:(SGFFFormatContext *)formatContext; - -@end - -@interface SGFFFormatContext : NSObject - -{ -@public - AVFormatContext * _format_context; - AVCodecContext * _video_codec_context; - AVCodecContext * _audio_codec_context; -} - -+ (instancetype)formatContextWithContentURL:(NSURL *)contentURL delegate:(id )delegate; - -@property (nonatomic, weak) id delegate; - -@property (nonatomic, copy, readonly) NSError * error; - -@property (nonatomic, copy, readonly) NSDictionary * metadata; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval duration; - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGFFTrack * videoTrack; -@property (nonatomic, strong, readonly) SGFFTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -@property (nonatomic, assign, readonly) NSTimeInterval videoTimebase; -@property (nonatomic, assign, readonly) NSTimeInterval videoFPS; -@property (nonatomic, assign, readonly) CGSize videoPresentationSize; -@property (nonatomic, assign, readonly) CGFloat videoAspect; -@property (nonatomic, assign, readonly) SGFFVideoFrameRotateType videoFrameRotateType; - -@property (nonatomic, assign, readonly) NSTimeInterval audioTimebase; - -@property (nonatomic, strong) NSDictionary * formatContextOptions; -@property (nonatomic, strong) NSDictionary * codecContextOptions; - -- (void)setupSync; -- (void)destroy; - -- (BOOL)seekEnable; -- (void)seekFileWithFFTimebase:(NSTimeInterval)time; - -- (int)readFrame:(AVPacket *)packet; - -- (BOOL)containAudioTrack:(int)audioTrackIndex; -- (NSError *)selectAudioTrackIndex:(int)audioTrackIndex; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.m deleted file mode 100644 index 35901932..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFormatContext.m +++ /dev/null @@ -1,479 +0,0 @@ -// -// SGFFFormatContext.m -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFFormatContext.h" -#import "SGFFTools.h" - -static int ffmpeg_interrupt_callback(void *ctx) -{ - SGFFFormatContext * obj = (__bridge SGFFFormatContext *)ctx; - return [obj.delegate formatContextNeedInterrupt:obj]; -} - -@interface SGFFFormatContext () - -@property (nonatomic, copy) NSURL * contentURL; - -@property (nonatomic, copy) NSError * error; -@property (nonatomic, copy) NSDictionary * metadata; - -@property (nonatomic, assign) BOOL videoEnable; -@property (nonatomic, assign) BOOL audioEnable; - -@property (nonatomic, strong) SGFFTrack * videoTrack; -@property (nonatomic, strong) SGFFTrack * audioTrack; - -@property (nonatomic, strong) NSArray * videoTracks; -@property (nonatomic, strong) NSArray * audioTracks; - -@property (nonatomic, assign) NSTimeInterval videoTimebase; -@property (nonatomic, assign) NSTimeInterval videoFPS; -@property (nonatomic, assign) CGSize videoPresentationSize; -@property (nonatomic, assign) CGFloat videoAspect; - -@property (nonatomic, assign) NSTimeInterval audioTimebase; - -@end - -@implementation SGFFFormatContext - -+ (instancetype)formatContextWithContentURL:(NSURL *)contentURL delegate:(id)delegate -{ - return [[self alloc] initWithContentURL:contentURL delegate:delegate]; -} - -- (instancetype)initWithContentURL:(NSURL *)contentURL delegate:(id)delegate -{ - if (self = [super init]) - { - self.contentURL = contentURL; - self.delegate = delegate; - } - return self; -} - -- (void)setupSync -{ - self.error = [self openStream]; - if (self.error) - { - return; - } - - [self openTracks]; - NSError * videoError = [self openVideoTrack]; - NSError * audioError = [self openAutioTrack]; - - if (videoError && audioError) - { - if (videoError.code == SGFFDecoderErrorCodeStreamNotFound && audioError.code != SGFFDecoderErrorCodeStreamNotFound) - { - self.error = audioError; - } - else - { - self.error = videoError; - } - return; - } -} - -- (NSError *)openStream -{ - int reslut = 0; - NSError * error = nil; - - self->_format_context = avformat_alloc_context(); - if (!_format_context) - { - reslut = -1; - error = [NSError errorWithDomain:@"SGFFDecoderErrorCodeFormatCreate error" code:SGFFDecoderErrorCodeFormatCreate userInfo:nil]; - return error; - } - - _format_context->interrupt_callback.callback = ffmpeg_interrupt_callback; - _format_context->interrupt_callback.opaque = (__bridge void *)self; - - AVDictionary * options = SGFFFFmpegBrigeOfNSDictionary(self.formatContextOptions); - - // options filter. - NSString * URLString = [self contentURLString]; - NSString * lowercaseURLString = [URLString lowercaseString]; - if ([lowercaseURLString hasPrefix:@"rtmp"] || [lowercaseURLString hasPrefix:@"rtsp"]) { - av_dict_set(&options, "timeout", NULL, 0); - } - - reslut = avformat_open_input(&_format_context, URLString.UTF8String, NULL, &options); - if (options) { - av_dict_free(&options); - } - error = SGFFCheckErrorCode(reslut, SGFFDecoderErrorCodeFormatOpenInput); - if (error || !_format_context) - { - if (_format_context) - { - avformat_free_context(_format_context); - } - return error; - } - - reslut = avformat_find_stream_info(_format_context, NULL); - error = SGFFCheckErrorCode(reslut, SGFFDecoderErrorCodeFormatFindStreamInfo); - if (error || !_format_context) - { - if (_format_context) - { - avformat_close_input(&_format_context); - } - return error; - } - self.metadata = SGFFFoundationBrigeOfAVDictionary(_format_context->metadata); - - return error; -} - -- (void)openTracks -{ - NSMutableArray * videoTracks = [NSMutableArray array]; - NSMutableArray * audioTracks = [NSMutableArray array]; - - for (int i = 0; i < _format_context->nb_streams; i++) - { - AVStream * stream = _format_context->streams[i]; - switch (stream->codecpar->codec_type) - { - case AVMEDIA_TYPE_VIDEO: - { - SGFFTrack * track = [[SGFFTrack alloc] init]; - track.type = SGFFTrackTypeVideo; - track.index = i; - track.metadata = [SGFFMetadata metadataWithAVDictionary:stream->metadata]; - [videoTracks addObject:track]; - } - break; - case AVMEDIA_TYPE_AUDIO: - { - SGFFTrack * track = [[SGFFTrack alloc] init]; - track.type = SGFFTrackTypeAudio; - track.index = i; - track.metadata = [SGFFMetadata metadataWithAVDictionary:stream->metadata]; - [audioTracks addObject:track]; - } - break; - default: - break; - } - } - - if (videoTracks.count > 0) - { - self.videoTracks = videoTracks; - } - if (audioTracks.count > 0) - { - self.audioTracks = audioTracks; - } -} - -- (NSError *)openVideoTrack -{ - NSError * error = nil; - - if (self.videoTracks.count > 0) - { - for (SGFFTrack * obj in self.videoTracks) - { - int index = obj.index; - if ((_format_context->streams[index]->disposition & AV_DISPOSITION_ATTACHED_PIC) == 0) - { - AVCodecContext * codec_context; - error = [self openStreamWithTrackIndex:index codecContext:&codec_context domain:@"video"]; - if (!error) - { - self.videoTrack = obj; - self.videoEnable = YES; - self.videoTimebase = SGFFStreamGetTimebase(_format_context->streams[index], 0.00004); - self.videoFPS = SGFFStreamGetFPS(_format_context->streams[index], self.videoTimebase); - self.videoPresentationSize = CGSizeMake(codec_context->width, codec_context->height); - self.videoAspect = (CGFloat)codec_context->width / (CGFloat)codec_context->height; - self->_video_codec_context = codec_context; - break; - } - } - } - } - else - { - error = [NSError errorWithDomain:@"video stream not found" code:SGFFDecoderErrorCodeStreamNotFound userInfo:nil]; - return error; - } - - return error; -} - -- (NSError *)openAutioTrack -{ - NSError * error = nil; - - if (self.audioTracks.count > 0) - { - for (SGFFTrack * obj in self.audioTracks) - { - int index = obj.index; - AVCodecContext * codec_context; - error = [self openStreamWithTrackIndex:index codecContext:&codec_context domain:@"audio"]; - if (!error) - { - self.audioTrack = obj; - self.audioEnable = YES; - self.audioTimebase = SGFFStreamGetTimebase(_format_context->streams[index], 0.000025); - self->_audio_codec_context = codec_context; - break; - } - } - } - else - { - error = [NSError errorWithDomain:@"audio stream not found" code:SGFFDecoderErrorCodeStreamNotFound userInfo:nil]; - return error; - } - - return error; -} - -- (NSError *)openStreamWithTrackIndex:(int)trackIndex codecContext:(AVCodecContext **)codecContext domain:(NSString *)domain -{ - int result = 0; - NSError * error = nil; - - AVStream * stream = _format_context->streams[trackIndex]; - AVCodecContext * codec_context = avcodec_alloc_context3(NULL); - if (!codec_context) - { - error = [NSError errorWithDomain:[NSString stringWithFormat:@"%@ codec context create error", domain] - code:SGFFDecoderErrorCodeCodecContextCreate - userInfo:nil]; - return error; - } - - result = avcodec_parameters_to_context(codec_context, stream->codecpar); - error = SGFFCheckErrorCode(result, SGFFDecoderErrorCodeCodecContextSetParam); - if (error) - { - avcodec_free_context(&codec_context); - return error; - } - av_codec_set_pkt_timebase(codec_context, stream->time_base); - - AVCodec * codec = avcodec_find_decoder(codec_context->codec_id); - if (!codec) - { - avcodec_free_context(&codec_context); - error = [NSError errorWithDomain:[NSString stringWithFormat:@"%@ codec not found decoder", domain] - code:SGFFDecoderErrorCodeCodecFindDecoder - userInfo:nil]; - return error; - } - codec_context->codec_id = codec->id; - - AVDictionary * options = SGFFFFmpegBrigeOfNSDictionary(self.codecContextOptions); - if (!av_dict_get(options, "threads", NULL, 0)) { - av_dict_set(&options, "threads", "auto", 0); - } - if (codec_context->codec_type == AVMEDIA_TYPE_VIDEO || codec_context->codec_type == AVMEDIA_TYPE_AUDIO) { - av_dict_set(&options, "refcounted_frames", "1", 0); - } - result = avcodec_open2(codec_context, codec, &options); - error = SGFFCheckErrorCode(result, SGFFDecoderErrorCodeCodecOpen2); - if (error) - { - avcodec_free_context(&codec_context); - return error; - } - - * codecContext = codec_context; - return error; -} - -- (void)seekFileWithFFTimebase:(NSTimeInterval)time -{ - int64_t ts = time * AV_TIME_BASE; - av_seek_frame(self->_format_context, -1, ts, AVSEEK_FLAG_BACKWARD); -} - -- (void)seekFileWithVideo:(NSTimeInterval)time -{ - if (self.videoEnable) - { - int64_t ts = time * 1000.0 / self.videoTimebase; - av_seek_frame(self->_format_context, -1, ts, AVSEEK_FLAG_BACKWARD); - } - else - { - [self seekFileWithFFTimebase:time]; - } -} - -- (void)seekFileWithAudio:(NSTimeInterval)time -{ - if (self.audioTimebase) - { - int64_t ts = time * 1000 / self.audioTimebase; - av_seek_frame(self->_format_context, -1, ts, AVSEEK_FLAG_BACKWARD); - } - else - { - [self seekFileWithFFTimebase:time]; - } -} - -- (int)readFrame:(AVPacket *)packet -{ - return av_read_frame(self->_format_context, packet); -} - -- (BOOL)containAudioTrack:(int)audioTrackIndex -{ - for (SGFFTrack * obj in self.audioTracks) { - if (obj.index == audioTrackIndex) { - return YES; - } - } - return NO; -} - -- (NSError * )selectAudioTrackIndex:(int)audioTrackIndex -{ - if (audioTrackIndex == self.audioTrack.index) return nil; - if (![self containAudioTrack:audioTrackIndex]) return nil; - - AVCodecContext * codec_context; - NSError * error = [self openStreamWithTrackIndex:audioTrackIndex codecContext:&codec_context domain:@"audio select"]; - if (!error) - { - if (_audio_codec_context) - { - avcodec_close(_audio_codec_context); - _audio_codec_context = NULL; - } - for (SGFFTrack * obj in self.audioTracks) - { - if (obj.index == audioTrackIndex) - { - self.audioTrack = obj; - } - } - self.audioEnable = YES; - self.audioTimebase = SGFFStreamGetTimebase(_format_context->streams[audioTrackIndex], 0.000025); - self->_audio_codec_context = codec_context; - } - else - { - SGPlayerLog(@"select audio track error : %@", error); - } - return error; -} - -- (NSTimeInterval)duration -{ - if (!self->_format_context) return 0; - int64_t duration = self->_format_context->duration; - if (duration < 0) { - return 0; - } - return (NSTimeInterval)duration / AV_TIME_BASE; -} - -- (BOOL)seekEnable -{ - if (!self->_format_context) return NO; - BOOL ioSeekAble = YES; - if (self->_format_context->pb) { - ioSeekAble = self->_format_context->pb->seekable; - } - if (ioSeekAble && self.duration > 0) { - return YES; - } - return NO; -} - -- (NSTimeInterval)bitrate -{ - if (!self->_format_context) return 0; - return (self->_format_context->bit_rate / 1000.0f); -} - -- (NSString *)contentURLString -{ - if ([self.contentURL isFileURL]) - { - return [self.contentURL path]; - } - else - { - return [self.contentURL absoluteString]; - } -} - -- (SGFFVideoFrameRotateType)videoFrameRotateType -{ - int rotate = [[self.videoTrack.metadata.metadata objectForKey:@"rotate"] intValue]; - if (rotate == 90) { - return SGFFVideoFrameRotateType90; - } else if (rotate == 180) { - return SGFFVideoFrameRotateType180; - } else if (rotate == 270) { - return SGFFVideoFrameRotateType270; - } - return SGFFVideoFrameRotateType0; -} - -- (void)destroyAudioTrack -{ - self.audioEnable = NO; - self.audioTrack = nil; - self.audioTracks = nil; - - if (_audio_codec_context) - { - avcodec_close(_audio_codec_context); - _audio_codec_context = NULL; - } -} - -- (void)destroyVideoTrack -{ - self.videoEnable = NO; - self.videoTrack = nil; - self.videoTracks = nil; - - if (_video_codec_context) - { - avcodec_close(_video_codec_context); - _video_codec_context = NULL; - } -} - -- (void)destroy -{ - [self destroyVideoTrack]; - [self destroyAudioTrack]; - if (_format_context) - { - avformat_close_input(&_format_context); - _format_context = NULL; - } -} - -- (void)dealloc -{ - [self destroy]; - SGPlayerLog(@"SGFFFormatContext release"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.h deleted file mode 100644 index 838f08c1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// SGFFFrame.h -// SGPlayer -// -// Created by Single on 06/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, SGFFFrameType) { - SGFFFrameTypeVideo, - SGFFFrameTypeAVYUVVideo, - SGFFFrameTypeCVYUVVideo, - SGFFFrameTypeAudio, - SGFFFrameTypeSubtitle, - SGFFFrameTypeArtwork, -}; - -@class SGFFFrame; - -@protocol SGFFFrameDelegate - -- (void)frameDidStartPlaying:(SGFFFrame *)frame; -- (void)frameDidStopPlaying:(SGFFFrame *)frame; -- (void)frameDidCancel:(SGFFFrame *)frame; - -@end - -@interface SGFFFrame : NSObject - -@property (nonatomic, weak) id delegate; -@property (nonatomic, assign, readonly) BOOL playing; - -@property (nonatomic, assign) SGFFFrameType type; -@property (nonatomic, assign) NSTimeInterval position; -@property (nonatomic, assign) NSTimeInterval duration; -@property (nonatomic, assign, readonly) int size; -@property (nonatomic, assign) int packetSize; - -- (void)startPlaying; -- (void)stopPlaying; -- (void)cancel; - -@end - - -@interface SGFFSubtileFrame : SGFFFrame - -@end - - -@interface SGFFArtworkFrame : SGFFFrame - -@property (nonatomic, strong) NSData * picture; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.m deleted file mode 100644 index daa92f15..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrame.m +++ /dev/null @@ -1,58 +0,0 @@ -// -// SGFFFrame.m -// SGPlayer -// -// Created by Single on 06/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFFrame.h" -#import "SGFFTools.h" - -@implementation SGFFFrame - -- (void)startPlaying -{ - self->_playing = YES; - if ([self.delegate respondsToSelector:@selector(frameDidStartPlaying:)]) { - [self.delegate frameDidStartPlaying:self]; - } -} - -- (void)stopPlaying -{ - self->_playing = NO; - if ([self.delegate respondsToSelector:@selector(frameDidStopPlaying:)]) { - [self.delegate frameDidStopPlaying:self]; - } -} - -- (void)cancel -{ - self->_playing = NO; - if ([self.delegate respondsToSelector:@selector(frameDidCancel:)]) { - [self.delegate frameDidCancel:self]; - } -} - -@end - - -@implementation SGFFSubtileFrame - -- (SGFFFrameType)type -{ - return SGFFFrameTypeSubtitle; -} - -@end - - -@implementation SGFFArtworkFrame - -- (SGFFFrameType)type -{ - return SGFFFrameTypeArtwork; -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.h deleted file mode 100644 index 66c020a9..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// SGFFFramePool.h -// SGPlayer -// -// Created by Single on 2017/3/3. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFFrame.h" - -@interface SGFFFramePool : NSObject - -+ (instancetype)videoPool; -+ (instancetype)audioPool; -+ (instancetype)poolWithCapacity:(NSUInteger)number frameClassName:(Class)frameClassName; - -- (NSUInteger)count; -- (NSUInteger)unuseCount; -- (NSUInteger)usedCount; - -- (__kindof SGFFFrame *)getUnuseFrame; - -- (void)flush; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.m deleted file mode 100644 index 9856d851..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFramePool.m +++ /dev/null @@ -1,162 +0,0 @@ -// -// SGFFFramePool.m -// SGPlayer -// -// Created by Single on 2017/3/3. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFFramePool.h" -#import "SGPlayerMacro.h" - -@interface SGFFFramePool () - -@property (nonatomic, copy) Class frameClassName; -@property (nonatomic, strong) NSLock * lock; -@property (nonatomic, strong) SGFFFrame * playingFrame; -@property (nonatomic, strong) NSMutableSet * unuseFrames; -@property (nonatomic, strong) NSMutableSet * usedFrames; - -@end - -@implementation SGFFFramePool - -+ (instancetype)videoPool -{ - return [self poolWithCapacity:60 frameClassName:NSClassFromString(@"SGFFAVYUVVideoFrame")]; -} - -+ (instancetype)audioPool -{ - return [self poolWithCapacity:500 frameClassName:NSClassFromString(@"SGFFAudioFrame")]; -} - -+ (instancetype)poolWithCapacity:(NSUInteger)number frameClassName:(Class)frameClassName -{ - return [[self alloc] initWithCapacity:number frameClassName:frameClassName]; -} - -- (instancetype)initWithCapacity:(NSUInteger)number frameClassName:(Class)frameClassName -{ - if (self = [super init]) { - self.frameClassName = frameClassName; - self.lock = [[NSLock alloc] init]; - self.unuseFrames = [NSMutableSet setWithCapacity:number]; - self.usedFrames = [NSMutableSet setWithCapacity:number]; - } - return self; -} - -- (NSUInteger)count -{ - return [self unuseCount] + [self usedCount] + (self.playingFrame ? 1 : 0); -} - -- (NSUInteger)unuseCount -{ - return self.unuseFrames.count; -} - -- (NSUInteger)usedCount -{ - return self.usedFrames.count; -} - -- (__kindof SGFFFrame *)getUnuseFrame -{ - [self.lock lock]; - SGFFFrame * frame; - if (self.unuseFrames.count > 0) { - frame = [self.unuseFrames anyObject]; - [self.unuseFrames removeObject:frame]; - [self.usedFrames addObject:frame]; - - } else { - frame = [[self.frameClassName alloc] init]; - frame.delegate = self; - [self.usedFrames addObject:frame]; - } - [self.lock unlock]; - return frame; -} - -- (void)setFrameUnuse:(SGFFFrame *)frame -{ - if (!frame) return; - if (![frame isKindOfClass:self.frameClassName]) return; - [self.lock lock]; - [self.unuseFrames addObject:frame]; - [self.usedFrames removeObject:frame]; - [self.lock unlock]; -} - -- (void)setFramesUnuse:(NSArray *)frames -{ - if (frames.count <= 0) return; - [self.lock lock]; - for (SGFFFrame * obj in frames) { - if (![obj isKindOfClass:self.frameClassName]) continue; - [self.usedFrames removeObject:obj]; - [self.unuseFrames addObject:obj]; - } - [self.lock unlock]; -} - -- (void)setFrameStartDrawing:(SGFFFrame *)frame -{ - if (!frame) return; - if (![frame isKindOfClass:self.frameClassName]) return; - [self.lock lock]; - if (self.playingFrame) { - [self.unuseFrames addObject:self.playingFrame]; - } - self.playingFrame = frame; - [self.usedFrames removeObject:self.playingFrame]; - [self.lock unlock]; -} - -- (void)setFrameStopDrawing:(SGFFFrame *)frame -{ - if (!frame) return; - if (![frame isKindOfClass:self.frameClassName]) return; - [self.lock lock]; - if (self.playingFrame == frame) { - [self.unuseFrames addObject:self.playingFrame]; - self.playingFrame = nil; - } - [self.lock unlock]; -} - -- (void)flush -{ - [self.lock lock]; - [self.usedFrames enumerateObjectsUsingBlock:^(SGFFFrame * _Nonnull obj, BOOL * _Nonnull stop) { - [self.unuseFrames addObject:obj]; - }]; - [self.usedFrames removeAllObjects]; - [self.lock unlock]; -} - -#pragma mark - SGFFFrameDelegate - -- (void)frameDidStartPlaying:(SGFFFrame *)frame -{ - [self setFrameStartDrawing:frame]; -} - -- (void)frameDidStopPlaying:(SGFFFrame *)frame -{ - [self setFrameStopDrawing:frame]; -} - -- (void)frameDidCancel:(SGFFFrame *)frame -{ - [self setFrameUnuse:frame]; -} - -- (void)dealloc -{ - SGPlayerLog(@"SGFFFramePool release"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.h deleted file mode 100644 index d0636ac8..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// SGFFFrameQueue.h -// SGPlayer -// -// Created by Single on 18/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGFFFrame.h" - -@interface SGFFFrameQueue : NSObject - -+ (instancetype)frameQueue; - -+ (NSTimeInterval)maxVideoDuration; - -+ (NSTimeInterval)sleepTimeIntervalForFull; -+ (NSTimeInterval)sleepTimeIntervalForFullAndPaused; - -@property (nonatomic, assign, readonly) int size; -@property (nonatomic, assign, readonly) int packetSize; -@property (nonatomic, assign, readonly) NSUInteger count; -@property (atomic, assign, readonly) NSTimeInterval duration; - -@property (nonatomic, assign) NSUInteger minFrameCountForGet; // default is 1. -@property (nonatomic, assign) BOOL ignoreMinFrameCountForGetLimit; - -- (void)putFrame:(__kindof SGFFFrame *)frame; -- (void)putSortFrame:(__kindof SGFFFrame *)frame; -- (__kindof SGFFFrame *)getFrameSync; -- (__kindof SGFFFrame *)getFrameAsync; -- (__kindof SGFFFrame *)getFrameAsyncPosistion:(NSTimeInterval)position discardFrames:(NSMutableArray <__kindof SGFFFrame *> **)discardFrames; -- (NSTimeInterval)getFirstFramePositionAsync; -- (NSMutableArray <__kindof SGFFFrame *> *)discardFrameBeforPosition:(NSTimeInterval)position; - -- (void)flush; -- (void)destroy; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.m deleted file mode 100644 index 477347dc..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFFrameQueue.m +++ /dev/null @@ -1,294 +0,0 @@ -// -// SGFFFrameQueue.m -// SGPlayer -// -// Created by Single on 18/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFFrameQueue.h" - -@interface SGFFFrameQueue () - -@property (nonatomic, assign) int size; -@property (nonatomic, assign) int packetSize; -@property (nonatomic, assign) NSUInteger count; -@property (atomic, assign) NSTimeInterval duration; - -@property (nonatomic, strong) NSCondition * condition; -@property (nonatomic, strong) NSMutableArray <__kindof SGFFFrame *> * frames; - -@property (nonatomic, assign) BOOL destoryToken; - -@end - -@implementation SGFFFrameQueue - -+ (instancetype)frameQueue -{ - return [[self alloc] init]; -} - -- (instancetype)init -{ - if (self = [super init]) { - self.frames = [NSMutableArray array]; - self.condition = [[NSCondition alloc] init]; - self.minFrameCountForGet = 1; - self.ignoreMinFrameCountForGetLimit = NO; - } - return self; -} - -- (void)putFrame:(__kindof SGFFFrame *)frame -{ - if (!frame) return; - [self.condition lock]; - if (self.destoryToken) { - [self.condition unlock]; - return; - } - [self.frames addObject:frame]; - self.duration += frame.duration; - self.size += frame.size; - self.packetSize += frame.packetSize; - [self.condition signal]; - [self.condition unlock]; -} - -- (void)putSortFrame:(__kindof SGFFFrame *)frame -{ - if (!frame) return; - [self.condition lock]; - if (self.destoryToken) { - [self.condition unlock]; - return; - } - BOOL added = NO; - if (self.frames.count > 0) { - for (int i = (int)self.frames.count - 1; i >= 0; i--) { - SGFFFrame * obj = [self.frames objectAtIndex:i]; - if (frame.position > obj.position) { - [self.frames insertObject:frame atIndex:i + 1]; - added = YES; - break; - } - } - } - if (!added) { - [self.frames addObject:frame]; - added = YES; - } - self.duration += frame.duration; - self.size += frame.size; - self.packetSize += frame.packetSize; - [self.condition signal]; - [self.condition unlock]; -} - -- (__kindof SGFFFrame *)getFrameSync -{ - [self.condition lock]; - while (self.frames.count < self.minFrameCountForGet && !(self.ignoreMinFrameCountForGetLimit && self.frames.firstObject)) { - if (self.destoryToken) { - [self.condition unlock]; - return nil; - } - [self.condition wait]; - } - SGFFFrame * frame = self.frames.firstObject; - [self.frames removeObjectAtIndex:0]; - self.duration -= frame.duration; - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - self.size -= frame.size; - if (self.size <= 0 || self.count <= 0) { - self.size = 0; - } - self.packetSize -= frame.packetSize; - if (self.packetSize <= 0 || self.count <= 0) { - self.packetSize = 0; - } - [self.condition unlock]; - return frame; -} - -- (__kindof SGFFFrame *)getFrameAsync -{ - [self.condition lock]; - if (self.destoryToken || self.frames.count <= 0) { - [self.condition unlock]; - return nil; - } - if (!self.ignoreMinFrameCountForGetLimit && self.frames.count < self.minFrameCountForGet) { - [self.condition unlock]; - return nil; - } - SGFFFrame * frame = self.frames.firstObject; - [self.frames removeObjectAtIndex:0]; - self.duration -= frame.duration; - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - self.size -= frame.size; - if (self.size <= 0 || self.count <= 0) { - self.size = 0; - } - self.packetSize -= frame.packetSize; - if (self.packetSize <= 0 || self.count <= 0) { - self.packetSize = 0; - } - [self.condition unlock]; - return frame; -} - -- (__kindof SGFFFrame *)getFrameAsyncPosistion:(NSTimeInterval)position discardFrames:(NSMutableArray <__kindof SGFFFrame *> **)discardFrames -{ - [self.condition lock]; - if (self.destoryToken || self.frames.count <= 0) { - [self.condition unlock]; - return nil; - } - if (!self.ignoreMinFrameCountForGetLimit && self.frames.count < self.minFrameCountForGet) { - [self.condition unlock]; - return nil; - } - SGFFFrame * frame = nil; - NSMutableArray * temp = [NSMutableArray array]; - for (SGFFFrame * obj in self.frames) { - if (obj.position + obj.duration < position) { - [temp addObject:obj]; - self.duration -= obj.duration; - self.size -= obj.size; - self.packetSize -= obj.packetSize; - } else { - break; - } - } - if (temp.count > 0) { - frame = temp.lastObject; - [self.frames removeObjectsInArray:temp]; - [temp removeObject:frame]; - if (temp.count > 0) { - * discardFrames = temp; - } - } else { - frame = self.frames.firstObject; - [self.frames removeObject:frame]; - self.duration -= frame.duration; - self.size -= frame.size; - self.packetSize -= frame.packetSize; - } - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - if (self.size <= 0 || self.count <= 0) { - self.size = 0; - } - if (self.packetSize <= 0 || self.count <= 0) { - self.packetSize = 0; - } - [self.condition unlock]; - return frame; -} - -- (NSTimeInterval)getFirstFramePositionAsync -{ - [self.condition lock]; - if (self.destoryToken || self.frames.count <= 0) { - [self.condition unlock]; - return -1; - } - if (!self.ignoreMinFrameCountForGetLimit && self.frames.count < self.minFrameCountForGet) { - [self.condition unlock]; - return -1; - } - NSTimeInterval time = self.frames.firstObject.position; - [self.condition unlock]; - return time; -} - -- (NSMutableArray <__kindof SGFFFrame *> *)discardFrameBeforPosition:(NSTimeInterval)position -{ - [self.condition lock]; - if (self.destoryToken || self.frames.count <= 0) { - [self.condition unlock]; - return nil; - } - if (!self.ignoreMinFrameCountForGetLimit && self.frames.count < self.minFrameCountForGet) { - [self.condition unlock]; - return nil; - } - NSMutableArray * temp = [NSMutableArray array]; - for (SGFFFrame * obj in self.frames) { - if (obj.position + obj.duration < position) { - [temp addObject:obj]; - self.duration -= obj.duration; - self.size -= obj.size; - self.packetSize -= obj.packetSize; - } else { - break; - } - } - if (temp.count > 0) { - [self.frames removeObjectsInArray:temp]; - } - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - if (self.size <= 0 || self.count <= 0) { - self.size = 0; - } - if (self.packetSize <= 0 || self.count <= 0) { - self.packetSize = 0; - } - [self.condition unlock]; - if (temp.count > 0) { - return temp; - } else { - return nil; - } -} - -- (void)flush -{ - [self.condition lock]; - [self.frames removeAllObjects]; - self.duration = 0; - self.size = 0; - self.packetSize = 0; - self.ignoreMinFrameCountForGetLimit = NO; - [self.condition unlock]; -} - -- (void)destroy -{ - [self flush]; - [self.condition lock]; - self.destoryToken = YES; - [self.condition broadcast]; - [self.condition unlock]; -} - -- (NSUInteger)count -{ - return self.frames.count; -} - -+ (NSTimeInterval)maxVideoDuration -{ - return 1.0; -} - -+ (NSTimeInterval)sleepTimeIntervalForFull -{ - return [self maxVideoDuration] / 2.0f; -} - -+ (NSTimeInterval)sleepTimeIntervalForFullAndPaused -{ - return [self maxVideoDuration] / 1.1f; -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.h deleted file mode 100644 index 4069a2e3..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SGFFMetadata.h -// SGPlayer -// -// Created by Single on 2017/3/6. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFTools.h" - -@interface SGFFMetadata : NSObject - -+ (instancetype)metadataWithAVDictionary:(AVDictionary *)avDictionary; - -@property (nonatomic, strong) NSDictionary * metadata; - -@property (nonatomic, copy) NSString * language; -@property (nonatomic, assign) long long BPS; -@property (nonatomic, copy) NSString * duration; -@property (nonatomic, assign) long long number_of_bytes; -@property (nonatomic, assign) long long number_of_frames; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.m deleted file mode 100644 index 24fa87a4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFMetadata.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// SGFFMetadata.m -// SGPlayer -// -// Created by Single on 2017/3/6. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFMetadata.h" - -@implementation SGFFMetadata - -+ (instancetype)metadataWithAVDictionary:(AVDictionary *)avDictionary -{ - return [[self alloc] initWithAVDictionary:avDictionary]; -} - -- (instancetype)initWithAVDictionary:(AVDictionary *)avDictionary -{ - if (self = [super init]) - { - NSDictionary * dic = SGFFFoundationBrigeOfAVDictionary(avDictionary); - - self.metadata = dic; - - self.language = [dic objectForKey:@"language"]; - self.BPS = [[dic objectForKey:@"BPS"] longLongValue]; - self.duration = [dic objectForKey:@"DURATION"]; - self.number_of_bytes = [[dic objectForKey:@"NUMBER_OF_BYTES"] longLongValue]; - self.number_of_frames = [[dic objectForKey:@"NUMBER_OF_FRAMES"] longLongValue]; - } - return self; -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.h deleted file mode 100644 index c5ac0b9a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// SGFFPacketQueue.h -// SGPlayer -// -// Created by Single on 18/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "avformat.h" - -@interface SGFFPacketQueue : NSObject - -+ (instancetype)packetQueueWithTimebase:(NSTimeInterval)timebase; - -@property (nonatomic, assign, readonly) NSUInteger count; -@property (nonatomic, assign, readonly) int size; -@property (atomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval timebase; - -- (void)putPacket:(AVPacket)packet duration:(NSTimeInterval)duration; -- (AVPacket)getPacketSync; -- (AVPacket)getPacketAsync; - -- (void)flush; -- (void)destroy; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.m deleted file mode 100644 index 12b46352..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFPacketQueue.m +++ /dev/null @@ -1,137 +0,0 @@ -// -// SGFFPacketQueue.m -// SGPlayer -// -// Created by Single on 18/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFPacketQueue.h" - -@interface SGFFPacketQueue () - -@property (nonatomic, assign) int size; -@property (atomic, assign) NSTimeInterval duration; -@property (nonatomic, assign) NSTimeInterval timebase; - -@property (nonatomic, strong) NSCondition * condition; -@property (nonatomic, strong) NSMutableArray * packets; - -@property (nonatomic, assign) BOOL destoryToken; - -@end - -@implementation SGFFPacketQueue - -+ (instancetype)packetQueueWithTimebase:(NSTimeInterval)timebase -{ - return [[self alloc] initWithTimebase:timebase]; -} - -- (instancetype)initWithTimebase:(NSTimeInterval)timebase -{ - if (self = [super init]) { - self.timebase = timebase; - self.packets = [NSMutableArray array]; - self.condition = [[NSCondition alloc] init]; - } - return self; -} - -- (void)putPacket:(AVPacket)packet duration:(NSTimeInterval)duration -{ - [self.condition lock]; - if (self.destoryToken) { - [self.condition unlock]; - return; - } - NSValue * value = [NSValue value:&packet withObjCType:@encode(AVPacket)]; - [self.packets addObject:value]; - self.size += packet.size; - if (packet.duration > 0) { - self.duration += packet.duration * self.timebase; - } else if (duration > 0) { - self.duration += duration; - } - [self.condition signal]; - [self.condition unlock]; -} - -- (AVPacket)getPacketSync -{ - [self.condition lock]; - AVPacket packet; - packet.stream_index = -2; - while (!self.packets.firstObject) { - if (self.destoryToken) { - [self.condition unlock]; - return packet; - } - [self.condition wait]; - } - [self.packets.firstObject getValue:&packet]; - [self.packets removeObjectAtIndex:0]; - self.size -= packet.size; - if (self.size < 0 || self.count <= 0) { - self.size = 0; - } - self.duration -= packet.duration * self.timebase; - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - [self.condition unlock]; - return packet; -} - -- (AVPacket)getPacketAsync -{ - [self.condition lock]; - AVPacket packet; - packet.stream_index = -2; - if (self.packets.count <= 0 || self.destoryToken) { - [self.condition unlock]; - return packet; - } - [self.packets.firstObject getValue:&packet]; - [self.packets removeObjectAtIndex:0]; - self.size -= packet.size; - if (self.size < 0 || self.count <= 0) { - self.size = 0; - } - self.duration -= packet.duration * self.timebase; - if (self.duration < 0 || self.count <= 0) { - self.duration = 0; - } - [self.condition unlock]; - return packet; -} - -- (void)flush -{ - [self.condition lock]; - for (NSValue * value in self.packets) { - AVPacket packet; - [value getValue:&packet]; - av_packet_unref(&packet); - } - [self.packets removeAllObjects]; - self.size = 0; - self.duration = 0; - [self.condition unlock]; -} - -- (void)destroy -{ - [self flush]; - [self.condition lock]; - self.destoryToken = YES; - [self.condition broadcast]; - [self.condition unlock]; -} - -- (NSUInteger)count -{ - return self.packets.count; -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.h deleted file mode 100644 index b74c4686..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.h +++ /dev/null @@ -1,93 +0,0 @@ -// -// SGFFTools.h -// SGPlayer -// -// Created by Single on 19/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGPlayerMacro.h" -#import "avformat.h" - -typedef NS_ENUM(NSUInteger, SGFFDecoderErrorCode) { - SGFFDecoderErrorCodeFormatCreate, - SGFFDecoderErrorCodeFormatOpenInput, - SGFFDecoderErrorCodeFormatFindStreamInfo, - SGFFDecoderErrorCodeStreamNotFound, - SGFFDecoderErrorCodeCodecContextCreate, - SGFFDecoderErrorCodeCodecContextSetParam, - SGFFDecoderErrorCodeCodecFindDecoder, - SGFFDecoderErrorCodeCodecVideoSendPacket, - SGFFDecoderErrorCodeCodecAudioSendPacket, - SGFFDecoderErrorCodeCodecVideoReceiveFrame, - SGFFDecoderErrorCodeCodecAudioReceiveFrame, - SGFFDecoderErrorCodeCodecOpen2, - SGFFDecoderErrorCodeAuidoSwrInit, -}; - -#pragma mark - Log Config - -#define SGFFFFmpegLogEnable 0 -#define SGFFSynLogEnable 0 -#define SGFFThreadLogEnable 0 -#define SGFFPacketLogEnable 0 -#define SGFFSleepLogEnable 0 -#define SGFFDecodeLogEnable 0 -#define SGFFErrorLogEnable 0 - -#if SGFFFFmpegLogEnable -#define SGFFFFmpegLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFFFmpegLog(...) -#endif - -#if SGFFSynLogEnable -#define SGFFSynLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFSynLog(...) -#endif - -#if SGFFThreadLogEnable -#define SGFFThreadLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFThreadLog(...) -#endif - -#if SGFFPacketLogEnable -#define SGFFPacketLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFPacketLog(...) -#endif - -#if SGFFSleepLogEnable -#define SGFFSleepLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFSleepLog(...) -#endif - -#if SGFFDecodeLogEnable -#define SGFFDecodeLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFDecodeLog(...) -#endif - -#if SGFFErrorLogEnable -#define SGFFErrorLog(...) NSLog(__VA_ARGS__) -#else -#define SGFFErrorLog(...) -#endif - - -#pragma mark - Util Function - -void SGFFLog(void * context, int level, const char * format, va_list args); - -NSError * SGFFCheckError(int result); -NSError * SGFFCheckErrorCode(int result, NSUInteger errorCode); - -double SGFFStreamGetTimebase(AVStream * stream, double default_timebase); -double SGFFStreamGetFPS(AVStream * stream, double timebase); - -NSDictionary * SGFFFoundationBrigeOfAVDictionary(AVDictionary * avDictionary); -AVDictionary * SGFFFFmpegBrigeOfNSDictionary(NSDictionary * dictionary); diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.m deleted file mode 100644 index e67553ae..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTools.m +++ /dev/null @@ -1,106 +0,0 @@ -// -// SGFFTools.m -// SGPlayer -// -// Created by Single on 19/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFFTools.h" -#import "SGFFDecoder.h" - -#pragma mark - Util Function - -void SGFFLog(void * context, int level, const char * format, va_list args) -{ -#if SGFFFFmpegLogEnable - NSString * message = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args]; - SGFFFFmpegLog(@"SGFFLog : %@", message); -#endif -} - -NSError * SGFFCheckError(int result) -{ - return SGFFCheckErrorCode(result, -1); -} - -NSError * SGFFCheckErrorCode(int result, NSUInteger errorCode) -{ - if (result < 0) { - char * error_string_buffer = malloc(256); - av_strerror(result, error_string_buffer, 256); - NSString * error_string = [NSString stringWithFormat:@"ffmpeg code : %d, ffmpeg msg : %s", result, error_string_buffer]; - NSError * error = [NSError errorWithDomain:error_string code:errorCode userInfo:nil]; - return error; - } - return nil; -} - -double SGFFStreamGetTimebase(AVStream * stream, double default_timebase) -{ - double timebase; - if (stream->time_base.den > 0 && stream->time_base.num > 0) { - timebase = av_q2d(stream->time_base); - } else { - timebase = default_timebase; - } - return timebase; -} - -double SGFFStreamGetFPS(AVStream * stream, double timebase) -{ - double fps; - if (stream->avg_frame_rate.den > 0 && stream->avg_frame_rate.num > 0) { - fps = av_q2d(stream->avg_frame_rate); - } else if (stream->r_frame_rate.den > 0 && stream->r_frame_rate.num > 0) { - fps = av_q2d(stream->r_frame_rate); - } else { - fps = 1.0 / timebase; - } - return fps; -} - -NSDictionary * SGFFFoundationBrigeOfAVDictionary(AVDictionary * avDictionary) -{ - if (avDictionary == NULL) return nil; - - int count = av_dict_count(avDictionary); - if (count <= 0) return nil; - - NSMutableDictionary * dictionary = [NSMutableDictionary dictionary]; - - AVDictionaryEntry * entry = NULL; - while ((entry = av_dict_get(avDictionary, "", entry, AV_DICT_IGNORE_SUFFIX))) { - @autoreleasepool { - NSString * key = [NSString stringWithUTF8String:entry->key]; - NSString * value = [NSString stringWithUTF8String:entry->value]; - [dictionary setObject:value forKey:key]; - } - } - - return dictionary; -} - -AVDictionary * SGFFFFmpegBrigeOfNSDictionary(NSDictionary * dictionary) -{ - if (dictionary.count <= 0) { - return NULL; - } - - __block BOOL success = NO; - __block AVDictionary * dict = NULL; - [dictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { - if ([obj isKindOfClass:[NSNumber class]]) { - av_dict_set_int(&dict, [key UTF8String], [obj integerValue], 0); - success = YES; - } else if ([obj isKindOfClass:[NSString class]]) { - av_dict_set(&dict, [key UTF8String], [obj UTF8String], 0); - success = YES; - } - }]; - if (success) { - return dict; - } - return NULL; -} - diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.h deleted file mode 100644 index 849fa855..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SGFFTrack.h -// SGPlayer -// -// Created by Single on 2017/3/6. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFMetadata.h" - -typedef NS_ENUM(NSUInteger, SGFFTrackType) { - SGFFTrackTypeVideo, - SGFFTrackTypeAudio, - SGFFTrackTypeSubtitle, -}; - -@interface SGFFTrack : NSObject - -@property (nonatomic, assign) int index; -@property (nonatomic, assign) SGFFTrackType type; -@property (nonatomic, strong) SGFFMetadata * metadata; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.m deleted file mode 100644 index b8e57343..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFTrack.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGFFTrack.m -// SGPlayer -// -// Created by Single on 2017/3/6. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFTrack.h" - -@implementation SGFFTrack - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.h deleted file mode 100644 index 83159df5..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// SGFFVideoDecoder.h -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFVideoFrame.h" -#import "avformat.h" - -@class SGFFVideoDecoder; - -@protocol SGFFVideoDecoderDlegate - -- (void)videoDecoder:(SGFFVideoDecoder *)videoDecoder didError:(NSError *)error; -- (void)videoDecoder:(SGFFVideoDecoder *)videoDecoder didChangePreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond; - -@end - -@interface SGFFVideoDecoder : NSObject - -+ (instancetype)decoderWithCodecContext:(AVCodecContext *)codec_context - timebase:(NSTimeInterval)timebase - fps:(NSTimeInterval)fps - codecContextAsync:(BOOL)codecContextAsync - videoToolBoxEnable:(BOOL)videoToolBoxEnable - rotateType:(SGFFVideoFrameRotateType)rotateType - delegate:(id )delegate; - -@property (nonatomic, weak) id delegate; -@property (nonatomic, strong, readonly) NSError * error; - -@property (nonatomic, assign, readonly) NSTimeInterval timebase; -@property (nonatomic, assign, readonly) NSTimeInterval fps; - -@property (nonatomic, assign, readonly) SGFFVideoFrameRotateType rotateType; - -@property (nonatomic, assign, readonly) BOOL videoToolBoxEnable; -@property (nonatomic, assign, readonly) BOOL videoToolBoxDidOpen; -@property (nonatomic, assign) NSInteger videoToolBoxMaxDecodeFrameCount; // default is 20. - -@property (nonatomic, assign, readonly) BOOL codecContextAsync; -@property (nonatomic, assign) NSInteger codecContextMaxDecodeFrameCount; // default is 3. - -@property (nonatomic, assign, readonly) BOOL decodeSync; -@property (nonatomic, assign, readonly) BOOL decodeAsync; -@property (nonatomic, assign, readonly) BOOL decodeOnMainThread; - -@property (nonatomic, assign, readonly) int size; -@property (nonatomic, assign, readonly) BOOL empty; -@property (nonatomic, assign, readonly) NSTimeInterval duration; - -@property (nonatomic, assign) BOOL paused; -@property (nonatomic, assign) BOOL endOfFile; - -- (SGFFVideoFrame *)getFrameAsync; -- (SGFFVideoFrame *)getFrameAsyncPosistion:(NSTimeInterval)position; -- (void)discardFrameBeforPosition:(NSTimeInterval)position; - -- (void)putPacket:(AVPacket)packet; - -- (void)flush; -- (void)destroy; - -- (void)startDecodeThread; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.m deleted file mode 100644 index de540926..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoDecoder.m +++ /dev/null @@ -1,463 +0,0 @@ -// -// SGFFVideoDecoder.m -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFVideoDecoder.h" -#import "SGFFPacketQueue.h" -#import "SGFFFrameQueue.h" -#import "SGFFFramePool.h" -#import "SGFFTools.h" - -#if SGPLATFORM_TARGET_OS_IPHONE -#import "SGFFVideoToolBox.h" -#endif - -static AVPacket flush_packet; - -@interface SGFFVideoDecoder () - -{ - AVCodecContext * _codec_context; - AVFrame * _temp_frame; -} - -@property (nonatomic, assign) NSInteger preferredFramesPerSecond; - -@property (nonatomic, assign) BOOL canceled; - -@property (nonatomic, strong) SGFFPacketQueue * packetQueue; -@property (nonatomic, strong) SGFFFrameQueue * frameQueue; - -@property (nonatomic, strong) SGFFFramePool * framePool; - -#if SGPLATFORM_TARGET_OS_IPHONE -@property (nonatomic, strong) SGFFVideoToolBox * videoToolBox; -#endif - -@end - -@implementation SGFFVideoDecoder - -+ (instancetype)decoderWithCodecContext:(AVCodecContext *)codec_context - timebase:(NSTimeInterval)timebase - fps:(NSTimeInterval)fps - codecContextAsync:(BOOL)codecContextAsync - videoToolBoxEnable:(BOOL)videoToolBoxEnable - rotateType:(SGFFVideoFrameRotateType)rotateType - delegate:(id)delegate -{ - return [[self alloc] initWithCodecContext:codec_context - timebase:timebase - fps:fps - codecContextAsync:codecContextAsync - videoToolBoxEnable:videoToolBoxEnable - rotateType:rotateType - delegate:delegate]; -} - -- (instancetype)initWithCodecContext:(AVCodecContext *)codec_context - timebase:(NSTimeInterval)timebase - fps:(NSTimeInterval)fps - codecContextAsync:(BOOL)codecContextAsync - videoToolBoxEnable:(BOOL)videoToolBoxEnable - rotateType:(SGFFVideoFrameRotateType)rotateType - delegate:(id)delegate -{ - if (self = [super init]) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - av_init_packet(&flush_packet); - flush_packet.data = (uint8_t *)&flush_packet; - flush_packet.duration = 0; - }); - self.delegate = delegate; - self->_codec_context = codec_context; - self->_timebase = timebase; - self->_fps = fps; - self->_codecContextAsync = codecContextAsync; - self->_videoToolBoxEnable = videoToolBoxEnable; - self->_rotateType = rotateType; - [self setupCodecContext]; - } - return self; -} - -- (void)setupCodecContext -{ - self.preferredFramesPerSecond = 60; - self->_temp_frame = av_frame_alloc(); - self.packetQueue = [SGFFPacketQueue packetQueueWithTimebase:self.timebase]; - self.videoToolBoxMaxDecodeFrameCount = 20; - self.codecContextMaxDecodeFrameCount = 3; -#if SGPLATFORM_TARGET_OS_IPHONE - if (self.videoToolBoxEnable && _codec_context->codec_id == AV_CODEC_ID_H264) { - self.videoToolBox = [SGFFVideoToolBox videoToolBoxWithCodecContext:self->_codec_context]; - if ([self.videoToolBox trySetupVTSession]) { - self->_videoToolBoxDidOpen = YES; - } else { - [self.videoToolBox flush]; - self.videoToolBox = nil; - } - } -#endif - if (self.videoToolBoxDidOpen) { - self.frameQueue = [SGFFFrameQueue frameQueue]; - self.frameQueue.minFrameCountForGet = 4; - self->_decodeAsync = YES; - } else if (self.codecContextAsync) { - self.frameQueue = [SGFFFrameQueue frameQueue]; - self.framePool = [SGFFFramePool videoPool]; - self->_decodeAsync = YES; - } else { - self.framePool = [SGFFFramePool videoPool]; - self->_decodeSync = YES; - self->_decodeOnMainThread = YES; - } -} - -- (SGFFVideoFrame *)getFrameAsync -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - return [self.frameQueue getFrameAsync]; - } else { - return [self codecContextDecodeSync]; - } -} - -- (SGFFVideoFrame *)getFrameAsyncPosistion:(NSTimeInterval)position -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - NSMutableArray * discardFrames = nil; - SGFFVideoFrame * videoFrame = [self.frameQueue getFrameAsyncPosistion:position discardFrames:&discardFrames]; - for (SGFFVideoFrame * obj in discardFrames) { - [obj cancel]; - } - return videoFrame; - } else { - return [self codecContextDecodeSync]; - } -} - -- (void)discardFrameBeforPosition:(NSTimeInterval)position -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - NSMutableArray * discardFrames = [self.frameQueue discardFrameBeforPosition:position]; - for (SGFFVideoFrame * obj in discardFrames) { - [obj cancel]; - } - } -} - -- (void)putPacket:(AVPacket)packet -{ - NSTimeInterval duration = 0; - if (packet.duration <= 0 && packet.size > 0 && packet.data != flush_packet.data) { - duration = 1.0 / self.fps; - } - [self.packetQueue putPacket:packet duration:duration]; -} - - -#pragma mark - start decode thread - -- (void)startDecodeThread -{ - if (self.videoToolBoxDidOpen) { - [self videoToolBoxDecodeAsyncThread]; - } else if (self.codecContextAsync) { - [self codecContextDecodeAsyncThread]; - } -} - - -#pragma mark - FFmpeg - -- (void)codecContextDecodeAsyncThread -{ - while (YES) { - if (!self.codecContextAsync) { - break; - } - if (self.canceled || self.error) { - SGFFThreadLog(@"decode video thread quit"); - break; - } - if (self.endOfFile && self.packetQueue.count <= 0) { - SGFFThreadLog(@"decode video finished"); - break; - } - if (self.paused) { - SGFFSleepLog(@"decode video thread pause sleep"); - [NSThread sleepForTimeInterval:0.03]; - continue; - } - if (self.frameQueue.count >= self.codecContextMaxDecodeFrameCount) { - SGFFSleepLog(@"decode video thread sleep"); - [NSThread sleepForTimeInterval:0.03]; - continue; - } - - AVPacket packet = [self.packetQueue getPacketSync]; - if (packet.data == flush_packet.data) { - SGFFDecodeLog(@"video codec flush"); - avcodec_flush_buffers(_codec_context); - [self.frameQueue flush]; - continue; - } - if (packet.stream_index < 0 || packet.data == NULL) continue; - - SGFFVideoFrame * videoFrame = nil; - int result = avcodec_send_packet(_codec_context, &packet); - if (result < 0) { - if (result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - self->_error = SGFFCheckError(result); - [self delegateErrorCallback]; - } - } else { - while (result >= 0) { - result = avcodec_receive_frame(_codec_context, _temp_frame); - if (result < 0) { - if (result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - self->_error = SGFFCheckError(result); - [self delegateErrorCallback]; - } - } else { - videoFrame = [self videoFrameFromTempFrame:packet.size]; - if (videoFrame) { - [self.frameQueue putSortFrame:videoFrame]; - } - } - } - } - av_packet_unref(&packet); - } -} - -- (SGFFVideoFrame *)codecContextDecodeSync -{ - if (self.canceled || self.error) { - return nil; - } - if (self.paused) { - return nil; - } - if (self.endOfFile && self.packetQueue.count <= 0) { - return nil; - } - - AVPacket packet = [self.packetQueue getPacketAsync]; - if (packet.data == flush_packet.data) { - avcodec_flush_buffers(_codec_context); - return nil; - } - if (packet.stream_index < 0 || packet.data == NULL) { - return nil; - } - - SGFFVideoFrame * videoFrame = nil; - int result = avcodec_send_packet(_codec_context, &packet); - if (result < 0) { - if (result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - self->_error = SGFFCheckError(result); - [self delegateErrorCallback]; - } - } else { - while (result >= 0) { - result = avcodec_receive_frame(_codec_context, _temp_frame); - if (result < 0) { - if (result != AVERROR(EAGAIN) && result != AVERROR_EOF) { - self->_error = SGFFCheckError(result); - [self delegateErrorCallback]; - } - } else { - videoFrame = [self videoFrameFromTempFrame:packet.size]; - } - } - } - av_packet_unref(&packet); - return videoFrame; -} - -- (SGFFAVYUVVideoFrame *)videoFrameFromTempFrame:(int)packetSize -{ - if (!_temp_frame->data[0] || !_temp_frame->data[1] || !_temp_frame->data[2]) return nil; - - SGFFAVYUVVideoFrame * videoFrame = [self.framePool getUnuseFrame]; - videoFrame.rotateType = self.rotateType; - - [videoFrame setFrameData:_temp_frame width:_codec_context->width height:_codec_context->height]; - videoFrame.position = av_frame_get_best_effort_timestamp(_temp_frame) * self.timebase; - videoFrame.packetSize = packetSize; - - const int64_t frame_duration = av_frame_get_pkt_duration(_temp_frame); - if (frame_duration) { - videoFrame.duration = frame_duration * self.timebase; - videoFrame.duration += _temp_frame->repeat_pict * self.timebase * 0.5; - } else { - videoFrame.duration = 1.0 / self.fps; - } - return videoFrame; -} - - -#pragma mark - VideoToolBox - -- (void)videoToolBoxDecodeAsyncThread -{ -#if SGPLATFORM_TARGET_OS_IPHONE - - while (YES) { - if (!self.videoToolBoxDidOpen) { - break; - } - if (self.canceled || self.error) { - SGFFThreadLog(@"decode video thread quit"); - break; - } - if (self.endOfFile && self.packetQueue.count <= 0) { - SGFFThreadLog(@"decode video finished"); - break; - } - if (self.paused) { - SGFFSleepLog(@"decode video thread pause sleep"); - [NSThread sleepForTimeInterval:0.01]; - continue; - } - if (self.frameQueue.count >= self.videoToolBoxMaxDecodeFrameCount) { - SGFFSleepLog(@"decode video thread sleep"); - [NSThread sleepForTimeInterval:0.03]; - continue; - } - - AVPacket packet = [self.packetQueue getPacketSync]; - if (packet.data == flush_packet.data) { - SGFFDecodeLog(@"video codec flush"); - [self.frameQueue flush]; - [self.videoToolBox flush]; - continue; - } - if (packet.stream_index < 0 || packet.data == NULL) continue; - - SGFFVideoFrame * videoFrame = nil; - BOOL vtbEnable = [self.videoToolBox trySetupVTSession]; - if (vtbEnable) { - BOOL needFlush = NO; - BOOL result = [self.videoToolBox sendPacket:packet needFlush:&needFlush]; - if (result) { - videoFrame = [self videoFrameFromVideoToolBox:packet]; - } else if (needFlush) { - [self.videoToolBox flush]; - BOOL result2 = [self.videoToolBox sendPacket:packet needFlush:&needFlush]; - if (result2) { - videoFrame = [self videoFrameFromVideoToolBox:packet]; - } - } - } - if (videoFrame) { - [self.frameQueue putSortFrame:videoFrame]; - } - av_packet_unref(&packet); - } - self.frameQueue.ignoreMinFrameCountForGetLimit = YES; -} - -- (SGFFVideoFrame *)videoFrameFromVideoToolBox:(AVPacket)packet -{ - CVImageBufferRef imageBuffer = [self.videoToolBox imageBuffer]; - if (imageBuffer == NULL) return nil; - - SGFFCVYUVVideoFrame * videoFrame = [[SGFFCVYUVVideoFrame alloc] initWithAVPixelBuffer:imageBuffer]; - videoFrame.rotateType = self.rotateType; - - if (packet.pts != AV_NOPTS_VALUE) { - videoFrame.position = packet.pts * self.timebase; - } else { - videoFrame.position = packet.dts; - } - videoFrame.packetSize = packet.size; - - const int64_t frame_duration = packet.duration; - if (frame_duration) { - videoFrame.duration = frame_duration * self.timebase; - } else { - videoFrame.duration = 1.0 / self.fps; - } - return videoFrame; - -#endif -} - -- (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond -{ - if (_preferredFramesPerSecond != preferredFramesPerSecond) { - _preferredFramesPerSecond = preferredFramesPerSecond; - [self.delegate videoDecoder:self didChangePreferredFramesPerSecond:_preferredFramesPerSecond]; - } -} - -- (int)size -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - return self.packetQueue.size + self.frameQueue.packetSize; - } else { - return self.packetQueue.size; - } -} - -- (BOOL)empty -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - return self.packetQueue.count <= 0 && self.frameQueue.count <= 0; - } else { - return self.packetQueue.count <= 0; - } -} - -- (NSTimeInterval)duration -{ - if (self.videoToolBoxDidOpen || self.codecContextAsync) { - return self.packetQueue.duration + self.frameQueue.duration; - } else { - return self.packetQueue.duration; - } -} - -- (void)delegateErrorCallback -{ - if (self.error) { - [self.delegate videoDecoder:self didError:self.error]; - } -} - -- (void)flush -{ - [self.packetQueue flush]; - [self.frameQueue flush]; - [self.framePool flush]; - [self putPacket:flush_packet]; -} - -- (void)destroy -{ - self.canceled = YES; - - [self.frameQueue destroy]; - [self.packetQueue destroy]; - [self.framePool flush]; -} - -- (void)dealloc -{ - if (_temp_frame) { - av_free(_temp_frame); - _temp_frame = NULL; - } - SGPlayerLog(@"SGFFVideoDecoder release"); -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.h deleted file mode 100644 index 46f2f4f2..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// SGFFVideoFrame.h -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFFrame.h" -#import -#import -#import "avformat.h" -#import "pixfmt.h" - -typedef NS_ENUM(int, SGYUVChannel) { - SGYUVChannelLuma = 0, - SGYUVChannelChromaB = 1, - SGYUVChannelChromaR = 2, - SGYUVChannelCount = 3, -}; - -typedef NS_ENUM(NSUInteger, SGFFVideoFrameRotateType) { - SGFFVideoFrameRotateType0, - SGFFVideoFrameRotateType90, - SGFFVideoFrameRotateType180, - SGFFVideoFrameRotateType270, -}; - -@interface SGFFVideoFrame : SGFFFrame - -@property (nonatomic, assign) SGFFVideoFrameRotateType rotateType; - -@end - - -// FFmpeg AVFrame YUV frame -@interface SGFFAVYUVVideoFrame : SGFFVideoFrame - -{ -@public - UInt8 * channel_pixels[SGYUVChannelCount]; -} - -@property (nonatomic, assign, readonly) int width; -@property (nonatomic, assign, readonly) int height; - -+ (instancetype)videoFrame; -- (void)setFrameData:(AVFrame *)frame width:(int)width height:(int)height; - -- (SGPLFImage *)image; - -@end - - -// CoreVideo YUV frame -@interface SGFFCVYUVVideoFrame : SGFFVideoFrame - -@property (nonatomic, assign, readonly) CVPixelBufferRef pixelBuffer; - -- (instancetype)initWithAVPixelBuffer:(CVPixelBufferRef)pixelBuffer; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.m deleted file mode 100644 index 5393c0cf..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoFrame.m +++ /dev/null @@ -1,223 +0,0 @@ -// -// SGFFVideoFrame.m -// SGPlayer -// -// Created by Single on 2017/2/17. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGFFVideoFrame.h" -#import "SGFFTools.h" -#import "SGYUVTools.h" - -@implementation SGFFVideoFrame - -- (SGFFFrameType)type -{ - return SGFFFrameTypeVideo; -} - -@end - - -@interface SGFFAVYUVVideoFrame () - -{ - enum AVPixelFormat pixelFormat; - - size_t channel_pixels_buffer_size[SGYUVChannelCount]; - int channel_lenghts[SGYUVChannelCount]; - int channel_linesize[SGYUVChannelCount]; -} - -@property (nonatomic, strong) NSLock * lock; - -@end - -@implementation SGFFAVYUVVideoFrame - -- (SGFFFrameType)type -{ - return SGFFFrameTypeAVYUVVideo; -} - -+ (instancetype)videoFrame -{ - return [[self alloc] init]; -} - -- (instancetype)init -{ - if (self = [super init]) { - channel_lenghts[SGYUVChannelLuma] = 0; - channel_lenghts[SGYUVChannelChromaB] = 0; - channel_lenghts[SGYUVChannelChromaR] = 0; - channel_pixels_buffer_size[SGYUVChannelLuma] = 0; - channel_pixels_buffer_size[SGYUVChannelChromaB] = 0; - channel_pixels_buffer_size[SGYUVChannelChromaR] = 0; - channel_linesize[SGYUVChannelLuma] = 0; - channel_linesize[SGYUVChannelChromaB] = 0; - channel_linesize[SGYUVChannelChromaR] = 0; - channel_pixels[SGYUVChannelLuma] = NULL; - channel_pixels[SGYUVChannelChromaB] = NULL; - channel_pixels[SGYUVChannelChromaR] = NULL; - self.lock = [[NSLock alloc] init]; - } - return self; -} - -- (void)setFrameData:(AVFrame *)frame width:(int)width height:(int)height -{ - pixelFormat = frame->format; - - self->_width = width; - self->_height = height; - - int linesize_y = frame->linesize[SGYUVChannelLuma]; - int linesize_u = frame->linesize[SGYUVChannelChromaB]; - int linesize_v = frame->linesize[SGYUVChannelChromaR]; - - channel_linesize[SGYUVChannelLuma] = linesize_y; - channel_linesize[SGYUVChannelChromaB] = linesize_u; - channel_linesize[SGYUVChannelChromaR] = linesize_v; - - UInt8 * buffer_y = channel_pixels[SGYUVChannelLuma]; - UInt8 * buffer_u = channel_pixels[SGYUVChannelChromaB]; - UInt8 * buffer_v = channel_pixels[SGYUVChannelChromaR]; - - size_t buffer_size_y = channel_pixels_buffer_size[SGYUVChannelLuma]; - size_t buffer_size_u = channel_pixels_buffer_size[SGYUVChannelChromaB]; - size_t buffer_size_v = channel_pixels_buffer_size[SGYUVChannelChromaR]; - - int need_size_y = SGYUVChannelFilterNeedSize(linesize_y, width, height, 1); - channel_lenghts[SGYUVChannelLuma] = need_size_y; - if (buffer_size_y < need_size_y) { - if (buffer_size_y > 0 && buffer_y != NULL) { - free(buffer_y); - } - channel_pixels_buffer_size[SGYUVChannelLuma] = need_size_y; - channel_pixels[SGYUVChannelLuma] = malloc(need_size_y); - } - int need_size_u = SGYUVChannelFilterNeedSize(linesize_u, width / 2, height / 2, 1); - channel_lenghts[SGYUVChannelChromaB] = need_size_u; - if (buffer_size_u < need_size_u) { - if (buffer_size_u > 0 && buffer_u != NULL) { - free(buffer_u); - } - channel_pixels_buffer_size[SGYUVChannelChromaB] = need_size_u; - channel_pixels[SGYUVChannelChromaB] = malloc(need_size_u); - } - int need_size_v = SGYUVChannelFilterNeedSize(linesize_v, width / 2, height / 2, 1); - channel_lenghts[SGYUVChannelChromaR] = need_size_v; - if (buffer_size_v < need_size_v) { - if (buffer_size_v > 0 && buffer_v != NULL) { - free(buffer_v); - } - channel_pixels_buffer_size[SGYUVChannelChromaR] = need_size_v; - channel_pixels[SGYUVChannelChromaR] = malloc(need_size_v); - } - - SGYUVChannelFilter(frame->data[SGYUVChannelLuma], - linesize_y, - width, - height, - channel_pixels[SGYUVChannelLuma], - channel_pixels_buffer_size[SGYUVChannelLuma], - 1); - SGYUVChannelFilter(frame->data[SGYUVChannelChromaB], - linesize_u, - width / 2, - height / 2, - channel_pixels[SGYUVChannelChromaB], - channel_pixels_buffer_size[SGYUVChannelChromaB], - 1); - SGYUVChannelFilter(frame->data[SGYUVChannelChromaR], - linesize_v, - width / 2, - height / 2, - channel_pixels[SGYUVChannelChromaR], - channel_pixels_buffer_size[SGYUVChannelChromaR], - 1); -} - -- (void)flush -{ - self->_width = 0; - self->_height = 0; - channel_lenghts[SGYUVChannelLuma] = 0; - channel_lenghts[SGYUVChannelChromaB] = 0; - channel_lenghts[SGYUVChannelChromaR] = 0; - channel_linesize[SGYUVChannelLuma] = 0; - channel_linesize[SGYUVChannelChromaB] = 0; - channel_linesize[SGYUVChannelChromaR] = 0; - if (channel_pixels[SGYUVChannelLuma] != NULL && channel_pixels_buffer_size[SGYUVChannelLuma] > 0) { - memset(channel_pixels[SGYUVChannelLuma], 0, channel_pixels_buffer_size[SGYUVChannelLuma]); - } - if (channel_pixels[SGYUVChannelChromaB] != NULL && channel_pixels_buffer_size[SGYUVChannelChromaB] > 0) { - memset(channel_pixels[SGYUVChannelChromaB], 0, channel_pixels_buffer_size[SGYUVChannelChromaB]); - } - if (channel_pixels[SGYUVChannelChromaR] != NULL && channel_pixels_buffer_size[SGYUVChannelChromaR] > 0) { - memset(channel_pixels[SGYUVChannelChromaR], 0, channel_pixels_buffer_size[SGYUVChannelChromaR]); - } -} - -- (void)stopPlaying -{ - [self.lock lock]; - [super stopPlaying]; - [self.lock unlock]; -} - -- (SGPLFImage *)image -{ - [self.lock lock]; - SGPLFImage * image = SGYUVConvertToImage(channel_pixels, channel_linesize, self.width, self.height, pixelFormat); - [self.lock unlock]; - return image; -} - -- (int)size -{ - return (int)(channel_lenghts[SGYUVChannelLuma] + channel_lenghts[SGYUVChannelChromaB] + channel_lenghts[SGYUVChannelChromaR]); -} - -- (void)dealloc -{ - if (channel_pixels[SGYUVChannelLuma] != NULL && channel_pixels_buffer_size[SGYUVChannelLuma] > 0) { - free(channel_pixels[SGYUVChannelLuma]); - } - if (channel_pixels[SGYUVChannelChromaB] != NULL && channel_pixels_buffer_size[SGYUVChannelChromaB] > 0) { - free(channel_pixels[SGYUVChannelChromaB]); - } - if (channel_pixels[SGYUVChannelChromaR] != NULL && channel_pixels_buffer_size[SGYUVChannelChromaR] > 0) { - free(channel_pixels[SGYUVChannelChromaR]); - } -} - -@end - - -@implementation SGFFCVYUVVideoFrame - -- (SGFFFrameType)type -{ - return SGFFFrameTypeCVYUVVideo; -} - -- (instancetype)initWithAVPixelBuffer:(CVPixelBufferRef)pixelBuffer -{ - if (self = [super init]) { - self->_pixelBuffer = pixelBuffer; - } - return self; -} - -- (void)dealloc -{ - if (self->_pixelBuffer) { - CVPixelBufferRelease(self->_pixelBuffer); - self->_pixelBuffer = NULL; - } -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.h b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.h deleted file mode 100644 index 1639ed57..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// SGFFVideoToolBox.h -// SGPlayer -// -// Created by Single on 2017/2/21. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import -#import "avformat.h" - -@interface SGFFVideoToolBox : NSObject - -+ (instancetype)videoToolBoxWithCodecContext:(AVCodecContext *)codecContext; - -- (BOOL)sendPacket:(AVPacket)packet needFlush:(BOOL *)needFlush; -- (CVImageBufferRef)imageBuffer; - -- (BOOL)trySetupVTSession; -- (void)flush; - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.m b/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.m deleted file mode 100644 index e95ebd5a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/SGFFmpeg/SGFFVideoToolBox.m +++ /dev/null @@ -1,304 +0,0 @@ -// -// SGFFVideoToolBox.m -// SGPlayer -// -// Created by Single on 2017/2/21. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "SGFFVideoToolBox.h" - -typedef NS_ENUM(NSUInteger, SGFFVideoToolBoxErrorCode) { - SGFFVideoToolBoxErrorCodeExtradataSize, - SGFFVideoToolBoxErrorCodeExtradataData, - SGFFVideoToolBoxErrorCodeCreateFormatDescription, - SGFFVideoToolBoxErrorCodeCreateSession, - SGFFVideoToolBoxErrorCodeNotH264, -}; - -@interface SGFFVideoToolBox () - -{ - AVCodecContext * _codec_context; - VTDecompressionSessionRef _vt_session; - CMFormatDescriptionRef _format_description; - -@public - OSStatus _decode_status; - CVImageBufferRef _decode_output; -} - -@property (nonatomic, assign) BOOL vtSessionToken; -@property (nonatomic, assign) BOOL needConvertNALSize3To4; - -@end - -@implementation SGFFVideoToolBox - -+ (instancetype)videoToolBoxWithCodecContext:(AVCodecContext *)codecContext -{ - return [[self alloc] initWithCodecContext:codecContext]; -} - -- (instancetype)initWithCodecContext:(AVCodecContext *)codecContext -{ - if (self = [super init]) { - self->_codec_context = codecContext; - } - return self; -} - -- (BOOL)trySetupVTSession -{ - if (!self.vtSessionToken) { - NSError * error = [self setupVTSession]; - if (!error) { - self.vtSessionToken = YES; - } - } - return self.vtSessionToken; -} - -- (NSError *)setupVTSession -{ - NSError * error; - - enum AVCodecID codec_id = self->_codec_context->codec_id; - uint8_t * extradata = self->_codec_context->extradata; - int extradata_size = self->_codec_context->extradata_size; - - if (codec_id == AV_CODEC_ID_H264) { - if (extradata_size < 7 || extradata == NULL) { - error = [NSError errorWithDomain:@"extradata error" code:SGFFVideoToolBoxErrorCodeExtradataSize userInfo:nil]; - return error; - } - - if (extradata[0] == 1) { - if (extradata[4] == 0xFE) { - extradata[4] = 0xFF; - self.needConvertNALSize3To4 = YES; - } - self->_format_description = CreateFormatDescription(kCMVideoCodecType_H264, _codec_context->width, _codec_context->height, extradata, extradata_size); - if (self->_format_description == NULL) { - error = [NSError errorWithDomain:@"create format description error" code:SGFFVideoToolBoxErrorCodeCreateFormatDescription userInfo:nil]; - return error; - } - - CFMutableDictionaryRef destinationPixelBufferAttributes = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - cf_dict_set_int32(destinationPixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); - cf_dict_set_int32(destinationPixelBufferAttributes, kCVPixelBufferWidthKey, _codec_context->width); - cf_dict_set_int32(destinationPixelBufferAttributes, kCVPixelBufferHeightKey, _codec_context->height); - -#if SGPLATFORM_TARGET_OS_MAC -// cf_dict_set_boolean(destinationPixelBufferAttributes, kCVPixelBufferOpenGLCompatibilityKey, YES); -// cf_dict_set_boolean(destinationPixelBufferAttributes, kCVPixelBufferOpenGLTextureCacheCompatibilityKey, YES); -#elif SGPLATFORM_TARGET_OS_IPHONE -// cf_dict_set_boolean(destinationPixelBufferAttributes, kCVPixelBufferOpenGLESCompatibilityKey, YES); -// cf_dict_set_boolean(destinationPixelBufferAttributes, kCVPixelBufferOpenGLESTextureCacheCompatibilityKey, YES); -#endif - - VTDecompressionOutputCallbackRecord outputCallbackRecord; - outputCallbackRecord.decompressionOutputCallback = outputCallback; - outputCallbackRecord.decompressionOutputRefCon = (__bridge void *)self; - - OSStatus status = VTDecompressionSessionCreate(kCFAllocatorDefault, self->_format_description, NULL, destinationPixelBufferAttributes, &outputCallbackRecord, &self->_vt_session); - if (status != noErr) { - error = [NSError errorWithDomain:@"create session error" code:SGFFVideoToolBoxErrorCodeCreateSession userInfo:nil]; - return error; - } - CFRelease(destinationPixelBufferAttributes); - return nil; - } else { - error = [NSError errorWithDomain:@"deal extradata error" code:SGFFVideoToolBoxErrorCodeExtradataData userInfo:nil]; - return error; - } - } else { - error = [NSError errorWithDomain:@"not h264 error" code:SGFFVideoToolBoxErrorCodeNotH264 userInfo:nil]; - return error; - } - - return error; -} - -- (void)cleanVTSession -{ - if (self->_format_description) { - CFRelease(self->_format_description); - self->_format_description = NULL; - } - if (self->_vt_session) { - VTDecompressionSessionWaitForAsynchronousFrames(self->_vt_session); - VTDecompressionSessionInvalidate(self->_vt_session); - CFRelease(self->_vt_session); - self->_vt_session = NULL; - } - self.needConvertNALSize3To4 = NO; - self.vtSessionToken = NO; -} - -- (void)cleanDecodeInfo -{ - self->_decode_status = noErr; - self->_decode_output = NULL; -} - -- (BOOL)sendPacket:(AVPacket)packet needFlush:(BOOL *)needFlush -{ - BOOL setupResult = [self trySetupVTSession]; - if (!setupResult) return NO; - [self cleanDecodeInfo]; - - BOOL result = NO; - CMBlockBufferRef blockBuffer = NULL; - OSStatus status = noErr; - - if (self.needConvertNALSize3To4) { - AVIOContext * io_context = NULL; - if (avio_open_dyn_buf(&io_context) < 0) { - status = -1900; - } else { - uint32_t nal_size; - uint8_t * end = packet.data + packet.size; - uint8_t * nal_start = packet.data; - while (nal_start < end) { - nal_size = (nal_start[0] << 16) | (nal_start[1] << 8) | nal_start[2]; - avio_wb32(io_context, nal_size); - nal_start += 3; - avio_write(io_context, nal_start, nal_size); - nal_start += nal_size; - } - uint8_t * demux_buffer = NULL; - int demux_size = avio_close_dyn_buf(io_context, &demux_buffer); - status = CMBlockBufferCreateWithMemoryBlock(NULL, demux_buffer, demux_size, kCFAllocatorNull, NULL, 0, packet.size, FALSE, &blockBuffer); - } - } else { - status = CMBlockBufferCreateWithMemoryBlock(NULL, packet.data, packet.size, kCFAllocatorNull, NULL, 0, packet.size, FALSE, &blockBuffer); - } - - if (status == noErr) { - CMSampleBufferRef sampleBuffer = NULL; - status = CMSampleBufferCreate( NULL, blockBuffer, TRUE, 0, 0, self->_format_description, 1, 0, NULL, 0, NULL, &sampleBuffer); - - if (status == noErr) { - status = VTDecompressionSessionDecodeFrame(self->_vt_session, sampleBuffer, 0, NULL, 0); - if (status == noErr) { - if (self->_decode_status == noErr && self->_decode_output != NULL) { - result = YES; - } - } else if (status == kVTInvalidSessionErr) { - * needFlush = YES; - } - } - if (sampleBuffer) { - CFRelease(sampleBuffer); - } - } - if (blockBuffer) { - CFRelease(blockBuffer); - } - return result; -} - -- (CVImageBufferRef)imageBuffer -{ - if (self->_decode_status == noErr && self->_decode_output != NULL) { - return self->_decode_output; - } - return NULL; -} - -- (void)flush -{ - [self cleanVTSession]; - [self cleanDecodeInfo]; -} - -- (void)dealloc -{ - [self flush]; -} - -static void outputCallback(void * decompressionOutputRefCon, void * sourceFrameRefCon, OSStatus status, VTDecodeInfoFlags infoFlags, CVImageBufferRef imageBuffer, CMTime presentationTimeStamp, CMTime presentationDuration) -{ - @autoreleasepool - { - SGFFVideoToolBox * videoToolBox = (__bridge SGFFVideoToolBox *)decompressionOutputRefCon; - videoToolBox->_decode_status = status; - videoToolBox->_decode_output = imageBuffer; - if (imageBuffer != NULL) { - CVPixelBufferRetain(imageBuffer); - } - } -} - -static CMFormatDescriptionRef CreateFormatDescription(CMVideoCodecType codec_type, int width, int height, const uint8_t * extradata, int extradata_size) -{ - CMFormatDescriptionRef format_description = NULL; - OSStatus status; - - CFMutableDictionaryRef par = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFMutableDictionaryRef atoms = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFMutableDictionaryRef extensions = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - - // CVPixelAspectRatio - cf_dict_set_int32(par, CFSTR("HorizontalSpacing"), 0); - cf_dict_set_int32(par, CFSTR("VerticalSpacing"), 0); - - // SampleDescriptionExtensionAtoms - cf_dict_set_data(atoms, CFSTR("avcC"), (uint8_t *)extradata, extradata_size); - - // Extensions - cf_dict_set_string(extensions, CFSTR ("CVImageBufferChromaLocationBottomField"), "left"); - cf_dict_set_string(extensions, CFSTR ("CVImageBufferChromaLocationTopField"), "left"); - cf_dict_set_boolean(extensions, CFSTR("FullRangeVideo"), FALSE); - cf_dict_set_object(extensions, CFSTR ("CVPixelAspectRatio"), (CFTypeRef *)par); - cf_dict_set_object(extensions, CFSTR ("SampleDescriptionExtensionAtoms"), (CFTypeRef *)atoms); - - status = CMVideoFormatDescriptionCreate(NULL, codec_type, width, height, extensions, &format_description); - - CFRelease(extensions); - CFRelease(atoms); - CFRelease(par); - - if (status != noErr) { - return NULL; - } - return format_description; -} - -static void cf_dict_set_data(CFMutableDictionaryRef dict, CFStringRef key, uint8_t * value, uint64_t length) -{ - CFDataRef data; - data = CFDataCreate(NULL, value, (CFIndex)length); - CFDictionarySetValue(dict, key, data); - CFRelease(data); -} - -static void cf_dict_set_int32(CFMutableDictionaryRef dict, CFStringRef key, int32_t value) -{ - CFNumberRef number; - number = CFNumberCreate(NULL, kCFNumberSInt32Type, &value); - CFDictionarySetValue(dict, key, number); - CFRelease(number); -} - -static void cf_dict_set_string(CFMutableDictionaryRef dict, CFStringRef key, const char * value) -{ - CFStringRef string; - string = CFStringCreateWithCString(NULL, value, kCFStringEncodingASCII); - CFDictionarySetValue(dict, key, string); - CFRelease(string); -} - -static void cf_dict_set_boolean(CFMutableDictionaryRef dict, CFStringRef key, BOOL value) -{ - CFDictionarySetValue(dict, key, value ? kCFBooleanTrue: kCFBooleanFalse); -} - -static void cf_dict_set_object(CFMutableDictionaryRef dict, CFStringRef key, CFTypeRef *value) -{ - CFDictionarySetValue(dict, key, value); -} - -@end diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avcodec.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avcodec.h deleted file mode 100644 index e5e7f422..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avcodec.h +++ /dev/null @@ -1,6241 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AVCODEC_H -#define AVCODEC_AVCODEC_H - -/** - * @file - * @ingroup libavc - * Libavcodec external API header - */ - -#include -#include "libavutil/samplefmt.h" -#include "libavutil/attributes.h" -#include "libavutil/avutil.h" -#include "libavutil/buffer.h" -#include "libavutil/cpu.h" -#include "libavutil/channel_layout.h" -#include "libavutil/dict.h" -#include "libavutil/frame.h" -#include "libavutil/log.h" -#include "libavutil/pixfmt.h" -#include "libavutil/rational.h" - -#include "version.h" - -/** - * @defgroup libavc libavcodec - * Encoding/Decoding Library - * - * @{ - * - * @defgroup lavc_decoding Decoding - * @{ - * @} - * - * @defgroup lavc_encoding Encoding - * @{ - * @} - * - * @defgroup lavc_codec Codecs - * @{ - * @defgroup lavc_codec_native Native Codecs - * @{ - * @} - * @defgroup lavc_codec_wrappers External library wrappers - * @{ - * @} - * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge - * @{ - * @} - * @} - * @defgroup lavc_internal Internal - * @{ - * @} - * @} - */ - -/** - * @ingroup libavc - * @defgroup lavc_encdec send/receive encoding and decoding API overview - * @{ - * - * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/ - * avcodec_receive_packet() functions provide an encode/decode API, which - * decouples input and output. - * - * The API is very similar for encoding/decoding and audio/video, and works as - * follows: - * - Set up and open the AVCodecContext as usual. - * - Send valid input: - * - For decoding, call avcodec_send_packet() to give the decoder raw - * compressed data in an AVPacket. - * - For encoding, call avcodec_send_frame() to give the decoder an AVFrame - * containing uncompressed audio or video. - * In both cases, it is recommended that AVPackets and AVFrames are - * refcounted, or libavcodec might have to copy the input data. (libavformat - * always returns refcounted AVPackets, and av_frame_get_buffer() allocates - * refcounted AVFrames.) - * - Receive output in a loop. Periodically call one of the avcodec_receive_*() - * functions and process their output: - * - For decoding, call avcodec_receive_frame(). On success, it will return - * an AVFrame containing uncompressed audio or video data. - * - For encoding, call avcodec_receive_packet(). On success, it will return - * an AVPacket with a compressed frame. - * Repeat this call until it returns AVERROR(EAGAIN) or an error. The - * AVERROR(EAGAIN) return value means that new input data is required to - * return new output. In this case, continue with sending input. For each - * input frame/packet, the codec will typically return 1 output frame/packet, - * but it can also be 0 or more than 1. - * - * At the beginning of decoding or encoding, the codec might accept multiple - * input frames/packets without returning a frame, until its internal buffers - * are filled. This situation is handled transparently if you follow the steps - * outlined above. - * - * End of stream situations. These require "flushing" (aka draining) the codec, - * as the codec might buffer multiple frames or packets internally for - * performance or out of necessity (consider B-frames). - * This is handled as follows: - * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding) - * or avcodec_send_frame() (encoding) functions. This will enter draining - * mode. - * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet() - * (encoding) in a loop until AVERROR_EOF is returned. The functions will - * not return AVERROR(EAGAIN), unless you forgot to enter draining mode. - * - Before decoding can be resumed again, the codec has to be reset with - * avcodec_flush_buffers(). - * - * Using the API as outlined above is highly recommended. But it is also - * possible to call functions outside of this rigid schema. For example, you can - * call avcodec_send_packet() repeatedly without calling - * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed - * until the codec's internal buffer has been filled up (which is typically of - * size 1 per output frame, after initial input), and then reject input with - * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to - * read at least some output. - * - * Not all codecs will follow a rigid and predictable dataflow; the only - * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on - * one end implies that a receive/send call on the other end will succeed. In - * general, no codec will permit unlimited buffering of input or output. - * - * This API replaces the following legacy functions: - * - avcodec_decode_video2() and avcodec_decode_audio4(): - * Use avcodec_send_packet() to feed input to the decoder, then use - * avcodec_receive_frame() to receive decoded frames after each packet. - * Unlike with the old video decoding API, multiple frames might result from - * a packet. For audio, splitting the input packet into frames by partially - * decoding packets becomes transparent to the API user. You never need to - * feed an AVPacket to the API twice. - * Additionally, sending a flush/draining packet is required only once. - * - avcodec_encode_video2()/avcodec_encode_audio2(): - * Use avcodec_send_frame() to feed input to the encoder, then use - * avcodec_receive_packet() to receive encoded packets. - * Providing user-allocated buffers for avcodec_receive_packet() is not - * possible. - * - The new API does not handle subtitles yet. - * - * Mixing new and old function calls on the same AVCodecContext is not allowed, - * and will result in undefined behavior. - * - * Some codecs might require using the new API; using the old API will return - * an error when calling it. - * @} - */ - -/** - * @defgroup lavc_core Core functions/structures. - * @ingroup libavc - * - * Basic definitions, functions for querying libavcodec capabilities, - * allocating core structures, etc. - * @{ - */ - - -/** - * Identify the syntax and semantics of the bitstream. - * The principle is roughly: - * Two decoders with the same ID can decode the same streams. - * Two encoders with the same ID can encode compatible streams. - * There may be slight deviations from the principle due to implementation - * details. - * - * If you add a codec ID to this list, add it so that - * 1. no value of an existing codec ID changes (that would break ABI), - * 2. it is as close as possible to similar codecs - * - * After adding new codec IDs, do not forget to add an entry to the codec - * descriptor list and bump libavcodec minor version. - */ -enum AVCodecID { - AV_CODEC_ID_NONE, - - /* video codecs */ - AV_CODEC_ID_MPEG1VIDEO, - AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding -#if FF_API_XVMC - AV_CODEC_ID_MPEG2VIDEO_XVMC, -#endif /* FF_API_XVMC */ - AV_CODEC_ID_H261, - AV_CODEC_ID_H263, - AV_CODEC_ID_RV10, - AV_CODEC_ID_RV20, - AV_CODEC_ID_MJPEG, - AV_CODEC_ID_MJPEGB, - AV_CODEC_ID_LJPEG, - AV_CODEC_ID_SP5X, - AV_CODEC_ID_JPEGLS, - AV_CODEC_ID_MPEG4, - AV_CODEC_ID_RAWVIDEO, - AV_CODEC_ID_MSMPEG4V1, - AV_CODEC_ID_MSMPEG4V2, - AV_CODEC_ID_MSMPEG4V3, - AV_CODEC_ID_WMV1, - AV_CODEC_ID_WMV2, - AV_CODEC_ID_H263P, - AV_CODEC_ID_H263I, - AV_CODEC_ID_FLV1, - AV_CODEC_ID_SVQ1, - AV_CODEC_ID_SVQ3, - AV_CODEC_ID_DVVIDEO, - AV_CODEC_ID_HUFFYUV, - AV_CODEC_ID_CYUV, - AV_CODEC_ID_H264, - AV_CODEC_ID_INDEO3, - AV_CODEC_ID_VP3, - AV_CODEC_ID_THEORA, - AV_CODEC_ID_ASV1, - AV_CODEC_ID_ASV2, - AV_CODEC_ID_FFV1, - AV_CODEC_ID_4XM, - AV_CODEC_ID_VCR1, - AV_CODEC_ID_CLJR, - AV_CODEC_ID_MDEC, - AV_CODEC_ID_ROQ, - AV_CODEC_ID_INTERPLAY_VIDEO, - AV_CODEC_ID_XAN_WC3, - AV_CODEC_ID_XAN_WC4, - AV_CODEC_ID_RPZA, - AV_CODEC_ID_CINEPAK, - AV_CODEC_ID_WS_VQA, - AV_CODEC_ID_MSRLE, - AV_CODEC_ID_MSVIDEO1, - AV_CODEC_ID_IDCIN, - AV_CODEC_ID_8BPS, - AV_CODEC_ID_SMC, - AV_CODEC_ID_FLIC, - AV_CODEC_ID_TRUEMOTION1, - AV_CODEC_ID_VMDVIDEO, - AV_CODEC_ID_MSZH, - AV_CODEC_ID_ZLIB, - AV_CODEC_ID_QTRLE, - AV_CODEC_ID_TSCC, - AV_CODEC_ID_ULTI, - AV_CODEC_ID_QDRAW, - AV_CODEC_ID_VIXL, - AV_CODEC_ID_QPEG, - AV_CODEC_ID_PNG, - AV_CODEC_ID_PPM, - AV_CODEC_ID_PBM, - AV_CODEC_ID_PGM, - AV_CODEC_ID_PGMYUV, - AV_CODEC_ID_PAM, - AV_CODEC_ID_FFVHUFF, - AV_CODEC_ID_RV30, - AV_CODEC_ID_RV40, - AV_CODEC_ID_VC1, - AV_CODEC_ID_WMV3, - AV_CODEC_ID_LOCO, - AV_CODEC_ID_WNV1, - AV_CODEC_ID_AASC, - AV_CODEC_ID_INDEO2, - AV_CODEC_ID_FRAPS, - AV_CODEC_ID_TRUEMOTION2, - AV_CODEC_ID_BMP, - AV_CODEC_ID_CSCD, - AV_CODEC_ID_MMVIDEO, - AV_CODEC_ID_ZMBV, - AV_CODEC_ID_AVS, - AV_CODEC_ID_SMACKVIDEO, - AV_CODEC_ID_NUV, - AV_CODEC_ID_KMVC, - AV_CODEC_ID_FLASHSV, - AV_CODEC_ID_CAVS, - AV_CODEC_ID_JPEG2000, - AV_CODEC_ID_VMNC, - AV_CODEC_ID_VP5, - AV_CODEC_ID_VP6, - AV_CODEC_ID_VP6F, - AV_CODEC_ID_TARGA, - AV_CODEC_ID_DSICINVIDEO, - AV_CODEC_ID_TIERTEXSEQVIDEO, - AV_CODEC_ID_TIFF, - AV_CODEC_ID_GIF, - AV_CODEC_ID_DXA, - AV_CODEC_ID_DNXHD, - AV_CODEC_ID_THP, - AV_CODEC_ID_SGI, - AV_CODEC_ID_C93, - AV_CODEC_ID_BETHSOFTVID, - AV_CODEC_ID_PTX, - AV_CODEC_ID_TXD, - AV_CODEC_ID_VP6A, - AV_CODEC_ID_AMV, - AV_CODEC_ID_VB, - AV_CODEC_ID_PCX, - AV_CODEC_ID_SUNRAST, - AV_CODEC_ID_INDEO4, - AV_CODEC_ID_INDEO5, - AV_CODEC_ID_MIMIC, - AV_CODEC_ID_RL2, - AV_CODEC_ID_ESCAPE124, - AV_CODEC_ID_DIRAC, - AV_CODEC_ID_BFI, - AV_CODEC_ID_CMV, - AV_CODEC_ID_MOTIONPIXELS, - AV_CODEC_ID_TGV, - AV_CODEC_ID_TGQ, - AV_CODEC_ID_TQI, - AV_CODEC_ID_AURA, - AV_CODEC_ID_AURA2, - AV_CODEC_ID_V210X, - AV_CODEC_ID_TMV, - AV_CODEC_ID_V210, - AV_CODEC_ID_DPX, - AV_CODEC_ID_MAD, - AV_CODEC_ID_FRWU, - AV_CODEC_ID_FLASHSV2, - AV_CODEC_ID_CDGRAPHICS, - AV_CODEC_ID_R210, - AV_CODEC_ID_ANM, - AV_CODEC_ID_BINKVIDEO, - AV_CODEC_ID_IFF_ILBM, -#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM - AV_CODEC_ID_KGV1, - AV_CODEC_ID_YOP, - AV_CODEC_ID_VP8, - AV_CODEC_ID_PICTOR, - AV_CODEC_ID_ANSI, - AV_CODEC_ID_A64_MULTI, - AV_CODEC_ID_A64_MULTI5, - AV_CODEC_ID_R10K, - AV_CODEC_ID_MXPEG, - AV_CODEC_ID_LAGARITH, - AV_CODEC_ID_PRORES, - AV_CODEC_ID_JV, - AV_CODEC_ID_DFA, - AV_CODEC_ID_WMV3IMAGE, - AV_CODEC_ID_VC1IMAGE, - AV_CODEC_ID_UTVIDEO, - AV_CODEC_ID_BMV_VIDEO, - AV_CODEC_ID_VBLE, - AV_CODEC_ID_DXTORY, - AV_CODEC_ID_V410, - AV_CODEC_ID_XWD, - AV_CODEC_ID_CDXL, - AV_CODEC_ID_XBM, - AV_CODEC_ID_ZEROCODEC, - AV_CODEC_ID_MSS1, - AV_CODEC_ID_MSA1, - AV_CODEC_ID_TSCC2, - AV_CODEC_ID_MTS2, - AV_CODEC_ID_CLLC, - AV_CODEC_ID_MSS2, - AV_CODEC_ID_VP9, - AV_CODEC_ID_AIC, - AV_CODEC_ID_ESCAPE130, - AV_CODEC_ID_G2M, - AV_CODEC_ID_WEBP, - AV_CODEC_ID_HNM4_VIDEO, - AV_CODEC_ID_HEVC, -#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC - AV_CODEC_ID_FIC, - AV_CODEC_ID_ALIAS_PIX, - AV_CODEC_ID_BRENDER_PIX, - AV_CODEC_ID_PAF_VIDEO, - AV_CODEC_ID_EXR, - AV_CODEC_ID_VP7, - AV_CODEC_ID_SANM, - AV_CODEC_ID_SGIRLE, - AV_CODEC_ID_MVC1, - AV_CODEC_ID_MVC2, - AV_CODEC_ID_HQX, - AV_CODEC_ID_TDSC, - AV_CODEC_ID_HQ_HQA, - AV_CODEC_ID_HAP, - AV_CODEC_ID_DDS, - AV_CODEC_ID_DXV, - AV_CODEC_ID_SCREENPRESSO, - AV_CODEC_ID_RSCC, - - AV_CODEC_ID_Y41P = 0x8000, - AV_CODEC_ID_AVRP, - AV_CODEC_ID_012V, - AV_CODEC_ID_AVUI, - AV_CODEC_ID_AYUV, - AV_CODEC_ID_TARGA_Y216, - AV_CODEC_ID_V308, - AV_CODEC_ID_V408, - AV_CODEC_ID_YUV4, - AV_CODEC_ID_AVRN, - AV_CODEC_ID_CPIA, - AV_CODEC_ID_XFACE, - AV_CODEC_ID_SNOW, - AV_CODEC_ID_SMVJPEG, - AV_CODEC_ID_APNG, - AV_CODEC_ID_DAALA, - AV_CODEC_ID_CFHD, - AV_CODEC_ID_TRUEMOTION2RT, - AV_CODEC_ID_M101, - AV_CODEC_ID_MAGICYUV, - AV_CODEC_ID_SHEERVIDEO, - AV_CODEC_ID_YLC, - - /* various PCM "codecs" */ - AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs - AV_CODEC_ID_PCM_S16LE = 0x10000, - AV_CODEC_ID_PCM_S16BE, - AV_CODEC_ID_PCM_U16LE, - AV_CODEC_ID_PCM_U16BE, - AV_CODEC_ID_PCM_S8, - AV_CODEC_ID_PCM_U8, - AV_CODEC_ID_PCM_MULAW, - AV_CODEC_ID_PCM_ALAW, - AV_CODEC_ID_PCM_S32LE, - AV_CODEC_ID_PCM_S32BE, - AV_CODEC_ID_PCM_U32LE, - AV_CODEC_ID_PCM_U32BE, - AV_CODEC_ID_PCM_S24LE, - AV_CODEC_ID_PCM_S24BE, - AV_CODEC_ID_PCM_U24LE, - AV_CODEC_ID_PCM_U24BE, - AV_CODEC_ID_PCM_S24DAUD, - AV_CODEC_ID_PCM_ZORK, - AV_CODEC_ID_PCM_S16LE_PLANAR, - AV_CODEC_ID_PCM_DVD, - AV_CODEC_ID_PCM_F32BE, - AV_CODEC_ID_PCM_F32LE, - AV_CODEC_ID_PCM_F64BE, - AV_CODEC_ID_PCM_F64LE, - AV_CODEC_ID_PCM_BLURAY, - AV_CODEC_ID_PCM_LXF, - AV_CODEC_ID_S302M, - AV_CODEC_ID_PCM_S8_PLANAR, - AV_CODEC_ID_PCM_S24LE_PLANAR, - AV_CODEC_ID_PCM_S32LE_PLANAR, - AV_CODEC_ID_PCM_S16BE_PLANAR, - - AV_CODEC_ID_PCM_S64LE = 0x10800, - AV_CODEC_ID_PCM_S64BE, - - /* various ADPCM codecs */ - AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, - AV_CODEC_ID_ADPCM_IMA_WAV, - AV_CODEC_ID_ADPCM_IMA_DK3, - AV_CODEC_ID_ADPCM_IMA_DK4, - AV_CODEC_ID_ADPCM_IMA_WS, - AV_CODEC_ID_ADPCM_IMA_SMJPEG, - AV_CODEC_ID_ADPCM_MS, - AV_CODEC_ID_ADPCM_4XM, - AV_CODEC_ID_ADPCM_XA, - AV_CODEC_ID_ADPCM_ADX, - AV_CODEC_ID_ADPCM_EA, - AV_CODEC_ID_ADPCM_G726, - AV_CODEC_ID_ADPCM_CT, - AV_CODEC_ID_ADPCM_SWF, - AV_CODEC_ID_ADPCM_YAMAHA, - AV_CODEC_ID_ADPCM_SBPRO_4, - AV_CODEC_ID_ADPCM_SBPRO_3, - AV_CODEC_ID_ADPCM_SBPRO_2, - AV_CODEC_ID_ADPCM_THP, - AV_CODEC_ID_ADPCM_IMA_AMV, - AV_CODEC_ID_ADPCM_EA_R1, - AV_CODEC_ID_ADPCM_EA_R3, - AV_CODEC_ID_ADPCM_EA_R2, - AV_CODEC_ID_ADPCM_IMA_EA_SEAD, - AV_CODEC_ID_ADPCM_IMA_EA_EACS, - AV_CODEC_ID_ADPCM_EA_XAS, - AV_CODEC_ID_ADPCM_EA_MAXIS_XA, - AV_CODEC_ID_ADPCM_IMA_ISS, - AV_CODEC_ID_ADPCM_G722, - AV_CODEC_ID_ADPCM_IMA_APC, - AV_CODEC_ID_ADPCM_VIMA, -#if FF_API_VIMA_DECODER - AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA, -#endif - - AV_CODEC_ID_ADPCM_AFC = 0x11800, - AV_CODEC_ID_ADPCM_IMA_OKI, - AV_CODEC_ID_ADPCM_DTK, - AV_CODEC_ID_ADPCM_IMA_RAD, - AV_CODEC_ID_ADPCM_G726LE, - AV_CODEC_ID_ADPCM_THP_LE, - AV_CODEC_ID_ADPCM_PSX, - AV_CODEC_ID_ADPCM_AICA, - AV_CODEC_ID_ADPCM_IMA_DAT4, - AV_CODEC_ID_ADPCM_MTAF, - - /* AMR */ - AV_CODEC_ID_AMR_NB = 0x12000, - AV_CODEC_ID_AMR_WB, - - /* RealAudio codecs*/ - AV_CODEC_ID_RA_144 = 0x13000, - AV_CODEC_ID_RA_288, - - /* various DPCM codecs */ - AV_CODEC_ID_ROQ_DPCM = 0x14000, - AV_CODEC_ID_INTERPLAY_DPCM, - AV_CODEC_ID_XAN_DPCM, - AV_CODEC_ID_SOL_DPCM, - - AV_CODEC_ID_SDX2_DPCM = 0x14800, - - /* audio codecs */ - AV_CODEC_ID_MP2 = 0x15000, - AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 - AV_CODEC_ID_AAC, - AV_CODEC_ID_AC3, - AV_CODEC_ID_DTS, - AV_CODEC_ID_VORBIS, - AV_CODEC_ID_DVAUDIO, - AV_CODEC_ID_WMAV1, - AV_CODEC_ID_WMAV2, - AV_CODEC_ID_MACE3, - AV_CODEC_ID_MACE6, - AV_CODEC_ID_VMDAUDIO, - AV_CODEC_ID_FLAC, - AV_CODEC_ID_MP3ADU, - AV_CODEC_ID_MP3ON4, - AV_CODEC_ID_SHORTEN, - AV_CODEC_ID_ALAC, - AV_CODEC_ID_WESTWOOD_SND1, - AV_CODEC_ID_GSM, ///< as in Berlin toast format - AV_CODEC_ID_QDM2, - AV_CODEC_ID_COOK, - AV_CODEC_ID_TRUESPEECH, - AV_CODEC_ID_TTA, - AV_CODEC_ID_SMACKAUDIO, - AV_CODEC_ID_QCELP, - AV_CODEC_ID_WAVPACK, - AV_CODEC_ID_DSICINAUDIO, - AV_CODEC_ID_IMC, - AV_CODEC_ID_MUSEPACK7, - AV_CODEC_ID_MLP, - AV_CODEC_ID_GSM_MS, /* as found in WAV */ - AV_CODEC_ID_ATRAC3, -#if FF_API_VOXWARE - AV_CODEC_ID_VOXWARE, -#endif - AV_CODEC_ID_APE, - AV_CODEC_ID_NELLYMOSER, - AV_CODEC_ID_MUSEPACK8, - AV_CODEC_ID_SPEEX, - AV_CODEC_ID_WMAVOICE, - AV_CODEC_ID_WMAPRO, - AV_CODEC_ID_WMALOSSLESS, - AV_CODEC_ID_ATRAC3P, - AV_CODEC_ID_EAC3, - AV_CODEC_ID_SIPR, - AV_CODEC_ID_MP1, - AV_CODEC_ID_TWINVQ, - AV_CODEC_ID_TRUEHD, - AV_CODEC_ID_MP4ALS, - AV_CODEC_ID_ATRAC1, - AV_CODEC_ID_BINKAUDIO_RDFT, - AV_CODEC_ID_BINKAUDIO_DCT, - AV_CODEC_ID_AAC_LATM, - AV_CODEC_ID_QDMC, - AV_CODEC_ID_CELT, - AV_CODEC_ID_G723_1, - AV_CODEC_ID_G729, - AV_CODEC_ID_8SVX_EXP, - AV_CODEC_ID_8SVX_FIB, - AV_CODEC_ID_BMV_AUDIO, - AV_CODEC_ID_RALF, - AV_CODEC_ID_IAC, - AV_CODEC_ID_ILBC, - AV_CODEC_ID_OPUS, - AV_CODEC_ID_COMFORT_NOISE, - AV_CODEC_ID_TAK, - AV_CODEC_ID_METASOUND, - AV_CODEC_ID_PAF_AUDIO, - AV_CODEC_ID_ON2AVC, - AV_CODEC_ID_DSS_SP, - - AV_CODEC_ID_FFWAVESYNTH = 0x15800, - AV_CODEC_ID_SONIC, - AV_CODEC_ID_SONIC_LS, - AV_CODEC_ID_EVRC, - AV_CODEC_ID_SMV, - AV_CODEC_ID_DSD_LSBF, - AV_CODEC_ID_DSD_MSBF, - AV_CODEC_ID_DSD_LSBF_PLANAR, - AV_CODEC_ID_DSD_MSBF_PLANAR, - AV_CODEC_ID_4GV, - AV_CODEC_ID_INTERPLAY_ACM, - AV_CODEC_ID_XMA1, - AV_CODEC_ID_XMA2, - AV_CODEC_ID_DST, - - /* subtitle codecs */ - AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. - AV_CODEC_ID_DVD_SUBTITLE = 0x17000, - AV_CODEC_ID_DVB_SUBTITLE, - AV_CODEC_ID_TEXT, ///< raw UTF-8 text - AV_CODEC_ID_XSUB, - AV_CODEC_ID_SSA, - AV_CODEC_ID_MOV_TEXT, - AV_CODEC_ID_HDMV_PGS_SUBTITLE, - AV_CODEC_ID_DVB_TELETEXT, - AV_CODEC_ID_SRT, - - AV_CODEC_ID_MICRODVD = 0x17800, - AV_CODEC_ID_EIA_608, - AV_CODEC_ID_JACOSUB, - AV_CODEC_ID_SAMI, - AV_CODEC_ID_REALTEXT, - AV_CODEC_ID_STL, - AV_CODEC_ID_SUBVIEWER1, - AV_CODEC_ID_SUBVIEWER, - AV_CODEC_ID_SUBRIP, - AV_CODEC_ID_WEBVTT, - AV_CODEC_ID_MPL2, - AV_CODEC_ID_VPLAYER, - AV_CODEC_ID_PJS, - AV_CODEC_ID_ASS, - AV_CODEC_ID_HDMV_TEXT_SUBTITLE, - - /* other specific kind of codecs (generally used for attachments) */ - AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. - AV_CODEC_ID_TTF = 0x18000, - - AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. - AV_CODEC_ID_BINTEXT = 0x18800, - AV_CODEC_ID_XBIN, - AV_CODEC_ID_IDF, - AV_CODEC_ID_OTF, - AV_CODEC_ID_SMPTE_KLV, - AV_CODEC_ID_DVD_NAV, - AV_CODEC_ID_TIMED_ID3, - AV_CODEC_ID_BIN_DATA, - - - AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it - - AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS - * stream (only used by libavformat) */ - AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems - * stream (only used by libavformat) */ - AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. - AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket -}; - -/** - * This struct describes the properties of a single codec described by an - * AVCodecID. - * @see avcodec_descriptor_get() - */ -typedef struct AVCodecDescriptor { - enum AVCodecID id; - enum AVMediaType type; - /** - * Name of the codec described by this descriptor. It is non-empty and - * unique for each codec descriptor. It should contain alphanumeric - * characters and '_' only. - */ - const char *name; - /** - * A more descriptive name for this codec. May be NULL. - */ - const char *long_name; - /** - * Codec properties, a combination of AV_CODEC_PROP_* flags. - */ - int props; - /** - * MIME type(s) associated with the codec. - * May be NULL; if not, a NULL-terminated array of MIME types. - * The first item is always non-NULL and is the preferred MIME type. - */ - const char *const *mime_types; - /** - * If non-NULL, an array of profiles recognized for this codec. - * Terminated with FF_PROFILE_UNKNOWN. - */ - const struct AVProfile *profiles; -} AVCodecDescriptor; - -/** - * Codec uses only intra compression. - * Video codecs only. - */ -#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) -/** - * Codec supports lossy compression. Audio and video codecs only. - * @note a codec may support both lossy and lossless - * compression modes - */ -#define AV_CODEC_PROP_LOSSY (1 << 1) -/** - * Codec supports lossless compression. Audio and video codecs only. - */ -#define AV_CODEC_PROP_LOSSLESS (1 << 2) -/** - * Codec supports frame reordering. That is, the coded order (the order in which - * the encoded packets are output by the encoders / stored / input to the - * decoders) may be different from the presentation order of the corresponding - * frames. - * - * For codecs that do not have this property set, PTS and DTS should always be - * equal. - */ -#define AV_CODEC_PROP_REORDER (1 << 3) -/** - * Subtitle codec is bitmap based - * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. - */ -#define AV_CODEC_PROP_BITMAP_SUB (1 << 16) -/** - * Subtitle codec is text based. - * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field. - */ -#define AV_CODEC_PROP_TEXT_SUB (1 << 17) - -/** - * @ingroup lavc_decoding - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * This is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end.
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged - * MPEG bitstreams could cause overread and segfault. - */ -#define AV_INPUT_BUFFER_PADDING_SIZE 32 - -/** - * @ingroup lavc_encoding - * minimum encoding buffer size - * Used to avoid some checks during header writing. - */ -#define AV_INPUT_BUFFER_MIN_SIZE 16384 - -#if FF_API_WITHOUT_PREFIX -/** - * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead - */ -#define FF_INPUT_BUFFER_PADDING_SIZE 32 - -/** - * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead - */ -#define FF_MIN_BUFFER_SIZE 16384 -#endif /* FF_API_WITHOUT_PREFIX */ - -/** - * @ingroup lavc_encoding - * motion estimation type. - * @deprecated use codec private option instead - */ -#if FF_API_MOTION_EST -enum Motion_Est_ID { - ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, ///< enhanced predictive zonal search - ME_X1, ///< reserved for experiments - ME_HEX, ///< hexagon based search - ME_UMH, ///< uneven multi-hexagon search - ME_TESA, ///< transformed exhaustive search algorithm - ME_ITER=50, ///< iterative search -}; -#endif - -/** - * @ingroup lavc_decoding - */ -enum AVDiscard{ - /* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). */ - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONINTRA= 24, ///< discard all non intra frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all -}; - -enum AVAudioServiceType { - AV_AUDIO_SERVICE_TYPE_MAIN = 0, - AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, - AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, - AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, - AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, - AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, - AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, - AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, - AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, - AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI -}; - -/** - * @ingroup lavc_encoding - */ -typedef struct RcOverride{ - int start_frame; - int end_frame; - int qscale; // If this is 0 then quality_factor will be used instead. - float quality_factor; -} RcOverride; - -#if FF_API_MAX_BFRAMES -/** - * @deprecated there is no libavcodec-wide limit on the number of B-frames - */ -#define FF_MAX_B_FRAMES 16 -#endif - -/* encoding support - These flags can be passed in AVCodecContext.flags before initialization. - Note: Not everything is supported yet. -*/ - -/** - * Allow decoders to produce frames with data planes that are not aligned - * to CPU requirements (e.g. due to cropping). - */ -#define AV_CODEC_FLAG_UNALIGNED (1 << 0) -/** - * Use fixed qscale. - */ -#define AV_CODEC_FLAG_QSCALE (1 << 1) -/** - * 4 MV per MB allowed / advanced prediction for H.263. - */ -#define AV_CODEC_FLAG_4MV (1 << 2) -/** - * Output even those frames that might be corrupted. - */ -#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3) -/** - * Use qpel MC. - */ -#define AV_CODEC_FLAG_QPEL (1 << 4) -/** - * Use internal 2pass ratecontrol in first pass mode. - */ -#define AV_CODEC_FLAG_PASS1 (1 << 9) -/** - * Use internal 2pass ratecontrol in second pass mode. - */ -#define AV_CODEC_FLAG_PASS2 (1 << 10) -/** - * loop filter. - */ -#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) -/** - * Only decode/encode grayscale. - */ -#define AV_CODEC_FLAG_GRAY (1 << 13) -/** - * error[?] variables will be set during encoding. - */ -#define AV_CODEC_FLAG_PSNR (1 << 15) -/** - * Input bitstream might be truncated at a random location - * instead of only at frame boundaries. - */ -#define AV_CODEC_FLAG_TRUNCATED (1 << 16) -/** - * Use interlaced DCT. - */ -#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18) -/** - * Force low delay. - */ -#define AV_CODEC_FLAG_LOW_DELAY (1 << 19) -/** - * Place global headers in extradata instead of every keyframe. - */ -#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) -/** - * Use only bitexact stuff (except (I)DCT). - */ -#define AV_CODEC_FLAG_BITEXACT (1 << 23) -/* Fx : Flag for H.263+ extra options */ -/** - * H.263 advanced intra coding / MPEG-4 AC prediction - */ -#define AV_CODEC_FLAG_AC_PRED (1 << 24) -/** - * interlaced motion estimation - */ -#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) -#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31) - -/** - * Allow non spec compliant speedup tricks. - */ -#define AV_CODEC_FLAG2_FAST (1 << 0) -/** - * Skip bitstream encoding. - */ -#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2) -/** - * Place global headers at every keyframe instead of in extradata. - */ -#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3) - -/** - * timecode is in drop frame format. DEPRECATED!!!! - */ -#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13) - -/** - * Input bitstream might be truncated at a packet boundaries - * instead of only at frame boundaries. - */ -#define AV_CODEC_FLAG2_CHUNKS (1 << 15) -/** - * Discard cropping information from SPS. - */ -#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16) - -/** - * Show all frames before the first keyframe - */ -#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) -/** - * Export motion vectors through frame side data - */ -#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28) -/** - * Do not skip samples and export skip information as frame side data - */ -#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29) -/** - * Do not reset ASS ReadOrder field on flush (subtitles decoding) - */ -#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30) - -/* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independent Segment Decoding */ -/* /Fx */ -/* codec capabilities */ - -/** - * Decoder can use draw_horiz_band callback. - */ -#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0) -/** - * Codec uses get_buffer() for allocating buffers and supports custom allocators. - * If not set, it might not use get_buffer() at all or use operations that - * assume the buffer was allocated by avcodec_default_get_buffer. - */ -#define AV_CODEC_CAP_DR1 (1 << 1) -#define AV_CODEC_CAP_TRUNCATED (1 << 3) -/** - * Encoder or decoder requires flushing with NULL input at the end in order to - * give the complete and correct output. - * - * NOTE: If this flag is not set, the codec is guaranteed to never be fed with - * with NULL data. The user can still send NULL data to the public encode - * or decode function, but libavcodec will not pass it along to the codec - * unless this flag is set. - * - * Decoders: - * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to get the delayed data until the decoder no longer - * returns frames. - * - * Encoders: - * The encoder needs to be fed with NULL data at the end of encoding until the - * encoder no longer returns data. - * - * NOTE: For encoders implementing the AVCodec.encode2() function, setting this - * flag also means that the encoder must set the pts and duration for - * each output packet. If this flag is not set, the pts and duration will - * be determined by libavcodec from the input frame. - */ -#define AV_CODEC_CAP_DELAY (1 << 5) -/** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. - */ -#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) - -#if FF_API_CAP_VDPAU -/** - * Codec can export data for HW decoding (VDPAU). - */ -#define AV_CODEC_CAP_HWACCEL_VDPAU (1 << 7) -#endif - -/** - * Codec can output multiple frames per AVPacket - * Normally demuxers return one frame at a time, demuxers which do not do - * are connected to a parser to split what they return into proper frames. - * This flag is reserved to the very rare category of codecs which have a - * bitstream that cannot be split into frames without timeconsuming - * operations like full decoding. Demuxers carrying such bitstreams thus - * may return multiple frames in a packet. This has many disadvantages like - * prohibiting stream copy in many cases thus it should only be considered - * as a last resort. - */ -#define AV_CODEC_CAP_SUBFRAMES (1 << 8) -/** - * Codec is experimental and is thus avoided in favor of non experimental - * encoders - */ -#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9) -/** - * Codec should fill in channel configuration and samplerate instead of container - */ -#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10) -/** - * Codec supports frame-level multithreading. - */ -#define AV_CODEC_CAP_FRAME_THREADS (1 << 12) -/** - * Codec supports slice-based (or partition-based) multithreading. - */ -#define AV_CODEC_CAP_SLICE_THREADS (1 << 13) -/** - * Codec supports changed parameters at any point. - */ -#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14) -/** - * Codec supports avctx->thread_count == 0 (auto). - */ -#define AV_CODEC_CAP_AUTO_THREADS (1 << 15) -/** - * Audio encoder supports receiving a different number of samples in each call. - */ -#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16) -/** - * Decoder is not a preferred choice for probing. - * This indicates that the decoder is not a good choice for probing. - * It could for example be an expensive to spin up hardware decoder, - * or it could simply not provide a lot of useful information about - * the stream. - * A decoder marked with this flag should only be used as last resort - * choice for probing. - */ -#define AV_CODEC_CAP_AVOID_PROBING (1 << 17) -/** - * Codec is intra only. - */ -#define AV_CODEC_CAP_INTRA_ONLY 0x40000000 -/** - * Codec is lossless. - */ -#define AV_CODEC_CAP_LOSSLESS 0x80000000 - - -#if FF_API_WITHOUT_PREFIX -/** - * Allow decoders to produce frames with data planes that are not aligned - * to CPU requirements (e.g. due to cropping). - */ -#define CODEC_FLAG_UNALIGNED AV_CODEC_FLAG_UNALIGNED -#define CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE -#define CODEC_FLAG_4MV AV_CODEC_FLAG_4MV -#define CODEC_FLAG_OUTPUT_CORRUPT AV_CODEC_FLAG_OUTPUT_CORRUPT -#define CODEC_FLAG_QPEL AV_CODEC_FLAG_QPEL -#if FF_API_GMC -/** - * @deprecated use the "gmc" private option of the libxvid encoder - */ -#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. -#endif -#if FF_API_MV0 -/** - * @deprecated use the flag "mv0" in the "mpv_flags" private option of the - * mpegvideo encoders - */ -#define CODEC_FLAG_MV0 0x0040 -#endif -#if FF_API_INPUT_PRESERVED -/** - * @deprecated passing reference-counted frames to the encoders replaces this - * flag - */ -#define CODEC_FLAG_INPUT_PRESERVED 0x0100 -#endif -#define CODEC_FLAG_PASS1 AV_CODEC_FLAG_PASS1 -#define CODEC_FLAG_PASS2 AV_CODEC_FLAG_PASS2 -#define CODEC_FLAG_GRAY AV_CODEC_FLAG_GRAY -#if FF_API_EMU_EDGE -/** - * @deprecated edges are not used/required anymore. I.e. this flag is now always - * set. - */ -#define CODEC_FLAG_EMU_EDGE 0x4000 -#endif -#define CODEC_FLAG_PSNR AV_CODEC_FLAG_PSNR -#define CODEC_FLAG_TRUNCATED AV_CODEC_FLAG_TRUNCATED - -#if FF_API_NORMALIZE_AQP -/** - * @deprecated use the flag "naq" in the "mpv_flags" private option of the - * mpegvideo encoders - */ -#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 -#endif -#define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT -#define CODEC_FLAG_LOW_DELAY AV_CODEC_FLAG_LOW_DELAY -#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER -#define CODEC_FLAG_BITEXACT AV_CODEC_FLAG_BITEXACT -#define CODEC_FLAG_AC_PRED AV_CODEC_FLAG_AC_PRED -#define CODEC_FLAG_LOOP_FILTER AV_CODEC_FLAG_LOOP_FILTER -#define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME -#define CODEC_FLAG_CLOSED_GOP AV_CODEC_FLAG_CLOSED_GOP -#define CODEC_FLAG2_FAST AV_CODEC_FLAG2_FAST -#define CODEC_FLAG2_NO_OUTPUT AV_CODEC_FLAG2_NO_OUTPUT -#define CODEC_FLAG2_LOCAL_HEADER AV_CODEC_FLAG2_LOCAL_HEADER -#define CODEC_FLAG2_DROP_FRAME_TIMECODE AV_CODEC_FLAG2_DROP_FRAME_TIMECODE -#define CODEC_FLAG2_IGNORE_CROP AV_CODEC_FLAG2_IGNORE_CROP - -#define CODEC_FLAG2_CHUNKS AV_CODEC_FLAG2_CHUNKS -#define CODEC_FLAG2_SHOW_ALL AV_CODEC_FLAG2_SHOW_ALL -#define CODEC_FLAG2_EXPORT_MVS AV_CODEC_FLAG2_EXPORT_MVS -#define CODEC_FLAG2_SKIP_MANUAL AV_CODEC_FLAG2_SKIP_MANUAL - -/* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independent Segment Decoding */ -/* /Fx */ -/* codec capabilities */ - -#define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND ///< Decoder can use draw_horiz_band callback. -/** - * Codec uses get_buffer() for allocating buffers and supports custom allocators. - * If not set, it might not use get_buffer() at all or use operations that - * assume the buffer was allocated by avcodec_default_get_buffer. - */ -#define CODEC_CAP_DR1 AV_CODEC_CAP_DR1 -#define CODEC_CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED -#if FF_API_XVMC -/* Codec can export data for HW decoding. This flag indicates that - * the codec would call get_format() with list that might contain HW accelerated - * pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them - * including raw image format. - * The application can use the passed context to determine bitstream version, - * chroma format, resolution etc. - */ -#define CODEC_CAP_HWACCEL 0x0010 -#endif /* FF_API_XVMC */ -/** - * Encoder or decoder requires flushing with NULL input at the end in order to - * give the complete and correct output. - * - * NOTE: If this flag is not set, the codec is guaranteed to never be fed with - * with NULL data. The user can still send NULL data to the public encode - * or decode function, but libavcodec will not pass it along to the codec - * unless this flag is set. - * - * Decoders: - * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to get the delayed data until the decoder no longer - * returns frames. - * - * Encoders: - * The encoder needs to be fed with NULL data at the end of encoding until the - * encoder no longer returns data. - * - * NOTE: For encoders implementing the AVCodec.encode2() function, setting this - * flag also means that the encoder must set the pts and duration for - * each output packet. If this flag is not set, the pts and duration will - * be determined by libavcodec from the input frame. - */ -#define CODEC_CAP_DELAY AV_CODEC_CAP_DELAY -/** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. - */ -#define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME -#if FF_API_CAP_VDPAU -/** - * Codec can export data for HW decoding (VDPAU). - */ -#define CODEC_CAP_HWACCEL_VDPAU AV_CODEC_CAP_HWACCEL_VDPAU -#endif -/** - * Codec can output multiple frames per AVPacket - * Normally demuxers return one frame at a time, demuxers which do not do - * are connected to a parser to split what they return into proper frames. - * This flag is reserved to the very rare category of codecs which have a - * bitstream that cannot be split into frames without timeconsuming - * operations like full decoding. Demuxers carrying such bitstreams thus - * may return multiple frames in a packet. This has many disadvantages like - * prohibiting stream copy in many cases thus it should only be considered - * as a last resort. - */ -#define CODEC_CAP_SUBFRAMES AV_CODEC_CAP_SUBFRAMES -/** - * Codec is experimental and is thus avoided in favor of non experimental - * encoders - */ -#define CODEC_CAP_EXPERIMENTAL AV_CODEC_CAP_EXPERIMENTAL -/** - * Codec should fill in channel configuration and samplerate instead of container - */ -#define CODEC_CAP_CHANNEL_CONF AV_CODEC_CAP_CHANNEL_CONF -#if FF_API_NEG_LINESIZES -/** - * @deprecated no codecs use this capability - */ -#define CODEC_CAP_NEG_LINESIZES 0x0800 -#endif -/** - * Codec supports frame-level multithreading. - */ -#define CODEC_CAP_FRAME_THREADS AV_CODEC_CAP_FRAME_THREADS -/** - * Codec supports slice-based (or partition-based) multithreading. - */ -#define CODEC_CAP_SLICE_THREADS AV_CODEC_CAP_SLICE_THREADS -/** - * Codec supports changed parameters at any point. - */ -#define CODEC_CAP_PARAM_CHANGE AV_CODEC_CAP_PARAM_CHANGE -/** - * Codec supports avctx->thread_count == 0 (auto). - */ -#define CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_AUTO_THREADS -/** - * Audio encoder supports receiving a different number of samples in each call. - */ -#define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE -/** - * Codec is intra only. - */ -#define CODEC_CAP_INTRA_ONLY AV_CODEC_CAP_INTRA_ONLY -/** - * Codec is lossless. - */ -#define CODEC_CAP_LOSSLESS AV_CODEC_CAP_LOSSLESS - -/** - * HWAccel is experimental and is thus avoided in favor of non experimental - * codecs - */ -#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 -#endif /* FF_API_WITHOUT_PREFIX */ - -#if FF_API_MB_TYPE -//The following defines may change, don't expect compatibility if you use them. -#define MB_TYPE_INTRA4x4 0x0001 -#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific -#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific -#define MB_TYPE_16x16 0x0008 -#define MB_TYPE_16x8 0x0010 -#define MB_TYPE_8x16 0x0020 -#define MB_TYPE_8x8 0x0040 -#define MB_TYPE_INTERLACED 0x0080 -#define MB_TYPE_DIRECT2 0x0100 //FIXME -#define MB_TYPE_ACPRED 0x0200 -#define MB_TYPE_GMC 0x0400 -#define MB_TYPE_SKIP 0x0800 -#define MB_TYPE_P0L0 0x1000 -#define MB_TYPE_P1L0 0x2000 -#define MB_TYPE_P0L1 0x4000 -#define MB_TYPE_P1L1 0x8000 -#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) -#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) -#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) -#define MB_TYPE_QUANT 0x00010000 -#define MB_TYPE_CBP 0x00020000 -// Note bits 24-31 are reserved for codec specific use (H.264 ref0, MPEG-1 0mv, ...) -#endif - -/** - * Pan Scan area. - * This specifies the area which should be displayed. - * Note there may be multiple such areas for one frame. - */ -typedef struct AVPanScan{ - /** - * id - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int id; - - /** - * width and height in 1/16 pel - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int width; - int height; - - /** - * position of the top left corner in 1/16 pel for up to 3 fields/frames - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t position[3][2]; -}AVPanScan; - -/** - * This structure describes the bitrate properties of an encoded bitstream. It - * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD - * parameters for H.264/HEVC. - */ -typedef struct AVCPBProperties { - /** - * Maximum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ - int max_bitrate; - /** - * Minimum bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ - int min_bitrate; - /** - * Average bitrate of the stream, in bits per second. - * Zero if unknown or unspecified. - */ - int avg_bitrate; - - /** - * The size of the buffer to which the ratecontrol is applied, in bits. - * Zero if unknown or unspecified. - */ - int buffer_size; - - /** - * The delay between the time the packet this structure is associated with - * is received and the time when it should be decoded, in periods of a 27MHz - * clock. - * - * UINT64_MAX when unknown or unspecified. - */ - uint64_t vbv_delay; -} AVCPBProperties; - -#if FF_API_QSCALE_TYPE -#define FF_QSCALE_TYPE_MPEG1 0 -#define FF_QSCALE_TYPE_MPEG2 1 -#define FF_QSCALE_TYPE_H264 2 -#define FF_QSCALE_TYPE_VP56 3 -#endif - -/** - * The decoder will keep a reference to the frame and may reuse it later. - */ -#define AV_GET_BUFFER_FLAG_REF (1 << 0) - -/** - * @defgroup lavc_packet AVPacket - * - * Types and functions for working with AVPacket. - * @{ - */ -enum AVPacketSideDataType { - AV_PKT_DATA_PALETTE, - - /** - * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format - * that the extradata buffer was changed and the receiving side should - * act upon it appropriately. The new extradata is embedded in the side - * data buffer and should be immediately used for processing the current - * frame or packet. - */ - AV_PKT_DATA_NEW_EXTRADATA, - - /** - * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: - * @code - * u32le param_flags - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) - * s32le channel_count - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) - * u64le channel_layout - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) - * s32le sample_rate - * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) - * s32le width - * s32le height - * @endcode - */ - AV_PKT_DATA_PARAM_CHANGE, - - /** - * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of - * structures with info about macroblocks relevant to splitting the - * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). - * That is, it does not necessarily contain info about all macroblocks, - * as long as the distance between macroblocks in the info is smaller - * than the target payload size. - * Each MB info structure is 12 bytes, and is laid out as follows: - * @code - * u32le bit offset from the start of the packet - * u8 current quantizer at the start of the macroblock - * u8 GOB number - * u16le macroblock address within the GOB - * u8 horizontal MV predictor - * u8 vertical MV predictor - * u8 horizontal MV predictor for block number 3 - * u8 vertical MV predictor for block number 3 - * @endcode - */ - AV_PKT_DATA_H263_MB_INFO, - - /** - * This side data should be associated with an audio stream and contains - * ReplayGain information in form of the AVReplayGain struct. - */ - AV_PKT_DATA_REPLAYGAIN, - - /** - * This side data contains a 3x3 transformation matrix describing an affine - * transformation that needs to be applied to the decoded video frames for - * correct presentation. - * - * See libavutil/display.h for a detailed description of the data. - */ - AV_PKT_DATA_DISPLAYMATRIX, - - /** - * This side data should be associated with a video stream and contains - * Stereoscopic 3D information in form of the AVStereo3D struct. - */ - AV_PKT_DATA_STEREO3D, - - /** - * This side data should be associated with an audio stream and corresponds - * to enum AVAudioServiceType. - */ - AV_PKT_DATA_AUDIO_SERVICE_TYPE, - - /** - * This side data contains quality related information from the encoder. - * @code - * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). - * u8 picture type - * u8 error count - * u16 reserved - * u64le[error count] sum of squared differences between encoder in and output - * @endcode - */ - AV_PKT_DATA_QUALITY_STATS, - - /** - * This side data contains an integer value representing the stream index - * of a "fallback" track. A fallback track indicates an alternate - * track to use when the current track can not be decoded for some reason. - * e.g. no decoder available for codec. - */ - AV_PKT_DATA_FALLBACK_TRACK, - - /** - * This side data corresponds to the AVCPBProperties struct. - */ - AV_PKT_DATA_CPB_PROPERTIES, - - /** - * Recommmends skipping the specified number of samples - * @code - * u32le number of samples to skip from start of this packet - * u32le number of samples to skip from end of this packet - * u8 reason for start skip - * u8 reason for end skip (0=padding silence, 1=convergence) - * @endcode - */ - AV_PKT_DATA_SKIP_SAMPLES=70, - - /** - * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that - * the packet may contain "dual mono" audio specific to Japanese DTV - * and if it is true, recommends only the selected channel to be used. - * @code - * u8 selected channels (0=mail/left, 1=sub/right, 2=both) - * @endcode - */ - AV_PKT_DATA_JP_DUALMONO, - - /** - * A list of zero terminated key/value strings. There is no end marker for - * the list, so it is required to rely on the side data size to stop. - */ - AV_PKT_DATA_STRINGS_METADATA, - - /** - * Subtitle event position - * @code - * u32le x1 - * u32le y1 - * u32le x2 - * u32le y2 - * @endcode - */ - AV_PKT_DATA_SUBTITLE_POSITION, - - /** - * Data found in BlockAdditional element of matroska container. There is - * no end marker for the data, so it is required to rely on the side data - * size to recognize the end. 8 byte id (as found in BlockAddId) followed - * by data. - */ - AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, - - /** - * The optional first identifier line of a WebVTT cue. - */ - AV_PKT_DATA_WEBVTT_IDENTIFIER, - - /** - * The optional settings (rendering instructions) that immediately - * follow the timestamp specifier of a WebVTT cue. - */ - AV_PKT_DATA_WEBVTT_SETTINGS, - - /** - * A list of zero terminated key/value strings. There is no end marker for - * the list, so it is required to rely on the side data size to stop. This - * side data includes updated metadata which appeared in the stream. - */ - AV_PKT_DATA_METADATA_UPDATE, - - /** - * MPEGTS stream ID, this is required to pass the stream ID - * information from the demuxer to the corresponding muxer. - */ - AV_PKT_DATA_MPEGTS_STREAM_ID, - - /** - * Mastering display metadata (based on SMPTE-2086:2014). This metadata - * should be associated with a video stream and containts data in the form - * of the AVMasteringDisplayMetadata struct. - */ - AV_PKT_DATA_MASTERING_DISPLAY_METADATA -}; - -#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED - -typedef struct AVPacketSideData { - uint8_t *data; - int size; - enum AVPacketSideDataType type; -} AVPacketSideData; - -/** - * This structure stores compressed data. It is typically exported by demuxers - * and then passed as input to decoders, or received as output from encoders and - * then passed to muxers. - * - * For video, it should typically contain one compressed frame. For audio it may - * contain several compressed frames. Encoders are allowed to output empty - * packets, with no compressed data, containing only side data - * (e.g. to update some stream parameters at the end of encoding). - * - * AVPacket is one of the few structs in FFmpeg, whose size is a part of public - * ABI. Thus it may be allocated on stack and no new fields can be added to it - * without libavcodec and libavformat major bump. - * - * The semantics of data ownership depends on the buf field. - * If it is set, the packet data is dynamically allocated and is - * valid indefinitely until a call to av_packet_unref() reduces the - * reference count to 0. - * - * If the buf field is not set av_packet_ref() would make a copy instead - * of increasing the reference count. - * - * The side data is always allocated with av_malloc(), copied by - * av_packet_ref() and freed by av_packet_unref(). - * - * @see av_packet_ref - * @see av_packet_unref - */ -typedef struct AVPacket { - /** - * A reference to the reference-counted buffer where the packet data is - * stored. - * May be NULL, then the packet data is not reference-counted. - */ - AVBufferRef *buf; - /** - * Presentation timestamp in AVStream->time_base units; the time at which - * the decompressed packet will be presented to the user. - * Can be AV_NOPTS_VALUE if it is not stored in the file. - * pts MUST be larger or equal to dts as presentation cannot happen before - * decompression, unless one wants to view hex dumps. Some formats misuse - * the terms dts and pts/cts to mean something different. Such timestamps - * must be converted to true pts/dts before they are stored in AVPacket. - */ - int64_t pts; - /** - * Decompression timestamp in AVStream->time_base units; the time at which - * the packet is decompressed. - * Can be AV_NOPTS_VALUE if it is not stored in the file. - */ - int64_t dts; - uint8_t *data; - int size; - int stream_index; - /** - * A combination of AV_PKT_FLAG values - */ - int flags; - /** - * Additional packet data that can be provided by the container. - * Packet can contain several types of side information. - */ - AVPacketSideData *side_data; - int side_data_elems; - - /** - * Duration of this packet in AVStream->time_base units, 0 if unknown. - * Equals next_pts - this_pts in presentation order. - */ - int64_t duration; - - int64_t pos; ///< byte position in stream, -1 if unknown - -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated Same as the duration field, but as int64_t. This was required - * for Matroska subtitles, whose duration values could overflow when the - * duration field was still an int. - */ - attribute_deprecated - int64_t convergence_duration; -#endif -} AVPacket; -#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe -#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted -/** - * Flag is used to discard packets which are required to maintain valid - * decoder state but are not required for output and should be dropped - * after decoding. - **/ -#define AV_PKT_FLAG_DISCARD 0x0004 - -enum AVSideDataParamChangeFlags { - AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, - AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, - AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, - AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, -}; -/** - * @} - */ - -struct AVCodecInternal; - -enum AVFieldOrder { - AV_FIELD_UNKNOWN, - AV_FIELD_PROGRESSIVE, - AV_FIELD_TT, //< Top coded_first, top displayed first - AV_FIELD_BB, //< Bottom coded first, bottom displayed first - AV_FIELD_TB, //< Top coded first, bottom displayed first - AV_FIELD_BT, //< Bottom coded first, top displayed first -}; - -/** - * main external API structure. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user - * applications. - * The name string for AVOptions options matches the associated command line - * parameter name and can be found in libavcodec/options_table.h - * The AVOption/command line parameter names differ in some cases from the C - * structure field names for historic reasons or brevity. - * sizeof(AVCodecContext) must not be used outside libav*. - */ -typedef struct AVCodecContext { - /** - * information on struct for av_log - * - set by avcodec_alloc_context3 - */ - const AVClass *av_class; - int log_level_offset; - - enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ - const struct AVCodec *codec; -#if FF_API_CODEC_NAME - /** - * @deprecated this field is not used for anything in libavcodec - */ - attribute_deprecated - char codec_name[32]; -#endif - enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ - - /** - * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * This is used to work around some encoder bugs. - * A demuxer should set this to what is stored in the field used to identify the codec. - * If there are multiple such fields in a container then the demuxer should choose the one - * which maximizes the information about the used codec. - * If the codec tag field in a container is larger than 32 bits then the demuxer should - * remap the longer ID to 32 bits with a table or other structure. Alternatively a new - * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated - * first. - * - encoding: Set by user, if not then the default based on codec_id will be used. - * - decoding: Set by user, will be converted to uppercase by libavcodec during init. - */ - unsigned int codec_tag; - -#if FF_API_STREAM_CODEC_TAG - /** - * @deprecated this field is unused - */ - attribute_deprecated - unsigned int stream_codec_tag; -#endif - - void *priv_data; - - /** - * Private context used for internal data. - * - * Unlike priv_data, this is not codec-specific. It is used in general - * libavcodec functions. - */ - struct AVCodecInternal *internal; - - /** - * Private data of the user, can be used to carry app specific stuff. - * - encoding: Set by user. - * - decoding: Set by user. - */ - void *opaque; - - /** - * the average bitrate - * - encoding: Set by user; unused for constant quantizer encoding. - * - decoding: Set by user, may be overwritten by libavcodec - * if this info is available in the stream - */ - int64_t bit_rate; - - /** - * number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: Set by user; unused for constant quantizer encoding. - * - decoding: unused - */ - int bit_rate_tolerance; - - /** - * Global quality for codecs which cannot change it per frame. - * This should be proportional to MPEG-1/2/4 qscale. - * - encoding: Set by user. - * - decoding: unused - */ - int global_quality; - - /** - * - encoding: Set by user. - * - decoding: unused - */ - int compression_level; -#define FF_COMPRESSION_DEFAULT -1 - - /** - * AV_CODEC_FLAG_*. - * - encoding: Set by user. - * - decoding: Set by user. - */ - int flags; - - /** - * AV_CODEC_FLAG2_* - * - encoding: Set by user. - * - decoding: Set by user. - */ - int flags2; - - /** - * some codecs need / can use extradata like Huffman tables. - * MJPEG: Huffman tables - * rv10: additional flags - * MPEG-4: global headers (they can be in the bitstream or here) - * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger - * than extradata_size to avoid problems if it is read with the bitstream reader. - * The bytewise contents of extradata must not depend on the architecture or CPU endianness. - * - encoding: Set/allocated/freed by libavcodec. - * - decoding: Set/allocated/freed by user. - */ - uint8_t *extradata; - int extradata_size; - - /** - * This is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. For fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * This often, but not always is the inverse of the frame rate or field rate - * for video. 1/time_base is not the average frame rate if the frame rate is not - * constant. - * - * Like containers, elementary streams also can store timestamps, 1/time_base - * is the unit in which these timestamps are specified. - * As example of such codec time base see ISO/IEC 14496-2:2001(E) - * vop_time_increment_resolution and fixed_vop_rate - * (fixed_vop_rate == 0 implies that it is different from the framerate) - * - * - encoding: MUST be set by user. - * - decoding: the use of this field for decoding is deprecated. - * Use framerate instead. - */ - AVRational time_base; - - /** - * For some codecs, the time base is closer to the field rate than the frame rate. - * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration - * if no telecine is used ... - * - * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. - */ - int ticks_per_frame; - - /** - * Codec delay. - * - * Encoding: Number of frames delay there will be from the encoder input to - * the decoder output. (we assume the decoder matches the spec) - * Decoding: Number of frames delay in addition to what a standard decoder - * as specified in the spec would produce. - * - * Video: - * Number of frames the decoded output will be delayed relative to the - * encoded input. - * - * Audio: - * For encoding, this field is unused (see initial_padding). - * - * For decoding, this is the number of samples the decoder needs to - * output before the decoder's output is valid. When seeking, you should - * start decoding this many samples prior to your desired seek point. - * - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int delay; - - - /* video only */ - /** - * picture width / height. - * - * @note Those fields may not match the values of the last - * AVFrame output by avcodec_decode_video2 due frame - * reordering. - * - * - encoding: MUST be set by user. - * - decoding: May be set by the user before opening the decoder if known e.g. - * from the container. Some decoders will require the dimensions - * to be set by the caller. During decoding, the decoder may - * overwrite those values as required while parsing the data. - */ - int width, height; - - /** - * Bitstream width / height, may be different from width/height e.g. when - * the decoded frame is cropped before being output or lowres is enabled. - * - * @note Those field may not match the value of the last - * AVFrame output by avcodec_receive_frame() due frame - * reordering. - * - * - encoding: unused - * - decoding: May be set by the user before opening the decoder if known - * e.g. from the container. During decoding, the decoder may - * overwrite those values as required while parsing the data. - */ - int coded_width, coded_height; - -#if FF_API_ASPECT_EXTENDED -#define FF_ASPECT_EXTENDED 15 -#endif - - /** - * the number of pictures in a group of pictures, or 0 for intra_only - * - encoding: Set by user. - * - decoding: unused - */ - int gop_size; - - /** - * Pixel format, see AV_PIX_FMT_xxx. - * May be set by the demuxer if known from headers. - * May be overridden by the decoder if it knows better. - * - * @note This field may not match the value of the last - * AVFrame output by avcodec_receive_frame() due frame - * reordering. - * - * - encoding: Set by user. - * - decoding: Set by user if known, overridden by libavcodec while - * parsing the data. - */ - enum AVPixelFormat pix_fmt; - -#if FF_API_MOTION_EST - /** - * This option does nothing - * @deprecated use codec private options instead - */ - attribute_deprecated int me_method; -#endif - - /** - * If non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw a horizontal band. It improves cache usage. Not - * all codecs can do that. You must check the codec capabilities - * beforehand. - * When multithreading is used, it may be called from multiple threads - * at the same time; threads might draw different parts of the same AVFrame, - * or multiple AVFrames, and there is no guarantee that slices will be drawn - * in order. - * The function is also used by hardware acceleration APIs. - * It is called at least once during frame decoding to pass - * the data needed for hardware render. - * In that mode instead of pixel data, AVFrame points to - * a structure specific to the acceleration API. The application - * reads the structure and can change some fields to indicate progress - * or mark state. - * - encoding: unused - * - decoding: Set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read - */ - void (*draw_horiz_band)(struct AVCodecContext *s, - const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], - int y, int type, int height); - - /** - * callback to negotiate the pixelFormat - * @param fmt is the list of formats which are supported by the codec, - * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. - * The first is always the native one. - * @note The callback may be called again immediately if initialization for - * the selected (hardware-accelerated) pixel format failed. - * @warning Behavior is undefined if the callback returns a value not - * in the fmt list of formats. - * @return the chosen format - * - encoding: unused - * - decoding: Set by user, if not set the native format will be chosen. - */ - enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); - - /** - * maximum number of B-frames between non-B-frames - * Note: The output will be delayed by max_b_frames+1 relative to the input. - * - encoding: Set by user. - * - decoding: unused - */ - int max_b_frames; - - /** - * qscale factor between IP and B-frames - * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). - * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). - * - encoding: Set by user. - * - decoding: unused - */ - float b_quant_factor; - -#if FF_API_RC_STRATEGY - /** @deprecated use codec private option instead */ - attribute_deprecated int rc_strategy; -#define FF_RC_STRATEGY_XVID 1 -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_frame_strategy; -#endif - - /** - * qscale offset between IP and B-frames - * - encoding: Set by user. - * - decoding: unused - */ - float b_quant_offset; - - /** - * Size of the frame reordering buffer in the decoder. - * For MPEG-2 it is 1 IPB or 0 low delay IP. - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int has_b_frames; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int mpeg_quant; -#endif - - /** - * qscale factor between P- and I-frames - * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). - * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). - * - encoding: Set by user. - * - decoding: unused - */ - float i_quant_factor; - - /** - * qscale offset between P and I-frames - * - encoding: Set by user. - * - decoding: unused - */ - float i_quant_offset; - - /** - * luminance masking (0-> disabled) - * - encoding: Set by user. - * - decoding: unused - */ - float lumi_masking; - - /** - * temporary complexity masking (0-> disabled) - * - encoding: Set by user. - * - decoding: unused - */ - float temporal_cplx_masking; - - /** - * spatial complexity masking (0-> disabled) - * - encoding: Set by user. - * - decoding: unused - */ - float spatial_cplx_masking; - - /** - * p block masking (0-> disabled) - * - encoding: Set by user. - * - decoding: unused - */ - float p_masking; - - /** - * darkness masking (0-> disabled) - * - encoding: Set by user. - * - decoding: unused - */ - float dark_masking; - - /** - * slice count - * - encoding: Set by libavcodec. - * - decoding: Set by user (or 0). - */ - int slice_count; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int prediction_method; -#define FF_PRED_LEFT 0 -#define FF_PRED_PLANE 1 -#define FF_PRED_MEDIAN 2 -#endif - - /** - * slice offsets in the frame in bytes - * - encoding: Set/allocated by libavcodec. - * - decoding: Set/allocated by user (or NULL). - */ - int *slice_offset; - - /** - * sample aspect ratio (0 if unknown) - * That is the width of a pixel divided by the height of the pixel. - * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - AVRational sample_aspect_ratio; - - /** - * motion estimation comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_cmp; - /** - * subpixel motion estimation comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_sub_cmp; - /** - * macroblock comparison function (not supported yet) - * - encoding: Set by user. - * - decoding: unused - */ - int mb_cmp; - /** - * interlaced DCT comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int ildct_cmp; -#define FF_CMP_SAD 0 -#define FF_CMP_SSE 1 -#define FF_CMP_SATD 2 -#define FF_CMP_DCT 3 -#define FF_CMP_PSNR 4 -#define FF_CMP_BIT 5 -#define FF_CMP_RD 6 -#define FF_CMP_ZERO 7 -#define FF_CMP_VSAD 8 -#define FF_CMP_VSSE 9 -#define FF_CMP_NSSE 10 -#define FF_CMP_W53 11 -#define FF_CMP_W97 12 -#define FF_CMP_DCTMAX 13 -#define FF_CMP_DCT264 14 -#define FF_CMP_MEDIAN_SAD 15 -#define FF_CMP_CHROMA 256 - - /** - * ME diamond size & shape - * - encoding: Set by user. - * - decoding: unused - */ - int dia_size; - - /** - * amount of previous MV predictors (2a+1 x 2a+1 square) - * - encoding: Set by user. - * - decoding: unused - */ - int last_predictor_count; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int pre_me; -#endif - - /** - * motion estimation prepass comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int me_pre_cmp; - - /** - * ME prepass diamond size & shape - * - encoding: Set by user. - * - decoding: unused - */ - int pre_dia_size; - - /** - * subpel ME quality - * - encoding: Set by user. - * - decoding: unused - */ - int me_subpel_quality; - -#if FF_API_AFD - /** - * DTG active format information (additional aspect ratio - * information only used in DVB MPEG-2 transport streams) - * 0 if not set. - * - * - encoding: unused - * - decoding: Set by decoder. - * @deprecated Deprecated in favor of AVSideData - */ - attribute_deprecated int dtg_active_format; -#define FF_DTG_AFD_SAME 8 -#define FF_DTG_AFD_4_3 9 -#define FF_DTG_AFD_16_9 10 -#define FF_DTG_AFD_14_9 11 -#define FF_DTG_AFD_4_3_SP_14_9 13 -#define FF_DTG_AFD_16_9_SP_14_9 14 -#define FF_DTG_AFD_SP_4_3 15 -#endif /* FF_API_AFD */ - - /** - * maximum motion estimation search range in subpel units - * If 0 then no limit. - * - * - encoding: Set by user. - * - decoding: unused - */ - int me_range; - -#if FF_API_QUANT_BIAS - /** - * @deprecated use encoder private option instead - */ - attribute_deprecated int intra_quant_bias; -#define FF_DEFAULT_QUANT_BIAS 999999 - - /** - * @deprecated use encoder private option instead - */ - attribute_deprecated int inter_quant_bias; -#endif - - /** - * slice flags - * - encoding: unused - * - decoding: Set by user. - */ - int slice_flags; -#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display -#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics) -#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - -#if FF_API_XVMC - /** - * XVideo Motion Acceleration - * - encoding: forbidden - * - decoding: set by decoder - * @deprecated XvMC doesn't need it anymore. - */ - attribute_deprecated int xvmc_acceleration; -#endif /* FF_API_XVMC */ - - /** - * macroblock decision mode - * - encoding: Set by user. - * - decoding: unused - */ - int mb_decision; -#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp -#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits -#define FF_MB_DECISION_RD 2 ///< rate distortion - - /** - * custom intra quantization matrix - * - encoding: Set by user, can be NULL. - * - decoding: Set by libavcodec. - */ - uint16_t *intra_matrix; - - /** - * custom inter quantization matrix - * - encoding: Set by user, can be NULL. - * - decoding: Set by libavcodec. - */ - uint16_t *inter_matrix; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int scenechange_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int noise_reduction; -#endif - -#if FF_API_MPV_OPT - /** - * @deprecated this field is unused - */ - attribute_deprecated - int me_threshold; - - /** - * @deprecated this field is unused - */ - attribute_deprecated - int mb_threshold; -#endif - - /** - * precision of the intra DC coefficient - 8 - * - encoding: Set by user. - * - decoding: Set by libavcodec - */ - int intra_dc_precision; - - /** - * Number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: Set by user. - */ - int skip_top; - - /** - * Number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: Set by user. - */ - int skip_bottom; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float border_masking; -#endif - - /** - * minimum MB Lagrange multiplier - * - encoding: Set by user. - * - decoding: unused - */ - int mb_lmin; - - /** - * maximum MB Lagrange multiplier - * - encoding: Set by user. - * - decoding: unused - */ - int mb_lmax; - -#if FF_API_PRIVATE_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int me_penalty_compensation; -#endif - - /** - * - encoding: Set by user. - * - decoding: unused - */ - int bidir_refine; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int brd_scale; -#endif - - /** - * minimum GOP size - * - encoding: Set by user. - * - decoding: unused - */ - int keyint_min; - - /** - * number of reference frames - * - encoding: Set by user. - * - decoding: Set by lavc. - */ - int refs; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int chromaoffset; -#endif - -#if FF_API_UNUSED_MEMBERS - /** - * Multiplied by qscale for each frame and added to scene_change_score. - * - encoding: Set by user. - * - decoding: unused - */ - attribute_deprecated int scenechange_factor; -#endif - - /** - * Note: Value depends upon the compare function used for fullpel ME. - * - encoding: Set by user. - * - decoding: unused - */ - int mv0_threshold; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int b_sensitivity; -#endif - - /** - * Chromaticity coordinates of the source primaries. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorPrimaries color_primaries; - - /** - * Color Transfer Characteristic. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorTransferCharacteristic color_trc; - - /** - * YUV colorspace type. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorSpace colorspace; - - /** - * MPEG vs JPEG YUV range. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorRange color_range; - - /** - * This defines the location of chroma samples. - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVChromaLocation chroma_sample_location; - - /** - * Number of slices. - * Indicates number of picture subdivisions. Used for parallelized - * decoding. - * - encoding: Set by user - * - decoding: unused - */ - int slices; - - /** Field order - * - encoding: set by libavcodec - * - decoding: Set by user. - */ - enum AVFieldOrder field_order; - - /* audio only */ - int sample_rate; ///< samples per second - int channels; ///< number of audio channels - - /** - * audio sample format - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - enum AVSampleFormat sample_fmt; ///< sample format - - /* The following data should not be initialized. */ - /** - * Number of samples per channel in an audio frame. - * - * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame - * except the last must contain exactly frame_size samples per channel. - * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the - * frame size is not restricted. - * - decoding: may be set by some decoders to indicate constant frame size - */ - int frame_size; - - /** - * Frame counter, set by libavcodec. - * - * - decoding: total number of frames returned from the decoder so far. - * - encoding: total number of frames passed to the encoder so far. - * - * @note the counter is not incremented if encoding/decoding resulted in - * an error. - */ - int frame_number; - - /** - * number of bytes per packet if constant and known or 0 - * Used by some WAV based audio codecs. - */ - int block_align; - - /** - * Audio cutoff bandwidth (0 means "automatic") - * - encoding: Set by user. - * - decoding: unused - */ - int cutoff; - - /** - * Audio channel layout. - * - encoding: set by user. - * - decoding: set by user, may be overwritten by libavcodec. - */ - uint64_t channel_layout; - - /** - * Request decoder to use this channel layout if it can (0 for default) - * - encoding: unused - * - decoding: Set by user. - */ - uint64_t request_channel_layout; - - /** - * Type of service that the audio stream conveys. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - enum AVAudioServiceType audio_service_type; - - /** - * desired sample format - * - encoding: Not used. - * - decoding: Set by user. - * Decoder will decode to this format if it can. - */ - enum AVSampleFormat request_sample_fmt; - - /** - * This callback is called at the beginning of each frame to get data - * buffer(s) for it. There may be one contiguous buffer for all the data or - * there may be a buffer per each data plane or anything in between. What - * this means is, you may set however many entries in buf[] you feel necessary. - * Each buffer must be reference-counted using the AVBuffer API (see description - * of buf[] below). - * - * The following fields will be set in the frame before this callback is - * called: - * - format - * - width, height (video only) - * - sample_rate, channel_layout, nb_samples (audio only) - * Their values may differ from the corresponding values in - * AVCodecContext. This callback must use the frame values, not the codec - * context values, to calculate the required buffer size. - * - * This callback must fill the following fields in the frame: - * - data[] - * - linesize[] - * - extended_data: - * * if the data is planar audio with more than 8 channels, then this - * callback must allocate and fill extended_data to contain all pointers - * to all data planes. data[] must hold as many pointers as it can. - * extended_data must be allocated with av_malloc() and will be freed in - * av_frame_unref(). - * * otherwise extended_data must point to data - * - buf[] must contain one or more pointers to AVBufferRef structures. Each of - * the frame's data and extended_data pointers must be contained in these. That - * is, one AVBufferRef for each allocated chunk of memory, not necessarily one - * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), - * and av_buffer_ref(). - * - extended_buf and nb_extended_buf must be allocated with av_malloc() by - * this callback and filled with the extra buffers if there are more - * buffers than buf[] can hold. extended_buf will be freed in - * av_frame_unref(). - * - * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call - * avcodec_default_get_buffer2() instead of providing buffers allocated by - * some other means. - * - * Each data plane must be aligned to the maximum required by the target - * CPU. - * - * @see avcodec_default_get_buffer2() - * - * Video: - * - * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused - * (read and/or written to if it is writable) later by libavcodec. - * - * avcodec_align_dimensions2() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16. - * - * Some decoders do not support linesizes changing between frames. - * - * If frame multithreading is used and thread_safe_callbacks is set, - * this callback may be called from a different thread, but not from more - * than one at once. Does not need to be reentrant. - * - * @see avcodec_align_dimensions2() - * - * Audio: - * - * Decoders request a buffer of a particular size by setting - * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, - * however, utilize only part of the buffer by setting AVFrame.nb_samples - * to a smaller value in the output frame. - * - * As a convenience, av_samples_get_buffer_size() and - * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() - * functions to find the required data size and to fill data pointers and - * linesize. In AVFrame.linesize, only linesize[0] may be set for audio - * since all planes must be the same size. - * - * @see av_samples_get_buffer_size(), av_samples_fill_arrays() - * - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - */ - int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); - - /** - * If non-zero, the decoded audio and video frames returned from - * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted - * and are valid indefinitely. The caller must free them with - * av_frame_unref() when they are not needed anymore. - * Otherwise, the decoded frames must not be freed by the caller and are - * only valid until the next decode call. - * - * This is always automatically enabled if avcodec_receive_frame() is used. - * - * - encoding: unused - * - decoding: set by the caller before avcodec_open2(). - */ - int refcounted_frames; - - /* - encoding parameters */ - float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - float qblur; ///< amount of qscale smoothing over time (0.0-1.0) - - /** - * minimum quantizer - * - encoding: Set by user. - * - decoding: unused - */ - int qmin; - - /** - * maximum quantizer - * - encoding: Set by user. - * - decoding: unused - */ - int qmax; - - /** - * maximum quantizer difference between frames - * - encoding: Set by user. - * - decoding: unused - */ - int max_qdiff; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float rc_qsquish; - - attribute_deprecated - float rc_qmod_amp; - attribute_deprecated - int rc_qmod_freq; -#endif - - /** - * decoder bitstream buffer size - * - encoding: Set by user. - * - decoding: unused - */ - int rc_buffer_size; - - /** - * ratecontrol override, see RcOverride - * - encoding: Allocated/set/freed by user. - * - decoding: unused - */ - int rc_override_count; - RcOverride *rc_override; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - const char *rc_eq; -#endif - - /** - * maximum bitrate - * - encoding: Set by user. - * - decoding: Set by user, may be overwritten by libavcodec. - */ - int64_t rc_max_rate; - - /** - * minimum bitrate - * - encoding: Set by user. - * - decoding: unused - */ - int64_t rc_min_rate; - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - float rc_buffer_aggressivity; - - attribute_deprecated - float rc_initial_cplx; -#endif - - /** - * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. - * - encoding: Set by user. - * - decoding: unused. - */ - float rc_max_available_vbv_use; - - /** - * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. - * - encoding: Set by user. - * - decoding: unused. - */ - float rc_min_vbv_overflow_use; - - /** - * Number of bits which should be loaded into the rc buffer before decoding starts. - * - encoding: Set by user. - * - decoding: unused - */ - int rc_initial_buffer_occupancy; - -#if FF_API_CODER_TYPE -#define FF_CODER_TYPE_VLC 0 -#define FF_CODER_TYPE_AC 1 -#define FF_CODER_TYPE_RAW 2 -#define FF_CODER_TYPE_RLE 3 -#if FF_API_UNUSED_MEMBERS -#define FF_CODER_TYPE_DEFLATE 4 -#endif /* FF_API_UNUSED_MEMBERS */ - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int coder_type; -#endif /* FF_API_CODER_TYPE */ - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int context_model; -#endif - -#if FF_API_MPV_OPT - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int lmin; - - /** - * @deprecated use encoder private options instead - */ - attribute_deprecated - int lmax; -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_threshold; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_factor; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_exp; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int frame_skip_cmp; -#endif /* FF_API_PRIVATE_OPT */ - - /** - * trellis RD quantization - * - encoding: Set by user. - * - decoding: unused - */ - int trellis; - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int min_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int max_prediction_order; - - /** @deprecated use encoder private options instead */ - attribute_deprecated - int64_t timecode_frame_start; -#endif - -#if FF_API_RTP_CALLBACK - /** - * @deprecated unused - */ - /* The RTP callback: This function is called */ - /* every time the encoder has a packet to send. */ - /* It depends on the encoder if the data starts */ - /* with a Start Code (it should). H.263 does. */ - /* mb_nb contains the number of macroblocks */ - /* encoded in the RTP payload. */ - attribute_deprecated - void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); -#endif - -#if FF_API_PRIVATE_OPT - /** @deprecated use encoder private options instead */ - attribute_deprecated - int rtp_payload_size; /* The size of the RTP payload: the coder will */ - /* do its best to deliver a chunk with size */ - /* below rtp_payload_size, the chunk will start */ - /* with a start code on some codecs like H.263. */ - /* This doesn't take account of any particular */ - /* headers inside the transmitted RTP payload. */ -#endif - -#if FF_API_STAT_BITS - /* statistics, used for 2-pass encoding */ - attribute_deprecated - int mv_bits; - attribute_deprecated - int header_bits; - attribute_deprecated - int i_tex_bits; - attribute_deprecated - int p_tex_bits; - attribute_deprecated - int i_count; - attribute_deprecated - int p_count; - attribute_deprecated - int skip_count; - attribute_deprecated - int misc_bits; - - /** @deprecated this field is unused */ - attribute_deprecated - int frame_bits; -#endif - - /** - * pass1 encoding statistics output buffer - * - encoding: Set by libavcodec. - * - decoding: unused - */ - char *stats_out; - - /** - * pass2 encoding statistics input buffer - * Concatenated stuff from stats_out of pass1 should be placed here. - * - encoding: Allocated/set/freed by user. - * - decoding: unused - */ - char *stats_in; - - /** - * Work around bugs in encoders which sometimes cannot be detected automatically. - * - encoding: Set by user - * - decoding: Set by user - */ - int workaround_bugs; -#define FF_BUG_AUTODETECT 1 ///< autodetection -#if FF_API_OLD_MSMPEG4 -#define FF_BUG_OLD_MSMPEG4 2 -#endif -#define FF_BUG_XVID_ILACE 4 -#define FF_BUG_UMP4 8 -#define FF_BUG_NO_PADDING 16 -#define FF_BUG_AMV 32 -#if FF_API_AC_VLC -#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. -#endif -#define FF_BUG_QPEL_CHROMA 64 -#define FF_BUG_STD_QPEL 128 -#define FF_BUG_QPEL_CHROMA2 256 -#define FF_BUG_DIRECT_BLOCKSIZE 512 -#define FF_BUG_EDGE 1024 -#define FF_BUG_HPEL_CHROMA 2048 -#define FF_BUG_DC_CLIP 4096 -#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. -#define FF_BUG_TRUNCATED 16384 -#define FF_BUG_IEDGE 32768 - - /** - * strictly follow the standard (MPEG-4, ...). - * - encoding: Set by user. - * - decoding: Set by user. - * Setting this to STRICT or higher means the encoder and decoder will - * generally do stupid things, whereas setting it to unofficial or lower - * will mean the encoder might produce output that is not supported by all - * spec-compliant decoders. Decoders don't differentiate between normal, - * unofficial and experimental (that is, they always try to decode things - * when they can) unless they are explicitly asked to behave stupidly - * (=strictly conform to the specs) - */ - int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. -#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. -#define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions -#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. - - /** - * error concealment flags - * - encoding: unused - * - decoding: Set by user. - */ - int error_concealment; -#define FF_EC_GUESS_MVS 1 -#define FF_EC_DEBLOCK 2 -#define FF_EC_FAVOR_INTER 256 - - /** - * debug - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug; -#define FF_DEBUG_PICT_INFO 1 -#define FF_DEBUG_RC 2 -#define FF_DEBUG_BITSTREAM 4 -#define FF_DEBUG_MB_TYPE 8 -#define FF_DEBUG_QP 16 -#if FF_API_DEBUG_MV -/** - * @deprecated this option does nothing - */ -#define FF_DEBUG_MV 32 -#endif -#define FF_DEBUG_DCT_COEFF 0x00000040 -#define FF_DEBUG_SKIP 0x00000080 -#define FF_DEBUG_STARTCODE 0x00000100 -#if FF_API_UNUSED_MEMBERS -#define FF_DEBUG_PTS 0x00000200 -#endif /* FF_API_UNUSED_MEMBERS */ -#define FF_DEBUG_ER 0x00000400 -#define FF_DEBUG_MMCO 0x00000800 -#define FF_DEBUG_BUGS 0x00001000 -#if FF_API_DEBUG_MV -#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec -#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec -#endif -#define FF_DEBUG_BUFFERS 0x00008000 -#define FF_DEBUG_THREADS 0x00010000 -#define FF_DEBUG_GREEN_MD 0x00800000 -#define FF_DEBUG_NOMC 0x01000000 - -#if FF_API_DEBUG_MV - /** - * debug - * Code outside libavcodec should access this field using AVOptions - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames -#endif - - /** - * Error recognition; may misdetect some more or less valid parts as errors. - * - encoding: unused - * - decoding: Set by user. - */ - int err_recognition; - -/** - * Verify checksums embedded in the bitstream (could be of either encoded or - * decoded data, depending on the codec) and print an error message on mismatch. - * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the - * decoder returning an error. - */ -#define AV_EF_CRCCHECK (1<<0) -#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations -#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length -#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection - -#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue -#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors -#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors -#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error - - - /** - * opaque 64-bit number (generally a PTS) that will be reordered and - * output in AVFrame.reordered_opaque - * - encoding: unused - * - decoding: Set by user. - */ - int64_t reordered_opaque; - - /** - * Hardware accelerator in use - * - encoding: unused. - * - decoding: Set by libavcodec - */ - struct AVHWAccel *hwaccel; - - /** - * Hardware accelerator context. - * For some hardware accelerators, a global context needs to be - * provided by the user. In that case, this holds display-dependent - * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. - * - encoding: unused - * - decoding: Set by user - */ - void *hwaccel_context; - - /** - * error - * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR. - * - decoding: unused - */ - uint64_t error[AV_NUM_DATA_POINTERS]; - - /** - * DCT algorithm, see FF_DCT_* below - * - encoding: Set by user. - * - decoding: unused - */ - int dct_algo; -#define FF_DCT_AUTO 0 -#define FF_DCT_FASTINT 1 -#define FF_DCT_INT 2 -#define FF_DCT_MMX 3 -#define FF_DCT_ALTIVEC 5 -#define FF_DCT_FAAN 6 - - /** - * IDCT algorithm, see FF_IDCT_* below. - * - encoding: Set by user. - * - decoding: Set by user. - */ - int idct_algo; -#define FF_IDCT_AUTO 0 -#define FF_IDCT_INT 1 -#define FF_IDCT_SIMPLE 2 -#define FF_IDCT_SIMPLEMMX 3 -#define FF_IDCT_ARM 7 -#define FF_IDCT_ALTIVEC 8 -#if FF_API_ARCH_SH4 -#define FF_IDCT_SH4 9 -#endif -#define FF_IDCT_SIMPLEARM 10 -#if FF_API_UNUSED_MEMBERS -#define FF_IDCT_IPP 13 -#endif /* FF_API_UNUSED_MEMBERS */ -#define FF_IDCT_XVID 14 -#if FF_API_IDCT_XVIDMMX -#define FF_IDCT_XVIDMMX 14 -#endif /* FF_API_IDCT_XVIDMMX */ -#define FF_IDCT_SIMPLEARMV5TE 16 -#define FF_IDCT_SIMPLEARMV6 17 -#if FF_API_ARCH_SPARC -#define FF_IDCT_SIMPLEVIS 18 -#endif -#define FF_IDCT_FAAN 20 -#define FF_IDCT_SIMPLENEON 22 -#if FF_API_ARCH_ALPHA -#define FF_IDCT_SIMPLEALPHA 23 -#endif -#define FF_IDCT_SIMPLEAUTO 128 - - /** - * bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: Set by libavcodec. - * - decoding: Set by user. - */ - int bits_per_coded_sample; - - /** - * Bits per sample/pixel of internal libavcodec pixel/sample format. - * - encoding: set by user. - * - decoding: set by libavcodec. - */ - int bits_per_raw_sample; - -#if FF_API_LOWRES - /** - * low resolution decoding, 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: Set by user. - * Code outside libavcodec should access this field using: - * av_codec_{get,set}_lowres(avctx) - */ - int lowres; -#endif - -#if FF_API_CODED_FRAME - /** - * the picture in the bitstream - * - encoding: Set by libavcodec. - * - decoding: unused - * - * @deprecated use the quality factor packet side data instead - */ - attribute_deprecated AVFrame *coded_frame; -#endif - - /** - * thread count - * is used to decide how many independent tasks should be passed to execute() - * - encoding: Set by user. - * - decoding: Set by user. - */ - int thread_count; - - /** - * Which multithreading methods to use. - * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, - * so clients which cannot provide future frames should not use it. - * - * - encoding: Set by user, otherwise the default is used. - * - decoding: Set by user, otherwise the default is used. - */ - int thread_type; -#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once -#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once - - /** - * Which multithreading methods are in use by the codec. - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int active_thread_type; - - /** - * Set by the client if its custom get_buffer() callback can be called - * synchronously from another thread, which allows faster multithreaded decoding. - * draw_horiz_band() will be called from other threads regardless of this setting. - * Ignored if the default get_buffer() is used. - * - encoding: Set by user. - * - decoding: Set by user. - */ - int thread_safe_callbacks; - - /** - * The codec may call this to execute several independent things. - * It will return only after finishing all tasks. - * The user may replace this with some multithreaded implementation, - * the default implementation will execute the parts serially. - * @param count the number of things to execute - * - encoding: Set by libavcodec, user can override. - * - decoding: Set by libavcodec, user can override. - */ - int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); - - /** - * The codec may call this to execute several independent things. - * It will return only after finishing all tasks. - * The user may replace this with some multithreaded implementation, - * the default implementation will execute the parts serially. - * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. - * @param c context passed also to func - * @param count the number of things to execute - * @param arg2 argument passed unchanged to func - * @param ret return values of executed functions, must have space for "count" values. May be NULL. - * @param func function that will be called count times, with jobnr from 0 to count-1. - * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no - * two instances of func executing at the same time will have the same threadnr. - * @return always 0 currently, but code should handle a future improvement where when any call to func - * returns < 0 no further calls to func may be done and < 0 is returned. - * - encoding: Set by libavcodec, user can override. - * - decoding: Set by libavcodec, user can override. - */ - int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); - - /** - * noise vs. sse weight for the nsse comparison function - * - encoding: Set by user. - * - decoding: unused - */ - int nsse_weight; - - /** - * profile - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int profile; -#define FF_PROFILE_UNKNOWN -99 -#define FF_PROFILE_RESERVED -100 - -#define FF_PROFILE_AAC_MAIN 0 -#define FF_PROFILE_AAC_LOW 1 -#define FF_PROFILE_AAC_SSR 2 -#define FF_PROFILE_AAC_LTP 3 -#define FF_PROFILE_AAC_HE 4 -#define FF_PROFILE_AAC_HE_V2 28 -#define FF_PROFILE_AAC_LD 22 -#define FF_PROFILE_AAC_ELD 38 -#define FF_PROFILE_MPEG2_AAC_LOW 128 -#define FF_PROFILE_MPEG2_AAC_HE 131 - -#define FF_PROFILE_DNXHD 0 -#define FF_PROFILE_DNXHR_LB 1 -#define FF_PROFILE_DNXHR_SQ 2 -#define FF_PROFILE_DNXHR_HQ 3 -#define FF_PROFILE_DNXHR_HQX 4 -#define FF_PROFILE_DNXHR_444 5 - -#define FF_PROFILE_DTS 20 -#define FF_PROFILE_DTS_ES 30 -#define FF_PROFILE_DTS_96_24 40 -#define FF_PROFILE_DTS_HD_HRA 50 -#define FF_PROFILE_DTS_HD_MA 60 -#define FF_PROFILE_DTS_EXPRESS 70 - -#define FF_PROFILE_MPEG2_422 0 -#define FF_PROFILE_MPEG2_HIGH 1 -#define FF_PROFILE_MPEG2_SS 2 -#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 -#define FF_PROFILE_MPEG2_MAIN 4 -#define FF_PROFILE_MPEG2_SIMPLE 5 - -#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag -#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag - -#define FF_PROFILE_H264_BASELINE 66 -#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) -#define FF_PROFILE_H264_MAIN 77 -#define FF_PROFILE_H264_EXTENDED 88 -#define FF_PROFILE_H264_HIGH 100 -#define FF_PROFILE_H264_HIGH_10 110 -#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 -#define FF_PROFILE_H264_HIGH_422 122 -#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_STEREO_HIGH 128 -#define FF_PROFILE_H264_HIGH_444 144 -#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 -#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_CAVLC_444 44 - -#define FF_PROFILE_VC1_SIMPLE 0 -#define FF_PROFILE_VC1_MAIN 1 -#define FF_PROFILE_VC1_COMPLEX 2 -#define FF_PROFILE_VC1_ADVANCED 3 - -#define FF_PROFILE_MPEG4_SIMPLE 0 -#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 -#define FF_PROFILE_MPEG4_CORE 2 -#define FF_PROFILE_MPEG4_MAIN 3 -#define FF_PROFILE_MPEG4_N_BIT 4 -#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 -#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 -#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 -#define FF_PROFILE_MPEG4_HYBRID 8 -#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 -#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 -#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 -#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 -#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 -#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 -#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 - -#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1 -#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2 -#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768 -#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 -#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 - -#define FF_PROFILE_VP9_0 0 -#define FF_PROFILE_VP9_1 1 -#define FF_PROFILE_VP9_2 2 -#define FF_PROFILE_VP9_3 3 - -#define FF_PROFILE_HEVC_MAIN 1 -#define FF_PROFILE_HEVC_MAIN_10 2 -#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 -#define FF_PROFILE_HEVC_REXT 4 - - /** - * level - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int level; -#define FF_LEVEL_UNKNOWN -99 - - /** - * Skip loop filtering for selected frames. - * - encoding: unused - * - decoding: Set by user. - */ - enum AVDiscard skip_loop_filter; - - /** - * Skip IDCT/dequantization for selected frames. - * - encoding: unused - * - decoding: Set by user. - */ - enum AVDiscard skip_idct; - - /** - * Skip decoding for selected frames. - * - encoding: unused - * - decoding: Set by user. - */ - enum AVDiscard skip_frame; - - /** - * Header containing style information for text subtitles. - * For SUBTITLE_ASS subtitle type, it should contain the whole ASS - * [Script Info] and [V4+ Styles] section, plus the [Events] line and - * the Format line following. It shouldn't include any Dialogue line. - * - encoding: Set/allocated/freed by user (before avcodec_open2()) - * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) - */ - uint8_t *subtitle_header; - int subtitle_header_size; - -#if FF_API_ERROR_RATE - /** - * @deprecated use the 'error_rate' private AVOption of the mpegvideo - * encoders - */ - attribute_deprecated - int error_rate; -#endif - -#if FF_API_VBV_DELAY - /** - * VBV delay coded in the last frame (in periods of a 27 MHz clock). - * Used for compliant TS muxing. - * - encoding: Set by libavcodec. - * - decoding: unused. - * @deprecated this value is now exported as a part of - * AV_PKT_DATA_CPB_PROPERTIES packet side data - */ - attribute_deprecated - uint64_t vbv_delay; -#endif - -#if FF_API_SIDEDATA_ONLY_PKT - /** - * Encoding only and set by default. Allow encoders to output packets - * that do not contain any encoded data, only side data. - * - * Some encoders need to output such packets, e.g. to update some stream - * parameters at the end of encoding. - * - * @deprecated this field disables the default behaviour and - * it is kept only for compatibility. - */ - attribute_deprecated - int side_data_only_packets; -#endif - - /** - * Audio only. The number of "priming" samples (padding) inserted by the - * encoder at the beginning of the audio. I.e. this number of leading - * decoded samples must be discarded by the caller to get the original audio - * without leading padding. - * - * - decoding: unused - * - encoding: Set by libavcodec. The timestamps on the output packets are - * adjusted by the encoder so that they always refer to the - * first sample of the data actually contained in the packet, - * including any added padding. E.g. if the timebase is - * 1/samplerate and the timestamp of the first input sample is - * 0, the timestamp of the first output packet will be - * -initial_padding. - */ - int initial_padding; - - /** - * - decoding: For codecs that store a framerate value in the compressed - * bitstream, the decoder may export it here. { 0, 1} when - * unknown. - * - encoding: May be used to signal the framerate of CFR content to an - * encoder. - */ - AVRational framerate; - - /** - * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. - * - encoding: unused. - * - decoding: Set by libavcodec before calling get_format() - */ - enum AVPixelFormat sw_pix_fmt; - - /** - * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. - * Code outside libavcodec should access this field using: - * av_codec_{get,set}_pkt_timebase(avctx) - * - encoding unused. - * - decoding set by user. - */ - AVRational pkt_timebase; - - /** - * AVCodecDescriptor - * Code outside libavcodec should access this field using: - * av_codec_{get,set}_codec_descriptor(avctx) - * - encoding: unused. - * - decoding: set by libavcodec. - */ - const AVCodecDescriptor *codec_descriptor; - -#if !FF_API_LOWRES - /** - * low resolution decoding, 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: Set by user. - * Code outside libavcodec should access this field using: - * av_codec_{get,set}_lowres(avctx) - */ - int lowres; -#endif - - /** - * Current statistics for PTS correction. - * - decoding: maintained and used by libavcodec, not intended to be used by user apps - * - encoding: unused - */ - int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far - int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far - int64_t pts_correction_last_pts; /// PTS of the last frame - int64_t pts_correction_last_dts; /// DTS of the last frame - - /** - * Character encoding of the input subtitles file. - * - decoding: set by user - * - encoding: unused - */ - char *sub_charenc; - - /** - * Subtitles character encoding mode. Formats or codecs might be adjusting - * this setting (if they are doing the conversion themselves for instance). - * - decoding: set by libavcodec - * - encoding: unused - */ - int sub_charenc_mode; -#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) -#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself -#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv - - /** - * Skip processing alpha if supported by codec. - * Note that if the format uses pre-multiplied alpha (common with VP6, - * and recommended due to better video quality/compression) - * the image will look as if alpha-blended onto a black background. - * However for formats that do not use pre-multiplied alpha - * there might be serious artefacts (though e.g. libswscale currently - * assumes pre-multiplied alpha anyway). - * Code outside libavcodec should access this field using AVOptions - * - * - decoding: set by user - * - encoding: unused - */ - int skip_alpha; - - /** - * Number of samples to skip after a discontinuity - * - decoding: unused - * - encoding: set by libavcodec - */ - int seek_preroll; - -#if !FF_API_DEBUG_MV - /** - * debug motion vectors - * Code outside libavcodec should access this field using AVOptions - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames -#endif - - /** - * custom intra quantization matrix - * Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix() - * - encoding: Set by user, can be NULL. - * - decoding: unused. - */ - uint16_t *chroma_intra_matrix; - - /** - * dump format separator. - * can be ", " or "\n " or anything else - * Code outside libavcodec should access this field using AVOptions - * (NO direct access). - * - encoding: Set by user. - * - decoding: Set by user. - */ - uint8_t *dump_separator; - - /** - * ',' separated list of allowed decoders. - * If NULL then all are allowed - * - encoding: unused - * - decoding: set by user through AVOPtions (NO direct access) - */ - char *codec_whitelist; - - /* - * Properties of the stream that gets decoded - * To be accessed through av_codec_get_properties() (NO direct access) - * - encoding: unused - * - decoding: set by libavcodec - */ - unsigned properties; -#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 -#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 - - /** - * Additional data associated with the entire coded stream. - * - * - decoding: unused - * - encoding: may be set by libavcodec after avcodec_open2(). - */ - AVPacketSideData *coded_side_data; - int nb_coded_side_data; - - /** - * A reference to the AVHWFramesContext describing the input (for encoding) - * or output (decoding) frames. The reference is set by the caller and - * afterwards owned (and freed) by libavcodec. - * - * - decoding: This field should be set by the caller from the get_format() - * callback. The previous reference (if any) will always be - * unreffed by libavcodec before the get_format() call. - * - * If the default get_buffer2() is used with a hwaccel pixel - * format, then this AVHWFramesContext will be used for - * allocating the frame buffers. - * - * - encoding: For hardware encoders configured to use a hwaccel pixel - * format, this field should be set by the caller to a reference - * to the AVHWFramesContext describing input frames. - * AVHWFramesContext.format must be equal to - * AVCodecContext.pix_fmt. - * - * This field should be set before avcodec_open2() is called. - */ - AVBufferRef *hw_frames_ctx; - - /** - * Control the form of AVSubtitle.rects[N]->ass - * - decoding: set by user - * - encoding: unused - */ - int sub_text_format; -#define FF_SUB_TEXT_FMT_ASS 0 -#if FF_API_ASS_TIMING -#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 -#endif - - /** - * Audio only. The amount of padding (in samples) appended by the encoder to - * the end of the audio. I.e. this number of decoded samples must be - * discarded by the caller from the end of the stream to get the original - * audio without any trailing padding. - * - * - decoding: unused - * - encoding: unused - */ - int trailing_padding; - -} AVCodecContext; - -AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); -void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); - -const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); -void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); - -unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); - -int av_codec_get_lowres(const AVCodecContext *avctx); -void av_codec_set_lowres(AVCodecContext *avctx, int val); - -int av_codec_get_seek_preroll(const AVCodecContext *avctx); -void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); - -uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); -void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); - -/** - * AVProfile. - */ -typedef struct AVProfile { - int profile; - const char *name; ///< short name for the profile -} AVProfile; - -typedef struct AVCodecDefault AVCodecDefault; - -struct AVSubtitle; - -/** - * AVCodec. - */ -typedef struct AVCodec { - /** - * Name of the codec implementation. - * The name is globally unique among encoders and among decoders (but an - * encoder and a decoder can share the same name). - * This is the primary way to find a codec from the user perspective. - */ - const char *name; - /** - * Descriptive name for the codec, meant to be more human readable than name. - * You should use the NULL_IF_CONFIG_SMALL() macro to define it. - */ - const char *long_name; - enum AVMediaType type; - enum AVCodecID id; - /** - * Codec capabilities. - * see AV_CODEC_CAP_* - */ - int capabilities; - const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} - const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 - const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 - const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 - const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres() - const AVClass *priv_class; ///< AVClass for the private context - const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavcodec and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - int priv_data_size; - struct AVCodec *next; - /** - * @name Frame-level threading support functions - * @{ - */ - /** - * If defined, called on thread contexts when they are created. - * If the codec allocates writable tables in init(), re-allocate them here. - * priv_data will be set to a copy of the original. - */ - int (*init_thread_copy)(AVCodecContext *); - /** - * Copy necessary context variables from a previous thread context to the current one. - * If not defined, the next thread will start automatically; otherwise, the codec - * must call ff_thread_finish_setup(). - * - * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. - */ - int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); - /** @} */ - - /** - * Private codec-specific defaults. - */ - const AVCodecDefault *defaults; - - /** - * Initialize codec static data, called from avcodec_register(). - */ - void (*init_static_data)(struct AVCodec *codec); - - int (*init)(AVCodecContext *); - int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, - const struct AVSubtitle *sub); - /** - * Encode data to an AVPacket. - * - * @param avctx codec context - * @param avpkt output AVPacket (may contain a user-provided buffer) - * @param[in] frame AVFrame containing the raw data to be encoded - * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a - * non-empty packet was returned in avpkt. - * @return 0 on success, negative error code on failure - */ - int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, - int *got_packet_ptr); - int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); - int (*close)(AVCodecContext *); - /** - * Decode/encode API with decoupled packet/frame dataflow. The API is the - * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except - * that: - * - never called if the codec is closed or the wrong type, - * - AVPacket parameter change side data is applied right before calling - * AVCodec->send_packet, - * - if AV_CODEC_CAP_DELAY is not set, drain packets or frames are never sent, - * - only one drain packet is ever passed down (until the next flush()), - * - a drain AVPacket is always NULL (no need to check for avpkt->size). - */ - int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame); - int (*send_packet)(AVCodecContext *avctx, const AVPacket *avpkt); - int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame); - int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt); - /** - * Flush buffers. - * Will be called when seeking - */ - void (*flush)(AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; -} AVCodec; - -int av_codec_get_max_lowres(const AVCodec *codec); - -struct MpegEncContext; - -/** - * @defgroup lavc_hwaccel AVHWAccel - * @{ - */ -typedef struct AVHWAccel { - /** - * Name of the hardware accelerated codec. - * The name is globally unique among encoders and among decoders (but an - * encoder and a decoder can share the same name). - */ - const char *name; - - /** - * Type of codec implemented by the hardware accelerator. - * - * See AVMEDIA_TYPE_xxx - */ - enum AVMediaType type; - - /** - * Codec implemented by the hardware accelerator. - * - * See AV_CODEC_ID_xxx - */ - enum AVCodecID id; - - /** - * Supported pixel format. - * - * Only hardware accelerated formats are supported here. - */ - enum AVPixelFormat pix_fmt; - - /** - * Hardware accelerated codec capabilities. - * see HWACCEL_CODEC_CAP_* - */ - int capabilities; - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavcodec and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - struct AVHWAccel *next; - - /** - * Allocate a custom buffer - */ - int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame); - - /** - * Called at the beginning of each frame or field picture. - * - * Meaningful frame information (codec specific) is guaranteed to - * be parsed at this point. This function is mandatory. - * - * Note that buf can be NULL along with buf_size set to 0. - * Otherwise, this means the whole frame is available at this point. - * - * @param avctx the codec context - * @param buf the frame data buffer base - * @param buf_size the size of the frame in bytes - * @return zero if successful, a negative value otherwise - */ - int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); - - /** - * Callback for each slice. - * - * Meaningful slice information (codec specific) is guaranteed to - * be parsed at this point. This function is mandatory. - * The only exception is XvMC, that works on MB level. - * - * @param avctx the codec context - * @param buf the slice data buffer base - * @param buf_size the size of the slice in bytes - * @return zero if successful, a negative value otherwise - */ - int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); - - /** - * Called at the end of each frame or field picture. - * - * The whole picture is parsed at this point and can now be sent - * to the hardware accelerator. This function is mandatory. - * - * @param avctx the codec context - * @return zero if successful, a negative value otherwise - */ - int (*end_frame)(AVCodecContext *avctx); - - /** - * Size of per-frame hardware accelerator private data. - * - * Private data is allocated with av_mallocz() before - * AVCodecContext.get_buffer() and deallocated after - * AVCodecContext.release_buffer(). - */ - int frame_priv_data_size; - - /** - * Called for every Macroblock in a slice. - * - * XvMC uses it to replace the ff_mpv_decode_mb(). - * Instead of decoding to raw picture, MB parameters are - * stored in an array provided by the video driver. - * - * @param s the mpeg context - */ - void (*decode_mb)(struct MpegEncContext *s); - - /** - * Initialize the hwaccel private data. - * - * This will be called from ff_get_format(), after hwaccel and - * hwaccel_context are set and the hwaccel private data in AVCodecInternal - * is allocated. - */ - int (*init)(AVCodecContext *avctx); - - /** - * Uninitialize the hwaccel private data. - * - * This will be called from get_format() or avcodec_close(), after hwaccel - * and hwaccel_context are already uninitialized. - */ - int (*uninit)(AVCodecContext *avctx); - - /** - * Size of the private data to allocate in - * AVCodecInternal.hwaccel_priv_data. - */ - int priv_data_size; -} AVHWAccel; - -/** - * Hardware acceleration should be used for decoding even if the codec level - * used is unknown or higher than the maximum supported level reported by the - * hardware driver. - * - * It's generally a good idea to pass this flag unless you have a specific - * reason not to, as hardware tends to under-report supported levels. - */ -#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) - -/** - * Hardware acceleration can output YUV pixel formats with a different chroma - * sampling than 4:2:0 and/or other than 8 bits per component. - */ -#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1) - -/** - * @} - */ - -#if FF_API_AVPICTURE -/** - * @defgroup lavc_picture AVPicture - * - * Functions for working with AVPicture - * @{ - */ - -/** - * Picture data structure. - * - * Up to four components can be stored into it, the last component is - * alpha. - * @deprecated use AVFrame or imgutils functions instead - */ -typedef struct AVPicture { - attribute_deprecated - uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes - attribute_deprecated - int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line -} AVPicture; - -/** - * @} - */ -#endif - -enum AVSubtitleType { - SUBTITLE_NONE, - - SUBTITLE_BITMAP, ///< A bitmap, pict will be set - - /** - * Plain text, the text field must be set by the decoder and is - * authoritative. ass and pict fields may contain approximations. - */ - SUBTITLE_TEXT, - - /** - * Formatted text, the ass field must be set by the decoder and is - * authoritative. pict and text fields may contain approximations. - */ - SUBTITLE_ASS, -}; - -#define AV_SUBTITLE_FLAG_FORCED 0x00000001 - -typedef struct AVSubtitleRect { - int x; ///< top left corner of pict, undefined when pict is not set - int y; ///< top left corner of pict, undefined when pict is not set - int w; ///< width of pict, undefined when pict is not set - int h; ///< height of pict, undefined when pict is not set - int nb_colors; ///< number of colors in pict, undefined when pict is not set - -#if FF_API_AVPICTURE - /** - * @deprecated unused - */ - attribute_deprecated - AVPicture pict; -#endif - /** - * data+linesize for the bitmap of this subtitle. - * Can be set for text/ass as well once they are rendered. - */ - uint8_t *data[4]; - int linesize[4]; - - enum AVSubtitleType type; - - char *text; ///< 0 terminated plain UTF-8 text - - /** - * 0 terminated ASS/SSA compatible event line. - * The presentation of this is unaffected by the other values in this - * struct. - */ - char *ass; - - int flags; -} AVSubtitleRect; - -typedef struct AVSubtitle { - uint16_t format; /* 0 = graphics */ - uint32_t start_display_time; /* relative to packet pts, in ms */ - uint32_t end_display_time; /* relative to packet pts, in ms */ - unsigned num_rects; - AVSubtitleRect **rects; - int64_t pts; ///< Same as packet pts, in AV_TIME_BASE -} AVSubtitle; - -/** - * This struct describes the properties of an encoded stream. - * - * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must - * be allocated with avcodec_parameters_alloc() and freed with - * avcodec_parameters_free(). - */ -typedef struct AVCodecParameters { - /** - * General type of the encoded data. - */ - enum AVMediaType codec_type; - /** - * Specific type of the encoded data (the codec used). - */ - enum AVCodecID codec_id; - /** - * Additional information about the codec (corresponds to the AVI FOURCC). - */ - uint32_t codec_tag; - - /** - * Extra binary data needed for initializing the decoder, codec-dependent. - * - * Must be allocated with av_malloc() and will be freed by - * avcodec_parameters_free(). The allocated size of extradata must be at - * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding - * bytes zeroed. - */ - uint8_t *extradata; - /** - * Size of the extradata content in bytes. - */ - int extradata_size; - - /** - * - video: the pixel format, the value corresponds to enum AVPixelFormat. - * - audio: the sample format, the value corresponds to enum AVSampleFormat. - */ - int format; - - /** - * The average bitrate of the encoded data (in bits per second). - */ - int64_t bit_rate; - - /** - * The number of bits per sample in the codedwords. - * - * This is basically the bitrate per sample. It is mandatory for a bunch of - * formats to actually decode them. It's the number of bits for one sample in - * the actual coded bitstream. - * - * This could be for example 4 for ADPCM - * For PCM formats this matches bits_per_raw_sample - * Can be 0 - */ - int bits_per_coded_sample; - - /** - * This is the number of valid bits in each output sample. If the - * sample format has more bits, the least significant bits are additional - * padding bits, which are always 0. Use right shifts to reduce the sample - * to its actual size. For example, audio formats with 24 bit samples will - * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32. - * To get the original sample use "(int32_t)sample >> 8"." - * - * For ADPCM this might be 12 or 16 or similar - * Can be 0 - */ - int bits_per_raw_sample; - - /** - * Codec-specific bitstream restrictions that the stream conforms to. - */ - int profile; - int level; - - /** - * Video only. The dimensions of the video frame in pixels. - */ - int width; - int height; - - /** - * Video only. The aspect ratio (width / height) which a single pixel - * should have when displayed. - * - * When the aspect ratio is unknown / undefined, the numerator should be - * set to 0 (the denominator may have any value). - */ - AVRational sample_aspect_ratio; - - /** - * Video only. The order of the fields in interlaced video. - */ - enum AVFieldOrder field_order; - - /** - * Video only. Additional colorspace characteristics. - */ - enum AVColorRange color_range; - enum AVColorPrimaries color_primaries; - enum AVColorTransferCharacteristic color_trc; - enum AVColorSpace color_space; - enum AVChromaLocation chroma_location; - - /** - * Video only. Number of delayed frames. - */ - int video_delay; - - /** - * Audio only. The channel layout bitmask. May be 0 if the channel layout is - * unknown or unspecified, otherwise the number of bits set must be equal to - * the channels field. - */ - uint64_t channel_layout; - /** - * Audio only. The number of audio channels. - */ - int channels; - /** - * Audio only. The number of audio samples per second. - */ - int sample_rate; - /** - * Audio only. The number of bytes per coded audio frame, required by some - * formats. - * - * Corresponds to nBlockAlign in WAVEFORMATEX. - */ - int block_align; - /** - * Audio only. Audio frame size, if known. Required by some formats to be static. - */ - int frame_size; - - /** - * Audio only. The amount of padding (in samples) inserted by the encoder at - * the beginning of the audio. I.e. this number of leading decoded samples - * must be discarded by the caller to get the original audio without leading - * padding. - */ - int initial_padding; - /** - * Audio only. The amount of padding (in samples) appended by the encoder to - * the end of the audio. I.e. this number of decoded samples must be - * discarded by the caller from the end of the stream to get the original - * audio without any trailing padding. - */ - int trailing_padding; - /** - * Audio only. Number of samples to skip after a discontinuity. - */ - int seek_preroll; -} AVCodecParameters; - -/** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - */ -AVCodec *av_codec_next(const AVCodec *c); - -/** - * Return the LIBAVCODEC_VERSION_INT constant. - */ -unsigned avcodec_version(void); - -/** - * Return the libavcodec build-time configuration. - */ -const char *avcodec_configuration(void); - -/** - * Return the libavcodec license. - */ -const char *avcodec_license(void); - -/** - * Register the codec codec and initialize libavcodec. - * - * @warning either this function or avcodec_register_all() must be called - * before any other libavcodec functions. - * - * @see avcodec_register_all() - */ -void avcodec_register(AVCodec *codec); - -/** - * Register all the codecs, parsers and bitstream filters which were enabled at - * configuration time. If you do not call this function you can select exactly - * which formats you want to support, by using the individual registration - * functions. - * - * @see avcodec_register - * @see av_register_codec_parser - * @see av_register_bitstream_filter - */ -void avcodec_register_all(void); - -/** - * Allocate an AVCodecContext and set its fields to default values. The - * resulting struct should be freed with avcodec_free_context(). - * - * @param codec if non-NULL, allocate private data and initialize defaults - * for the given codec. It is illegal to then call avcodec_open2() - * with a different codec. - * If NULL, then the codec-specific defaults won't be initialized, - * which may result in suboptimal default settings (this is - * important mainly for encoders, e.g. libx264). - * - * @return An AVCodecContext filled with default values or NULL on failure. - */ -AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); - -/** - * Free the codec context and everything associated with it and write NULL to - * the provided pointer. - */ -void avcodec_free_context(AVCodecContext **avctx); - -#if FF_API_GET_CONTEXT_DEFAULTS -/** - * @deprecated This function should not be used, as closing and opening a codec - * context multiple time is not supported. A new codec context should be - * allocated for each new use. - */ -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); -#endif - -/** - * Get the AVClass for AVCodecContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *avcodec_get_class(void); - -#if FF_API_COPY_CONTEXT -/** - * Get the AVClass for AVFrame. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *avcodec_get_frame_class(void); - -/** - * Get the AVClass for AVSubtitleRect. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *avcodec_get_subtitle_rect_class(void); - -/** - * Copy the settings of the source AVCodecContext into the destination - * AVCodecContext. The resulting destination codec context will be - * unopened, i.e. you are required to call avcodec_open2() before you - * can use this AVCodecContext to decode/encode video/audio data. - * - * @param dest target codec context, should be initialized with - * avcodec_alloc_context3(NULL), but otherwise uninitialized - * @param src source codec context - * @return AVERROR() on error (e.g. memory allocation error), 0 on success - * - * @deprecated The semantics of this function are ill-defined and it should not - * be used. If you need to transfer the stream parameters from one codec context - * to another, use an intermediate AVCodecParameters instance and the - * avcodec_parameters_from_context() / avcodec_parameters_to_context() - * functions. - */ -attribute_deprecated -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#endif - -/** - * Allocate a new AVCodecParameters and set its fields to default values - * (unknown/invalid/0). The returned struct must be freed with - * avcodec_parameters_free(). - */ -AVCodecParameters *avcodec_parameters_alloc(void); - -/** - * Free an AVCodecParameters instance and everything associated with it and - * write NULL to the supplied pointer. - */ -void avcodec_parameters_free(AVCodecParameters **par); - -/** - * Copy the contents of src to dst. Any allocated fields in dst are freed and - * replaced with newly allocated duplicates of the corresponding fields in src. - * - * @return >= 0 on success, a negative AVERROR code on failure. - */ -int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); - -/** - * Fill the parameters struct based on the values from the supplied codec - * context. Any allocated fields in par are freed and replaced with duplicates - * of the corresponding fields in codec. - * - * @return >= 0 on success, a negative AVERROR code on failure - */ -int avcodec_parameters_from_context(AVCodecParameters *par, - const AVCodecContext *codec); - -/** - * Fill the codec context based on the values from the supplied codec - * parameters. Any allocated fields in codec that have a corresponding field in - * par are freed and replaced with duplicates of the corresponding field in par. - * Fields in codec that do not have a counterpart in par are not touched. - * - * @return >= 0 on success, a negative AVERROR code on failure. - */ -int avcodec_parameters_to_context(AVCodecContext *codec, - const AVCodecParameters *par); - -/** - * Initialize the AVCodecContext to use the given AVCodec. Prior to using this - * function the context has to be allocated with avcodec_alloc_context3(). - * - * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), - * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for - * retrieving a codec. - * - * @warning This function is not thread safe! - * - * @note Always call this function before using decoding routines (such as - * @ref avcodec_receive_frame()). - * - * @code - * avcodec_register_all(); - * av_dict_set(&opts, "b", "2.5M", 0); - * codec = avcodec_find_decoder(AV_CODEC_ID_H264); - * if (!codec) - * exit(1); - * - * context = avcodec_alloc_context3(codec); - * - * if (avcodec_open2(context, codec, opts) < 0) - * exit(1); - * @endcode - * - * @param avctx The context to initialize. - * @param codec The codec to open this context for. If a non-NULL codec has been - * previously passed to avcodec_alloc_context3() or - * for this context, then this parameter MUST be either NULL or - * equal to the previously passed codec. - * @param options A dictionary filled with AVCodecContext and codec-private options. - * On return this object will be filled with options that were not found. - * - * @return zero on success, a negative value on error - * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), - * av_dict_set(), av_opt_find(). - */ -int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); - -/** - * Close a given AVCodecContext and free all the data associated with it - * (but not the AVCodecContext itself). - * - * Calling this function on an AVCodecContext that hasn't been opened will free - * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL - * codec. Subsequent calls will do nothing. - * - * @note Do not use this function. Use avcodec_free_context() to destroy a - * codec context (either open or closed). Opening and closing a codec context - * multiple times is not supported anymore -- use multiple codec contexts - * instead. - */ -int avcodec_close(AVCodecContext *avctx); - -/** - * Free all allocated data in the given subtitle struct. - * - * @param sub AVSubtitle to free. - */ -void avsubtitle_free(AVSubtitle *sub); - -/** - * @} - */ - -/** - * @addtogroup lavc_packet - * @{ - */ - -/** - * Allocate an AVPacket and set its fields to default values. The resulting - * struct must be freed using av_packet_free(). - * - * @return An AVPacket filled with default values or NULL on failure. - * - * @note this only allocates the AVPacket itself, not the data buffers. Those - * must be allocated through other means such as av_new_packet. - * - * @see av_new_packet - */ -AVPacket *av_packet_alloc(void); - -/** - * Create a new packet that references the same data as src. - * - * This is a shortcut for av_packet_alloc()+av_packet_ref(). - * - * @return newly created AVPacket on success, NULL on error. - * - * @see av_packet_alloc - * @see av_packet_ref - */ -AVPacket *av_packet_clone(AVPacket *src); - -/** - * Free the packet, if the packet is reference counted, it will be - * unreferenced first. - * - * @param packet packet to be freed. The pointer will be set to NULL. - * @note passing NULL is a no-op. - */ -void av_packet_free(AVPacket **pkt); - -/** - * Initialize optional fields of a packet with default values. - * - * Note, this does not touch the data and size members, which have to be - * initialized separately. - * - * @param pkt packet - */ -void av_init_packet(AVPacket *pkt); - -/** - * Allocate the payload of a packet and initialize its fields with - * default values. - * - * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise - */ -int av_new_packet(AVPacket *pkt, int size); - -/** - * Reduce packet size, correctly zeroing padding - * - * @param pkt packet - * @param size new size - */ -void av_shrink_packet(AVPacket *pkt, int size); - -/** - * Increase packet size, correctly zeroing padding - * - * @param pkt packet - * @param grow_by number of bytes by which to increase the size of the packet - */ -int av_grow_packet(AVPacket *pkt, int grow_by); - -/** - * Initialize a reference-counted packet from av_malloc()ed data. - * - * @param pkt packet to be initialized. This function will set the data, size, - * buf and destruct fields, all others are left untouched. - * @param data Data allocated by av_malloc() to be used as packet data. If this - * function returns successfully, the data is owned by the underlying AVBuffer. - * The caller may not access the data through other means. - * @param size size of data in bytes, without the padding. I.e. the full buffer - * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. - * - * @return 0 on success, a negative AVERROR on error - */ -int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); - -#if FF_API_AVPACKET_OLD_API -/** - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - * - * @deprecated Use av_packet_ref - */ -attribute_deprecated -int av_dup_packet(AVPacket *pkt); -/** - * Copy packet, including contents - * - * @return 0 on success, negative AVERROR on fail - */ -int av_copy_packet(AVPacket *dst, const AVPacket *src); - -/** - * Copy packet side data - * - * @return 0 on success, negative AVERROR on fail - */ -int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); - -/** - * Free a packet. - * - * @deprecated Use av_packet_unref - * - * @param pkt packet to free - */ -attribute_deprecated -void av_free_packet(AVPacket *pkt); -#endif -/** - * Allocate new information of a packet. - * - * @param pkt packet - * @param type side information type - * @param size side information size - * @return pointer to fresh allocated data or NULL otherwise - */ -uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size); - -/** - * Wrap an existing array as a packet side data. - * - * @param pkt packet - * @param type side information type - * @param data the side data array. It must be allocated with the av_malloc() - * family of functions. The ownership of the data is transferred to - * pkt. - * @param size side information size - * @return a non-negative number on success, a negative AVERROR code on - * failure. On failure, the packet is unchanged and the data remains - * owned by the caller. - */ -int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - uint8_t *data, size_t size); - -/** - * Shrink the already allocated side data buffer - * - * @param pkt packet - * @param type side information type - * @param size new side information size - * @return 0 on success, < 0 on failure - */ -int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size); - -/** - * Get side information from packet. - * - * @param pkt packet - * @param type desired side information type - * @param size pointer for side information size to store (optional) - * @return pointer to data if present or NULL otherwise - */ -uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int *size); - -int av_packet_merge_side_data(AVPacket *pkt); - -int av_packet_split_side_data(AVPacket *pkt); - -const char *av_packet_side_data_name(enum AVPacketSideDataType type); - -/** - * Pack a dictionary for use in side_data. - * - * @param dict The dictionary to pack. - * @param size pointer to store the size of the returned data - * @return pointer to data if successful, NULL otherwise - */ -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); -/** - * Unpack a dictionary from side_data. - * - * @param data data from side_data - * @param size size of the data - * @param dict the metadata storage dictionary - * @return 0 on success, < 0 on failure - */ -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); - - -/** - * Convenience function to free all the side data stored. - * All the other fields stay untouched. - * - * @param pkt packet - */ -void av_packet_free_side_data(AVPacket *pkt); - -/** - * Setup a new reference to the data described by a given packet - * - * If src is reference-counted, setup dst as a new reference to the - * buffer in src. Otherwise allocate a new buffer in dst and copy the - * data from src into it. - * - * All the other fields are copied from src. - * - * @see av_packet_unref - * - * @param dst Destination packet - * @param src Source packet - * - * @return 0 on success, a negative AVERROR on error. - */ -int av_packet_ref(AVPacket *dst, const AVPacket *src); - -/** - * Wipe the packet. - * - * Unreference the buffer referenced by the packet and reset the - * remaining packet fields to their default values. - * - * @param pkt The packet to be unreferenced. - */ -void av_packet_unref(AVPacket *pkt); - -/** - * Move every field in src to dst and reset src. - * - * @see av_packet_unref - * - * @param src Source packet, will be reset - * @param dst Destination packet - */ -void av_packet_move_ref(AVPacket *dst, AVPacket *src); - -/** - * Copy only "properties" fields from src to dst. - * - * Properties for the purpose of this function are all the fields - * beside those related to the packet data (buf, data, size) - * - * @param dst Destination packet - * @param src Source packet - * - * @return 0 on success AVERROR on failure. - */ -int av_packet_copy_props(AVPacket *dst, const AVPacket *src); - -/** - * Convert valid timing fields (timestamps / durations) in a packet from one - * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be - * ignored. - * - * @param pkt packet on which the conversion will be performed - * @param tb_src source timebase, in which the timing fields in pkt are - * expressed - * @param tb_dst destination timebase, to which the timing fields will be - * converted - */ -void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); - -/** - * @} - */ - -/** - * @addtogroup lavc_decoding - * @{ - */ - -/** - * Find a registered decoder with a matching codec ID. - * - * @param id AVCodecID of the requested decoder - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder(enum AVCodecID id); - -/** - * Find a registered decoder with the specified name. - * - * @param name name of the requested decoder - * @return A decoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_decoder_by_name(const char *name); - -/** - * The default callback for AVCodecContext.get_buffer2(). It is made public so - * it can be called by custom get_buffer2() implementations for decoders without - * AV_CODEC_CAP_DR1 set. - */ -int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); - -#if FF_API_EMU_EDGE -/** - * Return the amount of padding in pixels which the get_buffer callback must - * provide around the edge of the image for codecs which do not have the - * CODEC_FLAG_EMU_EDGE flag. - * - * @return Required padding in pixels. - * - * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer - * needed - */ -attribute_deprecated -unsigned avcodec_get_edge_width(void); -#endif - -/** - * Modify width and height values so that they will result in a memory - * buffer that is acceptable for the codec if you do not use any horizontal - * padding. - * - * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. - */ -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); - -/** - * Modify width and height values so that they will result in a memory - * buffer that is acceptable for the codec if you also ensure that all - * line sizes are a multiple of the respective linesize_align[i]. - * - * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. - */ -void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, - int linesize_align[AV_NUM_DATA_POINTERS]); - -/** - * Converts AVChromaLocation to swscale x/y chroma position. - * - * The positions represent the chroma (0,0) position in a coordinates system - * with luma (0,0) representing the origin and luma(1,1) representing 256,256 - * - * @param xpos horizontal chroma sample position - * @param ypos vertical chroma sample position - */ -int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); - -/** - * Converts swscale x/y chroma position to AVChromaLocation. - * - * The positions represent the chroma (0,0) position in a coordinates system - * with luma (0,0) representing the origin and luma(1,1) representing 256,256 - * - * @param xpos horizontal chroma sample position - * @param ypos vertical chroma sample position - */ -enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); - -/** - * Decode the audio frame of size avpkt->size from avpkt->data into frame. - * - * Some decoders may support multiple frames in a single AVPacket. Such - * decoders would then just decode the first frame and the return value would be - * less than the packet size. In this case, avcodec_decode_audio4 has to be - * called again with an AVPacket containing the remaining data in order to - * decode the second frame, etc... Even if no frames are returned, the packet - * needs to be fed to the decoder with remaining data until it is completely - * consumed or an error occurs. - * - * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning samples. It is safe to flush even those decoders that are not - * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] frame The AVFrame in which to store decoded audio samples. - * The decoder will allocate a buffer for the decoded frame by - * calling the AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is - * non-zero. Note that this field being set to zero - * does not mean that an error has occurred. For - * decoders with AV_CODEC_CAP_DELAY set, no given decode - * call is guaranteed to produce a frame. - * @param[in] avpkt The input AVPacket containing the input buffer. - * At least avpkt->data and avpkt->size should be set. Some - * decoders might also require additional fields to be set. - * @return A negative error code is returned if an error occurred during - * decoding, otherwise the number of bytes consumed from the input - * AVPacket is returned. - * -* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, - int *got_frame_ptr, const AVPacket *avpkt); - -/** - * Decode the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use av_frame_alloc() to get an AVFrame. The codec will - * allocate memory for the actual bitmap by calling the - * AVCodecContext.get_buffer2() callback. - * When AVCodecContext.refcounted_frames is set to 1, the frame is - * reference counted and the returned reference belongs to the - * caller. The caller must release the frame using av_frame_unref() - * when the frame is no longer needed. The caller may safely write - * to the frame if av_frame_is_writable() returns 1. - * When AVCodecContext.refcounted_frames is set to 0, the returned - * reference belongs to the decoder and is valid only until the - * next call to this function or until closing or flushing the - * decoder. The caller may not write to it. - * - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - * - * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). - */ -attribute_deprecated -int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt); - -/** - * Decode a subtitle message. - * Return a negative value on error, otherwise return the number of bytes used. - * If no subtitle could be decompressed, got_sub_ptr is zero. - * Otherwise, the subtitle is stored in *sub. - * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for - * simplicity, because the performance difference is expect to be negligible - * and reusing a get_buffer written for video codecs would probably perform badly - * due to a potentially very different allocation pattern. - * - * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input - * and output. This means that for some packets they will not immediately - * produce decoded output and need to be flushed at the end of decoding to get - * all the decoded data. Flushing is done by calling this function with packets - * with avpkt->data set to NULL and avpkt->size set to 0 until it stops - * returning subtitles. It is safe to flush even those decoders that are not - * marked with CODEC_CAP_DELAY, then no subtitles will be returned. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx the codec context - * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored, - * must be freed with avsubtitle_free if *got_sub_ptr is set. - * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. - * @param[in] avpkt The input AVPacket containing the input buffer. - */ -int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - AVPacket *avpkt); - -/** - * Supply raw packet data as input to a decoder. - * - * Internally, this call will copy relevant AVCodecContext fields, which can - * influence decoding per-packet, and apply them when the packet is actually - * decoded. (For example AVCodecContext.skip_frame, which might direct the - * decoder to drop the frame contained by the packet sent with this function.) - * - * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE - * larger than the actual read bytes because some optimized bitstream - * readers read 32 or 64 bits at once and could read over the end. - * - * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) - * on the same AVCodecContext. It will return unexpected results now - * or in future libavcodec versions. - * - * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() - * before packets may be fed to the decoder. - * - * @param avctx codec context - * @param[in] avpkt The input AVPacket. Usually, this will be a single video - * frame, or several complete audio frames. - * Ownership of the packet remains with the caller, and the - * decoder will not write to the packet. The decoder may create - * a reference to the packet data (or copy it if the packet is - * not reference-counted). - * Unlike with older APIs, the packet is always fully consumed, - * and if it contains multiple frames (e.g. some audio codecs), - * will require you to call avcodec_receive_frame() multiple - * times afterwards before you can send a new packet. - * It can be NULL (or an AVPacket with data set to NULL and - * size set to 0); in this case, it is considered a flush - * packet, which signals the end of the stream. Sending the - * first flush packet will return success. Subsequent ones are - * unnecessary and will return AVERROR_EOF. If the decoder - * still has frames buffered, it will return them after sending - * a flush packet. - * - * @return 0 on success, otherwise negative error code: - * AVERROR(EAGAIN): input is not accepted right now - the packet must be - * resent after trying to read output - * AVERROR_EOF: the decoder has been flushed, and no new packets can - * be sent to it (also returned if more than 1 flush - * packet is sent) - * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush - * AVERROR(ENOMEM): failed to add packet to internal queue, or similar - * other errors: legitimate decoding errors - */ -int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); - -/** - * Return decoded output data from a decoder. - * - * @param avctx codec context - * @param frame This will be set to a reference-counted video or audio - * frame (depending on the decoder type) allocated by the - * decoder. Note that the function will always call - * av_frame_unref(frame) before doing anything else. - * - * @return - * 0: success, a frame was returned - * AVERROR(EAGAIN): output is not available right now - user must try - * to send new input - * AVERROR_EOF: the decoder has been fully flushed, and there will be - * no more output frames - * AVERROR(EINVAL): codec not opened, or it is an encoder - * other negative values: legitimate decoding errors - */ -int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); - -/** - * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet() - * to retrieve buffered output packets. - * - * @param avctx codec context - * @param[in] frame AVFrame containing the raw audio or video frame to be encoded. - * Ownership of the frame remains with the caller, and the - * encoder will not write to the frame. The encoder may create - * a reference to the frame data (or copy it if the frame is - * not reference-counted). - * It can be NULL, in which case it is considered a flush - * packet. This signals the end of the stream. If the encoder - * still has packets buffered, it will return them after this - * call. Once flushing mode has been entered, additional flush - * packets are ignored, and sending frames will return - * AVERROR_EOF. - * - * For audio: - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @return 0 on success, otherwise negative error code: - * AVERROR(EAGAIN): input is not accepted right now - the frame must be - * resent after trying to read output packets - * AVERROR_EOF: the encoder has been flushed, and no new frames can - * be sent to it - * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a - * decoder, or requires flush - * AVERROR(ENOMEM): failed to add packet to internal queue, or similar - * other errors: legitimate decoding errors - */ -int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame); - -/** - * Read encoded data from the encoder. - * - * @param avctx codec context - * @param avpkt This will be set to a reference-counted packet allocated by the - * encoder. Note that the function will always call - * av_frame_unref(frame) before doing anything else. - * @return 0 on success, otherwise negative error code: - * AVERROR(EAGAIN): output is not available right now - user must try - * to send input - * AVERROR_EOF: the encoder has been fully flushed, and there will be - * no more output packets - * AVERROR(EINVAL): codec not opened, or it is an encoder - * other errors: legitimate decoding errors - */ -int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); - - -/** - * @defgroup lavc_parsing Frame parsing - * @{ - */ - -enum AVPictureStructure { - AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown - AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field - AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field - AV_PICTURE_STRUCTURE_FRAME, //< coded as frame -}; - -typedef struct AVCodecParserContext { - void *priv_data; - struct AVCodecParser *parser; - int64_t frame_offset; /* offset of the current frame */ - int64_t cur_offset; /* current offset - (incremented by each av_parser_parse()) */ - int64_t next_frame_offset; /* offset of the next frame */ - /* video info */ - int pict_type; /* XXX: Put it back in AVCodecContext. */ - /** - * This field is used for proper frame duration computation in lavf. - * It signals, how much longer the frame duration of the current frame - * is compared to normal frame duration. - * - * frame_duration = (1 + repeat_pict) * time_base - * - * It is used by codecs like H.264 to display telecined material. - */ - int repeat_pict; /* XXX: Put it back in AVCodecContext. */ - int64_t pts; /* pts of the current frame */ - int64_t dts; /* dts of the current frame */ - - /* private data */ - int64_t last_pts; - int64_t last_dts; - int fetch_timestamp; - -#define AV_PARSER_PTS_NB 4 - int cur_frame_start_index; - int64_t cur_frame_offset[AV_PARSER_PTS_NB]; - int64_t cur_frame_pts[AV_PARSER_PTS_NB]; - int64_t cur_frame_dts[AV_PARSER_PTS_NB]; - - int flags; -#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 -#define PARSER_FLAG_ONCE 0x0002 -/// Set if the parser has a valid file offset -#define PARSER_FLAG_FETCHED_OFFSET 0x0004 -#define PARSER_FLAG_USE_CODEC_TS 0x1000 - - int64_t offset; ///< byte offset from starting packet start - int64_t cur_frame_end[AV_PARSER_PTS_NB]; - - /** - * Set by parser to 1 for key frames and 0 for non-key frames. - * It is initialized to -1, so if the parser doesn't set this flag, - * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames - * will be used. - */ - int key_frame; - -#if FF_API_CONVERGENCE_DURATION - /** - * @deprecated unused - */ - attribute_deprecated - int64_t convergence_duration; -#endif - - // Timestamp generation support: - /** - * Synchronization point for start of timestamp generation. - * - * Set to >0 for sync point, 0 for no sync point and <0 for undefined - * (default). - * - * For example, this corresponds to presence of H.264 buffering period - * SEI message. - */ - int dts_sync_point; - - /** - * Offset of the current timestamp against last timestamp sync point in - * units of AVCodecContext.time_base. - * - * Set to INT_MIN when dts_sync_point unused. Otherwise, it must - * contain a valid timestamp offset. - * - * Note that the timestamp of sync point has usually a nonzero - * dts_ref_dts_delta, which refers to the previous sync point. Offset of - * the next frame after timestamp sync point will be usually 1. - * - * For example, this corresponds to H.264 cpb_removal_delay. - */ - int dts_ref_dts_delta; - - /** - * Presentation delay of current frame in units of AVCodecContext.time_base. - * - * Set to INT_MIN when dts_sync_point unused. Otherwise, it must - * contain valid non-negative timestamp delta (presentation time of a frame - * must not lie in the past). - * - * This delay represents the difference between decoding and presentation - * time of the frame. - * - * For example, this corresponds to H.264 dpb_output_delay. - */ - int pts_dts_delta; - - /** - * Position of the packet in file. - * - * Analogous to cur_frame_pts/dts - */ - int64_t cur_frame_pos[AV_PARSER_PTS_NB]; - - /** - * Byte position of currently parsed frame in stream. - */ - int64_t pos; - - /** - * Previous frame byte position. - */ - int64_t last_pos; - - /** - * Duration of the current frame. - * For audio, this is in units of 1 / AVCodecContext.sample_rate. - * For all other types, this is in units of AVCodecContext.time_base. - */ - int duration; - - enum AVFieldOrder field_order; - - /** - * Indicate whether a picture is coded as a frame, top field or bottom field. - * - * For example, H.264 field_pic_flag equal to 0 corresponds to - * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag - * equal to 1 and bottom_field_flag equal to 0 corresponds to - * AV_PICTURE_STRUCTURE_TOP_FIELD. - */ - enum AVPictureStructure picture_structure; - - /** - * Picture number incremented in presentation or output order. - * This field may be reinitialized at the first picture of a new sequence. - * - * For example, this corresponds to H.264 PicOrderCnt. - */ - int output_picture_number; - - /** - * Dimensions of the decoded video intended for presentation. - */ - int width; - int height; - - /** - * Dimensions of the coded video. - */ - int coded_width; - int coded_height; - - /** - * The format of the coded data, corresponds to enum AVPixelFormat for video - * and for enum AVSampleFormat for audio. - * - * Note that a decoder can have considerable freedom in how exactly it - * decodes the data, so the format reported here might be different from the - * one returned by a decoder. - */ - int format; -} AVCodecParserContext; - -typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ - int priv_data_size; - int (*parser_init)(AVCodecParserContext *s); - /* This callback never returns an error, a negative value means that - * the frame start was in a previous packet. */ - int (*parser_parse)(AVCodecParserContext *s, - AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size); - void (*parser_close)(AVCodecParserContext *s); - int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); - struct AVCodecParser *next; -} AVCodecParser; - -AVCodecParser *av_parser_next(const AVCodecParser *c); - -void av_register_codec_parser(AVCodecParser *parser); -AVCodecParserContext *av_parser_init(int codec_id); - -/** - * Parse a packet. - * - * @param s parser context. - * @param avctx codec context. - * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. - * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. - * @param buf input buffer. - * @param buf_size buffer size in bytes without the padding. I.e. the full buffer - size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE. - To signal EOF, this should be 0 (so that the last frame - can be output). - * @param pts input presentation timestamp. - * @param dts input decoding timestamp. - * @param pos input byte position in stream. - * @return the number of bytes of the input bitstream used. - * - * Example: - * @code - * while(in_len){ - * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, - * in_data, in_len, - * pts, dts, pos); - * in_data += len; - * in_len -= len; - * - * if(size) - * decode_frame(data, size); - * } - * @endcode - */ -int av_parser_parse2(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts, - int64_t pos); - -/** - * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed - * @deprecated use AVBitStreamFilter - */ -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); -void av_parser_close(AVCodecParserContext *s); - -/** - * @} - * @} - */ - -/** - * @addtogroup lavc_encoding - * @{ - */ - -/** - * Find a registered encoder with a matching codec ID. - * - * @param id AVCodecID of the requested encoder - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder(enum AVCodecID id); - -/** - * Find a registered encoder with the specified name. - * - * @param name name of the requested encoder - * @return An encoder if one was found, NULL otherwise. - */ -AVCodec *avcodec_find_encoder_by_name(const char *name); - -/** - * Encode a frame of audio. - * - * Takes input samples from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay, split, and combine input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. If avpkt->data and - * avpkt->size are set, avpkt->destruct must also be set. All - * other AVPacket fields will be reset by the encoder using - * av_init_packet(). If avpkt->data is NULL, the encoder will - * allocate it. The encoder will set avpkt->size to the size - * of the output packet. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw audio data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame - * can have any number of samples. - * If it is not set, frame->nb_samples must be equal to - * avctx->frame_size for all frames except the last. - * The final frame may be smaller than avctx->frame_size. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead - */ -attribute_deprecated -int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -/** - * Encode a frame of video. - * - * Takes input raw video data from frame and writes the next output packet, if - * available, to avpkt. The output packet does not necessarily contain data for - * the most recent frame, as encoders can delay and reorder input frames - * internally as needed. - * - * @param avctx codec context - * @param avpkt output AVPacket. - * The user can supply an output buffer by setting - * avpkt->data and avpkt->size prior to calling the - * function, but if the size of the user-provided data is not - * large enough, encoding will fail. All other AVPacket fields - * will be reset by the encoder using av_init_packet(). If - * avpkt->data is NULL, the encoder will allocate it. - * The encoder will set avpkt->size to the size of the - * output packet. The returned data (if any) belongs to the - * caller, he is responsible for freeing it. - * - * If this function fails or produces no output, avpkt will be - * freed using av_packet_unref(). - * @param[in] frame AVFrame containing the raw video data to be encoded. - * May be NULL when flushing an encoder that has the - * AV_CODEC_CAP_DELAY capability set. - * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the - * output packet is non-empty, and to 0 if it is - * empty. If the function returns an error, the - * packet can be assumed to be invalid, and the - * value of got_packet_ptr is undefined and should - * not be used. - * @return 0 on success, negative error code on failure - * - * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead - */ -attribute_deprecated -int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr); - -int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVSubtitle *sub); - - -/** - * @} - */ - -#if FF_API_AVCODEC_RESAMPLE -/** - * @defgroup lavc_resample Audio resampling - * @ingroup libavc - * @deprecated use libswresample instead - * - * @{ - */ -struct ReSampleContext; -struct AVResampleContext; - -typedef struct ReSampleContext ReSampleContext; - -/** - * Initialize audio resampling context. - * - * @param output_channels number of output channels - * @param input_channels number of input channels - * @param output_rate output sample rate - * @param input_rate input sample rate - * @param sample_fmt_out requested output sample format - * @param sample_fmt_in input sample format - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency - * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear if 1 then the used FIR filter will be linearly interpolated - between the 2 closest, if 0 the closest will be used - * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - * @return allocated ReSampleContext, NULL if error occurred - */ -attribute_deprecated -ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate, - enum AVSampleFormat sample_fmt_out, - enum AVSampleFormat sample_fmt_in, - int filter_length, int log2_phase_count, - int linear, double cutoff); - -attribute_deprecated -int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); - -/** - * Free resample context. - * - * @param s a non-NULL pointer to a resample context previously - * created with av_audio_resample_init() - */ -attribute_deprecated -void audio_resample_close(ReSampleContext *s); - - -/** - * Initialize an audio resampler. - * Note, if either rate is not an integer then simply scale both rates up so they are. - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq - * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated - between the 2 closest, if 0 the closest will be used - * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - */ -attribute_deprecated -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); - -/** - * Resample an array of samples using a previously configured context. - * @param src an array of unconsumed samples - * @param consumed the number of samples of src which have been consumed are returned here - * @param src_size the number of unconsumed samples available - * @param dst_size the amount of space in samples available in dst - * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. - * @return the number of samples written in dst or -1 if an error occurred - */ -attribute_deprecated -int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); - - -/** - * Compensate samplerate/timestamp drift. The compensation is done by changing - * the resampler parameters, so no audible clicks or similar distortions occur - * @param compensation_distance distance in output samples over which the compensation should be performed - * @param sample_delta number of output samples which should be output less - * - * example: av_resample_compensate(c, 10, 500) - * here instead of 510 samples only 500 samples would be output - * - * note, due to rounding the actual compensation might be slightly different, - * especially if the compensation_distance is large and the in_rate used during init is small - */ -attribute_deprecated -void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); -attribute_deprecated -void av_resample_close(struct AVResampleContext *c); - -/** - * @} - */ -#endif - -#if FF_API_AVPICTURE -/** - * @addtogroup lavc_picture - * @{ - */ - -/** - * @deprecated unused - */ -attribute_deprecated -int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -void avpicture_free(AVPicture *picture); - -/** - * @deprecated use av_image_fill_arrays() instead. - */ -attribute_deprecated -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated use av_image_copy_to_buffer() instead. - */ -attribute_deprecated -int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, - int width, int height, - unsigned char *dest, int dest_size); - -/** - * @deprecated use av_image_get_buffer_size() instead. - */ -attribute_deprecated -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated av_image_copy() instead. - */ -attribute_deprecated -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band); - -/** - * @deprecated unused - */ -attribute_deprecated -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color); - -/** - * @} - */ -#endif - -/** - * @defgroup lavc_misc Utility functions - * @ingroup libavc - * - * Miscellaneous utility functions related to both encoding and decoding - * (or neither). - * @{ - */ - -/** - * @defgroup lavc_misc_pixfmt Pixel formats - * - * Functions for working with pixel formats. - * @{ - */ - -/** - * Utility function to access log2_chroma_w log2_chroma_h from - * the pixel format AVPixFmtDescriptor. - * - * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample - * for one that returns a failure code and continues in case of invalid - * pix_fmts. - * - * @param[in] pix_fmt the pixel format - * @param[out] h_shift store log2_chroma_w - * @param[out] v_shift store log2_chroma_h - * - * @see av_pix_fmt_get_chroma_sub_sample - */ - -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); - -/** - * Return a value representing the fourCC code associated to the - * pixel format pix_fmt, or 0 if no associated fourCC code can be - * found. - */ -unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); - -/** - * @deprecated see av_get_pix_fmt_loss() - */ -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); - -/** - * Find the best pixel format to convert to given a certain source pixel - * format. When converting from one pixel format to another, information loss - * may occur. For example, when converting from RGB24 to GRAY, the color - * information will be lost. Similarly, other losses occur when converting from - * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of - * the given pixel formats should be used to suffer the least amount of loss. - * The pixel formats from which it chooses one, are determined by the - * pix_fmt_list parameter. - * - * - * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from - * @param[in] src_pix_fmt source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. - * @return The best pixel format to convert to or -1 if none was found. - */ -enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, - enum AVPixelFormat src_pix_fmt, - int has_alpha, int *loss_ptr); - -/** - * @deprecated see av_find_best_pix_fmt_of_2() - */ -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); - -/** - * @} - */ - -#if FF_API_SET_DIMENSIONS -/** - * @deprecated this function is not supposed to be used from outside of lavc - */ -attribute_deprecated -void avcodec_set_dimensions(AVCodecContext *s, int width, int height); -#endif - -/** - * Put a string representing the codec tag codec_tag in buf. - * - * @param buf buffer to place codec tag in - * @param buf_size size in bytes of buf - * @param codec_tag codec tag to assign - * @return the length of the string that would have been generated if - * enough space had been available, excluding the trailing null - */ -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); - -void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); - -/** - * Return a name for the specified profile, if available. - * - * @param codec the codec that is searched for the given profile - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - */ -const char *av_get_profile_name(const AVCodec *codec, int profile); - -/** - * Return a name for the specified profile, if available. - * - * @param codec_id the ID of the codec to which the requested profile belongs - * @param profile the profile value for which a name is requested - * @return A name for the profile if found, NULL otherwise. - * - * @note unlike av_get_profile_name(), which searches a list of profiles - * supported by a specific decoder or encoder implementation, this - * function searches the list of profiles from the AVCodecDescriptor - */ -const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); - -int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); -int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); -//FIXME func typedef - -/** - * Fill AVFrame audio data and linesize pointers. - * - * The buffer buf must be a preallocated buffer with a size big enough - * to contain the specified samples amount. The filled AVFrame data - * pointers will point to this buffer. - * - * AVFrame extended_data channel pointers are allocated if necessary for - * planar audio. - * - * @param frame the AVFrame - * frame->nb_samples must be set prior to calling the - * function. This function fills in frame->data, - * frame->extended_data, frame->linesize[0]. - * @param nb_channels channel count - * @param sample_fmt sample format - * @param buf buffer to use for frame data - * @param buf_size size of buffer - * @param align plane size sample alignment (0 = default) - * @return >=0 on success, negative error code on failure - * @todo return the size in bytes required to store the samples in - * case of success, at the next libavutil bump - */ -int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, - enum AVSampleFormat sample_fmt, const uint8_t *buf, - int buf_size, int align); - -/** - * Reset the internal decoder state / flush internal buffers. Should be called - * e.g. when seeking or when switching to a different stream. - * - * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), - * this invalidates the frames previously returned from the decoder. When - * refcounted frames are used, the decoder just releases any references it might - * keep internally, but the caller's reference remains valid. - */ -void avcodec_flush_buffers(AVCodecContext *avctx); - -/** - * Return codec bits per sample. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return the PCM codec associated with a sample format. - * @param be endianness, 0 for little, 1 for big, - * -1 (or anything else) for native - * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE - */ -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); - -/** - * Return codec bits per sample. - * Only return non-zero if the bits per sample is exactly correct, not an - * approximation. - * - * @param[in] codec_id the codec - * @return Number of bits per sample or zero if unknown for the given codec. - */ -int av_get_exact_bits_per_sample(enum AVCodecID codec_id); - -/** - * Return audio frame duration. - * - * @param avctx codec context - * @param frame_bytes size of the frame, or 0 if unknown - * @return frame duration, in samples, if known. 0 if not able to - * determine. - */ -int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); - -/** - * This function is the same as av_get_audio_frame_duration(), except it works - * with AVCodecParameters instead of an AVCodecContext. - */ -int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); - -#if FF_API_OLD_BSF -typedef struct AVBitStreamFilterContext { - void *priv_data; - struct AVBitStreamFilter *filter; - AVCodecParserContext *parser; - struct AVBitStreamFilterContext *next; - /** - * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). - * Not for access by library users. - */ - char *args; -} AVBitStreamFilterContext; -#endif - -typedef struct AVBSFInternal AVBSFInternal; - -/** - * The bitstream filter state. - * - * This struct must be allocated with av_bsf_alloc() and freed with - * av_bsf_free(). - * - * The fields in the struct will only be changed (by the caller or by the - * filter) as described in their documentation, and are to be considered - * immutable otherwise. - */ -typedef struct AVBSFContext { - /** - * A class for logging and AVOptions - */ - const AVClass *av_class; - - /** - * The bitstream filter this context is an instance of. - */ - const struct AVBitStreamFilter *filter; - - /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - - /** - * Opaque filter-specific private data. If filter->priv_class is non-NULL, - * this is an AVOptions-enabled struct. - */ - void *priv_data; - - /** - * Parameters of the input stream. Set by the caller before av_bsf_init(). - */ - AVCodecParameters *par_in; - - /** - * Parameters of the output stream. Set by the filter in av_bsf_init(). - */ - AVCodecParameters *par_out; - - /** - * The timebase used for the timestamps of the input packets. Set by the - * caller before av_bsf_init(). - */ - AVRational time_base_in; - - /** - * The timebase used for the timestamps of the output packets. Set by the - * filter in av_bsf_init(). - */ - AVRational time_base_out; -} AVBSFContext; - -typedef struct AVBitStreamFilter { - const char *name; - - /** - * A list of codec ids supported by the filter, terminated by - * AV_CODEC_ID_NONE. - * May be NULL, in that case the bitstream filter works with any codec id. - */ - const enum AVCodecID *codec_ids; - - /** - * A class for the private data, used to declare bitstream filter private - * AVOptions. This field is NULL for bitstream filters that do not declare - * any options. - * - * If this field is non-NULL, the first member of the filter private data - * must be a pointer to AVClass, which will be set by libavcodec generic - * code to this class. - */ - const AVClass *priv_class; - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavcodec and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - - int priv_data_size; - int (*init)(AVBSFContext *ctx); - int (*filter)(AVBSFContext *ctx, AVPacket *pkt); - void (*close)(AVBSFContext *ctx); -} AVBitStreamFilter; - -#if FF_API_OLD_BSF -/** - * Register a bitstream filter. - * - * The filter will be accessible to the application code through - * av_bitstream_filter_next() or can be directly initialized with - * av_bitstream_filter_init(). - * - * @see avcodec_register_all() - */ -attribute_deprecated -void av_register_bitstream_filter(AVBitStreamFilter *bsf); - -/** - * Create and initialize a bitstream filter context given a bitstream - * filter name. - * - * The returned context must be freed with av_bitstream_filter_close(). - * - * @param name the name of the bitstream filter - * @return a bitstream filter context if a matching filter was found - * and successfully initialized, NULL otherwise - */ -attribute_deprecated -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); - -/** - * Filter bitstream. - * - * This function filters the buffer buf with size buf_size, and places the - * filtered buffer in the buffer pointed to by poutbuf. - * - * The output buffer must be freed by the caller. - * - * @param bsfc bitstream filter context created by av_bitstream_filter_init() - * @param avctx AVCodecContext accessed by the filter, may be NULL. - * If specified, this must point to the encoder context of the - * output stream the packet is sent to. - * @param args arguments which specify the filter configuration, may be NULL - * @param poutbuf pointer which is updated to point to the filtered buffer - * @param poutbuf_size pointer which is updated to the filtered buffer size in bytes - * @param buf buffer containing the data to filter - * @param buf_size size in bytes of buf - * @param keyframe set to non-zero if the buffer to filter corresponds to a key-frame packet data - * @return >= 0 in case of success, or a negative error code in case of failure - * - * If the return value is positive, an output buffer is allocated and - * is available in *poutbuf, and is distinct from the input buffer. - * - * If the return value is 0, the output buffer is not allocated and - * should be considered identical to the input buffer, or in case - * *poutbuf was set it points to the input buffer (not necessarily to - * its starting address). A special case is if *poutbuf was set to NULL and - * *poutbuf_size was set to 0, which indicates the packet should be dropped. - */ -attribute_deprecated -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe); - -/** - * Release bitstream filter context. - * - * @param bsf the bitstream filter context created with - * av_bitstream_filter_init(), can be NULL - */ -attribute_deprecated -void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); - -/** - * If f is NULL, return the first registered bitstream filter, - * if f is non-NULL, return the next registered bitstream filter - * after f, or NULL if f is the last one. - * - * This function can be used to iterate over all registered bitstream - * filters. - */ -attribute_deprecated -AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); -#endif - -/** - * @return a bitstream filter with the specified name or NULL if no such - * bitstream filter exists. - */ -const AVBitStreamFilter *av_bsf_get_by_name(const char *name); - -/** - * Iterate over all registered bitstream filters. - * - * @param opaque a pointer where libavcodec will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered bitstream filter or NULL when the iteration is - * finished - */ -const AVBitStreamFilter *av_bsf_next(void **opaque); - -/** - * Allocate a context for a given bitstream filter. The caller must fill in the - * context parameters as described in the documentation and then call - * av_bsf_init() before sending any data to the filter. - * - * @param filter the filter for which to allocate an instance. - * @param ctx a pointer into which the pointer to the newly-allocated context - * will be written. It must be freed with av_bsf_free() after the - * filtering is done. - * - * @return 0 on success, a negative AVERROR code on failure - */ -int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx); - -/** - * Prepare the filter for use, after all the parameters and options have been - * set. - */ -int av_bsf_init(AVBSFContext *ctx); - -/** - * Submit a packet for filtering. - * - * After sending each packet, the filter must be completely drained by calling - * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or - * AVERROR_EOF. - * - * @param pkt the packet to filter. pkt must contain some payload (i.e data or - * side data must be present in pkt). The bitstream filter will take ownership of - * the packet and reset the contents of pkt. pkt is not touched if an error occurs. - * This parameter may be NULL, which signals the end of the stream (i.e. no more - * packets will be sent). That will cause the filter to output any packets it - * may have buffered internally. - * - * @return 0 on success, a negative AVERROR on error. - */ -int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); - -/** - * Retrieve a filtered packet. - * - * @param[out] pkt this struct will be filled with the contents of the filtered - * packet. It is owned by the caller and must be freed using - * av_packet_unref() when it is no longer needed. - * This parameter should be "clean" (i.e. freshly allocated - * with av_packet_alloc() or unreffed with av_packet_unref()) - * when this function is called. If this function returns - * successfully, the contents of pkt will be completely - * overwritten by the returned data. On failure, pkt is not - * touched. - * - * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the - * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there - * will be no further output from the filter. Another negative AVERROR value if - * an error occurs. - * - * @note one input packet may result in several output packets, so after sending - * a packet with av_bsf_send_packet(), this function needs to be called - * repeatedly until it stops returning 0. It is also possible for a filter to - * output fewer packets than were sent to it, so this function may return - * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call. - */ -int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); - -/** - * Free a bitstream filter context and everything associated with it; write NULL - * into the supplied pointer. - */ -void av_bsf_free(AVBSFContext **ctx); - -/** - * Get the AVClass for AVBSFContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *av_bsf_get_class(void); - -/** - * Structure for chain/list of bitstream filters. - * Empty list can be allocated by av_bsf_list_alloc(). - */ -typedef struct AVBSFList AVBSFList; - -/** - * Allocate empty list of bitstream filters. - * The list must be later freed by av_bsf_list_free() - * or finalized by av_bsf_list_finalize(). - * - * @return Pointer to @ref AVBSFList on success, NULL in case of failure - */ -AVBSFList *av_bsf_list_alloc(void); - -/** - * Free list of bitstream filters. - * - * @param lst Pointer to pointer returned by av_bsf_list_alloc() - */ -void av_bsf_list_free(AVBSFList **lst); - -/** - * Append bitstream filter to the list of bitstream filters. - * - * @param lst List to append to - * @param bsf Filter context to be appended - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf); - -/** - * Construct new bitstream filter context given it's name and options - * and append it to the list of bitstream filters. - * - * @param lst List to append to - * @param bsf_name Name of the bitstream filter - * @param options Options for the bitstream filter, can be set to NULL - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options); -/** - * Finalize list of bitstream filters. - * - * This function will transform @ref AVBSFList to single @ref AVBSFContext, - * so the whole chain of bitstream filters can be treated as single filter - * freshly allocated by av_bsf_alloc(). - * If the call is successful, @ref AVBSFList structure is freed and lst - * will be set to NULL. In case of failure, caller is responsible for - * freeing the structure by av_bsf_list_free() - * - * @param lst Filter list structure to be transformed - * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure - * representing the chain of bitstream filters - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf); - -/** - * Parse string describing list of bitstream filters and create single - * @ref AVBSFContext describing the whole chain of bitstream filters. - * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly - * allocated by av_bsf_alloc(). - * - * @param str String describing chain of bitstream filters in format - * `bsf1[=opt1=val1:opt2=val2][,bsf2]` - * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure - * representing the chain of bitstream filters - * - * @return >=0 on success, negative AVERROR in case of failure - */ -int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf); - -/** - * Get null/pass-through bitstream filter. - * - * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter - * - * @return - */ -int av_bsf_get_null_filter(AVBSFContext **bsf); - -/* memory */ - -/** - * Same behaviour av_fast_malloc but the buffer has additional - * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. - * - * In addition the whole buffer will initially and after resizes - * be 0-initialized so that no uninitialized data will ever appear. - */ -void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); - -/** - * Same behaviour av_fast_padded_malloc except that buffer will always - * be 0-initialized after call. - */ -void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); - -/** - * Encode extradata length to a buffer. Used by xiph codecs. - * - * @param s buffer to write to; must be at least (v/255+1) bytes long - * @param v size of extradata in bytes - * @return number of bytes written to the buffer. - */ -unsigned int av_xiphlacing(unsigned char *s, unsigned int v); - -#if FF_API_MISSING_SAMPLE -/** - * Log a generic warning message about a missing feature. This function is - * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) - * only, and would normally not be used by applications. - * @param[in] avc a pointer to an arbitrary struct of which the first field is - * a pointer to an AVClass struct - * @param[in] feature string containing the name of the missing feature - * @param[in] want_sample indicates if samples are wanted which exhibit this feature. - * If want_sample is non-zero, additional verbiage will be added to the log - * message which tells the user how to report samples to the development - * mailing list. - * @deprecated Use avpriv_report_missing_feature() instead. - */ -attribute_deprecated -void av_log_missing_feature(void *avc, const char *feature, int want_sample); - -/** - * Log a generic warning message asking for a sample. This function is - * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) - * only, and would normally not be used by applications. - * @param[in] avc a pointer to an arbitrary struct of which the first field is - * a pointer to an AVClass struct - * @param[in] msg string containing an optional message, or NULL if no message - * @deprecated Use avpriv_request_sample() instead. - */ -attribute_deprecated -void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); -#endif /* FF_API_MISSING_SAMPLE */ - -/** - * Register the hardware accelerator hwaccel. - */ -void av_register_hwaccel(AVHWAccel *hwaccel); - -/** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - */ -AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); - - -/** - * Lock operation used by lockmgr - */ -enum AVLockOp { - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY, ///< Free mutex resources -}; - -/** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. The "mutex" argument to the function points - * to a (void *) where the lockmgr should store/get a pointer to a user - * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the - * value left by the last call for all other ops. If the lock manager is - * unable to perform the op then it should leave the mutex in the same - * state as when it was called and return a non-zero value. However, - * when called with AV_LOCK_DESTROY the mutex will always be assumed to - * have been successfully destroyed. If av_lockmgr_register succeeds - * it will return a non-negative value, if it fails it will return a - * negative value and destroy all mutex and unregister all callbacks. - * av_lockmgr_register is not thread-safe, it must be called from a - * single thread before any calls which make use of locking are used. - * - * @param cb User defined callback. av_lockmgr_register invokes calls - * to this callback and the previously registered callback. - * The callback will be used to create more than one mutex - * each of which must be backed by its own underlying locking - * mechanism (i.e. do not use a single static object to - * implement your lock manager). If cb is set to NULL the - * lockmgr will be unregistered. - */ -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); - -/** - * Get the type of the given codec. - */ -enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); - -/** - * Get the name of a codec. - * @return a static string identifying the codec; never NULL - */ -const char *avcodec_get_name(enum AVCodecID id); - -/** - * @return a positive value if s is open (i.e. avcodec_open2() was called on it - * with no corresponding avcodec_close()), 0 otherwise. - */ -int avcodec_is_open(AVCodecContext *s); - -/** - * @return a non-zero number if codec is an encoder, zero otherwise - */ -int av_codec_is_encoder(const AVCodec *codec); - -/** - * @return a non-zero number if codec is a decoder, zero otherwise - */ -int av_codec_is_decoder(const AVCodec *codec); - -/** - * @return descriptor for given codec ID or NULL if no descriptor exists. - */ -const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); - -/** - * Iterate over all codec descriptors known to libavcodec. - * - * @param prev previous descriptor. NULL to get the first descriptor. - * - * @return next descriptor or NULL after the last descriptor - */ -const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); - -/** - * @return codec descriptor with the given name or NULL if no such descriptor - * exists. - */ -const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); - -/** - * Allocate a CPB properties structure and initialize its fields to default - * values. - * - * @param size if non-NULL, the size of the allocated struct will be written - * here. This is useful for embedding it in side data. - * - * @return the newly allocated struct or NULL on failure - */ -AVCPBProperties *av_cpb_properties_alloc(size_t *size); - -/** - * @} - */ - -#endif /* AVCODEC_AVCODEC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avdct.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avdct.h deleted file mode 100644 index 272422e4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avdct.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AVDCT_H -#define AVCODEC_AVDCT_H - -#include "libavutil/opt.h" - -/** - * AVDCT context. - * @note function pointers can be NULL if the specific features have been - * disabled at build time. - */ -typedef struct AVDCT { - const AVClass *av_class; - - void (*idct)(int16_t *block /* align 16 */); - - /** - * IDCT input permutation. - * Several optimized IDCTs need a permutated input (relative to the - * normal order of the reference IDCT). - * This permutation must be performed before the idct_put/add. - * Note, normally this can be merged with the zigzag/alternate scan
- * An example to avoid confusion: - * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) - * - (x -> reference DCT -> reference IDCT -> x) - * - (x -> reference DCT -> simple_mmx_perm = idct_permutation - * -> simple_idct_mmx -> x) - * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant - * -> simple_idct_mmx -> ...) - */ - uint8_t idct_permutation[64]; - - void (*fdct)(int16_t *block /* align 16 */); - - - /** - * DCT algorithm. - * must use AVOptions to set this field. - */ - int dct_algo; - - /** - * IDCT algorithm. - * must use AVOptions to set this field. - */ - int idct_algo; - - void (*get_pixels)(int16_t *block /* align 16 */, - const uint8_t *pixels /* align 8 */, - ptrdiff_t line_size); - - int bits_per_sample; -} AVDCT; - -/** - * Allocates a AVDCT context. - * This needs to be initialized with avcodec_dct_init() after optionally - * configuring it with AVOptions. - * - * To free it use av_free() - */ -AVDCT *avcodec_dct_alloc(void); -int avcodec_dct_init(AVDCT *); - -const AVClass *avcodec_dct_get_class(void); - -#endif /* AVCODEC_AVDCT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avfft.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avfft.h deleted file mode 100644 index 0c0f9b8d..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/avfft.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AVFFT_H -#define AVCODEC_AVFFT_H - -/** - * @file - * @ingroup lavc_fft - * FFT functions - */ - -/** - * @defgroup lavc_fft FFT functions - * @ingroup lavc_misc - * - * @{ - */ - -typedef float FFTSample; - -typedef struct FFTComplex { - FFTSample re, im; -} FFTComplex; - -typedef struct FFTContext FFTContext; - -/** - * Set up a complex FFT. - * @param nbits log2 of the length of the input array - * @param inverse if 0 perform the forward transform, if 1 perform the inverse - */ -FFTContext *av_fft_init(int nbits, int inverse); - -/** - * Do the permutation needed BEFORE calling ff_fft_calc(). - */ -void av_fft_permute(FFTContext *s, FFTComplex *z); - -/** - * Do a complex FFT with the parameters defined in av_fft_init(). The - * input data must be permuted before. No 1.0/sqrt(n) normalization is done. - */ -void av_fft_calc(FFTContext *s, FFTComplex *z); - -void av_fft_end(FFTContext *s); - -FFTContext *av_mdct_init(int nbits, int inverse, double scale); -void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); -void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); -void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); -void av_mdct_end(FFTContext *s); - -/* Real Discrete Fourier Transform */ - -enum RDFTransformType { - DFT_R2C, - IDFT_C2R, - IDFT_R2C, - DFT_C2R, -}; - -typedef struct RDFTContext RDFTContext; - -/** - * Set up a real FFT. - * @param nbits log2 of the length of the input array - * @param trans the type of transform - */ -RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); -void av_rdft_calc(RDFTContext *s, FFTSample *data); -void av_rdft_end(RDFTContext *s); - -/* Discrete Cosine Transform */ - -typedef struct DCTContext DCTContext; - -enum DCTTransformType { - DCT_II = 0, - DCT_III, - DCT_I, - DST_I, -}; - -/** - * Set up DCT. - * - * @param nbits size of the input array: - * (1 << nbits) for DCT-II, DCT-III and DST-I - * (1 << nbits) + 1 for DCT-I - * @param type the type of transform - * - * @note the first element of the input of DST-I is ignored - */ -DCTContext *av_dct_init(int nbits, enum DCTTransformType type); -void av_dct_calc(DCTContext *s, FFTSample *data); -void av_dct_end (DCTContext *s); - -/** - * @} - */ - -#endif /* AVCODEC_AVFFT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/d3d11va.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/d3d11va.h deleted file mode 100644 index 6816b6c1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/d3d11va.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Direct3D11 HW acceleration - * - * copyright (c) 2009 Laurent Aimar - * copyright (c) 2015 Steve Lhomme - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_D3D11VA_H -#define AVCODEC_D3D11VA_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_d3d11va - * Public libavcodec D3D11VA header. - */ - -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0602 -#endif - -#include -#include - -/** - * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 - * @ingroup lavc_codec_hwaccel - * - * @{ - */ - -#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards -#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface - -/** - * This structure is used to provides the necessary configurations and data - * to the Direct3D11 FFmpeg HWAccel implementation. - * - * The application must make it available as AVCodecContext.hwaccel_context. - * - * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. - */ -typedef struct AVD3D11VAContext { - /** - * D3D11 decoder object - */ - ID3D11VideoDecoder *decoder; - - /** - * D3D11 VideoContext - */ - ID3D11VideoContext *video_context; - - /** - * D3D11 configuration used to create the decoder - */ - D3D11_VIDEO_DECODER_CONFIG *cfg; - - /** - * The number of surface in the surface array - */ - unsigned surface_count; - - /** - * The array of Direct3D surfaces used to create the decoder - */ - ID3D11VideoDecoderOutputView **surface; - - /** - * A bit field configuring the workarounds needed for using the decoder - */ - uint64_t workaround; - - /** - * Private to the FFmpeg AVHWAccel implementation - */ - unsigned report_id; - - /** - * Mutex to access video_context - */ - HANDLE context_mutex; -} AVD3D11VAContext; - -/** - * Allocate an AVD3D11VAContext. - * - * @return Newly-allocated AVD3D11VAContext or NULL on failure. - */ -AVD3D11VAContext *av_d3d11va_alloc_context(void); - -/** - * @} - */ - -#endif /* AVCODEC_D3D11VA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dirac.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dirac.h deleted file mode 100644 index e6d9d346..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dirac.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * Copyright (C) 2011 Jordi Ortiz - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DIRAC_H -#define AVCODEC_DIRAC_H - -/** - * @file - * Interface to Dirac Decoder/Encoder - * @author Marco Gerards - * @author David Conrad - * @author Jordi Ortiz - */ - -#include "avcodec.h" - -/** - * The spec limits the number of wavelet decompositions to 4 for both - * level 1 (VC-2) and 128 (long-gop default). - * 5 decompositions is the maximum before >16-bit buffers are needed. - * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting - * the others to 4 decompositions (or 3 for the fidelity filter). - * - * We use this instead of MAX_DECOMPOSITIONS to save some memory. - */ -#define MAX_DWT_LEVELS 5 - -/** - * Parse code values: - * - * Dirac Specification -> - * 9.6.1 Table 9.1 - * - * VC-2 Specification -> - * 10.4.1 Table 10.1 - */ - -enum DiracParseCodes { - DIRAC_PCODE_SEQ_HEADER = 0x00, - DIRAC_PCODE_END_SEQ = 0x10, - DIRAC_PCODE_AUX = 0x20, - DIRAC_PCODE_PAD = 0x30, - DIRAC_PCODE_PICTURE_CODED = 0x08, - DIRAC_PCODE_PICTURE_RAW = 0x48, - DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8, - DIRAC_PCODE_PICTURE_HQ = 0xE8, - DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A, - DIRAC_PCODE_INTER_NOREF_CO2 = 0x09, - DIRAC_PCODE_INTER_REF_CO1 = 0x0D, - DIRAC_PCODE_INTER_REF_CO2 = 0x0E, - DIRAC_PCODE_INTRA_REF_CO = 0x0C, - DIRAC_PCODE_INTRA_REF_RAW = 0x4C, - DIRAC_PCODE_INTRA_REF_PICT = 0xCC, - DIRAC_PCODE_MAGIC = 0x42424344, -}; - -typedef struct DiracVersionInfo { - int major; - int minor; -} DiracVersionInfo; - -typedef struct AVDiracSeqHeader { - unsigned width; - unsigned height; - uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 - - uint8_t interlaced; - uint8_t top_field_first; - - uint8_t frame_rate_index; ///< index into dirac_frame_rate[] - uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] - - uint16_t clean_width; - uint16_t clean_height; - uint16_t clean_left_offset; - uint16_t clean_right_offset; - - uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] - uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] - - int profile; - int level; - - AVRational framerate; - AVRational sample_aspect_ratio; - - enum AVPixelFormat pix_fmt; - enum AVColorRange color_range; - enum AVColorPrimaries color_primaries; - enum AVColorTransferCharacteristic color_trc; - enum AVColorSpace colorspace; - - DiracVersionInfo version; - int bit_depth; -} AVDiracSeqHeader; - -/** - * Parse a Dirac sequence header. - * - * @param dsh this function will allocate and fill an AVDiracSeqHeader struct - * and write it into this pointer. The caller must free it with - * av_free(). - * @param buf the data buffer - * @param buf_size the size of the data buffer in bytes - * @param log_ctx if non-NULL, this function will log errors here - * @return 0 on success, a negative AVERROR code on failure - */ -int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh, - const uint8_t *buf, size_t buf_size, - void *log_ctx); - -#endif /* AVCODEC_DIRAC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dv_profile.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dv_profile.h deleted file mode 100644 index 9380a66f..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dv_profile.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DV_PROFILE_H -#define AVCODEC_DV_PROFILE_H - -#include - -#include "libavutil/pixfmt.h" -#include "libavutil/rational.h" -#include "avcodec.h" - -/* minimum number of bytes to read from a DV stream in order to - * determine the profile */ -#define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ - - -/* - * AVDVProfile is used to express the differences between various - * DV flavors. For now it's primarily used for differentiating - * 525/60 and 625/50, but the plans are to use it for various - * DV specs as well (e.g. SMPTE314M vs. IEC 61834). - */ -typedef struct AVDVProfile { - int dsf; /* value of the dsf in the DV header */ - int video_stype; /* stype for VAUX source pack */ - int frame_size; /* total size of one frame in bytes */ - int difseg_size; /* number of DIF segments per DIF channel */ - int n_difchan; /* number of DIF channels per frame */ - AVRational time_base; /* 1/framerate */ - int ltc_divisor; /* FPS from the LTS standpoint */ - int height; /* picture height in pixels */ - int width; /* picture width in pixels */ - AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ - enum AVPixelFormat pix_fmt; /* picture pixel format */ - int bpm; /* blocks per macroblock */ - const uint8_t *block_sizes; /* AC block sizes, in bits */ - int audio_stride; /* size of audio_shuffle table */ - int audio_min_samples[3]; /* min amount of audio samples */ - /* for 48kHz, 44.1kHz and 32kHz */ - int audio_samples_dist[5]; /* how many samples are supposed to be */ - /* in each frame in a 5 frames window */ - const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ -} AVDVProfile; - -/** - * Get a DV profile for the provided compressed frame. - * - * @param sys the profile used for the previous frame, may be NULL - * @param frame the compressed data buffer - * @param buf_size size of the buffer in bytes - * @return the DV profile for the supplied data or NULL on failure - */ -const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, - const uint8_t *frame, unsigned buf_size); - -/** - * Get a DV profile for the provided stream parameters. - */ -const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); - -/** - * Get a DV profile for the provided stream parameters. - * The frame rate is used as a best-effort parameter. - */ -const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); - -#endif /* AVCODEC_DV_PROFILE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dxva2.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dxva2.h deleted file mode 100644 index 22c93992..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/dxva2.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * DXVA2 HW acceleration - * - * copyright (c) 2009 Laurent Aimar - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DXVA2_H -#define AVCODEC_DXVA2_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_dxva2 - * Public libavcodec DXVA2 header. - */ - -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0602 -#endif - -#include -#include -#include - -/** - * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 - * @ingroup lavc_codec_hwaccel - * - * @{ - */ - -#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards -#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface - -/** - * This structure is used to provides the necessary configurations and data - * to the DXVA2 FFmpeg HWAccel implementation. - * - * The application must make it available as AVCodecContext.hwaccel_context. - */ -struct dxva_context { - /** - * DXVA2 decoder object - */ - IDirectXVideoDecoder *decoder; - - /** - * DXVA2 configuration used to create the decoder - */ - const DXVA2_ConfigPictureDecode *cfg; - - /** - * The number of surface in the surface array - */ - unsigned surface_count; - - /** - * The array of Direct3D surfaces used to create the decoder - */ - LPDIRECT3DSURFACE9 *surface; - - /** - * A bit field configuring the workarounds needed for using the decoder - */ - uint64_t workaround; - - /** - * Private to the FFmpeg AVHWAccel implementation - */ - unsigned report_id; -}; - -/** - * @} - */ - -#endif /* AVCODEC_DXVA2_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/jni.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/jni.h deleted file mode 100644 index dd99e926..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/jni.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * JNI public API functions - * - * Copyright (c) 2015-2016 Matthieu Bouron - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_JNI_H -#define AVCODEC_JNI_H - -/* - * Manually set a Java virtual machine which will be used to retrieve the JNI - * environment. Once a Java VM is set it cannot be changed afterwards, meaning - * you can call multiple times av_jni_set_java_vm with the same Java VM pointer - * however it will error out if you try to set a different Java VM. - * - * @param vm Java virtual machine - * @param log_ctx context used for logging, can be NULL - * @return 0 on success, < 0 otherwise - */ -int av_jni_set_java_vm(void *vm, void *log_ctx); - -/* - * Get the Java virtual machine which has been set with av_jni_set_java_vm. - * - * @param vm Java virtual machine - * @return a pointer to the Java virtual machine - */ -void *av_jni_get_java_vm(void *log_ctx); - -#endif /* AVCODEC_JNI_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/mediacodec.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/mediacodec.h deleted file mode 100644 index 5606d24a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/mediacodec.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Android MediaCodec public API - * - * Copyright (c) 2016 Matthieu Bouron - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MEDIACODEC_H -#define AVCODEC_MEDIACODEC_H - -#include "libavcodec/avcodec.h" - -/** - * This structure holds a reference to a android/view/Surface object that will - * be used as output by the decoder. - * - */ -typedef struct AVMediaCodecContext { - - /** - * android/view/Surface object reference. - */ - void *surface; - -} AVMediaCodecContext; - -/** - * Allocate and initialize a MediaCodec context. - * - * When decoding with MediaCodec is finished, the caller must free the - * MediaCodec context with av_mediacodec_default_free. - * - * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise - */ -AVMediaCodecContext *av_mediacodec_alloc_context(void); - -/** - * Convenience function that sets up the MediaCodec context. - * - * @param avctx codec context - * @param ctx MediaCodec context to initialize - * @param surface reference to an android/view/Surface - * @return 0 on success, < 0 otherwise - */ -int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); - -/** - * This function must be called to free the MediaCodec context initialized with - * av_mediacodec_default_init(). - * - * @param avctx codec context - */ -void av_mediacodec_default_free(AVCodecContext *avctx); - -/** - * Opaque structure representing a MediaCodec buffer to render. - */ -typedef struct MediaCodecBuffer AVMediaCodecBuffer; - -/** - * Release a MediaCodec buffer and render it to the surface that is associated - * with the decoder. This function should only be called once on a given - * buffer, once released the underlying buffer returns to the codec, thus - * subsequent calls to this function will have no effect. - * - * @param buffer the buffer to render - * @param render 1 to release and render the buffer to the surface or 0 to - * discard the buffer - * @return 0 on success, < 0 otherwise - */ -int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); - -#endif /* AVCODEC_MEDIACODEC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/qsv.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/qsv.h deleted file mode 100644 index b77158ec..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/qsv.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Intel MediaSDK QSV public API - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_QSV_H -#define AVCODEC_QSV_H - -#include - -#include "libavutil/buffer.h" - -/** - * This struct is used for communicating QSV parameters between libavcodec and - * the caller. It is managed by the caller and must be assigned to - * AVCodecContext.hwaccel_context. - * - decoding: hwaccel_context must be set on return from the get_format() - * callback - * - encoding: hwaccel_context must be set before avcodec_open2() - */ -typedef struct AVQSVContext { - /** - * If non-NULL, the session to use for encoding or decoding. - * Otherwise, libavcodec will try to create an internal session. - */ - mfxSession session; - - /** - * The IO pattern to use. - */ - int iopattern; - - /** - * Extra buffers to pass to encoder or decoder initialization. - */ - mfxExtBuffer **ext_buffers; - int nb_ext_buffers; - - /** - * Encoding only. If this field is set to non-zero by the caller, libavcodec - * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to - * the encoder initialization. This only makes sense if iopattern is also - * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. - * - * The number of allocated opaque surfaces will be the sum of the number - * required by the encoder and the user-provided value nb_opaque_surfaces. - * The array of the opaque surfaces will be exported to the caller through - * the opaque_surfaces field. - */ - int opaque_alloc; - - /** - * Encoding only, and only if opaque_alloc is set to non-zero. Before - * calling avcodec_open2(), the caller should set this field to the number - * of extra opaque surfaces to allocate beyond what is required by the - * encoder. - * - * On return from avcodec_open2(), this field will be set by libavcodec to - * the total number of allocated opaque surfaces. - */ - int nb_opaque_surfaces; - - /** - * Encoding only, and only if opaque_alloc is set to non-zero. On return - * from avcodec_open2(), this field will be used by libavcodec to export the - * array of the allocated opaque surfaces to the caller, so they can be - * passed to other parts of the pipeline. - * - * The buffer reference exported here is owned and managed by libavcodec, - * the callers should make their own reference with av_buffer_ref() and free - * it with av_buffer_unref() when it is no longer needed. - * - * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. - */ - AVBufferRef *opaque_surfaces; - - /** - * Encoding only, and only if opaque_alloc is set to non-zero. On return - * from avcodec_open2(), this field will be set to the surface type used in - * the opaque allocation request. - */ - int opaque_alloc_type; -} AVQSVContext; - -/** - * Allocate a new context. - * - * It must be freed by the caller with av_free(). - */ -AVQSVContext *av_qsv_alloc_context(void); - -#endif /* AVCODEC_QSV_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vaapi.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vaapi.h deleted file mode 100644 index 7a29f6f8..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vaapi.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Video Acceleration API (shared data between FFmpeg and the video player) - * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 - * - * Copyright (C) 2008-2009 Splitted-Desktop Systems - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VAAPI_H -#define AVCODEC_VAAPI_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vaapi - * Public libavcodec VA API header. - */ - -#include -#include "libavutil/attributes.h" -#include "version.h" - -/** - * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding - * @ingroup lavc_codec_hwaccel - * @{ - */ - -/** - * This structure is used to share data between the FFmpeg library and - * the client video application. - * This shall be zero-allocated and available as - * AVCodecContext.hwaccel_context. All user members can be set once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - */ -struct vaapi_context { - /** - * Window system dependent data - * - * - encoding: unused - * - decoding: Set by user - */ - void *display; - - /** - * Configuration ID - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t config_id; - - /** - * Context ID (video decode pipeline) - * - * - encoding: unused - * - decoding: Set by user - */ - uint32_t context_id; - -#if FF_API_VAAPI_CONTEXT - /** - * VAPictureParameterBuffer ID - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - uint32_t pic_param_buf_id; - - /** - * VAIQMatrixBuffer ID - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - uint32_t iq_matrix_buf_id; - - /** - * VABitPlaneBuffer ID (for VC-1 decoding) - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - uint32_t bitplane_buf_id; - - /** - * Slice parameter/data buffer IDs - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - uint32_t *slice_buf_ids; - - /** - * Number of effective slice buffer IDs to send to the HW - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - unsigned int n_slice_buf_ids; - - /** - * Size of pre-allocated slice_buf_ids - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - unsigned int slice_buf_ids_alloc; - - /** - * Pointer to VASliceParameterBuffers - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - void *slice_params; - - /** - * Size of a VASliceParameterBuffer element - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - unsigned int slice_param_size; - - /** - * Size of pre-allocated slice_params - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - unsigned int slice_params_alloc; - - /** - * Number of slices currently filled in - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - unsigned int slice_count; - - /** - * Pointer to slice data buffer base - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - const uint8_t *slice_data; - - /** - * Current size of slice data - * - * - encoding: unused - * - decoding: Set by libavcodec - */ - attribute_deprecated - uint32_t slice_data_size; -#endif -}; - -/* @} */ - -#endif /* AVCODEC_VAAPI_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vda.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vda.h deleted file mode 100644 index bde14e31..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vda.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * VDA HW acceleration - * - * copyright (c) 2011 Sebastien Zwickert - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VDA_H -#define AVCODEC_VDA_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vda - * Public libavcodec VDA header. - */ - -#include "libavcodec/avcodec.h" - -#include - -// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes -// http://openradar.appspot.com/8026390 -#undef __GNUC_STDC_INLINE__ - -#define Picture QuickdrawPicture -#include -#undef Picture - -#include "libavcodec/version.h" - -// extra flags not defined in VDADecoder.h -enum { - kVDADecodeInfo_Asynchronous = 1UL << 0, - kVDADecodeInfo_FrameDropped = 1UL << 1 -}; - -/** - * @defgroup lavc_codec_hwaccel_vda VDA - * @ingroup lavc_codec_hwaccel - * - * @{ - */ - -/** - * This structure is used to provide the necessary configurations and data - * to the VDA FFmpeg HWAccel implementation. - * - * The application must make it available as AVCodecContext.hwaccel_context. - */ -struct vda_context { - /** - * VDA decoder object. - * - * - encoding: unused - * - decoding: Set/Unset by libavcodec. - */ - VDADecoder decoder; - - /** - * The Core Video pixel buffer that contains the current image data. - * - * encoding: unused - * decoding: Set by libavcodec. Unset by user. - */ - CVPixelBufferRef cv_buffer; - - /** - * Use the hardware decoder in synchronous mode. - * - * encoding: unused - * decoding: Set by user. - */ - int use_sync_decoding; - - /** - * The frame width. - * - * - encoding: unused - * - decoding: Set/Unset by user. - */ - int width; - - /** - * The frame height. - * - * - encoding: unused - * - decoding: Set/Unset by user. - */ - int height; - - /** - * The frame format. - * - * - encoding: unused - * - decoding: Set/Unset by user. - */ - int format; - - /** - * The pixel format for output image buffers. - * - * - encoding: unused - * - decoding: Set/Unset by user. - */ - OSType cv_pix_fmt_type; - - /** - * unused - */ - uint8_t *priv_bitstream; - - /** - * unused - */ - int priv_bitstream_size; - - /** - * unused - */ - int priv_allocated_size; - - /** - * Use av_buffer to manage buffer. - * When the flag is set, the CVPixelBuffers returned by the decoder will - * be released automatically, so you have to retain them if necessary. - * Not setting this flag may cause memory leak. - * - * encoding: unused - * decoding: Set by user. - */ - int use_ref_buffer; -}; - -/** Create the video decoder. */ -int ff_vda_create_decoder(struct vda_context *vda_ctx, - uint8_t *extradata, - int extradata_size); - -/** Destroy the video decoder. */ -int ff_vda_destroy_decoder(struct vda_context *vda_ctx); - -/** - * This struct holds all the information that needs to be passed - * between the caller and libavcodec for initializing VDA decoding. - * Its size is not a part of the public ABI, it must be allocated with - * av_vda_alloc_context() and freed with av_free(). - */ -typedef struct AVVDAContext { - /** - * VDA decoder object. Created and freed by the caller. - */ - VDADecoder decoder; - - /** - * The output callback that must be passed to VDADecoderCreate. - * Set by av_vda_alloc_context(). - */ - VDADecoderOutputCallback output_callback; - - /** - * CVPixelBuffer Format Type that VDA will use for decoded frames; set by - * the caller. - */ - OSType cv_pix_fmt_type; -} AVVDAContext; - -/** - * Allocate and initialize a VDA context. - * - * This function should be called from the get_format() callback when the caller - * selects the AV_PIX_FMT_VDA format. The caller must then create the decoder - * object (using the output callback provided by libavcodec) that will be used - * for VDA-accelerated decoding. - * - * When decoding with VDA is finished, the caller must destroy the decoder - * object and free the VDA context using av_free(). - * - * @return the newly allocated context or NULL on failure - */ -AVVDAContext *av_vda_alloc_context(void); - -/** - * This is a convenience function that creates and sets up the VDA context using - * an internal implementation. - * - * @param avctx the corresponding codec context - * - * @return >= 0 on success, a negative AVERROR code on failure - */ -int av_vda_default_init(AVCodecContext *avctx); - -/** - * This is a convenience function that creates and sets up the VDA context using - * an internal implementation. - * - * @param avctx the corresponding codec context - * @param vdactx the VDA context to use - * - * @return >= 0 on success, a negative AVERROR code on failure - */ -int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx); - -/** - * This function must be called to free the VDA context initialized with - * av_vda_default_init(). - * - * @param avctx the corresponding codec context - */ -void av_vda_default_free(AVCodecContext *avctx); - -/** - * @} - */ - -#endif /* AVCODEC_VDA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vdpau.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vdpau.h deleted file mode 100644 index e85e4d9e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vdpau.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * The Video Decode and Presentation API for UNIX (VDPAU) is used for - * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. - * - * Copyright (C) 2008 NVIDIA - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VDPAU_H -#define AVCODEC_VDPAU_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_vdpau - * Public libavcodec VDPAU header. - */ - - -/** - * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer - * @ingroup lavc_codec_hwaccel - * - * VDPAU hardware acceleration has two modules - * - VDPAU decoding - * - VDPAU presentation - * - * The VDPAU decoding module parses all headers using FFmpeg - * parsing mechanisms and uses VDPAU for the actual decoding. - * - * As per the current implementation, the actual decoding - * and rendering (API calls) are done as part of the VDPAU - * presentation (vo_vdpau.c) module. - * - * @{ - */ - -#include -#include -#include "libavutil/avconfig.h" -#include "libavutil/attributes.h" - -#include "avcodec.h" -#include "version.h" - -#if FF_API_BUFS_VDPAU -union AVVDPAUPictureInfo { - VdpPictureInfoH264 h264; - VdpPictureInfoMPEG1Or2 mpeg; - VdpPictureInfoVC1 vc1; - VdpPictureInfoMPEG4Part2 mpeg4; -}; -#endif - -struct AVCodecContext; -struct AVFrame; - -typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, - const VdpPictureInfo *, uint32_t, - const VdpBitstreamBuffer *); - -/** - * This structure is used to share data between the libavcodec library and - * the client video application. - * The user shall allocate the structure via the av_alloc_vdpau_hwaccel - * function and make it available as - * AVCodecContext.hwaccel_context. Members can be set by the user once - * during initialization or through each AVCodecContext.get_buffer() - * function call. In any case, they must be valid prior to calling - * decoding functions. - * - * The size of this structure is not a part of the public ABI and must not - * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an - * AVVDPAUContext. - */ -typedef struct AVVDPAUContext { - /** - * VDPAU decoder handle - * - * Set by user. - */ - VdpDecoder decoder; - - /** - * VDPAU decoder render callback - * - * Set by the user. - */ - VdpDecoderRender *render; - -#if FF_API_BUFS_VDPAU - /** - * VDPAU picture information - * - * Set by libavcodec. - */ - attribute_deprecated - union AVVDPAUPictureInfo info; - - /** - * Allocated size of the bitstream_buffers table. - * - * Set by libavcodec. - */ - attribute_deprecated - int bitstream_buffers_allocated; - - /** - * Useful bitstream buffers in the bitstream buffers table. - * - * Set by libavcodec. - */ - attribute_deprecated - int bitstream_buffers_used; - - /** - * Table of bitstream buffers. - * The user is responsible for freeing this buffer using av_freep(). - * - * Set by libavcodec. - */ - attribute_deprecated - VdpBitstreamBuffer *bitstream_buffers; -#endif - AVVDPAU_Render2 render2; -} AVVDPAUContext; - -/** - * @brief allocation function for AVVDPAUContext - * - * Allows extending the struct without breaking API/ABI - */ -AVVDPAUContext *av_alloc_vdpaucontext(void); - -AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); -void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); - -/** - * Associate a VDPAU device with a codec context for hardware acceleration. - * This function is meant to be called from the get_format() codec callback, - * or earlier. It can also be called after avcodec_flush_buffers() to change - * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent - * display preemption). - * - * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes - * successfully. - * - * @param avctx decoding context whose get_format() callback is invoked - * @param device VDPAU device handle to use for hardware acceleration - * @param get_proc_address VDPAU device driver - * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags - * - * @return 0 on success, an AVERROR code on failure. - */ -int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, - VdpGetProcAddress *get_proc_address, unsigned flags); - -/** - * Gets the parameters to create an adequate VDPAU video surface for the codec - * context using VDPAU hardware decoding acceleration. - * - * @note Behavior is undefined if the context was not successfully bound to a - * VDPAU device using av_vdpau_bind_context(). - * - * @param avctx the codec context being used for decoding the stream - * @param type storage space for the VDPAU video surface chroma type - * (or NULL to ignore) - * @param width storage space for the VDPAU video surface pixel width - * (or NULL to ignore) - * @param height storage space for the VDPAU video surface pixel height - * (or NULL to ignore) - * - * @return 0 on success, a negative AVERROR code on failure. - */ -int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, - uint32_t *width, uint32_t *height); - -/** - * Allocate an AVVDPAUContext. - * - * @return Newly-allocated AVVDPAUContext or NULL on failure. - */ -AVVDPAUContext *av_vdpau_alloc_context(void); - -#if FF_API_VDPAU_PROFILE -/** - * Get a decoder profile that should be used for initializing a VDPAU decoder. - * Should be called from the AVCodecContext.get_format() callback. - * - * @deprecated Use av_vdpau_bind_context() instead. - * - * @param avctx the codec context being used for decoding the stream - * @param profile a pointer into which the result will be written on success. - * The contents of profile are undefined if this function returns - * an error. - * - * @return 0 on success (non-negative), a negative AVERROR on failure. - */ -attribute_deprecated -int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); -#endif - -#if FF_API_CAP_VDPAU -/** @brief The videoSurface is used for rendering. */ -#define FF_VDPAU_STATE_USED_FOR_RENDER 1 - -/** - * @brief The videoSurface is needed for reference/prediction. - * The codec manipulates this. - */ -#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 - -/** - * @brief This structure is used as a callback between the FFmpeg - * decoder (vd_) and presentation (vo_) module. - * This is used for defining a video frame containing surface, - * picture parameter, bitstream information etc which are passed - * between the FFmpeg decoder and its clients. - */ -struct vdpau_render_state { - VdpVideoSurface surface; ///< Used as rendered surface, never changed. - - int state; ///< Holds FF_VDPAU_STATE_* values. - - /** picture parameter information for all supported codecs */ - union AVVDPAUPictureInfo info; - - /** Describe size/location of the compressed video data. - Set to 0 when freeing bitstream_buffers. */ - int bitstream_buffers_allocated; - int bitstream_buffers_used; - /** The user is responsible for freeing this buffer using av_freep(). */ - VdpBitstreamBuffer *bitstream_buffers; -}; -#endif - -/* @}*/ - -#endif /* AVCODEC_VDPAU_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/version.h deleted file mode 100644 index ec8837a4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/version.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VERSION_H -#define AVCODEC_VERSION_H - -/** - * @file - * @ingroup libavc - * Libavcodec version macros. - */ - -#include "libavutil/version.h" - -#define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 64 -#define LIBAVCODEC_VERSION_MICRO 101 - -#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - * - * @note, when bumping the major version it is recommended to manually - * disable each FF_API_* in its own commit instead of disabling them all - * at once through the bump. This improves the git bisect-ability of the change. - */ - -#ifndef FF_API_VIMA_DECODER -#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AUDIO_CONVERT -#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AVCODEC_RESAMPLE -#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT -#endif -#ifndef FF_API_GETCHROMA -#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_MISSING_SAMPLE -#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_LOWRES -#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_CAP_VDPAU -#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_BUFS_VDPAU -#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_VOXWARE -#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_SET_DIMENSIONS -#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_DEBUG_MV -#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AC_VLC -#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_OLD_MSMPEG4 -#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_ASPECT_EXTENDED -#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_ARCH_ALPHA -#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_ERROR_RATE -#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_QSCALE_TYPE -#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_MB_TYPE -#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_MAX_BFRAMES -#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_NEG_LINESIZES -#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_EMU_EDGE -#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_ARCH_SH4 -#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_ARCH_SPARC -#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_UNUSED_MEMBERS -#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_IDCT_XVIDMMX -#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_INPUT_PRESERVED -#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_NORMALIZE_AQP -#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_GMC -#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_MV0 -#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_CODEC_NAME -#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AFD -#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_VISMV -/* XXX: don't forget to drop the -vismv documentation */ -#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AUDIOENC_DELAY -#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_VAAPI_CONTEXT -#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_AVCTX_TIMEBASE -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MPV_OPT -#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STREAM_CODEC_TAG -#define FF_API_STREAM_CODEC_TAG (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_QUANT_BIAS -#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RC_STRATEGY -#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODED_FRAME -#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_MOTION_EST -#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_WITHOUT_PREFIX -#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_SIDEDATA_ONLY_PKT -#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VDPAU_PROFILE -#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CONVERGENCE_DURATION -#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPICTURE -#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_AVPACKET_OLD_API -#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_RTP_CALLBACK -#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_VBV_DELAY -#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_CODER_TYPE -#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_STAT_BITS -#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_PRIVATE_OPT -#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_ASS_TIMING -#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_OLD_BSF -#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_COPY_CONTEXT -#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_GET_CONTEXT_DEFAULTS -#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) -#endif -#ifndef FF_API_NVENC_OLD_NAME -#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) -#endif - -#endif /* AVCODEC_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/videotoolbox.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/videotoolbox.h deleted file mode 100644 index a48638e2..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/videotoolbox.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Videotoolbox hardware acceleration - * - * copyright (c) 2012 Sebastien Zwickert - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VIDEOTOOLBOX_H -#define AVCODEC_VIDEOTOOLBOX_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_videotoolbox - * Public libavcodec Videotoolbox header. - */ - -#include - -#define Picture QuickdrawPicture -#include -#undef Picture - -#include "libavcodec/avcodec.h" - -/** - * This struct holds all the information that needs to be passed - * between the caller and libavcodec for initializing Videotoolbox decoding. - * Its size is not a part of the public ABI, it must be allocated with - * av_videotoolbox_alloc_context() and freed with av_free(). - */ -typedef struct AVVideotoolboxContext { - /** - * Videotoolbox decompression session object. - * Created and freed the caller. - */ - VTDecompressionSessionRef session; - - /** - * The output callback that must be passed to the session. - * Set by av_videottoolbox_default_init() - */ - VTDecompressionOutputCallback output_callback; - - /** - * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. - * set by the caller. - */ - OSType cv_pix_fmt_type; - - /** - * CoreMedia Format Description that Videotoolbox will use to create the decompression session. - * Set by the caller. - */ - CMVideoFormatDescriptionRef cm_fmt_desc; - - /** - * CoreMedia codec type that Videotoolbox will use to create the decompression session. - * Set by the caller. - */ - int cm_codec_type; -} AVVideotoolboxContext; - -/** - * Allocate and initialize a Videotoolbox context. - * - * This function should be called from the get_format() callback when the caller - * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create - * the decoder object (using the output callback provided by libavcodec) that - * will be used for Videotoolbox-accelerated decoding. - * - * When decoding with Videotoolbox is finished, the caller must destroy the decoder - * object and free the Videotoolbox context using av_free(). - * - * @return the newly allocated context or NULL on failure - */ -AVVideotoolboxContext *av_videotoolbox_alloc_context(void); - -/** - * This is a convenience function that creates and sets up the Videotoolbox context using - * an internal implementation. - * - * @param avctx the corresponding codec context - * - * @return >= 0 on success, a negative AVERROR code on failure - */ -int av_videotoolbox_default_init(AVCodecContext *avctx); - -/** - * This is a convenience function that creates and sets up the Videotoolbox context using - * an internal implementation. - * - * @param avctx the corresponding codec context - * @param vtctx the Videotoolbox context to use - * - * @return >= 0 on success, a negative AVERROR code on failure - */ -int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); - -/** - * This function must be called to free the Videotoolbox context initialized with - * av_videotoolbox_default_init(). - * - * @param avctx the corresponding codec context - */ -void av_videotoolbox_default_free(AVCodecContext *avctx); - -/** - * @} - */ - -#endif /* AVCODEC_VIDEOTOOLBOX_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vorbis_parser.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vorbis_parser.h deleted file mode 100644 index 92050277..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/vorbis_parser.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * A public API for Vorbis parsing - * - * Determines the duration for each packet. - */ - -#ifndef AVCODEC_VORBIS_PARSER_H -#define AVCODEC_VORBIS_PARSER_H - -#include - -typedef struct AVVorbisParseContext AVVorbisParseContext; - -/** - * Allocate and initialize the Vorbis parser using headers in the extradata. - * - * @param avctx codec context - * @param s Vorbis parser context - */ -AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, - int extradata_size); - -/** - * Free the parser and everything associated with it. - */ -void av_vorbis_parse_free(AVVorbisParseContext **s); - -#define VORBIS_FLAG_HEADER 0x00000001 -#define VORBIS_FLAG_COMMENT 0x00000002 -#define VORBIS_FLAG_SETUP 0x00000004 - -/** - * Get the duration for a Vorbis packet. - * - * If @p flags is @c NULL, - * special frames are considered invalid. - * - * @param s Vorbis parser context - * @param buf buffer containing a Vorbis frame - * @param buf_size size of the buffer - * @param flags flags for special frames - */ -int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, - int buf_size, int *flags); - -/** - * Get the duration for a Vorbis packet. - * - * @param s Vorbis parser context - * @param buf buffer containing a Vorbis frame - * @param buf_size size of the buffer - */ -int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, - int buf_size); - -void av_vorbis_parse_reset(AVVorbisParseContext *s); - -#endif /* AVCODEC_VORBIS_PARSER_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/xvmc.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/xvmc.h deleted file mode 100644 index 465ee78d..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavcodec/xvmc.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2003 Ivan Kalvachev - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_XVMC_H -#define AVCODEC_XVMC_H - -/** - * @file - * @ingroup lavc_codec_hwaccel_xvmc - * Public libavcodec XvMC header. - */ - -#include - -#include "libavutil/attributes.h" -#include "version.h" -#include "avcodec.h" - -/** - * @defgroup lavc_codec_hwaccel_xvmc XvMC - * @ingroup lavc_codec_hwaccel - * - * @{ - */ - -#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct - the number is 1337 speak for the letters IDCT MCo (motion compensation) */ - -struct attribute_deprecated xvmc_pix_fmt { - /** The field contains the special constant value AV_XVMC_ID. - It is used as a test that the application correctly uses the API, - and that there is no corruption caused by pixel routines. - - application - set during initialization - - libavcodec - unchanged - */ - int xvmc_id; - - /** Pointer to the block array allocated by XvMCCreateBlocks(). - The array has to be freed by XvMCDestroyBlocks(). - Each group of 64 values represents one data block of differential - pixel information (in MoCo mode) or coefficients for IDCT. - - application - set the pointer during initialization - - libavcodec - fills coefficients/pixel data into the array - */ - short* data_blocks; - - /** Pointer to the macroblock description array allocated by - XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). - - application - set the pointer during initialization - - libavcodec - fills description data into the array - */ - XvMCMacroBlock* mv_blocks; - - /** Number of macroblock descriptions that can be stored in the mv_blocks - array. - - application - set during initialization - - libavcodec - unchanged - */ - int allocated_mv_blocks; - - /** Number of blocks that can be stored at once in the data_blocks array. - - application - set during initialization - - libavcodec - unchanged - */ - int allocated_data_blocks; - - /** Indicate that the hardware would interpret data_blocks as IDCT - coefficients and perform IDCT on them. - - application - set during initialization - - libavcodec - unchanged - */ - int idct; - - /** In MoCo mode it indicates that intra macroblocks are assumed to be in - unsigned format; same as the XVMC_INTRA_UNSIGNED flag. - - application - set during initialization - - libavcodec - unchanged - */ - int unsigned_intra; - - /** Pointer to the surface allocated by XvMCCreateSurface(). - It has to be freed by XvMCDestroySurface() on application exit. - It identifies the frame and its state on the video hardware. - - application - set during initialization - - libavcodec - unchanged - */ - XvMCSurface* p_surface; - -/** Set by the decoder before calling ff_draw_horiz_band(), - needed by the XvMCRenderSurface function. */ -//@{ - /** Pointer to the surface used as past reference - - application - unchanged - - libavcodec - set - */ - XvMCSurface* p_past_surface; - - /** Pointer to the surface used as future reference - - application - unchanged - - libavcodec - set - */ - XvMCSurface* p_future_surface; - - /** top/bottom field or frame - - application - unchanged - - libavcodec - set - */ - unsigned int picture_structure; - - /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence - - application - unchanged - - libavcodec - set - */ - unsigned int flags; -//}@ - - /** Number of macroblock descriptions in the mv_blocks array - that have already been passed to the hardware. - - application - zeroes it on get_buffer(). - A successful ff_draw_horiz_band() may increment it - with filled_mb_block_num or zero both. - - libavcodec - unchanged - */ - int start_mv_blocks_num; - - /** Number of new macroblock descriptions in the mv_blocks array (after - start_mv_blocks_num) that are filled by libavcodec and have to be - passed to the hardware. - - application - zeroes it on get_buffer() or after successful - ff_draw_horiz_band(). - - libavcodec - increment with one of each stored MB - */ - int filled_mv_blocks_num; - - /** Number of the next free data block; one data block consists of - 64 short values in the data_blocks array. - All blocks before this one have already been claimed by placing their - position into the corresponding block description structure field, - that are part of the mv_blocks array. - - application - zeroes it on get_buffer(). - A successful ff_draw_horiz_band() may zero it together - with start_mb_blocks_num. - - libavcodec - each decoded macroblock increases it by the number - of coded blocks it contains. - */ - int next_free_data_block_num; -}; - -/** - * @} - */ - -#endif /* AVCODEC_XVMC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfilter.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfilter.h deleted file mode 100644 index 15d00f70..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfilter.h +++ /dev/null @@ -1,1126 +0,0 @@ -/* - * filter layer - * Copyright (c) 2007 Bobby Bingham - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_AVFILTER_H -#define AVFILTER_AVFILTER_H - -/** - * @file - * @ingroup lavfi - * Main libavfilter public API header - */ - -/** - * @defgroup lavfi libavfilter - * Graph-based frame editing library. - * - * @{ - */ - -#include - -#include "libavutil/attributes.h" -#include "libavutil/avutil.h" -#include "libavutil/buffer.h" -#include "libavutil/dict.h" -#include "libavutil/frame.h" -#include "libavutil/log.h" -#include "libavutil/samplefmt.h" -#include "libavutil/pixfmt.h" -#include "libavutil/rational.h" - -#include "libavfilter/version.h" - -/** - * Return the LIBAVFILTER_VERSION_INT constant. - */ -unsigned avfilter_version(void); - -/** - * Return the libavfilter build-time configuration. - */ -const char *avfilter_configuration(void); - -/** - * Return the libavfilter license. - */ -const char *avfilter_license(void); - -typedef struct AVFilterContext AVFilterContext; -typedef struct AVFilterLink AVFilterLink; -typedef struct AVFilterPad AVFilterPad; -typedef struct AVFilterFormats AVFilterFormats; - -/** - * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. - * AVFilter.inputs/outputs). - */ -int avfilter_pad_count(const AVFilterPad *pads); - -/** - * Get the name of an AVFilterPad. - * - * @param pads an array of AVFilterPads - * @param pad_idx index of the pad in the array it; is the caller's - * responsibility to ensure the index is valid - * - * @return name of the pad_idx'th pad in pads - */ -const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx); - -/** - * Get the type of an AVFilterPad. - * - * @param pads an array of AVFilterPads - * @param pad_idx index of the pad in the array; it is the caller's - * responsibility to ensure the index is valid - * - * @return type of the pad_idx'th pad in pads - */ -enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); - -/** - * The number of the filter inputs is not determined just by AVFilter.inputs. - * The filter might add additional inputs during initialization depending on the - * options supplied to it. - */ -#define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0) -/** - * The number of the filter outputs is not determined just by AVFilter.outputs. - * The filter might add additional outputs during initialization depending on - * the options supplied to it. - */ -#define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) -/** - * The filter supports multithreading by splitting frames into multiple parts - * and processing them concurrently. - */ -#define AVFILTER_FLAG_SLICE_THREADS (1 << 2) -/** - * Some filters support a generic "enable" expression option that can be used - * to enable or disable a filter in the timeline. Filters supporting this - * option have this flag set. When the enable expression is false, the default - * no-op filter_frame() function is called in place of the filter_frame() - * callback defined on each input pad, thus the frame is passed unchanged to - * the next filters. - */ -#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16) -/** - * Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will - * have its filter_frame() callback(s) called as usual even when the enable - * expression is false. The filter will disable filtering within the - * filter_frame() callback(s) itself, for example executing code depending on - * the AVFilterContext->is_disabled value. - */ -#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17) -/** - * Handy mask to test whether the filter supports or no the timeline feature - * (internally or generically). - */ -#define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL) - -/** - * Filter definition. This defines the pads a filter contains, and all the - * callback functions used to interact with the filter. - */ -typedef struct AVFilter { - /** - * Filter name. Must be non-NULL and unique among filters. - */ - const char *name; - - /** - * A description of the filter. May be NULL. - * - * You should use the NULL_IF_CONFIG_SMALL() macro to define it. - */ - const char *description; - - /** - * List of inputs, terminated by a zeroed element. - * - * NULL if there are no (static) inputs. Instances of filters with - * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in - * this list. - */ - const AVFilterPad *inputs; - /** - * List of outputs, terminated by a zeroed element. - * - * NULL if there are no (static) outputs. Instances of filters with - * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in - * this list. - */ - const AVFilterPad *outputs; - - /** - * A class for the private data, used to declare filter private AVOptions. - * This field is NULL for filters that do not declare any options. - * - * If this field is non-NULL, the first member of the filter private data - * must be a pointer to AVClass, which will be set by libavfilter generic - * code to this class. - */ - const AVClass *priv_class; - - /** - * A combination of AVFILTER_FLAG_* - */ - int flags; - - /***************************************************************** - * All fields below this line are not part of the public API. They - * may not be used outside of libavfilter and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - - /** - * Filter initialization function. - * - * This callback will be called only once during the filter lifetime, after - * all the options have been set, but before links between filters are - * established and format negotiation is done. - * - * Basic filter initialization should be done here. Filters with dynamic - * inputs and/or outputs should create those inputs/outputs here based on - * provided options. No more changes to this filter's inputs/outputs can be - * done after this callback. - * - * This callback must not assume that the filter links exist or frame - * parameters are known. - * - * @ref AVFilter.uninit "uninit" is guaranteed to be called even if - * initialization fails, so this callback does not have to clean up on - * failure. - * - * @return 0 on success, a negative AVERROR on failure - */ - int (*init)(AVFilterContext *ctx); - - /** - * Should be set instead of @ref AVFilter.init "init" by the filters that - * want to pass a dictionary of AVOptions to nested contexts that are - * allocated during init. - * - * On return, the options dict should be freed and replaced with one that - * contains all the options which could not be processed by this filter (or - * with NULL if all the options were processed). - * - * Otherwise the semantics is the same as for @ref AVFilter.init "init". - */ - int (*init_dict)(AVFilterContext *ctx, AVDictionary **options); - - /** - * Filter uninitialization function. - * - * Called only once right before the filter is freed. Should deallocate any - * memory held by the filter, release any buffer references, etc. It does - * not need to deallocate the AVFilterContext.priv memory itself. - * - * This callback may be called even if @ref AVFilter.init "init" was not - * called or failed, so it must be prepared to handle such a situation. - */ - void (*uninit)(AVFilterContext *ctx); - - /** - * Query formats supported by the filter on its inputs and outputs. - * - * This callback is called after the filter is initialized (so the inputs - * and outputs are fixed), shortly before the format negotiation. This - * callback may be called more than once. - * - * This callback must set AVFilterLink.out_formats on every input link and - * AVFilterLink.in_formats on every output link to a list of pixel/sample - * formats that the filter supports on that link. For audio links, this - * filter must also set @ref AVFilterLink.in_samplerates "in_samplerates" / - * @ref AVFilterLink.out_samplerates "out_samplerates" and - * @ref AVFilterLink.in_channel_layouts "in_channel_layouts" / - * @ref AVFilterLink.out_channel_layouts "out_channel_layouts" analogously. - * - * This callback may be NULL for filters with one input, in which case - * libavfilter assumes that it supports all input formats and preserves - * them on output. - * - * @return zero on success, a negative value corresponding to an - * AVERROR code otherwise - */ - int (*query_formats)(AVFilterContext *); - - int priv_size; ///< size of private data to allocate for the filter - - /** - * Used by the filter registration system. Must not be touched by any other - * code. - */ - struct AVFilter *next; - - /** - * Make the filter instance process a command. - * - * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only - * @param arg the argument for the command - * @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported. - * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be - * time consuming then a filter should treat it like an unsupported command - * - * @returns >=0 on success otherwise an error code. - * AVERROR(ENOSYS) on unsupported commands - */ - int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags); - - /** - * Filter initialization function, alternative to the init() - * callback. Args contains the user-supplied parameters, opaque is - * used for providing binary data. - */ - int (*init_opaque)(AVFilterContext *ctx, void *opaque); -} AVFilter; - -/** - * Process multiple parts of the frame concurrently. - */ -#define AVFILTER_THREAD_SLICE (1 << 0) - -typedef struct AVFilterInternal AVFilterInternal; - -/** An instance of a filter */ -struct AVFilterContext { - const AVClass *av_class; ///< needed for av_log() and filters common options - - const AVFilter *filter; ///< the AVFilter of which this is an instance - - char *name; ///< name of this filter instance - - AVFilterPad *input_pads; ///< array of input pads - AVFilterLink **inputs; ///< array of pointers to input links - unsigned nb_inputs; ///< number of input pads - - AVFilterPad *output_pads; ///< array of output pads - AVFilterLink **outputs; ///< array of pointers to output links - unsigned nb_outputs; ///< number of output pads - - void *priv; ///< private data for use by the filter - - struct AVFilterGraph *graph; ///< filtergraph this filter belongs to - - /** - * Type of multithreading being allowed/used. A combination of - * AVFILTER_THREAD_* flags. - * - * May be set by the caller before initializing the filter to forbid some - * or all kinds of multithreading for this filter. The default is allowing - * everything. - * - * When the filter is initialized, this field is combined using bit AND with - * AVFilterGraph.thread_type to get the final mask used for determining - * allowed threading types. I.e. a threading type needs to be set in both - * to be allowed. - * - * After the filter is initialized, libavfilter sets this field to the - * threading type that is actually used (0 for no multithreading). - */ - int thread_type; - - /** - * An opaque struct for libavfilter internal use. - */ - AVFilterInternal *internal; - - struct AVFilterCommand *command_queue; - - char *enable_str; ///< enable expression string - void *enable; ///< parsed expression (AVExpr*) - double *var_values; ///< variable values for the enable expression - int is_disabled; ///< the enabled state from the last expression evaluation - - /** - * For filters which will create hardware frames, sets the device the - * filter should create them in. All other filters will ignore this field: - * in particular, a filter which consumes or processes hardware frames will - * instead use the hw_frames_ctx field in AVFilterLink to carry the - * hardware context information. - */ - AVBufferRef *hw_device_ctx; - - /** - * Max number of threads allowed in this filter instance. - * If <= 0, its value is ignored. - * Overrides global number of threads set per filter graph. - */ - int nb_threads; -}; - -/** - * A link between two filters. This contains pointers to the source and - * destination filters between which this link exists, and the indexes of - * the pads involved. In addition, this link also contains the parameters - * which have been negotiated and agreed upon between the filter, such as - * image dimensions, format, etc. - */ -struct AVFilterLink { - AVFilterContext *src; ///< source filter - AVFilterPad *srcpad; ///< output pad on the source filter - - AVFilterContext *dst; ///< dest filter - AVFilterPad *dstpad; ///< input pad on the dest filter - - enum AVMediaType type; ///< filter media type - - /* These parameters apply only to video */ - int w; ///< agreed upon image width - int h; ///< agreed upon image height - AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio - /* These parameters apply only to audio */ - uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h) - int sample_rate; ///< samples per second - - int format; ///< agreed upon media format - - /** - * Define the time base used by the PTS of the frames/samples - * which will pass through this link. - * During the configuration stage, each filter is supposed to - * change only the output timebase, while the timebase of the - * input link is assumed to be an unchangeable property. - */ - AVRational time_base; - - /***************************************************************** - * All fields below this line are not part of the public API. They - * may not be used outside of libavfilter and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - /** - * Lists of formats and channel layouts supported by the input and output - * filters respectively. These lists are used for negotiating the format - * to actually be used, which will be loaded into the format and - * channel_layout members, above, when chosen. - * - */ - AVFilterFormats *in_formats; - AVFilterFormats *out_formats; - - /** - * Lists of channel layouts and sample rates used for automatic - * negotiation. - */ - AVFilterFormats *in_samplerates; - AVFilterFormats *out_samplerates; - struct AVFilterChannelLayouts *in_channel_layouts; - struct AVFilterChannelLayouts *out_channel_layouts; - - /** - * Audio only, the destination filter sets this to a non-zero value to - * request that buffers with the given number of samples should be sent to - * it. AVFilterPad.needs_fifo must also be set on the corresponding input - * pad. - * Last buffer before EOF will be padded with silence. - */ - int request_samples; - - /** stage of the initialization of the link properties (dimensions, etc) */ - enum { - AVLINK_UNINIT = 0, ///< not started - AVLINK_STARTINIT, ///< started, but incomplete - AVLINK_INIT ///< complete - } init_state; - - /** - * Graph the filter belongs to. - */ - struct AVFilterGraph *graph; - - /** - * Current timestamp of the link, as defined by the most recent - * frame(s), in link time_base units. - */ - int64_t current_pts; - - /** - * Current timestamp of the link, as defined by the most recent - * frame(s), in AV_TIME_BASE units. - */ - int64_t current_pts_us; - - /** - * Index in the age array. - */ - int age_index; - - /** - * Frame rate of the stream on the link, or 1/0 if unknown or variable; - * if left to 0/0, will be automatically copied from the first input - * of the source filter if it exists. - * - * Sources should set it to the best estimation of the real frame rate. - * If the source frame rate is unknown or variable, set this to 1/0. - * Filters should update it if necessary depending on their function. - * Sinks can use it to set a default output frame rate. - * It is similar to the r_frame_rate field in AVStream. - */ - AVRational frame_rate; - - /** - * Buffer partially filled with samples to achieve a fixed/minimum size. - */ - AVFrame *partial_buf; - - /** - * Size of the partial buffer to allocate. - * Must be between min_samples and max_samples. - */ - int partial_buf_size; - - /** - * Minimum number of samples to filter at once. If filter_frame() is - * called with fewer samples, it will accumulate them in partial_buf. - * This field and the related ones must not be changed after filtering - * has started. - * If 0, all related fields are ignored. - */ - int min_samples; - - /** - * Maximum number of samples to filter at once. If filter_frame() is - * called with more samples, it will split them. - */ - int max_samples; - - /** - * Link status. - * If not zero, all attempts of filter_frame or request_frame - * will fail with the corresponding code, and if necessary the reference - * will be destroyed. - * If request_frame returns an error, the status is set on the - * corresponding link. - * It can be set also be set by either the source or the destination - * filter. - */ - int status; - - /** - * Number of channels. - */ - int channels; - - /** - * Link processing flags. - */ - unsigned flags; - - /** - * Number of past frames sent through the link. - */ - int64_t frame_count; - - /** - * A pointer to a FFVideoFramePool struct. - */ - void *video_frame_pool; - - /** - * True if a frame is currently wanted on the input of this filter. - * Set when ff_request_frame() is called by the output, - * cleared when the request is handled or forwarded. - */ - int frame_wanted_in; - - /** - * True if a frame is currently wanted on the output of this filter. - * Set when ff_request_frame() is called by the output, - * cleared when a frame is filtered. - */ - int frame_wanted_out; - - /** - * For hwaccel pixel formats, this should be a reference to the - * AVHWFramesContext describing the frames. - */ - AVBufferRef *hw_frames_ctx; -}; - -/** - * Link two filters together. - * - * @param src the source filter - * @param srcpad index of the output pad on the source filter - * @param dst the destination filter - * @param dstpad index of the input pad on the destination filter - * @return zero on success - */ -int avfilter_link(AVFilterContext *src, unsigned srcpad, - AVFilterContext *dst, unsigned dstpad); - -/** - * Free the link in *link, and set its pointer to NULL. - */ -void avfilter_link_free(AVFilterLink **link); - -/** - * Get the number of channels of a link. - */ -int avfilter_link_get_channels(AVFilterLink *link); - -/** - * Set the closed field of a link. - * @deprecated applications are not supposed to mess with links, they should - * close the sinks. - */ -attribute_deprecated -void avfilter_link_set_closed(AVFilterLink *link, int closed); - -/** - * Negotiate the media format, dimensions, etc of all inputs to a filter. - * - * @param filter the filter to negotiate the properties for its inputs - * @return zero on successful negotiation - */ -int avfilter_config_links(AVFilterContext *filter); - -#define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically -#define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw) - -/** - * Make the filter instance process a command. - * It is recommended to use avfilter_graph_send_command(). - */ -int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags); - -/** Initialize the filter system. Register all builtin filters. */ -void avfilter_register_all(void); - -#if FF_API_OLD_FILTER_REGISTER -/** Uninitialize the filter system. Unregister all filters. */ -attribute_deprecated -void avfilter_uninit(void); -#endif - -/** - * Register a filter. This is only needed if you plan to use - * avfilter_get_by_name later to lookup the AVFilter structure by name. A - * filter can still by instantiated with avfilter_graph_alloc_filter even if it - * is not registered. - * - * @param filter the filter to register - * @return 0 if the registration was successful, a negative value - * otherwise - */ -int avfilter_register(AVFilter *filter); - -/** - * Get a filter definition matching the given name. - * - * @param name the filter name to find - * @return the filter definition, if any matching one is registered. - * NULL if none found. - */ -#if !FF_API_NOCONST_GET_NAME -const -#endif -AVFilter *avfilter_get_by_name(const char *name); - -/** - * Iterate over all registered filters. - * @return If prev is non-NULL, next registered filter after prev or NULL if - * prev is the last filter. If prev is NULL, return the first registered filter. - */ -const AVFilter *avfilter_next(const AVFilter *prev); - -#if FF_API_OLD_FILTER_REGISTER -/** - * If filter is NULL, returns a pointer to the first registered filter pointer, - * if filter is non-NULL, returns the next pointer after filter. - * If the returned pointer points to NULL, the last registered filter - * was already reached. - * @deprecated use avfilter_next() - */ -attribute_deprecated -AVFilter **av_filter_next(AVFilter **filter); -#endif - -#if FF_API_AVFILTER_OPEN -/** - * Create a filter instance. - * - * @param filter_ctx put here a pointer to the created filter context - * on success, NULL on failure - * @param filter the filter to create an instance of - * @param inst_name Name to give to the new instance. Can be NULL for none. - * @return >= 0 in case of success, a negative error code otherwise - * @deprecated use avfilter_graph_alloc_filter() instead - */ -attribute_deprecated -int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); -#endif - - -#if FF_API_AVFILTER_INIT_FILTER -/** - * Initialize a filter. - * - * @param filter the filter to initialize - * @param args A string of parameters to use when initializing the filter. - * The format and meaning of this string varies by filter. - * @param opaque Any extra non-string data needed by the filter. The meaning - * of this parameter varies by filter. - * @return zero on success - */ -attribute_deprecated -int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque); -#endif - -/** - * Initialize a filter with the supplied parameters. - * - * @param ctx uninitialized filter context to initialize - * @param args Options to initialize the filter with. This must be a - * ':'-separated list of options in the 'key=value' form. - * May be NULL if the options have been set directly using the - * AVOptions API or there are no options that need to be set. - * @return 0 on success, a negative AVERROR on failure - */ -int avfilter_init_str(AVFilterContext *ctx, const char *args); - -/** - * Initialize a filter with the supplied dictionary of options. - * - * @param ctx uninitialized filter context to initialize - * @param options An AVDictionary filled with options for this filter. On - * return this parameter will be destroyed and replaced with - * a dict containing options that were not found. This dictionary - * must be freed by the caller. - * May be NULL, then this function is equivalent to - * avfilter_init_str() with the second parameter set to NULL. - * @return 0 on success, a negative AVERROR on failure - * - * @note This function and avfilter_init_str() do essentially the same thing, - * the difference is in manner in which the options are passed. It is up to the - * calling code to choose whichever is more preferable. The two functions also - * behave differently when some of the provided options are not declared as - * supported by the filter. In such a case, avfilter_init_str() will fail, but - * this function will leave those extra options in the options AVDictionary and - * continue as usual. - */ -int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options); - -/** - * Free a filter context. This will also remove the filter from its - * filtergraph's list of filters. - * - * @param filter the filter to free - */ -void avfilter_free(AVFilterContext *filter); - -/** - * Insert a filter in the middle of an existing link. - * - * @param link the link into which the filter should be inserted - * @param filt the filter to be inserted - * @param filt_srcpad_idx the input pad on the filter to connect - * @param filt_dstpad_idx the output pad on the filter to connect - * @return zero on success - */ -int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, - unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); - -/** - * @return AVClass for AVFilterContext. - * - * @see av_opt_find(). - */ -const AVClass *avfilter_get_class(void); - -typedef struct AVFilterGraphInternal AVFilterGraphInternal; - -/** - * A function pointer passed to the @ref AVFilterGraph.execute callback to be - * executed multiple times, possibly in parallel. - * - * @param ctx the filter context the job belongs to - * @param arg an opaque parameter passed through from @ref - * AVFilterGraph.execute - * @param jobnr the index of the job being executed - * @param nb_jobs the total number of jobs - * - * @return 0 on success, a negative AVERROR on error - */ -typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); - -/** - * A function executing multiple jobs, possibly in parallel. - * - * @param ctx the filter context to which the jobs belong - * @param func the function to be called multiple times - * @param arg the argument to be passed to func - * @param ret a nb_jobs-sized array to be filled with return values from each - * invocation of func - * @param nb_jobs the number of jobs to execute - * - * @return 0 on success, a negative AVERROR on error - */ -typedef int (avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func, - void *arg, int *ret, int nb_jobs); - -typedef struct AVFilterGraph { - const AVClass *av_class; - AVFilterContext **filters; - unsigned nb_filters; - - char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters - char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters - - /** - * Type of multithreading allowed for filters in this graph. A combination - * of AVFILTER_THREAD_* flags. - * - * May be set by the caller at any point, the setting will apply to all - * filters initialized after that. The default is allowing everything. - * - * When a filter in this graph is initialized, this field is combined using - * bit AND with AVFilterContext.thread_type to get the final mask used for - * determining allowed threading types. I.e. a threading type needs to be - * set in both to be allowed. - */ - int thread_type; - - /** - * Maximum number of threads used by filters in this graph. May be set by - * the caller before adding any filters to the filtergraph. Zero (the - * default) means that the number of threads is determined automatically. - */ - int nb_threads; - - /** - * Opaque object for libavfilter internal use. - */ - AVFilterGraphInternal *internal; - - /** - * Opaque user data. May be set by the caller to an arbitrary value, e.g. to - * be used from callbacks like @ref AVFilterGraph.execute. - * Libavfilter will not touch this field in any way. - */ - void *opaque; - - /** - * This callback may be set by the caller immediately after allocating the - * graph and before adding any filters to it, to provide a custom - * multithreading implementation. - * - * If set, filters with slice threading capability will call this callback - * to execute multiple jobs in parallel. - * - * If this field is left unset, libavfilter will use its internal - * implementation, which may or may not be multithreaded depending on the - * platform and build options. - */ - avfilter_execute_func *execute; - - char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions - - /** - * Private fields - * - * The following fields are for internal use only. - * Their type, offset, number and semantic can change without notice. - */ - - AVFilterLink **sink_links; - int sink_links_count; - - unsigned disable_auto_convert; -} AVFilterGraph; - -/** - * Allocate a filter graph. - * - * @return the allocated filter graph on success or NULL. - */ -AVFilterGraph *avfilter_graph_alloc(void); - -/** - * Create a new filter instance in a filter graph. - * - * @param graph graph in which the new filter will be used - * @param filter the filter to create an instance of - * @param name Name to give to the new instance (will be copied to - * AVFilterContext.name). This may be used by the caller to identify - * different filters, libavfilter itself assigns no semantics to - * this parameter. May be NULL. - * - * @return the context of the newly created filter instance (note that it is - * also retrievable directly through AVFilterGraph.filters or with - * avfilter_graph_get_filter()) on success or NULL on failure. - */ -AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, - const AVFilter *filter, - const char *name); - -/** - * Get a filter instance identified by instance name from graph. - * - * @param graph filter graph to search through. - * @param name filter instance name (should be unique in the graph). - * @return the pointer to the found filter instance or NULL if it - * cannot be found. - */ -AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *name); - -#if FF_API_AVFILTER_OPEN -/** - * Add an existing filter instance to a filter graph. - * - * @param graphctx the filter graph - * @param filter the filter to be added - * - * @deprecated use avfilter_graph_alloc_filter() to allocate a filter in a - * filter graph - */ -attribute_deprecated -int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter); -#endif - -/** - * Create and add a filter instance into an existing graph. - * The filter instance is created from the filter filt and inited - * with the parameters args and opaque. - * - * In case of success put in *filt_ctx the pointer to the created - * filter instance, otherwise set *filt_ctx to NULL. - * - * @param name the instance name to give to the created filter instance - * @param graph_ctx the filter graph - * @return a negative AVERROR error code in case of failure, a non - * negative value otherwise - */ -int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, - const char *name, const char *args, void *opaque, - AVFilterGraph *graph_ctx); - -/** - * Enable or disable automatic format conversion inside the graph. - * - * Note that format conversion can still happen inside explicitly inserted - * scale and aresample filters. - * - * @param flags any of the AVFILTER_AUTO_CONVERT_* constants - */ -void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags); - -enum { - AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */ - AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */ -}; - -/** - * Check validity and configure all the links and formats in the graph. - * - * @param graphctx the filter graph - * @param log_ctx context used for logging - * @return >= 0 in case of success, a negative AVERROR code otherwise - */ -int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); - -/** - * Free a graph, destroy its links, and set *graph to NULL. - * If *graph is NULL, do nothing. - */ -void avfilter_graph_free(AVFilterGraph **graph); - -/** - * A linked-list of the inputs/outputs of the filter chain. - * - * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(), - * where it is used to communicate open (unlinked) inputs and outputs from and - * to the caller. - * This struct specifies, per each not connected pad contained in the graph, the - * filter context and the pad index required for establishing a link. - */ -typedef struct AVFilterInOut { - /** unique name for this input/output in the list */ - char *name; - - /** filter context associated to this input/output */ - AVFilterContext *filter_ctx; - - /** index of the filt_ctx pad to use for linking */ - int pad_idx; - - /** next input/input in the list, NULL if this is the last */ - struct AVFilterInOut *next; -} AVFilterInOut; - -/** - * Allocate a single AVFilterInOut entry. - * Must be freed with avfilter_inout_free(). - * @return allocated AVFilterInOut on success, NULL on failure. - */ -AVFilterInOut *avfilter_inout_alloc(void); - -/** - * Free the supplied list of AVFilterInOut and set *inout to NULL. - * If *inout is NULL, do nothing. - */ -void avfilter_inout_free(AVFilterInOut **inout); - -/** - * Add a graph described by a string to a graph. - * - * @note The caller must provide the lists of inputs and outputs, - * which therefore must be known before calling the function. - * - * @note The inputs parameter describes inputs of the already existing - * part of the graph; i.e. from the point of view of the newly created - * part, they are outputs. Similarly the outputs parameter describes - * outputs of the already existing filters, which are provided as - * inputs to the parsed filters. - * - * @param graph the filter graph where to link the parsed graph context - * @param filters string to be parsed - * @param inputs linked list to the inputs of the graph - * @param outputs linked list to the outputs of the graph - * @return zero on success, a negative AVERROR code on error - */ -int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, - AVFilterInOut *inputs, AVFilterInOut *outputs, - void *log_ctx); - -/** - * Add a graph described by a string to a graph. - * - * In the graph filters description, if the input label of the first - * filter is not specified, "in" is assumed; if the output label of - * the last filter is not specified, "out" is assumed. - * - * @param graph the filter graph where to link the parsed graph context - * @param filters string to be parsed - * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. - * If non-NULL, *inputs is updated to contain the list of open inputs - * after the parsing, should be freed with avfilter_inout_free(). - * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. - * If non-NULL, *outputs is updated to contain the list of open outputs - * after the parsing, should be freed with avfilter_inout_free(). - * @return non negative on success, a negative AVERROR code on error - */ -int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, - AVFilterInOut **inputs, AVFilterInOut **outputs, - void *log_ctx); - -/** - * Add a graph described by a string to a graph. - * - * @param[in] graph the filter graph where to link the parsed graph context - * @param[in] filters string to be parsed - * @param[out] inputs a linked list of all free (unlinked) inputs of the - * parsed graph will be returned here. It is to be freed - * by the caller using avfilter_inout_free(). - * @param[out] outputs a linked list of all free (unlinked) outputs of the - * parsed graph will be returned here. It is to be freed by the - * caller using avfilter_inout_free(). - * @return zero on success, a negative AVERROR code on error - * - * @note This function returns the inputs and outputs that are left - * unlinked after parsing the graph and the caller then deals with - * them. - * @note This function makes no reference whatsoever to already - * existing parts of the graph and the inputs parameter will on return - * contain inputs of the newly parsed part of the graph. Analogously - * the outputs parameter will contain outputs of the newly created - * filters. - */ -int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, - AVFilterInOut **inputs, - AVFilterInOut **outputs); - -/** - * Send a command to one or more filter instances. - * - * @param graph the filter graph - * @param target the filter(s) to which the command should be sent - * "all" sends to all filters - * otherwise it can be a filter or filter instance name - * which will send the command to all matching filters. - * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only - * @param arg the argument for the command - * @param res a buffer with size res_size where the filter(s) can return a response. - * - * @returns >=0 on success otherwise an error code. - * AVERROR(ENOSYS) on unsupported commands - */ -int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags); - -/** - * Queue a command for one or more filter instances. - * - * @param graph the filter graph - * @param target the filter(s) to which the command should be sent - * "all" sends to all filters - * otherwise it can be a filter or filter instance name - * which will send the command to all matching filters. - * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only - * @param arg the argument for the command - * @param ts time at which the command should be sent to the filter - * - * @note As this executes commands after this function returns, no return code - * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported. - */ -int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts); - - -/** - * Dump a graph into a human-readable string representation. - * - * @param graph the graph to dump - * @param options formatting options; currently ignored - * @return a string, or NULL in case of memory allocation failure; - * the string must be freed using av_free - */ -char *avfilter_graph_dump(AVFilterGraph *graph, const char *options); - -/** - * Request a frame on the oldest sink link. - * - * If the request returns AVERROR_EOF, try the next. - * - * Note that this function is not meant to be the sole scheduling mechanism - * of a filtergraph, only a convenience function to help drain a filtergraph - * in a balanced way under normal circumstances. - * - * Also note that AVERROR_EOF does not mean that frames did not arrive on - * some of the sinks during the process. - * When there are multiple sink links, in case the requested link - * returns an EOF, this may cause a filter to flush pending frames - * which are sent to another sink link, although unrequested. - * - * @return the return value of ff_request_frame(), - * or AVERROR_EOF if all links returned AVERROR_EOF - */ -int avfilter_graph_request_oldest(AVFilterGraph *graph); - -/** - * @} - */ - -#endif /* AVFILTER_AVFILTER_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfiltergraph.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfiltergraph.h deleted file mode 100644 index b31d581c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/avfiltergraph.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Filter graphs - * copyright (c) 2007 Bobby Bingham - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_AVFILTERGRAPH_H -#define AVFILTER_AVFILTERGRAPH_H - -#include "avfilter.h" -#include "libavutil/log.h" - -#endif /* AVFILTER_AVFILTERGRAPH_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersink.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersink.h deleted file mode 100644 index e399b911..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersink.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_BUFFERSINK_H -#define AVFILTER_BUFFERSINK_H - -/** - * @file - * @ingroup lavfi_buffersink - * memory buffer sink API for audio and video - */ - -#include "avfilter.h" - -/** - * @defgroup lavfi_buffersink Buffer sink API - * @ingroup lavfi - * @{ - */ - -/** - * Get a frame with filtered data from sink and put it in frame. - * - * @param ctx pointer to a buffersink or abuffersink filter context. - * @param frame pointer to an allocated frame that will be filled with data. - * The data must be freed using av_frame_unref() / av_frame_free() - * @param flags a combination of AV_BUFFERSINK_FLAG_* flags - * - * @return >= 0 in for success, a negative AVERROR code for failure. - */ -int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags); - -/** - * Tell av_buffersink_get_buffer_ref() to read video/samples buffer - * reference, but not remove it from the buffer. This is useful if you - * need only to read a video/samples buffer, without to fetch it. - */ -#define AV_BUFFERSINK_FLAG_PEEK 1 - -/** - * Tell av_buffersink_get_buffer_ref() not to request a frame from its input. - * If a frame is already buffered, it is read (and removed from the buffer), - * but if no frame is present, return AVERROR(EAGAIN). - */ -#define AV_BUFFERSINK_FLAG_NO_REQUEST 2 - -/** - * Struct to use for initializing a buffersink context. - */ -typedef struct { - const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE -} AVBufferSinkParams; - -/** - * Create an AVBufferSinkParams structure. - * - * Must be freed with av_free(). - */ -AVBufferSinkParams *av_buffersink_params_alloc(void); - -/** - * Struct to use for initializing an abuffersink context. - */ -typedef struct { - const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE - const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 - const int *channel_counts; ///< list of allowed channel counts, terminated by -1 - int all_channel_counts; ///< if not 0, accept any channel count or layout - int *sample_rates; ///< list of allowed sample rates, terminated by -1 -} AVABufferSinkParams; - -/** - * Create an AVABufferSinkParams structure. - * - * Must be freed with av_free(). - */ -AVABufferSinkParams *av_abuffersink_params_alloc(void); - -/** - * Set the frame size for an audio buffer sink. - * - * All calls to av_buffersink_get_buffer_ref will return a buffer with - * exactly the specified number of samples, or AVERROR(EAGAIN) if there is - * not enough. The last buffer at EOF will be padded with 0. - */ -void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size); - -/** - * Get the frame rate of the input. - */ -AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx); - -/** - * Get a frame with filtered data from sink and put it in frame. - * - * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. - * @param frame pointer to an allocated frame that will be filled with data. - * The data must be freed using av_frame_unref() / av_frame_free() - * - * @return - * - >= 0 if a frame was successfully returned. - * - AVERROR(EAGAIN) if no frames are available at this point; more - * input frames must be added to the filtergraph to get more output. - * - AVERROR_EOF if there will be no more output frames on this sink. - * - A different negative AVERROR code in other failure cases. - */ -int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); - -/** - * Same as av_buffersink_get_frame(), but with the ability to specify the number - * of samples read. This function is less efficient than - * av_buffersink_get_frame(), because it copies the data around. - * - * @param ctx pointer to a context of the abuffersink AVFilter. - * @param frame pointer to an allocated frame that will be filled with data. - * The data must be freed using av_frame_unref() / av_frame_free() - * frame will contain exactly nb_samples audio samples, except at - * the end of stream, when it can contain less than nb_samples. - * - * @return The return codes have the same meaning as for - * av_buffersink_get_samples(). - * - * @warning do not mix this function with av_buffersink_get_frame(). Use only one or - * the other with a single sink, not both. - */ -int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); - -/** - * @} - */ - -#endif /* AVFILTER_BUFFERSINK_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersrc.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersrc.h deleted file mode 100644 index e42c7819..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/buffersrc.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_BUFFERSRC_H -#define AVFILTER_BUFFERSRC_H - -/** - * @file - * @ingroup lavfi_buffersrc - * Memory buffer source API. - */ - -#include "avfilter.h" - -/** - * @defgroup lavfi_buffersrc Buffer source API - * @ingroup lavfi - * @{ - */ - -enum { - - /** - * Do not check for format changes. - */ - AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, - - /** - * Immediately push the frame to the output. - */ - AV_BUFFERSRC_FLAG_PUSH = 4, - - /** - * Keep a reference to the frame. - * If the frame if reference-counted, create a new reference; otherwise - * copy the frame data. - */ - AV_BUFFERSRC_FLAG_KEEP_REF = 8, - -}; - -/** - * Get the number of failed requests. - * - * A failed request is when the request_frame method is called while no - * frame is present in the buffer. - * The number is reset when a frame is added. - */ -unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src); - -/** - * This structure contains the parameters describing the frames that will be - * passed to this filter. - * - * It should be allocated with av_buffersrc_parameters_alloc() and freed with - * av_free(). All the allocated fields in it remain owned by the caller. - */ -typedef struct AVBufferSrcParameters { - /** - * video: the pixel format, value corresponds to enum AVPixelFormat - * audio: the sample format, value corresponds to enum AVSampleFormat - */ - int format; - /** - * The timebase to be used for the timestamps on the input frames. - */ - AVRational time_base; - - /** - * Video only, the display dimensions of the input frames. - */ - int width, height; - - /** - * Video only, the sample (pixel) aspect ratio. - */ - AVRational sample_aspect_ratio; - - /** - * Video only, the frame rate of the input video. This field must only be - * set to a non-zero value if input stream has a known constant framerate - * and should be left at its initial value if the framerate is variable or - * unknown. - */ - AVRational frame_rate; - - /** - * Video with a hwaccel pixel format only. This should be a reference to an - * AVHWFramesContext instance describing the input frames. - */ - AVBufferRef *hw_frames_ctx; - - /** - * Audio only, the audio sampling rate in samples per secon. - */ - int sample_rate; - - /** - * Audio only, the audio channel layout - */ - uint64_t channel_layout; -} AVBufferSrcParameters; - -/** - * Allocate a new AVBufferSrcParameters instance. It should be freed by the - * caller with av_free(). - */ -AVBufferSrcParameters *av_buffersrc_parameters_alloc(void); - -/** - * Initialize the buffersrc or abuffersrc filter with the provided parameters. - * This function may be called multiple times, the later calls override the - * previous ones. Some of the parameters may also be set through AVOptions, then - * whatever method is used last takes precedence. - * - * @param ctx an instance of the buffersrc or abuffersrc filter - * @param param the stream parameters. The frames later passed to this filter - * must conform to those parameters. All the allocated fields in - * param remain owned by the caller, libavfilter will make internal - * copies or references when necessary. - * @return 0 on success, a negative AVERROR code on failure. - */ -int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param); - -/** - * Add a frame to the buffer source. - * - * @param ctx an instance of the buffersrc filter - * @param frame frame to be added. If the frame is reference counted, this - * function will make a new reference to it. Otherwise the frame data will be - * copied. - * - * @return 0 on success, a negative AVERROR on error - * - * This function is equivalent to av_buffersrc_add_frame_flags() with the - * AV_BUFFERSRC_FLAG_KEEP_REF flag. - */ -av_warn_unused_result -int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame); - -/** - * Add a frame to the buffer source. - * - * @param ctx an instance of the buffersrc filter - * @param frame frame to be added. If the frame is reference counted, this - * function will take ownership of the reference(s) and reset the frame. - * Otherwise the frame data will be copied. If this function returns an error, - * the input frame is not touched. - * - * @return 0 on success, a negative AVERROR on error. - * - * @note the difference between this function and av_buffersrc_write_frame() is - * that av_buffersrc_write_frame() creates a new reference to the input frame, - * while this function takes ownership of the reference passed to it. - * - * This function is equivalent to av_buffersrc_add_frame_flags() without the - * AV_BUFFERSRC_FLAG_KEEP_REF flag. - */ -av_warn_unused_result -int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame); - -/** - * Add a frame to the buffer source. - * - * By default, if the frame is reference-counted, this function will take - * ownership of the reference(s) and reset the frame. This can be controlled - * using the flags. - * - * If this function returns an error, the input frame is not touched. - * - * @param buffer_src pointer to a buffer source context - * @param frame a frame, or NULL to mark EOF - * @param flags a combination of AV_BUFFERSRC_FLAG_* - * @return >= 0 in case of success, a negative AVERROR code - * in case of failure - */ -av_warn_unused_result -int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src, - AVFrame *frame, int flags); - - -/** - * @} - */ - -#endif /* AVFILTER_BUFFERSRC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/version.h deleted file mode 100644 index adf8c719..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavfilter/version.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Version macros. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_VERSION_H -#define AVFILTER_VERSION_H - -/** - * @file - * @ingroup lavfi - * Libavfilter version macros - */ - -#include "libavutil/version.h" - -#define LIBAVFILTER_VERSION_MAJOR 6 -#define LIBAVFILTER_VERSION_MINOR 65 -#define LIBAVFILTER_VERSION_MICRO 100 - -#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ - LIBAVFILTER_VERSION_MINOR, \ - LIBAVFILTER_VERSION_MICRO) -#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ - LIBAVFILTER_VERSION_MINOR, \ - LIBAVFILTER_VERSION_MICRO) -#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT - -#define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - -#ifndef FF_API_OLD_FILTER_OPTS -#define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 7) -#endif -#ifndef FF_API_OLD_FILTER_OPTS_ERROR -#define FF_API_OLD_FILTER_OPTS_ERROR (LIBAVFILTER_VERSION_MAJOR < 7) -#endif -#ifndef FF_API_AVFILTER_OPEN -#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7) -#endif -#ifndef FF_API_AVFILTER_INIT_FILTER -#define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 7) -#endif -#ifndef FF_API_OLD_FILTER_REGISTER -#define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 7) -#endif -#ifndef FF_API_NOCONST_GET_NAME -#define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 7) -#endif - -#endif /* AVFILTER_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avformat.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avformat.h deleted file mode 100644 index c81a916d..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avformat.h +++ /dev/null @@ -1,2978 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AVFORMAT_H -#define AVFORMAT_AVFORMAT_H - -/** - * @file - * @ingroup libavf - * Main libavformat public API header - */ - -/** - * @defgroup libavf libavformat - * I/O and Muxing/Demuxing Library - * - * Libavformat (lavf) is a library for dealing with various media container - * formats. Its main two purposes are demuxing - i.e. splitting a media file - * into component streams, and the reverse process of muxing - writing supplied - * data in a specified container format. It also has an @ref lavf_io - * "I/O module" which supports a number of protocols for accessing the data (e.g. - * file, tcp, http and others). Before using lavf, you need to call - * av_register_all() to register all compiled muxers, demuxers and protocols. - * Unless you are absolutely sure you won't use libavformat's network - * capabilities, you should also call avformat_network_init(). - * - * A supported input format is described by an AVInputFormat struct, conversely - * an output format is described by AVOutputFormat. You can iterate over all - * registered input/output formats using the av_iformat_next() / - * av_oformat_next() functions. The protocols layer is not part of the public - * API, so you can only get the names of supported protocols with the - * avio_enum_protocols() function. - * - * Main lavf structure used for both muxing and demuxing is AVFormatContext, - * which exports all information about the file being read or written. As with - * most Libavformat structures, its size is not part of public ABI, so it cannot be - * allocated on stack or directly with av_malloc(). To create an - * AVFormatContext, use avformat_alloc_context() (some functions, like - * avformat_open_input() might do that for you). - * - * Most importantly an AVFormatContext contains: - * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat - * "output" format. It is either autodetected or set by user for input; - * always set by user for output. - * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all - * elementary streams stored in the file. AVStreams are typically referred to - * using their index in this array. - * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or - * set by user for input, always set by user for output (unless you are dealing - * with an AVFMT_NOFILE format). - * - * @section lavf_options Passing options to (de)muxers - * It is possible to configure lavf muxers and demuxers using the @ref avoptions - * mechanism. Generic (format-independent) libavformat options are provided by - * AVFormatContext, they can be examined from a user program by calling - * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass - * from avformat_get_class()). Private (format-specific) options are provided by - * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / - * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. - * Further options may be provided by the @ref AVFormatContext.pb "I/O context", - * if its AVClass is non-NULL, and the protocols layer. See the discussion on - * nesting in @ref avoptions documentation to learn how to access those. - * - * @section urls - * URL strings in libavformat are made of a scheme/protocol, a ':', and a - * scheme specific string. URLs without a scheme and ':' used for local files - * are supported but deprecated. "file:" should be used for local files. - * - * It is important that the scheme string is not taken from untrusted - * sources without checks. - * - * Note that some schemes/protocols are quite powerful, allowing access to - * both local and remote files, parts of them, concatenations of them, local - * audio and video devices and so on. - * - * @{ - * - * @defgroup lavf_decoding Demuxing - * @{ - * Demuxers read a media file and split it into chunks of data (@em packets). A - * @ref AVPacket "packet" contains one or more encoded frames which belongs to a - * single elementary stream. In the lavf API this process is represented by the - * avformat_open_input() function for opening a file, av_read_frame() for - * reading a single packet and finally avformat_close_input(), which does the - * cleanup. - * - * @section lavf_decoding_open Opening a media file - * The minimum information required to open a file is its URL, which - * is passed to avformat_open_input(), as in the following code: - * @code - * const char *url = "file:in.mp3"; - * AVFormatContext *s = NULL; - * int ret = avformat_open_input(&s, url, NULL, NULL); - * if (ret < 0) - * abort(); - * @endcode - * The above code attempts to allocate an AVFormatContext, open the - * specified file (autodetecting the format) and read the header, exporting the - * information stored there into s. Some formats do not have a header or do not - * store enough information there, so it is recommended that you call the - * avformat_find_stream_info() function which tries to read and decode a few - * frames to find missing information. - * - * In some cases you might want to preallocate an AVFormatContext yourself with - * avformat_alloc_context() and do some tweaking on it before passing it to - * avformat_open_input(). One such case is when you want to use custom functions - * for reading input data instead of lavf internal I/O layer. - * To do that, create your own AVIOContext with avio_alloc_context(), passing - * your reading callbacks to it. Then set the @em pb field of your - * AVFormatContext to newly created AVIOContext. - * - * Since the format of the opened file is in general not known until after - * avformat_open_input() has returned, it is not possible to set demuxer private - * options on a preallocated context. Instead, the options should be passed to - * avformat_open_input() wrapped in an AVDictionary: - * @code - * AVDictionary *options = NULL; - * av_dict_set(&options, "video_size", "640x480", 0); - * av_dict_set(&options, "pixel_format", "rgb24", 0); - * - * if (avformat_open_input(&s, url, NULL, &options) < 0) - * abort(); - * av_dict_free(&options); - * @endcode - * This code passes the private options 'video_size' and 'pixel_format' to the - * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it - * cannot know how to interpret raw video data otherwise. If the format turns - * out to be something different than raw video, those options will not be - * recognized by the demuxer and therefore will not be applied. Such unrecognized - * options are then returned in the options dictionary (recognized options are - * consumed). The calling program can handle such unrecognized options as it - * wishes, e.g. - * @code - * AVDictionaryEntry *e; - * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { - * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); - * abort(); - * } - * @endcode - * - * After you have finished reading the file, you must close it with - * avformat_close_input(). It will free everything associated with the file. - * - * @section lavf_decoding_read Reading from an opened file - * Reading data from an opened AVFormatContext is done by repeatedly calling - * av_read_frame() on it. Each call, if successful, will return an AVPacket - * containing encoded data for one AVStream, identified by - * AVPacket.stream_index. This packet may be passed straight into the libavcodec - * decoding functions avcodec_send_packet() or avcodec_decode_subtitle2() if the - * caller wishes to decode the data. - * - * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be - * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for - * pts/dts, 0 for duration) if the stream does not provide them. The timing - * information will be in AVStream.time_base units, i.e. it has to be - * multiplied by the timebase to convert them to seconds. - * - * If AVPacket.buf is set on the returned packet, then the packet is - * allocated dynamically and the user may keep it indefinitely. - * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a - * static storage somewhere inside the demuxer and the packet is only valid - * until the next av_read_frame() call or closing the file. If the caller - * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy - * of it. - * In both cases, the packet must be freed with av_packet_unref() when it is no - * longer needed. - * - * @section lavf_decoding_seek Seeking - * @} - * - * @defgroup lavf_encoding Muxing - * @{ - * Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write - * it into files or other output bytestreams in the specified container format. - * - * The main API functions for muxing are avformat_write_header() for writing the - * file header, av_write_frame() / av_interleaved_write_frame() for writing the - * packets and av_write_trailer() for finalizing the file. - * - * At the beginning of the muxing process, the caller must first call - * avformat_alloc_context() to create a muxing context. The caller then sets up - * the muxer by filling the various fields in this context: - * - * - The @ref AVFormatContext.oformat "oformat" field must be set to select the - * muxer that will be used. - * - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb - * "pb" field must be set to an opened IO context, either returned from - * avio_open2() or a custom one. - * - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must - * be created with the avformat_new_stream() function. The caller should fill - * the @ref AVStream.codecpar "stream codec parameters" information, such as the - * codec @ref AVCodecParameters.codec_type "type", @ref AVCodecParameters.codec_id - * "id" and other parameters (e.g. width / height, the pixel or sample format, - * etc.) as known. The @ref AVStream.time_base "stream timebase" should - * be set to the timebase that the caller desires to use for this stream (note - * that the timebase actually used by the muxer can be different, as will be - * described later). - * - It is advised to manually initialize only the relevant fields in - * AVCodecParameters, rather than using @ref avcodec_parameters_copy() during - * remuxing: there is no guarantee that the codec context values remain valid - * for both input and output format contexts. - * - The caller may fill in additional information, such as @ref - * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" - * metadata, @ref AVFormatContext.chapters "chapters", @ref - * AVFormatContext.programs "programs", etc. as described in the - * AVFormatContext documentation. Whether such information will actually be - * stored in the output depends on what the container format and the muxer - * support. - * - * When the muxing context is fully set up, the caller must call - * avformat_write_header() to initialize the muxer internals and write the file - * header. Whether anything actually is written to the IO context at this step - * depends on the muxer, but this function must always be called. Any muxer - * private options must be passed in the options parameter to this function. - * - * The data is then sent to the muxer by repeatedly calling av_write_frame() or - * av_interleaved_write_frame() (consult those functions' documentation for - * discussion on the difference between them; only one of them may be used with - * a single muxing context, they should not be mixed). Do note that the timing - * information on the packets sent to the muxer must be in the corresponding - * AVStream's timebase. That timebase is set by the muxer (in the - * avformat_write_header() step) and may be different from the timebase - * requested by the caller. - * - * Once all the data has been written, the caller must call av_write_trailer() - * to flush any buffered packets and finalize the output file, then close the IO - * context (if any) and finally free the muxing context with - * avformat_free_context(). - * @} - * - * @defgroup lavf_io I/O Read/Write - * @{ - * @section lavf_io_dirlist Directory listing - * The directory listing API makes it possible to list files on remote servers. - * - * Some of possible use cases: - * - an "open file" dialog to choose files from a remote location, - * - a recursive media finder providing a player with an ability to play all - * files from a given directory. - * - * @subsection lavf_io_dirlist_open Opening a directory - * At first, a directory needs to be opened by calling avio_open_dir() - * supplied with a URL and, optionally, ::AVDictionary containing - * protocol-specific parameters. The function returns zero or positive - * integer and allocates AVIODirContext on success. - * - * @code - * AVIODirContext *ctx = NULL; - * if (avio_open_dir(&ctx, "smb://example.com/some_dir", NULL) < 0) { - * fprintf(stderr, "Cannot open directory.\n"); - * abort(); - * } - * @endcode - * - * This code tries to open a sample directory using smb protocol without - * any additional parameters. - * - * @subsection lavf_io_dirlist_read Reading entries - * Each directory's entry (i.e. file, another directory, anything else - * within ::AVIODirEntryType) is represented by AVIODirEntry. - * Reading consecutive entries from an opened AVIODirContext is done by - * repeatedly calling avio_read_dir() on it. Each call returns zero or - * positive integer if successful. Reading can be stopped right after the - * NULL entry has been read -- it means there are no entries left to be - * read. The following code reads all entries from a directory associated - * with ctx and prints their names to standard output. - * @code - * AVIODirEntry *entry = NULL; - * for (;;) { - * if (avio_read_dir(ctx, &entry) < 0) { - * fprintf(stderr, "Cannot list directory.\n"); - * abort(); - * } - * if (!entry) - * break; - * printf("%s\n", entry->name); - * avio_free_directory_entry(&entry); - * } - * @endcode - * @} - * - * @defgroup lavf_codec Demuxers - * @{ - * @defgroup lavf_codec_native Native Demuxers - * @{ - * @} - * @defgroup lavf_codec_wrappers External library wrappers - * @{ - * @} - * @} - * @defgroup lavf_protos I/O Protocols - * @{ - * @} - * @defgroup lavf_internal Internal - * @{ - * @} - * @} - */ - -#include -#include /* FILE */ -#include "libavcodec/avcodec.h" -#include "libavutil/dict.h" -#include "libavutil/log.h" - -#include "avio.h" -#include "libavformat/version.h" - -struct AVFormatContext; - -struct AVDeviceInfoList; -struct AVDeviceCapabilitiesQuery; - -/** - * @defgroup metadata_api Public Metadata API - * @{ - * @ingroup libavf - * The metadata API allows libavformat to export metadata tags to a client - * application when demuxing. Conversely it allows a client application to - * set metadata when muxing. - * - * Metadata is exported or set as pairs of key/value strings in the 'metadata' - * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs - * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg, - * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata - * exported by demuxers isn't checked to be valid UTF-8 in most cases. - * - * Important concepts to keep in mind: - * - Keys are unique; there can never be 2 tags with the same key. This is - * also meant semantically, i.e., a demuxer should not knowingly produce - * several keys that are literally different but semantically identical. - * E.g., key=Author5, key=Author6. In this example, all authors must be - * placed in the same tag. - * - Metadata is flat, not hierarchical; there are no subtags. If you - * want to store, e.g., the email address of the child of producer Alice - * and actor Bob, that could have key=alice_and_bobs_childs_email_address. - * - Several modifiers can be applied to the tag name. This is done by - * appending a dash character ('-') and the modifier name in the order - * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. - * - language -- a tag whose value is localized for a particular language - * is appended with the ISO 639-2/B 3-letter language code. - * For example: Author-ger=Michael, Author-eng=Mike - * The original/default language is in the unqualified "Author" tag. - * A demuxer should set a default if it sets any translated tag. - * - sorting -- a modified version of a tag that should be used for - * sorting will have '-sort' appended. E.g. artist="The Beatles", - * artist-sort="Beatles, The". - * - Some protocols and demuxers support metadata updates. After a successful - * call to av_read_packet(), AVFormatContext.event_flags or AVStream.event_flags - * will be updated to indicate if metadata changed. In order to detect metadata - * changes on a stream, you need to loop through all streams in the AVFormatContext - * and check their individual event_flags. - * - * - Demuxers attempt to export metadata in a generic format, however tags - * with no generic equivalents are left as they are stored in the container. - * Follows a list of generic tag names: - * - @verbatim - album -- name of the set this work belongs to - album_artist -- main creator of the set/album, if different from artist. - e.g. "Various Artists" for compilation albums. - artist -- main creator of the work - comment -- any additional description of the file. - composer -- who composed the work, if different from artist. - copyright -- name of copyright holder. - creation_time-- date when the file was created, preferably in ISO 8601. - date -- date when the work was created, preferably in ISO 8601. - disc -- number of a subset, e.g. disc in a multi-disc collection. - encoder -- name/settings of the software/hardware that produced the file. - encoded_by -- person/group who created the file. - filename -- original name of the file. - genre -- . - language -- main language in which the work is performed, preferably - in ISO 639-2 format. Multiple languages can be specified by - separating them with commas. - performer -- artist who performed the work, if different from artist. - E.g for "Also sprach Zarathustra", artist would be "Richard - Strauss" and performer "London Philharmonic Orchestra". - publisher -- name of the label/publisher. - service_name -- name of the service in broadcasting (channel name). - service_provider -- name of the service provider in broadcasting. - title -- name of the work. - track -- number of this work in the set, can be in form current/total. - variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of - @endverbatim - * - * Look in the examples section for an application example how to use the Metadata API. - * - * @} - */ - -/* packet functions */ - - -/** - * Allocate and read the payload of a packet and initialize its - * fields with default values. - * - * @param s associated IO context - * @param pkt packet - * @param size desired payload size - * @return >0 (read size) if OK, AVERROR_xxx otherwise - */ -int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); - - -/** - * Read data and append it to the current content of the AVPacket. - * If pkt->size is 0 this is identical to av_get_packet. - * Note that this uses av_grow_packet and thus involves a realloc - * which is inefficient. Thus this function should only be used - * when there is no reasonable way to know (an upper bound of) - * the final size. - * - * @param s associated IO context - * @param pkt packet - * @param size amount of data to read - * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data - * will not be lost even if an error occurs. - */ -int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); - -#if FF_API_LAVF_FRAC -/*************************************************/ -/* fractional numbers for exact pts handling */ - -/** - * The exact value of the fractional number is: 'val + num / den'. - * num is assumed to be 0 <= num < den. - */ -typedef struct AVFrac { - int64_t val, num, den; -} AVFrac; -#endif - -/*************************************************/ -/* input/output formats */ - -struct AVCodecTag; - -/** - * This structure contains the data a format has to probe a file. - */ -typedef struct AVProbeData { - const char *filename; - unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ - int buf_size; /**< Size of buf except extra allocated bytes */ - const char *mime_type; /**< mime_type, when known. */ -} AVProbeData; - -#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) -#define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1) - -#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension -#define AVPROBE_SCORE_MIME 75 ///< score for file mime type -#define AVPROBE_SCORE_MAX 100 ///< maximum score - -#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer - -/// Demuxer will use avio_open, no opened file should be provided by the caller. -#define AVFMT_NOFILE 0x0001 -#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ -#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ -#if FF_API_LAVF_FMT_RAWPICTURE -#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for - raw picture data. @deprecated Not used anymore */ -#endif -#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ -#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ -#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ -#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ -#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ -#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ -#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ -#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ -#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ -#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ -#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ -#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly - increasing timestamps, but they must - still be monotonic */ -#define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative - timestamps. If not set the timestamp - will be shifted in av_write_frame and - av_interleaved_write_frame so they - start from 0. - The user or muxer can override this through - AVFormatContext.avoid_negative_ts - */ - -#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */ - -/** - * @addtogroup lavf_encoding - * @{ - */ -typedef struct AVOutputFormat { - const char *name; - /** - * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro - * to define it. - */ - const char *long_name; - const char *mime_type; - const char *extensions; /**< comma-separated filename extensions */ - /* output support */ - enum AVCodecID audio_codec; /**< default audio codec */ - enum AVCodecID video_codec; /**< default video codec */ - enum AVCodecID subtitle_codec; /**< default subtitle codec */ - /** - * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, - * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, - * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, - * AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE - */ - int flags; - - /** - * List of supported codec_id-codec_tag pairs, ordered by "better - * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. - */ - const struct AVCodecTag * const *codec_tag; - - - const AVClass *priv_class; ///< AVClass for the private context - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavformat and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - struct AVOutputFormat *next; - /** - * size of private data so that it can be allocated in the wrapper - */ - int priv_data_size; - - int (*write_header)(struct AVFormatContext *); - /** - * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, - * pkt can be NULL in order to flush data buffered in the muxer. - * When flushing, return 0 if there still is more data to flush, - * or 1 if everything was flushed and there is no more buffered - * data. - */ - int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); - int (*write_trailer)(struct AVFormatContext *); - /** - * Currently only used to set pixel format if not YUV420P. - */ - int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, - AVPacket *in, int flush); - /** - * Test if the given codec can be stored in this container. - * - * @return 1 if the codec is supported, 0 if it is not. - * A negative number if unknown. - * MKTAG('A', 'P', 'I', 'C') if the codec is only supported as AV_DISPOSITION_ATTACHED_PIC - */ - int (*query_codec)(enum AVCodecID id, int std_compliance); - - void (*get_output_timestamp)(struct AVFormatContext *s, int stream, - int64_t *dts, int64_t *wall); - /** - * Allows sending messages from application to device. - */ - int (*control_message)(struct AVFormatContext *s, int type, - void *data, size_t data_size); - - /** - * Write an uncoded AVFrame. - * - * See av_write_uncoded_frame() for details. - * - * The library will free *frame afterwards, but the muxer can prevent it - * by setting the pointer to NULL. - */ - int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index, - AVFrame **frame, unsigned flags); - /** - * Returns device list with it properties. - * @see avdevice_list_devices() for more details. - */ - int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); - /** - * Initialize device capabilities submodule. - * @see avdevice_capabilities_create() for more details. - */ - int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); - /** - * Free device capabilities submodule. - * @see avdevice_capabilities_free() for more details. - */ - int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); - enum AVCodecID data_codec; /**< default data codec */ - /** - * Initialize format. May allocate data here, and set any AVFormatContext or - * AVStream parameters that need to be set before packets are sent. - * This method must not write output. - * - * Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure - * - * Any allocations made here must be freed in deinit(). - */ - int (*init)(struct AVFormatContext *); - /** - * Deinitialize format. If present, this is called whenever the muxer is being - * destroyed, regardless of whether or not the header has been written. - * - * If a trailer is being written, this is called after write_trailer(). - * - * This is called if init() fails as well. - */ - void (*deinit)(struct AVFormatContext *); - /** - * Set up any necessary bitstream filtering and extract any extra data needed - * for the global header. - * Return 0 if more packets from this stream must be checked; 1 if not. - */ - int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); -} AVOutputFormat; -/** - * @} - */ - -/** - * @addtogroup lavf_decoding - * @{ - */ -typedef struct AVInputFormat { - /** - * A comma separated list of short names for the format. New names - * may be appended with a minor bump. - */ - const char *name; - - /** - * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro - * to define it. - */ - const char *long_name; - - /** - * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, - * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, - * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. - */ - int flags; - - /** - * If extensions are defined, then no probe is done. You should - * usually not use extension format guessing because it is not - * reliable enough - */ - const char *extensions; - - const struct AVCodecTag * const *codec_tag; - - const AVClass *priv_class; ///< AVClass for the private context - - /** - * Comma-separated list of mime types. - * It is used check for matching mime types while probing. - * @see av_probe_input_format2 - */ - const char *mime_type; - - /***************************************************************** - * No fields below this line are part of the public API. They - * may not be used outside of libavformat and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - struct AVInputFormat *next; - - /** - * Raw demuxers store their codec ID here. - */ - int raw_codec_id; - - /** - * Size of private data so that it can be allocated in the wrapper. - */ - int priv_data_size; - - /** - * Tell if a given file has a chance of being parsed as this format. - * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes - * big so you do not have to check for that unless you need more. - */ - int (*read_probe)(AVProbeData *); - - /** - * Read the format header and initialize the AVFormatContext - * structure. Return 0 if OK. 'avformat_new_stream' should be - * called to create new streams. - */ - int (*read_header)(struct AVFormatContext *); - - /** - * Read one packet and put it in 'pkt'. pts and flags are also - * set. 'avformat_new_stream' can be called only if the flag - * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a - * background thread). - * @return 0 on success, < 0 on error. - * When returning an error, pkt must not have been allocated - * or must be freed before returning - */ - int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); - - /** - * Close the stream. The AVFormatContext and AVStreams are not - * freed by this function - */ - int (*read_close)(struct AVFormatContext *); - - /** - * Seek to a given timestamp relative to the frames in - * stream component stream_index. - * @param stream_index Must not be -1. - * @param flags Selects which direction should be preferred if no exact - * match is available. - * @return >= 0 on success (but not necessarily the new offset) - */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); - - /** - * Get the next timestamp in stream[stream_index].time_base units. - * @return the timestamp or AV_NOPTS_VALUE if an error occurred - */ - int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, - int64_t *pos, int64_t pos_limit); - - /** - * Start/resume playing - only meaningful if using a network-based format - * (RTSP). - */ - int (*read_play)(struct AVFormatContext *); - - /** - * Pause playing - only meaningful if using a network-based format - * (RTSP). - */ - int (*read_pause)(struct AVFormatContext *); - - /** - * Seek to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - */ - int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); - - /** - * Returns device list with it properties. - * @see avdevice_list_devices() for more details. - */ - int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); - - /** - * Initialize device capabilities submodule. - * @see avdevice_capabilities_create() for more details. - */ - int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); - - /** - * Free device capabilities submodule. - * @see avdevice_capabilities_free() for more details. - */ - int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); -} AVInputFormat; -/** - * @} - */ - -enum AVStreamParseType { - AVSTREAM_PARSE_NONE, - AVSTREAM_PARSE_FULL, /**< full parsing and repack */ - AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ - AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ - AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ - AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'), /**< full parsing and repack with timestamp and position generation by parser for raw - this assumes that each packet in the file contains no demuxer level headers and - just codec level data, otherwise position generation would fail */ -}; - -typedef struct AVIndexEntry { - int64_t pos; - int64_t timestamp; /**< - * Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are available - * when seeking to this entry. That means preferable PTS on keyframe based formats. - * But demuxers can choose to store a different timestamp, if it is more convenient for the implementation or nothing better - * is known - */ -#define AVINDEX_KEYFRAME 0x0001 -#define AVINDEX_DISCARD_FRAME 0x0002 /** - * Flag is used to indicate which frame should be discarded after decoding. - */ - int flags:2; - int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). - int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ -} AVIndexEntry; - -#define AV_DISPOSITION_DEFAULT 0x0001 -#define AV_DISPOSITION_DUB 0x0002 -#define AV_DISPOSITION_ORIGINAL 0x0004 -#define AV_DISPOSITION_COMMENT 0x0008 -#define AV_DISPOSITION_LYRICS 0x0010 -#define AV_DISPOSITION_KARAOKE 0x0020 - -/** - * Track should be used during playback by default. - * Useful for subtitle track that should be displayed - * even when user did not explicitly ask for subtitles. - */ -#define AV_DISPOSITION_FORCED 0x0040 -#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ -#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ -#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ -/** - * The stream is stored in the file as an attached picture/"cover art" (e.g. - * APIC frame in ID3v2). The first (usually only) packet associated with it - * will be returned among the first few packets read from the file unless - * seeking takes place. It can also be accessed at any time in - * AVStream.attached_pic. - */ -#define AV_DISPOSITION_ATTACHED_PIC 0x0400 -/** - * The stream is sparse, and contains thumbnail images, often corresponding - * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC. - */ -#define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800 - -typedef struct AVStreamInternal AVStreamInternal; - -/** - * To specify text track kind (different from subtitles default). - */ -#define AV_DISPOSITION_CAPTIONS 0x10000 -#define AV_DISPOSITION_DESCRIPTIONS 0x20000 -#define AV_DISPOSITION_METADATA 0x40000 - -/** - * Options for behavior on timestamp wrap detection. - */ -#define AV_PTS_WRAP_IGNORE 0 ///< ignore the wrap -#define AV_PTS_WRAP_ADD_OFFSET 1 ///< add the format specific offset on wrap detection -#define AV_PTS_WRAP_SUB_OFFSET -1 ///< subtract the format specific offset on wrap detection - -/** - * Stream structure. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVStream) must not be used outside libav*. - */ -typedef struct AVStream { - int index; /**< stream index in AVFormatContext */ - /** - * Format-specific stream ID. - * decoding: set by libavformat - * encoding: set by the user, replaced by libavformat if left unset - */ - int id; -#if FF_API_LAVF_AVCTX - /** - * @deprecated use the codecpar struct instead - */ - attribute_deprecated - AVCodecContext *codec; -#endif - void *priv_data; - -#if FF_API_LAVF_FRAC - /** - * @deprecated this field is unused - */ - attribute_deprecated - struct AVFrac pts; -#endif - - /** - * This is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. - * - * decoding: set by libavformat - * encoding: May be set by the caller before avformat_write_header() to - * provide a hint to the muxer about the desired timebase. In - * avformat_write_header(), the muxer will overwrite this field - * with the timebase that will actually be used for the timestamps - * written into the file (which may or may not be related to the - * user-provided one, depending on the format). - */ - AVRational time_base; - - /** - * Decoding: pts of the first frame of the stream in presentation order, in stream time base. - * Only set this if you are absolutely 100% sure that the value you set - * it to really is the pts of the first frame. - * This may be undefined (AV_NOPTS_VALUE). - * @note The ASF header does NOT contain a correct start_time the ASF - * demuxer must NOT set this. - */ - int64_t start_time; - - /** - * Decoding: duration of the stream, in stream time base. - * If a source file does not specify a duration, but does specify - * a bitrate, this value will be estimated from bitrate and file size. - */ - int64_t duration; - - int64_t nb_frames; ///< number of frames in this stream if known or 0 - - int disposition; /**< AV_DISPOSITION_* bit field */ - - enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. - - /** - * sample aspect ratio (0 if unknown) - * - encoding: Set by user. - * - decoding: Set by libavformat. - */ - AVRational sample_aspect_ratio; - - AVDictionary *metadata; - - /** - * Average framerate - * - * - demuxing: May be set by libavformat when creating the stream or in - * avformat_find_stream_info(). - * - muxing: May be set by the caller before avformat_write_header(). - */ - AVRational avg_frame_rate; - - /** - * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet - * will contain the attached picture. - * - * decoding: set by libavformat, must not be modified by the caller. - * encoding: unused - */ - AVPacket attached_pic; - - /** - * An array of side data that applies to the whole stream (i.e. the - * container does not allow it to change between packets). - * - * There may be no overlap between the side data in this array and side data - * in the packets. I.e. a given side data is either exported by the muxer - * (demuxing) / set by the caller (muxing) in this array, then it never - * appears in the packets, or the side data is exported / sent through - * the packets (always in the first packet where the value becomes known or - * changes), then it does not appear in this array. - * - * - demuxing: Set by libavformat when the stream is created. - * - muxing: May be set by the caller before avformat_write_header(). - * - * Freed by libavformat in avformat_free_context(). - * - * @see av_format_inject_global_side_data() - */ - AVPacketSideData *side_data; - /** - * The number of elements in the AVStream.side_data array. - */ - int nb_side_data; - - /** - * Flags for the user to detect events happening on the stream. Flags must - * be cleared by the user once the event has been handled. - * A combination of AVSTREAM_EVENT_FLAG_*. - */ - int event_flags; -#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. - - /***************************************************************** - * All fields below this line are not part of the public API. They - * may not be used outside of libavformat and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - - /** - * Stream information used internally by av_find_stream_info() - */ -#define MAX_STD_TIMEBASES (30*12+30+3+6) - struct { - int64_t last_dts; - int64_t duration_gcd; - int duration_count; - int64_t rfps_duration_sum; - double (*duration_error)[2][MAX_STD_TIMEBASES]; - int64_t codec_info_duration; - int64_t codec_info_duration_fields; - - /** - * 0 -> decoder has not been searched for yet. - * >0 -> decoder found - * <0 -> decoder with codec_id == -found_decoder has not been found - */ - int found_decoder; - - int64_t last_duration; - - /** - * Those are used for average framerate estimation. - */ - int64_t fps_first_dts; - int fps_first_dts_idx; - int64_t fps_last_dts; - int fps_last_dts_idx; - - } *info; - - int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ - - // Timestamp generation support: - /** - * Timestamp corresponding to the last dts sync point. - * - * Initialized when AVCodecParserContext.dts_sync_point >= 0 and - * a DTS is received from the underlying container. Otherwise set to - * AV_NOPTS_VALUE by default. - */ - int64_t first_dts; - int64_t cur_dts; - int64_t last_IP_pts; - int last_IP_duration; - - /** - * Number of packets to buffer for codec probing - */ - int probe_packets; - - /** - * Number of frames that have been demuxed during av_find_stream_info() - */ - int codec_info_nb_frames; - - /* av_read_frame() support */ - enum AVStreamParseType need_parsing; - struct AVCodecParserContext *parser; - - /** - * last packet in packet_buffer for this stream when muxing. - */ - struct AVPacketList *last_in_packet_buffer; - AVProbeData probe_data; -#define MAX_REORDER_DELAY 16 - int64_t pts_buffer[MAX_REORDER_DELAY+1]; - - AVIndexEntry *index_entries; /**< Only used if the format does not - support seeking natively. */ - int nb_index_entries; - unsigned int index_entries_allocated_size; - - /** - * Real base framerate of the stream. - * This is the lowest framerate with which all timestamps can be - * represented accurately (it is the least common multiple of all - * framerates in the stream). Note, this value is just a guess! - * For example, if the time base is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. - * - * Code outside avformat should access this field using: - * av_stream_get/set_r_frame_rate(stream) - */ - AVRational r_frame_rate; - - /** - * Stream Identifier - * This is the MPEG-TS stream identifier +1 - * 0 means unknown - */ - int stream_identifier; - - int64_t interleaver_chunk_size; - int64_t interleaver_chunk_duration; - - /** - * stream probing state - * -1 -> probing finished - * 0 -> no probing requested - * rest -> perform probing with request_probe being the minimum score to accept. - * NOT PART OF PUBLIC API - */ - int request_probe; - /** - * Indicates that everything up to the next keyframe - * should be discarded. - */ - int skip_to_keyframe; - - /** - * Number of samples to skip at the start of the frame decoded from the next packet. - */ - int skip_samples; - - /** - * If not 0, the number of samples that should be skipped from the start of - * the stream (the samples are removed from packets with pts==0, which also - * assumes negative timestamps do not happen). - * Intended for use with formats such as mp3 with ad-hoc gapless audio - * support. - */ - int64_t start_skip_samples; - - /** - * If not 0, the first audio sample that should be discarded from the stream. - * This is broken by design (needs global sample count), but can't be - * avoided for broken by design formats such as mp3 with ad-hoc gapless - * audio support. - */ - int64_t first_discard_sample; - - /** - * The sample after last sample that is intended to be discarded after - * first_discard_sample. Works on frame boundaries only. Used to prevent - * early EOF if the gapless info is broken (considered concatenated mp3s). - */ - int64_t last_discard_sample; - - /** - * Number of internally decoded frames, used internally in libavformat, do not access - * its lifetime differs from info which is why it is not in that structure. - */ - int nb_decoded_frames; - - /** - * Timestamp offset added to timestamps before muxing - * NOT PART OF PUBLIC API - */ - int64_t mux_ts_offset; - - /** - * Internal data to check for wrapping of the time stamp - */ - int64_t pts_wrap_reference; - - /** - * Options for behavior, when a wrap is detected. - * - * Defined by AV_PTS_WRAP_ values. - * - * If correction is enabled, there are two possibilities: - * If the first time stamp is near the wrap point, the wrap offset - * will be subtracted, which will create negative time stamps. - * Otherwise the offset will be added. - */ - int pts_wrap_behavior; - - /** - * Internal data to prevent doing update_initial_durations() twice - */ - int update_initial_durations_done; - - /** - * Internal data to generate dts from pts - */ - int64_t pts_reorder_error[MAX_REORDER_DELAY+1]; - uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]; - - /** - * Internal data to analyze DTS and detect faulty mpeg streams - */ - int64_t last_dts_for_order_check; - uint8_t dts_ordered; - uint8_t dts_misordered; - - /** - * Internal data to inject global side data - */ - int inject_global_side_data; - - /** - * String containing paris of key and values describing recommended encoder configuration. - * Paris are separated by ','. - * Keys are separated from values by '='. - */ - char *recommended_encoder_configuration; - - /** - * display aspect ratio (0 if unknown) - * - encoding: unused - * - decoding: Set by libavformat to calculate sample_aspect_ratio internally - */ - AVRational display_aspect_ratio; - - struct FFFrac *priv_pts; - - /** - * An opaque field for libavformat internal usage. - * Must not be accessed in any way by callers. - */ - AVStreamInternal *internal; - - /* - * Codec parameters associated with this stream. Allocated and freed by - * libavformat in avformat_new_stream() and avformat_free_context() - * respectively. - * - * - demuxing: filled by libavformat on stream creation or in - * avformat_find_stream_info() - * - muxing: filled by the caller before avformat_write_header() - */ - AVCodecParameters *codecpar; -} AVStream; - -AVRational av_stream_get_r_frame_rate(const AVStream *s); -void av_stream_set_r_frame_rate(AVStream *s, AVRational r); -struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); -char* av_stream_get_recommended_encoder_configuration(const AVStream *s); -void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration); - -/** - * Returns the pts of the last muxed packet + its duration - * - * the retuned value is undefined when used with a demuxer. - */ -int64_t av_stream_get_end_pts(const AVStream *st); - -#define AV_PROGRAM_RUNNING 1 - -/** - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVProgram) must not be used outside libav*. - */ -typedef struct AVProgram { - int id; - int flags; - enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller - unsigned int *stream_index; - unsigned int nb_stream_indexes; - AVDictionary *metadata; - - int program_num; - int pmt_pid; - int pcr_pid; - - /***************************************************************** - * All fields below this line are not part of the public API. They - * may not be used outside of libavformat and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** - */ - int64_t start_time; - int64_t end_time; - - int64_t pts_wrap_reference; ///< reference dts for wrap detection - int pts_wrap_behavior; ///< behavior on wrap detection -} AVProgram; - -#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present - (streams are added dynamically) */ - -typedef struct AVChapter { - int id; ///< unique ID to identify the chapter - AVRational time_base; ///< time base in which the start/end timestamps are specified - int64_t start, end; ///< chapter start/end time in time_base units - AVDictionary *metadata; -} AVChapter; - - -/** - * Callback used by devices to communicate with application. - */ -typedef int (*av_format_control_message)(struct AVFormatContext *s, int type, - void *data, size_t data_size); - -typedef int (*AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options); - -/** - * The duration of a video can be estimated through various ways, and this enum can be used - * to know how the duration was estimated. - */ -enum AVDurationEstimationMethod { - AVFMT_DURATION_FROM_PTS, ///< Duration accurately estimated from PTSes - AVFMT_DURATION_FROM_STREAM, ///< Duration estimated from a stream with a known duration - AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate) -}; - -typedef struct AVFormatInternal AVFormatInternal; - -/** - * Format I/O context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVFormatContext) must not be used outside libav*, use - * avformat_alloc_context() to create an AVFormatContext. - * - * Fields can be accessed through AVOptions (av_opt*), - * the name string used matches the associated command line parameter name and - * can be found in libavformat/options_table.h. - * The AVOption/command line parameter names differ in some cases from the C - * structure field names for historic reasons or brevity. - */ -typedef struct AVFormatContext { - /** - * A class for logging and @ref avoptions. Set by avformat_alloc_context(). - * Exports (de)muxer private options if they exist. - */ - const AVClass *av_class; - - /** - * The input container format. - * - * Demuxing only, set by avformat_open_input(). - */ - struct AVInputFormat *iformat; - - /** - * The output container format. - * - * Muxing only, must be set by the caller before avformat_write_header(). - */ - struct AVOutputFormat *oformat; - - /** - * Format private data. This is an AVOptions-enabled struct - * if and only if iformat/oformat.priv_class is not NULL. - * - * - muxing: set by avformat_write_header() - * - demuxing: set by avformat_open_input() - */ - void *priv_data; - - /** - * I/O context. - * - * - demuxing: either set by the user before avformat_open_input() (then - * the user must close it manually) or set by avformat_open_input(). - * - muxing: set by the user before avformat_write_header(). The caller must - * take care of closing / freeing the IO context. - * - * Do NOT set this field if AVFMT_NOFILE flag is set in - * iformat/oformat.flags. In such a case, the (de)muxer will handle - * I/O in some other way and this field will be NULL. - */ - AVIOContext *pb; - - /* stream info */ - /** - * Flags signalling stream properties. A combination of AVFMTCTX_*. - * Set by libavformat. - */ - int ctx_flags; - - /** - * Number of elements in AVFormatContext.streams. - * - * Set by avformat_new_stream(), must not be modified by any other code. - */ - unsigned int nb_streams; - /** - * A list of all streams in the file. New streams are created with - * avformat_new_stream(). - * - * - demuxing: streams are created by libavformat in avformat_open_input(). - * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also - * appear in av_read_frame(). - * - muxing: streams are created by the user before avformat_write_header(). - * - * Freed by libavformat in avformat_free_context(). - */ - AVStream **streams; - - /** - * input or output filename - * - * - demuxing: set by avformat_open_input() - * - muxing: may be set by the caller before avformat_write_header() - */ - char filename[1024]; - - /** - * Position of the first frame of the component, in - * AV_TIME_BASE fractional seconds. NEVER set this value directly: - * It is deduced from the AVStream values. - * - * Demuxing only, set by libavformat. - */ - int64_t start_time; - - /** - * Duration of the stream, in AV_TIME_BASE fractional - * seconds. Only set this value if you know none of the individual stream - * durations and also do not set any of them. This is deduced from the - * AVStream values if not set. - * - * Demuxing only, set by libavformat. - */ - int64_t duration; - - /** - * Total stream bitrate in bit/s, 0 if not - * available. Never set it directly if the file_size and the - * duration are known as FFmpeg can compute it automatically. - */ - int64_t bit_rate; - - unsigned int packet_size; - int max_delay; - - /** - * Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. - * Set by the user before avformat_open_input() / avformat_write_header(). - */ - int flags; -#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. -#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. -#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. -#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS -#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container -#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled -#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible -#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. -#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted -#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. -/** - * When muxing, try to avoid writing any random/volatile data to the output. - * This includes any random IDs, real-time timestamps/dates, muxer version, etc. - * - * This flag is mainly intended for testing. - */ -#define AVFMT_FLAG_BITEXACT 0x0400 -#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload -#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) -#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) -#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. -#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats -#define AVFMT_FLAG_SHORTEST 0x100000 ///< Stop muxing when the shortest stream stops. -#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Wait for packet data before writing a header, and add bitstream filters as requested by the muxer - - /** - * Maximum size of the data read from input for determining - * the input container format. - * Demuxing only, set by the caller before avformat_open_input(). - */ - int64_t probesize; - - /** - * Maximum duration (in AV_TIME_BASE units) of the data read - * from input in avformat_find_stream_info(). - * Demuxing only, set by the caller before avformat_find_stream_info(). - * Can be set to 0 to let avformat choose using a heuristic. - */ - int64_t max_analyze_duration; - - const uint8_t *key; - int keylen; - - unsigned int nb_programs; - AVProgram **programs; - - /** - * Forced video codec_id. - * Demuxing: Set by user. - */ - enum AVCodecID video_codec_id; - - /** - * Forced audio codec_id. - * Demuxing: Set by user. - */ - enum AVCodecID audio_codec_id; - - /** - * Forced subtitle codec_id. - * Demuxing: Set by user. - */ - enum AVCodecID subtitle_codec_id; - - /** - * Maximum amount of memory in bytes to use for the index of each stream. - * If the index exceeds this size, entries will be discarded as - * needed to maintain a smaller size. This can lead to slower or less - * accurate seeking (depends on demuxer). - * Demuxers for which a full in-memory index is mandatory will ignore - * this. - * - muxing: unused - * - demuxing: set by user - */ - unsigned int max_index_size; - - /** - * Maximum amount of memory in bytes to use for buffering frames - * obtained from realtime capture devices. - */ - unsigned int max_picture_buffer; - - /** - * Number of chapters in AVChapter array. - * When muxing, chapters are normally written in the file header, - * so nb_chapters should normally be initialized before write_header - * is called. Some muxers (e.g. mov and mkv) can also write chapters - * in the trailer. To write chapters in the trailer, nb_chapters - * must be zero when write_header is called and non-zero when - * write_trailer is called. - * - muxing: set by user - * - demuxing: set by libavformat - */ - unsigned int nb_chapters; - AVChapter **chapters; - - /** - * Metadata that applies to the whole file. - * - * - demuxing: set by libavformat in avformat_open_input() - * - muxing: may be set by the caller before avformat_write_header() - * - * Freed by libavformat in avformat_free_context(). - */ - AVDictionary *metadata; - - /** - * Start time of the stream in real world time, in microseconds - * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the - * stream was captured at this real world time. - * - muxing: Set by the caller before avformat_write_header(). If set to - * either 0 or AV_NOPTS_VALUE, then the current wall-time will - * be used. - * - demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that - * the value may become known after some number of frames - * have been received. - */ - int64_t start_time_realtime; - - /** - * The number of frames used for determining the framerate in - * avformat_find_stream_info(). - * Demuxing only, set by the caller before avformat_find_stream_info(). - */ - int fps_probe_size; - - /** - * Error recognition; higher values will detect more errors but may - * misdetect some more or less valid parts as errors. - * Demuxing only, set by the caller before avformat_open_input(). - */ - int error_recognition; - - /** - * Custom interrupt callbacks for the I/O layer. - * - * demuxing: set by the user before avformat_open_input(). - * muxing: set by the user before avformat_write_header() - * (mainly useful for AVFMT_NOFILE formats). The callback - * should also be passed to avio_open2() if it's used to - * open the file. - */ - AVIOInterruptCB interrupt_callback; - - /** - * Flags to enable debugging. - */ - int debug; -#define FF_FDEBUG_TS 0x0001 - - /** - * Maximum buffering duration for interleaving. - * - * To ensure all the streams are interleaved correctly, - * av_interleaved_write_frame() will wait until it has at least one packet - * for each stream before actually writing any packets to the output file. - * When some streams are "sparse" (i.e. there are large gaps between - * successive packets), this can result in excessive buffering. - * - * This field specifies the maximum difference between the timestamps of the - * first and the last packet in the muxing queue, above which libavformat - * will output a packet regardless of whether it has queued a packet for all - * the streams. - * - * Muxing only, set by the caller before avformat_write_header(). - */ - int64_t max_interleave_delta; - - /** - * Allow non-standard and experimental extension - * @see AVCodecContext.strict_std_compliance - */ - int strict_std_compliance; - - /** - * Flags for the user to detect events happening on the file. Flags must - * be cleared by the user once the event has been handled. - * A combination of AVFMT_EVENT_FLAG_*. - */ - int event_flags; -#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. - - /** - * Maximum number of packets to read while waiting for the first timestamp. - * Decoding only. - */ - int max_ts_probe; - - /** - * Avoid negative timestamps during muxing. - * Any value of the AVFMT_AVOID_NEG_TS_* constants. - * Note, this only works when using av_interleaved_write_frame. (interleave_packet_per_dts is in use) - * - muxing: Set by user - * - demuxing: unused - */ - int avoid_negative_ts; -#define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format -#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative -#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 - - /** - * Transport stream id. - * This will be moved into demuxer private options. Thus no API/ABI compatibility - */ - int ts_id; - - /** - * Audio preload in microseconds. - * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) - * - decoding: unused - */ - int audio_preload; - - /** - * Max chunk time in microseconds. - * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) - * - decoding: unused - */ - int max_chunk_duration; - - /** - * Max chunk size in bytes - * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user via AVOptions (NO direct access) - * - decoding: unused - */ - int max_chunk_size; - - /** - * forces the use of wallclock timestamps as pts/dts of packets - * This has undefined results in the presence of B frames. - * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) - */ - int use_wallclock_as_timestamps; - - /** - * avio flags, used to force AVIO_FLAG_DIRECT. - * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) - */ - int avio_flags; - - /** - * The duration field can be estimated through various ways, and this field can be used - * to know how the duration was estimated. - * - encoding: unused - * - decoding: Read by user via AVOptions (NO direct access) - */ - enum AVDurationEstimationMethod duration_estimation_method; - - /** - * Skip initial bytes when opening stream - * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) - */ - int64_t skip_initial_bytes; - - /** - * Correct single timestamp overflows - * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) - */ - unsigned int correct_ts_overflow; - - /** - * Force seeking to any (also non key) frames. - * - encoding: unused - * - decoding: Set by user via AVOptions (NO direct access) - */ - int seek2any; - - /** - * Flush the I/O context after each packet. - * - encoding: Set by user via AVOptions (NO direct access) - * - decoding: unused - */ - int flush_packets; - - /** - * format probing score. - * The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes - * the format. - * - encoding: unused - * - decoding: set by avformat, read by user via av_format_get_probe_score() (NO direct access) - */ - int probe_score; - - /** - * number of bytes to read maximally to identify format. - * - encoding: unused - * - decoding: set by user through AVOPtions (NO direct access) - */ - int format_probesize; - - /** - * ',' separated list of allowed decoders. - * If NULL then all are allowed - * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) - */ - char *codec_whitelist; - - /** - * ',' separated list of allowed demuxers. - * If NULL then all are allowed - * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) - */ - char *format_whitelist; - - /** - * An opaque field for libavformat internal usage. - * Must not be accessed in any way by callers. - */ - AVFormatInternal *internal; - - /** - * IO repositioned flag. - * This is set by avformat when the underlaying IO context read pointer - * is repositioned, for example when doing byte based seeking. - * Demuxers can use the flag to detect such changes. - */ - int io_repositioned; - - /** - * Forced video codec. - * This allows forcing a specific decoder, even when there are multiple with - * the same codec_id. - * Demuxing: Set by user via av_format_set_video_codec (NO direct access). - */ - AVCodec *video_codec; - - /** - * Forced audio codec. - * This allows forcing a specific decoder, even when there are multiple with - * the same codec_id. - * Demuxing: Set by user via av_format_set_audio_codec (NO direct access). - */ - AVCodec *audio_codec; - - /** - * Forced subtitle codec. - * This allows forcing a specific decoder, even when there are multiple with - * the same codec_id. - * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct access). - */ - AVCodec *subtitle_codec; - - /** - * Forced data codec. - * This allows forcing a specific decoder, even when there are multiple with - * the same codec_id. - * Demuxing: Set by user via av_format_set_data_codec (NO direct access). - */ - AVCodec *data_codec; - - /** - * Number of bytes to be written as padding in a metadata header. - * Demuxing: Unused. - * Muxing: Set by user via av_format_set_metadata_header_padding. - */ - int metadata_header_padding; - - /** - * User data. - * This is a place for some private data of the user. - */ - void *opaque; - - /** - * Callback used by devices to communicate with application. - */ - av_format_control_message control_message_cb; - - /** - * Output timestamp offset, in microseconds. - * Muxing: set by user via AVOptions (NO direct access) - */ - int64_t output_ts_offset; - - /** - * dump format separator. - * can be ", " or "\n " or anything else - * Code outside libavformat should access this field using AVOptions - * (NO direct access). - * - muxing: Set by user. - * - demuxing: Set by user. - */ - uint8_t *dump_separator; - - /** - * Forced Data codec_id. - * Demuxing: Set by user. - */ - enum AVCodecID data_codec_id; - -#if FF_API_OLD_OPEN_CALLBACKS - /** - * Called to open further IO contexts when needed for demuxing. - * - * This can be set by the user application to perform security checks on - * the URLs before opening them. - * The function should behave like avio_open2(), AVFormatContext is provided - * as contextual information and to reach AVFormatContext.opaque. - * - * If NULL then some simple checks are used together with avio_open2(). - * - * Must not be accessed directly from outside avformat. - * @See av_format_set_open_cb() - * - * Demuxing: Set by user. - * - * @deprecated Use io_open and io_close. - */ - attribute_deprecated - int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); -#endif - - /** - * ',' separated list of allowed protocols. - * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) - */ - char *protocol_whitelist; - - /* - * A callback for opening new IO streams. - * - * Whenever a muxer or a demuxer needs to open an IO stream (typically from - * avformat_open_input() for demuxers, but for certain formats can happen at - * other times as well), it will call this callback to obtain an IO context. - * - * @param s the format context - * @param pb on success, the newly opened IO context should be returned here - * @param url the url to open - * @param flags a combination of AVIO_FLAG_* - * @param options a dictionary of additional options, with the same - * semantics as in avio_open2() - * @return 0 on success, a negative AVERROR code on failure - * - * @note Certain muxers and demuxers do nesting, i.e. they open one or more - * additional internal format contexts. Thus the AVFormatContext pointer - * passed to this callback may be different from the one facing the caller. - * It will, however, have the same 'opaque' field. - */ - int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, - int flags, AVDictionary **options); - - /** - * A callback for closing the streams opened with AVFormatContext.io_open(). - */ - void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); - - /** - * ',' separated list of disallowed protocols. - * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) - */ - char *protocol_blacklist; - - /** - * The maximum number of streams. - * - encoding: unused - * - decoding: set by user through AVOptions (NO direct access) - */ - int max_streams; -} AVFormatContext; - -int av_format_get_probe_score(const AVFormatContext *s); -AVCodec * av_format_get_video_codec(const AVFormatContext *s); -void av_format_set_video_codec(AVFormatContext *s, AVCodec *c); -AVCodec * av_format_get_audio_codec(const AVFormatContext *s); -void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c); -AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s); -void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c); -AVCodec * av_format_get_data_codec(const AVFormatContext *s); -void av_format_set_data_codec(AVFormatContext *s, AVCodec *c); -int av_format_get_metadata_header_padding(const AVFormatContext *s); -void av_format_set_metadata_header_padding(AVFormatContext *s, int c); -void * av_format_get_opaque(const AVFormatContext *s); -void av_format_set_opaque(AVFormatContext *s, void *opaque); -av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s); -void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); -#if FF_API_OLD_OPEN_CALLBACKS -attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); -attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); -#endif - -/** - * This function will cause global side data to be injected in the next packet - * of each stream as well as after any subsequent seek. - */ -void av_format_inject_global_side_data(AVFormatContext *s); - -/** - * Returns the method used to set ctx->duration. - * - * @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. - */ -enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx); - -typedef struct AVPacketList { - AVPacket pkt; - struct AVPacketList *next; -} AVPacketList; - - -/** - * @defgroup lavf_core Core functions - * @ingroup libavf - * - * Functions for querying libavformat capabilities, allocating core structures, - * etc. - * @{ - */ - -/** - * Return the LIBAVFORMAT_VERSION_INT constant. - */ -unsigned avformat_version(void); - -/** - * Return the libavformat build-time configuration. - */ -const char *avformat_configuration(void); - -/** - * Return the libavformat license. - */ -const char *avformat_license(void); - -/** - * Initialize libavformat and register all the muxers, demuxers and - * protocols. If you do not call this function, then you can select - * exactly which formats you want to support. - * - * @see av_register_input_format() - * @see av_register_output_format() - */ -void av_register_all(void); - -void av_register_input_format(AVInputFormat *format); -void av_register_output_format(AVOutputFormat *format); - -/** - * Do global initialization of network components. This is optional, - * but recommended, since it avoids the overhead of implicitly - * doing the setup for each session. - * - * Calling this function will become mandatory if using network - * protocols at some major version bump. - */ -int avformat_network_init(void); - -/** - * Undo the initialization done by avformat_network_init. - */ -int avformat_network_deinit(void); - -/** - * If f is NULL, returns the first registered input format, - * if f is non-NULL, returns the next registered input format after f - * or NULL if f is the last one. - */ -AVInputFormat *av_iformat_next(const AVInputFormat *f); - -/** - * If f is NULL, returns the first registered output format, - * if f is non-NULL, returns the next registered output format after f - * or NULL if f is the last one. - */ -AVOutputFormat *av_oformat_next(const AVOutputFormat *f); - -/** - * Allocate an AVFormatContext. - * avformat_free_context() can be used to free the context and everything - * allocated by the framework within it. - */ -AVFormatContext *avformat_alloc_context(void); - -/** - * Free an AVFormatContext and all its streams. - * @param s context to free - */ -void avformat_free_context(AVFormatContext *s); - -/** - * Get the AVClass for AVFormatContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *avformat_get_class(void); - -/** - * Add a new stream to a media file. - * - * When demuxing, it is called by the demuxer in read_header(). If the - * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also - * be called in read_packet(). - * - * When muxing, should be called by the user before avformat_write_header(). - * - * User is required to call avcodec_close() and avformat_free_context() to - * clean up the allocation by avformat_new_stream(). - * - * @param s media file handle - * @param c If non-NULL, the AVCodecContext corresponding to the new stream - * will be initialized to use this codec. This is needed for e.g. codec-specific - * defaults to be set, so codec should be provided if it is known. - * - * @return newly created stream or NULL on error. - */ -AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); - -/** - * Allocate new information from stream. - * - * @param stream stream - * @param type desired side information type - * @param size side information size - * @return pointer to fresh allocated data or NULL otherwise - */ -uint8_t *av_stream_new_side_data(AVStream *stream, - enum AVPacketSideDataType type, int size); -/** - * Get side information from stream. - * - * @param stream stream - * @param type desired side information type - * @param size pointer for side information size to store (optional) - * @return pointer to data if present or NULL otherwise - */ -#if FF_API_NOCONST_GET_SIDE_DATA -uint8_t *av_stream_get_side_data(AVStream *stream, - enum AVPacketSideDataType type, int *size); -#else -uint8_t *av_stream_get_side_data(const AVStream *stream, - enum AVPacketSideDataType type, int *size); -#endif - -AVProgram *av_new_program(AVFormatContext *s, int id); - -/** - * @} - */ - - -/** - * Allocate an AVFormatContext for an output format. - * avformat_free_context() can be used to free the context and - * everything allocated by the framework within it. - * - * @param *ctx is set to the created format context, or to NULL in - * case of failure - * @param oformat format to use for allocating the context, if NULL - * format_name and filename are used instead - * @param format_name the name of output format to use for allocating the - * context, if NULL filename is used instead - * @param filename the name of the filename to use for allocating the - * context, may be NULL - * @return >= 0 in case of success, a negative AVERROR code in case of - * failure - */ -int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, - const char *format_name, const char *filename); - -/** - * @addtogroup lavf_decoding - * @{ - */ - -/** - * Find AVInputFormat based on the short name of the input format. - */ -AVInputFormat *av_find_input_format(const char *short_name); - -/** - * Guess the file format. - * - * @param pd data to be probed - * @param is_opened Whether the file is already opened; determines whether - * demuxers with or without AVFMT_NOFILE are probed. - */ -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); - -/** - * Guess the file format. - * - * @param pd data to be probed - * @param is_opened Whether the file is already opened; determines whether - * demuxers with or without AVFMT_NOFILE are probed. - * @param score_max A probe score larger that this is required to accept a - * detection, the variable is set to the actual detection - * score afterwards. - * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended - * to retry with a larger probe buffer. - */ -AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); - -/** - * Guess the file format. - * - * @param is_opened Whether the file is already opened; determines whether - * demuxers with or without AVFMT_NOFILE are probed. - * @param score_ret The score of the best detection. - */ -AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); - -/** - * Probe a bytestream to determine the input format. Each time a probe returns - * with a score that is too low, the probe buffer size is increased and another - * attempt is made. When the maximum probe size is reached, the input format - * with the highest score is returned. - * - * @param pb the bytestream to probe - * @param fmt the input format is put here - * @param url the url of the stream - * @param logctx the log context - * @param offset the offset within the bytestream to probe from - * @param max_probe_size the maximum probe buffer size (zero for default) - * @return the score in case of success, a negative value corresponding to an - * the maximal score is AVPROBE_SCORE_MAX - * AVERROR code otherwise - */ -int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, - const char *url, void *logctx, - unsigned int offset, unsigned int max_probe_size); - -/** - * Like av_probe_input_buffer2() but returns 0 on success - */ -int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, - const char *url, void *logctx, - unsigned int offset, unsigned int max_probe_size); - -/** - * Open an input stream and read the header. The codecs are not opened. - * The stream must be closed with avformat_close_input(). - * - * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). - * May be a pointer to NULL, in which case an AVFormatContext is allocated by this - * function and written into ps. - * Note that a user-supplied AVFormatContext will be freed on failure. - * @param url URL of the stream to open. - * @param fmt If non-NULL, this parameter forces a specific input format. - * Otherwise the format is autodetected. - * @param options A dictionary filled with AVFormatContext and demuxer-private options. - * On return this parameter will be destroyed and replaced with a dict containing - * options that were not found. May be NULL. - * - * @return 0 on success, a negative AVERROR on failure. - * - * @note If you want to use custom IO, preallocate the format context and set its pb field. - */ -int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); - -attribute_deprecated -int av_demuxer_open(AVFormatContext *ic); - -/** - * Read packets of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also computes the real framerate in case of MPEG-2 repeat - * frame mode. - * The logical file position is not changed by this function; - * examined packets may be buffered for later processing. - * - * @param ic media file handle - * @param options If non-NULL, an ic.nb_streams long array of pointers to - * dictionaries, where i-th member contains options for - * codec corresponding to i-th stream. - * On return each dictionary will be filled with options that were not found. - * @return >=0 if OK, AVERROR_xxx on error - * - * @note this function isn't guaranteed to open all the codecs, so - * options being non-empty at return is a perfectly normal behavior. - * - * @todo Let the user decide somehow what information is needed so that - * we do not waste time getting stuff the user does not need. - */ -int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); - -/** - * Find the programs which belong to a given stream. - * - * @param ic media file handle - * @param last the last found program, the search will start after this - * program, or from the beginning if it is NULL - * @param s stream index - * @return the next program which belongs to s, NULL if no program is found or - * the last program is not among the programs of ic. - */ -AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); - -void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); - -/** - * Find the "best" stream in the file. - * The best stream is determined according to various heuristics as the most - * likely to be what the user expects. - * If the decoder parameter is non-NULL, av_find_best_stream will find the - * default decoder for the stream's codec; streams for which no decoder can - * be found are ignored. - * - * @param ic media file handle - * @param type stream type: video, audio, subtitles, etc. - * @param wanted_stream_nb user-requested stream number, - * or -1 for automatic selection - * @param related_stream try to find a stream related (eg. in the same - * program) to this one, or -1 if none - * @param decoder_ret if non-NULL, returns the decoder for the - * selected stream - * @param flags flags; none are currently defined - * @return the non-negative stream number in case of success, - * AVERROR_STREAM_NOT_FOUND if no stream with the requested type - * could be found, - * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder - * @note If av_find_best_stream returns successfully and decoder_ret is not - * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. - */ -int av_find_best_stream(AVFormatContext *ic, - enum AVMediaType type, - int wanted_stream_nb, - int related_stream, - AVCodec **decoder_ret, - int flags); - -/** - * Return the next frame of a stream. - * This function returns what is stored in the file, and does not validate - * that what is there are valid frames for the decoder. It will split what is - * stored in the file into frames and return one for each call. It will not - * omit invalid data between valid frames so as to give the decoder the maximum - * information possible for decoding. - * - * If pkt->buf is NULL, then the packet is valid until the next - * av_read_frame() or until avformat_close_input(). Otherwise the packet - * is valid indefinitely. In both cases the packet must be freed with - * av_packet_unref when it is no longer needed. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of frames if each - * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames - * have a variable size (e.g. MPEG audio), then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.time_base units (and guessed if the format cannot - * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B-frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 on error or end of file - */ -int av_read_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Seek to the keyframe at timestamp. - * 'timestamp' in 'stream_index'. - * - * @param s media file handle - * @param stream_index If stream_index is (-1), a default - * stream is selected, and timestamp is automatically converted - * from AV_TIME_BASE units to the stream specific time_base. - * @param timestamp Timestamp in AVStream.time_base units - * or, if no stream is specified, in AV_TIME_BASE units. - * @param flags flags which select direction and seeking mode - * @return >= 0 on success - */ -int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, - int flags); - -/** - * Seek to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - * - * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and - * are the file position (this may not be supported by all demuxers). - * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames - * in the stream with stream_index (this may not be supported by all demuxers). - * Otherwise all timestamps are in units of the stream selected by stream_index - * or if stream_index is -1, in AV_TIME_BASE units. - * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as - * keyframes (this may not be supported by all demuxers). - * If flags contain AVSEEK_FLAG_BACKWARD, it is ignored. - * - * @param s media file handle - * @param stream_index index of the stream which is used as time base reference - * @param min_ts smallest acceptable timestamp - * @param ts target timestamp - * @param max_ts largest acceptable timestamp - * @param flags flags - * @return >=0 on success, error code otherwise - * - * @note This is part of the new seek API which is still under construction. - * Thus do not use this yet. It may change at any time, do not expect - * ABI compatibility yet! - */ -int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); - -/** - * Discard all internally buffered data. This can be useful when dealing with - * discontinuities in the byte stream. Generally works only with formats that - * can resync. This includes headerless formats like MPEG-TS/TS but should also - * work with NUT, Ogg and in a limited way AVI for example. - * - * The set of streams, the detected duration, stream parameters and codecs do - * not change when calling this function. If you want a complete reset, it's - * better to open a new AVFormatContext. - * - * This does not flush the AVIOContext (s->pb). If necessary, call - * avio_flush(s->pb) before calling this function. - * - * @param s media file handle - * @return >=0 on success, error code otherwise - */ -int avformat_flush(AVFormatContext *s); - -/** - * Start playing a network-based stream (e.g. RTSP stream) at the - * current position. - */ -int av_read_play(AVFormatContext *s); - -/** - * Pause a network-based stream (e.g. RTSP stream). - * - * Use av_read_play() to resume it. - */ -int av_read_pause(AVFormatContext *s); - -/** - * Close an opened input AVFormatContext. Free it and all its contents - * and set *s to NULL. - */ -void avformat_close_input(AVFormatContext **s); -/** - * @} - */ - -#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward -#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes -#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes -#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number - -/** - * @addtogroup lavf_encoding - * @{ - */ - -#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in avformat_write_header -#define AVSTREAM_INIT_IN_INIT_OUTPUT 1 ///< stream parameters initialized in avformat_init_output - -/** - * Allocate the stream private data and write the stream header to - * an output media file. - * - * @param s Media file handle, must be allocated with avformat_alloc_context(). - * Its oformat field must be set to the desired output format; - * Its pb field must be set to an already opened AVIOContext. - * @param options An AVDictionary filled with AVFormatContext and muxer-private options. - * On return this parameter will be destroyed and replaced with a dict containing - * options that were not found. May be NULL. - * - * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not already been fully initialized in avformat_init, - * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec had already been fully initialized in avformat_init, - * negative AVERROR on failure. - * - * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output. - */ -av_warn_unused_result -int avformat_write_header(AVFormatContext *s, AVDictionary **options); - -/** - * Allocate the stream private data and initialize the codec, but do not write the header. - * May optionally be used before avformat_write_header to initialize stream parameters - * before actually writing the header. - * If using this function, do not pass the same options to avformat_write_header. - * - * @param s Media file handle, must be allocated with avformat_alloc_context(). - * Its oformat field must be set to the desired output format; - * Its pb field must be set to an already opened AVIOContext. - * @param options An AVDictionary filled with AVFormatContext and muxer-private options. - * On return this parameter will be destroyed and replaced with a dict containing - * options that were not found. May be NULL. - * - * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires avformat_write_header to fully initialize, - * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec has been fully initialized, - * negative AVERROR on failure. - * - * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header. - */ -av_warn_unused_result -int avformat_init_output(AVFormatContext *s, AVDictionary **options); - -/** - * Write a packet to an output media file. - * - * This function passes the packet directly to the muxer, without any buffering - * or reordering. The caller is responsible for correctly interleaving the - * packets if the format requires it. Callers that want libavformat to handle - * the interleaving should call av_interleaved_write_frame() instead of this - * function. - * - * @param s media file handle - * @param pkt The packet containing the data to be written. Note that unlike - * av_interleaved_write_frame(), this function does not take - * ownership of the packet passed to it (though some muxers may make - * an internal reference to the input packet). - *
- * This parameter can be NULL (at any time, not just at the end), in - * order to immediately flush data buffered within the muxer, for - * muxers that buffer up data internally before writing it to the - * output. - *
- * Packet's @ref AVPacket.stream_index "stream_index" field must be - * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". - *
- * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") - * must be set to correct values in the stream's timebase (unless the - * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then - * they can be set to AV_NOPTS_VALUE). - * The dts for subsequent packets passed to this function must be strictly - * increasing when compared in their respective timebases (unless the - * output format is flagged with the AVFMT_TS_NONSTRICT, then they - * merely have to be nondecreasing). @ref AVPacket.duration - * "duration") should also be set if known. - * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush - * - * @see av_interleaved_write_frame() - */ -int av_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Write a packet to an output media file ensuring correct interleaving. - * - * This function will buffer the packets internally as needed to make sure the - * packets in the output file are properly interleaved in the order of - * increasing dts. Callers doing their own interleaving should call - * av_write_frame() instead of this function. - * - * Using this function instead of av_write_frame() can give muxers advance - * knowledge of future packets, improving e.g. the behaviour of the mp4 - * muxer for VFR content in fragmenting mode. - * - * @param s media file handle - * @param pkt The packet containing the data to be written. - *
- * If the packet is reference-counted, this function will take - * ownership of this reference and unreference it later when it sees - * fit. - * The caller must not access the data through this reference after - * this function returns. If the packet is not reference-counted, - * libavformat will make a copy. - *
- * This parameter can be NULL (at any time, not just at the end), to - * flush the interleaving queues. - *
- * Packet's @ref AVPacket.stream_index "stream_index" field must be - * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". - *
- * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") - * must be set to correct values in the stream's timebase (unless the - * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then - * they can be set to AV_NOPTS_VALUE). - * The dts for subsequent packets in one stream must be strictly - * increasing (unless the output format is flagged with the - * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). - * @ref AVPacket.duration "duration") should also be set if known. - * - * @return 0 on success, a negative AVERROR on error. Libavformat will always - * take care of freeing the packet, even if this function fails. - * - * @see av_write_frame(), AVFormatContext.max_interleave_delta - */ -int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); - -/** - * Write an uncoded frame to an output media file. - * - * The frame must be correctly interleaved according to the container - * specification; if not, then av_interleaved_write_frame() must be used. - * - * See av_interleaved_write_frame() for details. - */ -int av_write_uncoded_frame(AVFormatContext *s, int stream_index, - AVFrame *frame); - -/** - * Write an uncoded frame to an output media file. - * - * If the muxer supports it, this function makes it possible to write an AVFrame - * structure directly, without encoding it into a packet. - * It is mostly useful for devices and similar special muxers that use raw - * video or PCM data and will not serialize it into a byte stream. - * - * To test whether it is possible to use it with a given muxer and stream, - * use av_write_uncoded_frame_query(). - * - * The caller gives up ownership of the frame and must not access it - * afterwards. - * - * @return >=0 for success, a negative code on error - */ -int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, - AVFrame *frame); - -/** - * Test whether a muxer supports uncoded frame. - * - * @return >=0 if an uncoded frame can be written to that muxer and stream, - * <0 if not - */ -int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index); - -/** - * Write the stream trailer to an output media file and free the - * file private data. - * - * May only be called after a successful call to avformat_write_header. - * - * @param s media file handle - * @return 0 if OK, AVERROR_xxx on error - */ -int av_write_trailer(AVFormatContext *s); - -/** - * Return the output format in the list of registered output formats - * which best matches the provided parameters, or return NULL if - * there is no match. - * - * @param short_name if non-NULL checks if short_name matches with the - * names of the registered formats - * @param filename if non-NULL checks if filename terminates with the - * extensions of the registered formats - * @param mime_type if non-NULL checks if mime_type matches with the - * MIME type of the registered formats - */ -AVOutputFormat *av_guess_format(const char *short_name, - const char *filename, - const char *mime_type); - -/** - * Guess the codec ID based upon muxer and filename. - */ -enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, - enum AVMediaType type); - -/** - * Get timing information for the data currently output. - * The exact meaning of "currently output" depends on the format. - * It is mostly relevant for devices that have an internal buffer and/or - * work in real time. - * @param s media file handle - * @param stream stream in the media file - * @param[out] dts DTS of the last packet output for the stream, in stream - * time_base units - * @param[out] wall absolute time when that packet whas output, - * in microsecond - * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it - * Note: some formats or devices may not allow to measure dts and wall - * atomically. - */ -int av_get_output_timestamp(struct AVFormatContext *s, int stream, - int64_t *dts, int64_t *wall); - - -/** - * @} - */ - - -/** - * @defgroup lavf_misc Utility functions - * @ingroup libavf - * @{ - * - * Miscellaneous utility functions related to both muxing and demuxing - * (or neither). - */ - -/** - * Send a nice hexadecimal dump of a buffer to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 - */ -void av_hex_dump(FILE *f, const uint8_t *buf, int size); - -/** - * Send a nice hexadecimal dump of a buffer to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param buf buffer - * @param size buffer size - * - * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 - */ -void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); - -/** - * Send a nice dump of a packet to the specified file stream. - * - * @param f The file stream pointer where the dump should be sent to. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - * @param st AVStream that the packet belongs to - */ -void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st); - - -/** - * Send a nice dump of a packet to the log. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message, lower values signifying - * higher importance. - * @param pkt packet to dump - * @param dump_payload True if the payload must be displayed, too. - * @param st AVStream that the packet belongs to - */ -void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, - const AVStream *st); - -/** - * Get the AVCodecID for the given codec tag tag. - * If no codec id is found returns AV_CODEC_ID_NONE. - * - * @param tags list of supported codec_id-codec_tag pairs, as stored - * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag - * @param tag codec tag to match to a codec ID - */ -enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); - -/** - * Get the codec tag for the given codec id id. - * If no codec tag is found returns 0. - * - * @param tags list of supported codec_id-codec_tag pairs, as stored - * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag - * @param id codec ID to match to a codec tag - */ -unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); - -/** - * Get the codec tag for the given codec id. - * - * @param tags list of supported codec_id - codec_tag pairs, as stored - * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag - * @param id codec id that should be searched for in the list - * @param tag A pointer to the found tag - * @return 0 if id was not found in tags, > 0 if it was found - */ -int av_codec_get_tag2(const struct AVCodecTag * const *tags, enum AVCodecID id, - unsigned int *tag); - -int av_find_default_stream_index(AVFormatContext *s); - -/** - * Get the index for a specific timestamp. - * - * @param st stream that the timestamp belongs to - * @param timestamp timestamp to retrieve the index for - * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond - * to the timestamp which is <= the requested one, if backward - * is 0, then it will be >= - * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise - * @return < 0 if no such timestamp could be found - */ -int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); - -/** - * Add an index entry into a sorted list. Update the entry if the list - * already contains it. - * - * @param timestamp timestamp in the time base of the given stream - */ -int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, - int size, int distance, int flags); - - -/** - * Split a URL string into components. - * - * The pointers to buffers for storing individual components may be null, - * in order to ignore that component. Buffers for components not found are - * set to empty strings. If the port is not found, it is set to a negative - * value. - * - * @param proto the buffer for the protocol - * @param proto_size the size of the proto buffer - * @param authorization the buffer for the authorization - * @param authorization_size the size of the authorization buffer - * @param hostname the buffer for the host name - * @param hostname_size the size of the hostname buffer - * @param port_ptr a pointer to store the port number in - * @param path the buffer for the path - * @param path_size the size of the path buffer - * @param url the URL to split - */ -void av_url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); - - -/** - * Print detailed information about the input or output format, such as - * duration, bitrate, streams, container, programs, metadata, side data, - * codec and time base. - * - * @param ic the context to analyze - * @param index index of the stream to dump information about - * @param url the URL to print, such as source or destination file - * @param is_output Select whether the specified context is an input(0) or output(1) - */ -void av_dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); - - -#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d - -/** - * Return in 'buf' the path with '%d' replaced by a number. - * - * Also handles the '%0nd' format where 'n' is the total number - * of digits and '%%'. - * - * @param buf destination buffer - * @param buf_size destination buffer size - * @param path numbered sequence string - * @param number frame number - * @param flags AV_FRAME_FILENAME_FLAGS_* - * @return 0 if OK, -1 on format error - */ -int av_get_frame_filename2(char *buf, int buf_size, - const char *path, int number, int flags); - -int av_get_frame_filename(char *buf, int buf_size, - const char *path, int number); - -/** - * Check whether filename actually is a numbered sequence generator. - * - * @param filename possible numbered sequence string - * @return 1 if a valid numbered sequence string, 0 otherwise - */ -int av_filename_number_test(const char *filename); - -/** - * Generate an SDP for an RTP session. - * - * Note, this overwrites the id values of AVStreams in the muxer contexts - * for getting unique dynamic payload types. - * - * @param ac array of AVFormatContexts describing the RTP streams. If the - * array is composed by only one context, such context can contain - * multiple AVStreams (one AVStream per RTP stream). Otherwise, - * all the contexts in the array (an AVCodecContext per RTP stream) - * must contain only one AVStream. - * @param n_files number of AVCodecContexts contained in ac - * @param buf buffer where the SDP will be stored (must be allocated by - * the caller) - * @param size the size of the buffer - * @return 0 if OK, AVERROR_xxx on error - */ -int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); - -/** - * Return a positive value if the given filename has one of the given - * extensions, 0 otherwise. - * - * @param filename file name to check against the given extensions - * @param extensions a comma-separated list of filename extensions - */ -int av_match_ext(const char *filename, const char *extensions); - -/** - * Test if the given container can store a codec. - * - * @param ofmt container to check for compatibility - * @param codec_id codec to potentially store in container - * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* - * - * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. - * A negative number if this information is not available. - */ -int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, - int std_compliance); - -/** - * @defgroup riff_fourcc RIFF FourCCs - * @{ - * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are - * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the - * following code: - * @code - * uint32_t tag = MKTAG('H', '2', '6', '4'); - * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; - * enum AVCodecID id = av_codec_get_id(table, tag); - * @endcode - */ -/** - * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. - */ -const struct AVCodecTag *avformat_get_riff_video_tags(void); -/** - * @return the table mapping RIFF FourCCs for audio to AVCodecID. - */ -const struct AVCodecTag *avformat_get_riff_audio_tags(void); -/** - * @return the table mapping MOV FourCCs for video to libavcodec AVCodecID. - */ -const struct AVCodecTag *avformat_get_mov_video_tags(void); -/** - * @return the table mapping MOV FourCCs for audio to AVCodecID. - */ -const struct AVCodecTag *avformat_get_mov_audio_tags(void); - -/** - * @} - */ - -/** - * Guess the sample aspect ratio of a frame, based on both the stream and the - * frame aspect ratio. - * - * Since the frame aspect ratio is set by the codec but the stream aspect ratio - * is set by the demuxer, these two may not be equal. This function tries to - * return the value that you should use if you would like to display the frame. - * - * Basic logic is to use the stream aspect ratio if it is set to something sane - * otherwise use the frame aspect ratio. This way a container setting, which is - * usually easy to modify can override the coded value in the frames. - * - * @param format the format context which the stream is part of - * @param stream the stream which the frame is part of - * @param frame the frame with the aspect ratio to be determined - * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea - */ -AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame); - -/** - * Guess the frame rate, based on both the container and codec information. - * - * @param ctx the format context which the stream is part of - * @param stream the stream which the frame is part of - * @param frame the frame for which the frame rate should be determined, may be NULL - * @return the guessed (valid) frame rate, 0/1 if no idea - */ -AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame); - -/** - * Check if the stream st contained in s is matched by the stream specifier - * spec. - * - * See the "stream specifiers" chapter in the documentation for the syntax - * of spec. - * - * @return >0 if st is matched by spec; - * 0 if st is not matched by spec; - * AVERROR code if spec is invalid - * - * @note A stream specifier can match several streams in the format. - */ -int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, - const char *spec); - -int avformat_queue_attached_pictures(AVFormatContext *s); - -/** - * Apply a list of bitstream filters to a packet. - * - * @param codec AVCodecContext, usually from an AVStream - * @param pkt the packet to apply filters to. If, on success, the returned - * packet has size == 0 and side_data_elems == 0, it indicates that - * the packet should be dropped - * @param bsfc a NULL-terminated list of filters to apply - * @return >=0 on success; - * AVERROR code on failure - */ -#if FF_API_OLD_BSF -attribute_deprecated -int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, - AVBitStreamFilterContext *bsfc); -#endif - -enum AVTimebaseSource { - AVFMT_TBCF_AUTO = -1, - AVFMT_TBCF_DECODER, - AVFMT_TBCF_DEMUXER, -#if FF_API_R_FRAME_RATE - AVFMT_TBCF_R_FRAMERATE, -#endif -}; - -/** - * Transfer internal timing information from one stream to another. - * - * This function is useful when doing stream copy. - * - * @param ofmt target output format for ost - * @param ost output stream which needs timings copy and adjustments - * @param ist reference input stream to copy timings from - * @param copy_tb define from where the stream codec timebase needs to be imported - */ -int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, - AVStream *ost, const AVStream *ist, - enum AVTimebaseSource copy_tb); - -/** - * Get the internal codec timebase from a stream. - * - * @param st input stream to extract the timebase from - */ -AVRational av_stream_get_codec_timebase(const AVStream *st); - -/** - * @} - */ - -#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avio.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avio.h deleted file mode 100644 index b1ce1d1c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/avio.h +++ /dev/null @@ -1,801 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVFORMAT_AVIO_H -#define AVFORMAT_AVIO_H - -/** - * @file - * @ingroup lavf_io - * Buffered I/O operations - */ - -#include - -#include "libavutil/common.h" -#include "libavutil/dict.h" -#include "libavutil/log.h" - -#include "libavformat/version.h" - -#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ - -/** - * Callback for checking whether to abort blocking functions. - * AVERROR_EXIT is returned in this case by the interrupted - * function. During blocking operations, callback is called with - * opaque as parameter. If the callback returns 1, the - * blocking operation will be aborted. - * - * No members can be added to this struct without a major bump, if - * new elements have been added after this struct in AVFormatContext - * or AVIOContext. - */ -typedef struct AVIOInterruptCB { - int (*callback)(void*); - void *opaque; -} AVIOInterruptCB; - -/** - * Directory entry types. - */ -enum AVIODirEntryType { - AVIO_ENTRY_UNKNOWN, - AVIO_ENTRY_BLOCK_DEVICE, - AVIO_ENTRY_CHARACTER_DEVICE, - AVIO_ENTRY_DIRECTORY, - AVIO_ENTRY_NAMED_PIPE, - AVIO_ENTRY_SYMBOLIC_LINK, - AVIO_ENTRY_SOCKET, - AVIO_ENTRY_FILE, - AVIO_ENTRY_SERVER, - AVIO_ENTRY_SHARE, - AVIO_ENTRY_WORKGROUP, -}; - -/** - * Describes single entry of the directory. - * - * Only name and type fields are guaranteed be set. - * Rest of fields are protocol or/and platform dependent and might be unknown. - */ -typedef struct AVIODirEntry { - char *name; /**< Filename */ - int type; /**< Type of the entry */ - int utf8; /**< Set to 1 when name is encoded with UTF-8, 0 otherwise. - Name can be encoded with UTF-8 even though 0 is set. */ - int64_t size; /**< File size in bytes, -1 if unknown. */ - int64_t modification_timestamp; /**< Time of last modification in microseconds since unix - epoch, -1 if unknown. */ - int64_t access_timestamp; /**< Time of last access in microseconds since unix epoch, - -1 if unknown. */ - int64_t status_change_timestamp; /**< Time of last status change in microseconds since unix - epoch, -1 if unknown. */ - int64_t user_id; /**< User ID of owner, -1 if unknown. */ - int64_t group_id; /**< Group ID of owner, -1 if unknown. */ - int64_t filemode; /**< Unix file mode, -1 if unknown. */ -} AVIODirEntry; - -typedef struct AVIODirContext { - struct URLContext *url_context; -} AVIODirContext; - -/** - * Different data types that can be returned via the AVIO - * write_data_type callback. - */ -enum AVIODataMarkerType { - /** - * Header data; this needs to be present for the stream to be decodeable. - */ - AVIO_DATA_MARKER_HEADER, - /** - * A point in the output bytestream where a decoder can start decoding - * (i.e. a keyframe). A demuxer/decoder given the data flagged with - * AVIO_DATA_MARKER_HEADER, followed by any AVIO_DATA_MARKER_SYNC_POINT, - * should give decodeable results. - */ - AVIO_DATA_MARKER_SYNC_POINT, - /** - * A point in the output bytestream where a demuxer can start parsing - * (for non self synchronizing bytestream formats). That is, any - * non-keyframe packet start point. - */ - AVIO_DATA_MARKER_BOUNDARY_POINT, - /** - * This is any, unlabelled data. It can either be a muxer not marking - * any positions at all, it can be an actual boundary/sync point - * that the muxer chooses not to mark, or a later part of a packet/fragment - * that is cut into multiple write callbacks due to limited IO buffer size. - */ - AVIO_DATA_MARKER_UNKNOWN, - /** - * Trailer data, which doesn't contain actual content, but only for - * finalizing the output file. - */ - AVIO_DATA_MARKER_TRAILER -}; - -/** - * Bytestream IO Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(AVIOContext) must not be used outside libav*. - * - * @note None of the function pointers in AVIOContext should be called - * directly, they should only be set by the client application - * when implementing custom I/O. Normally these are set to the - * function pointers specified in avio_alloc_context() - */ -typedef struct AVIOContext { - /** - * A class for private options. - * - * If this AVIOContext is created by avio_open2(), av_class is set and - * passes the options down to protocols. - * - * If this AVIOContext is manually allocated, then av_class may be set by - * the caller. - * - * warning -- this field can be NULL, be sure to not pass this AVIOContext - * to any av_opt_* functions in that case. - */ - const AVClass *av_class; - - /* - * The following shows the relationship between buffer, buf_ptr, buf_end, buf_size, - * and pos, when reading and when writing (since AVIOContext is used for both): - * - ********************************************************************************** - * READING - ********************************************************************************** - * - * | buffer_size | - * |---------------------------------------| - * | | - * - * buffer buf_ptr buf_end - * +---------------+-----------------------+ - * |/ / / / / / / /|/ / / / / / /| | - * read buffer: |/ / consumed / | to be read /| | - * |/ / / / / / / /|/ / / / / / /| | - * +---------------+-----------------------+ - * - * pos - * +-------------------------------------------+-----------------+ - * input file: | | | - * +-------------------------------------------+-----------------+ - * - * - ********************************************************************************** - * WRITING - ********************************************************************************** - * - * | buffer_size | - * |-------------------------------| - * | | - * - * buffer buf_ptr buf_end - * +-------------------+-----------+ - * |/ / / / / / / / / /| | - * write buffer: | / to be flushed / | | - * |/ / / / / / / / / /| | - * +-------------------+-----------+ - * - * pos - * +--------------------------+-----------------------------------+ - * output file: | | | - * +--------------------------+-----------------------------------+ - * - */ - unsigned char *buffer; /**< Start of the buffer. */ - int buffer_size; /**< Maximum buffer size */ - unsigned char *buf_ptr; /**< Current position in the buffer */ - unsigned char *buf_end; /**< End of the data, may be less than - buffer+buffer_size if the read function returned - less data than requested, e.g. for streams where - no more data has been received yet. */ - void *opaque; /**< A private pointer, passed to the read/write/seek/... - functions. */ - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - int64_t (*seek)(void *opaque, int64_t offset, int whence); - int64_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; /**< contains the error code or 0 if no error happened */ - /** - * Pause or resume playback for network streaming protocols - e.g. MMS. - */ - int (*read_pause)(void *opaque, int pause); - /** - * Seek to a given timestamp in stream with the specified stream_index. - * Needed for some network streaming protocols which don't support seeking - * to byte position. - */ - int64_t (*read_seek)(void *opaque, int stream_index, - int64_t timestamp, int flags); - /** - * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. - */ - int seekable; - - /** - * max filesize, used to limit allocations - * This field is internal to libavformat and access from outside is not allowed. - */ - int64_t maxsize; - - /** - * avio_read and avio_write should if possible be satisfied directly - * instead of going through a buffer, and avio_seek will always - * call the underlying seek function directly. - */ - int direct; - - /** - * Bytes read statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int64_t bytes_read; - - /** - * seek statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int seek_count; - - /** - * writeout statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int writeout_count; - - /** - * Original buffer size - * used internally after probing and ensure seekback to reset the buffer size - * This field is internal to libavformat and access from outside is not allowed. - */ - int orig_buffer_size; - - /** - * Threshold to favor readahead over seek. - * This is current internal only, do not use from outside. - */ - int short_seek_threshold; - - /** - * ',' separated list of allowed protocols. - */ - const char *protocol_whitelist; - - /** - * ',' separated list of disallowed protocols. - */ - const char *protocol_blacklist; - - /** - * A callback that is used instead of write_packet. - */ - int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size, - enum AVIODataMarkerType type, int64_t time); - /** - * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT, - * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly - * small chunks of data returned from the callback). - */ - int ignore_boundary_point; - - /** - * Internal, not meant to be used from outside of AVIOContext. - */ - enum AVIODataMarkerType current_type; - int64_t last_time; -} AVIOContext; - -/** - * Return the name of the protocol that will handle the passed URL. - * - * NULL is returned if no protocol could be found for the given URL. - * - * @return Name of the protocol or NULL. - */ -const char *avio_find_protocol_name(const char *url); - -/** - * Return AVIO_FLAG_* access flags corresponding to the access permissions - * of the resource in url, or a negative value corresponding to an - * AVERROR code in case of failure. The returned access flags are - * masked by the value in flags. - * - * @note This function is intrinsically unsafe, in the sense that the - * checked resource may change its existence or permission status from - * one call to another. Thus you should not trust the returned value, - * unless you are sure that no other processes are accessing the - * checked resource. - */ -int avio_check(const char *url, int flags); - -/** - * Move or rename a resource. - * - * @note url_src and url_dst should share the same protocol and authority. - * - * @param url_src url to resource to be moved - * @param url_dst new url to resource if the operation succeeded - * @return >=0 on success or negative on error. - */ -int avpriv_io_move(const char *url_src, const char *url_dst); - -/** - * Delete a resource. - * - * @param url resource to be deleted. - * @return >=0 on success or negative on error. - */ -int avpriv_io_delete(const char *url); - -/** - * Open directory for reading. - * - * @param s directory read context. Pointer to a NULL pointer must be passed. - * @param url directory to be listed. - * @param options A dictionary filled with protocol-private options. On return - * this parameter will be destroyed and replaced with a dictionary - * containing options that were not found. May be NULL. - * @return >=0 on success or negative on error. - */ -int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options); - -/** - * Get next directory entry. - * - * Returned entry must be freed with avio_free_directory_entry(). In particular - * it may outlive AVIODirContext. - * - * @param s directory read context. - * @param[out] next next entry or NULL when no more entries. - * @return >=0 on success or negative on error. End of list is not considered an - * error. - */ -int avio_read_dir(AVIODirContext *s, AVIODirEntry **next); - -/** - * Close directory. - * - * @note Entries created using avio_read_dir() are not deleted and must be - * freeded with avio_free_directory_entry(). - * - * @param s directory read context. - * @return >=0 on success or negative on error. - */ -int avio_close_dir(AVIODirContext **s); - -/** - * Free entry allocated by avio_read_dir(). - * - * @param entry entry to be freed. - */ -void avio_free_directory_entry(AVIODirEntry **entry); - -/** - * Allocate and initialize an AVIOContext for buffered I/O. It must be later - * freed with av_free(). - * - * @param buffer Memory block for input/output operations via AVIOContext. - * The buffer must be allocated with av_malloc() and friends. - * It may be freed and replaced with a new buffer by libavformat. - * AVIOContext.buffer holds the buffer currently in use, - * which must be later freed with av_free(). - * @param buffer_size The buffer size is very important for performance. - * For protocols with fixed blocksize it should be set to this blocksize. - * For others a typical size is a cache page, e.g. 4kb. - * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. - * @param opaque An opaque pointer to user-specific data. - * @param read_packet A function for refilling the buffer, may be NULL. - * @param write_packet A function for writing the buffer contents, may be NULL. - * The function may not change the input buffers content. - * @param seek A function for seeking to specified byte position, may be NULL. - * - * @return Allocated AVIOContext or NULL on failure. - */ -AVIOContext *avio_alloc_context( - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); - -void avio_w8(AVIOContext *s, int b); -void avio_write(AVIOContext *s, const unsigned char *buf, int size); -void avio_wl64(AVIOContext *s, uint64_t val); -void avio_wb64(AVIOContext *s, uint64_t val); -void avio_wl32(AVIOContext *s, unsigned int val); -void avio_wb32(AVIOContext *s, unsigned int val); -void avio_wl24(AVIOContext *s, unsigned int val); -void avio_wb24(AVIOContext *s, unsigned int val); -void avio_wl16(AVIOContext *s, unsigned int val); -void avio_wb16(AVIOContext *s, unsigned int val); - -/** - * Write a NULL-terminated string. - * @return number of bytes written. - */ -int avio_put_str(AVIOContext *s, const char *str); - -/** - * Convert an UTF-8 string to UTF-16LE and write it. - * @param s the AVIOContext - * @param str NULL-terminated UTF-8 string - * - * @return number of bytes written. - */ -int avio_put_str16le(AVIOContext *s, const char *str); - -/** - * Convert an UTF-8 string to UTF-16BE and write it. - * @param s the AVIOContext - * @param str NULL-terminated UTF-8 string - * - * @return number of bytes written. - */ -int avio_put_str16be(AVIOContext *s, const char *str); - -/** - * Mark the written bytestream as a specific type. - * - * Zero-length ranges are omitted from the output. - * - * @param time the stream time the current bytestream pos corresponds to - * (in AV_TIME_BASE units), or AV_NOPTS_VALUE if unknown or not - * applicable - * @param type the kind of data written starting at the current pos - */ -void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type); - -/** - * ORing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere. Supporting this is optional. - * If it is not supported then the seek function will return <0. - */ -#define AVSEEK_SIZE 0x10000 - -/** - * Passing this flag as the "whence" parameter to a seek function causes it to - * seek by any means (like reopening and linear reading) or other normally unreasonable - * means that can be extremely slow. - * This may be ignored by the seek code. - */ -#define AVSEEK_FORCE 0x20000 - -/** - * fseek() equivalent for AVIOContext. - * @return new position or AVERROR. - */ -int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); - -/** - * Skip given number of bytes forward - * @return new position or AVERROR. - */ -int64_t avio_skip(AVIOContext *s, int64_t offset); - -/** - * ftell() equivalent for AVIOContext. - * @return position or AVERROR. - */ -static av_always_inline int64_t avio_tell(AVIOContext *s) -{ - return avio_seek(s, 0, SEEK_CUR); -} - -/** - * Get the filesize. - * @return filesize or AVERROR - */ -int64_t avio_size(AVIOContext *s); - -/** - * feof() equivalent for AVIOContext. - * @return non zero if and only if end of file - */ -int avio_feof(AVIOContext *s); -#if FF_API_URL_FEOF -/** - * @deprecated use avio_feof() - */ -attribute_deprecated -int url_feof(AVIOContext *s); -#endif - -/** @warning Writes up to 4 KiB per call */ -int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); - -/** - * Force flushing of buffered data. - * - * For write streams, force the buffered data to be immediately written to the output, - * without to wait to fill the internal buffer. - * - * For read streams, discard all currently buffered data, and advance the - * reported file position to that of the underlying stream. This does not - * read new data, and does not perform any seeks. - */ -void avio_flush(AVIOContext *s); - -/** - * Read size bytes from AVIOContext into buf. - * @return number of bytes read or AVERROR - */ -int avio_read(AVIOContext *s, unsigned char *buf, int size); - -/** - * @name Functions for reading from AVIOContext - * @{ - * - * @note return 0 if EOF, so you cannot use it if EOF handling is - * necessary - */ -int avio_r8 (AVIOContext *s); -unsigned int avio_rl16(AVIOContext *s); -unsigned int avio_rl24(AVIOContext *s); -unsigned int avio_rl32(AVIOContext *s); -uint64_t avio_rl64(AVIOContext *s); -unsigned int avio_rb16(AVIOContext *s); -unsigned int avio_rb24(AVIOContext *s); -unsigned int avio_rb32(AVIOContext *s); -uint64_t avio_rb64(AVIOContext *s); -/** - * @} - */ - -/** - * Read a string from pb into buf. The reading will terminate when either - * a NULL character was encountered, maxlen bytes have been read, or nothing - * more can be read from pb. The result is guaranteed to be NULL-terminated, it - * will be truncated if buf is too small. - * Note that the string is not interpreted or validated in any way, it - * might get truncated in the middle of a sequence for multi-byte encodings. - * - * @return number of bytes read (is always <= maxlen). - * If reading ends on EOF or error, the return value will be one more than - * bytes actually read. - */ -int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); - -/** - * Read a UTF-16 string from pb and convert it to UTF-8. - * The reading will terminate when either a null or invalid character was - * encountered or maxlen bytes have been read. - * @return number of bytes read (is always <= maxlen) - */ -int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); -int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); - - -/** - * @name URL open modes - * The flags argument to avio_open must be one of the following - * constants, optionally ORed with other flags. - * @{ - */ -#define AVIO_FLAG_READ 1 /**< read-only */ -#define AVIO_FLAG_WRITE 2 /**< write-only */ -#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ -/** - * @} - */ - -/** - * Use non-blocking mode. - * If this flag is set, operations on the context will return - * AVERROR(EAGAIN) if they can not be performed immediately. - * If this flag is not set, operations on the context will never return - * AVERROR(EAGAIN). - * Note that this flag does not affect the opening/connecting of the - * context. Connecting a protocol will always block if necessary (e.g. on - * network protocols) but never hang (e.g. on busy devices). - * Warning: non-blocking protocols is work-in-progress; this flag may be - * silently ignored. - */ -#define AVIO_FLAG_NONBLOCK 8 - -/** - * Use direct mode. - * avio_read and avio_write should if possible be satisfied directly - * instead of going through a buffer, and avio_seek will always - * call the underlying seek function directly. - */ -#define AVIO_FLAG_DIRECT 0x8000 - -/** - * Create and initialize a AVIOContext for accessing the - * resource indicated by url. - * @note When the resource indicated by url has been opened in - * read+write mode, the AVIOContext can be used only for writing. - * - * @param s Used to return the pointer to the created AVIOContext. - * In case of failure the pointed to value is set to NULL. - * @param url resource to access - * @param flags flags which control how the resource indicated by url - * is to be opened - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int avio_open(AVIOContext **s, const char *url, int flags); - -/** - * Create and initialize a AVIOContext for accessing the - * resource indicated by url. - * @note When the resource indicated by url has been opened in - * read+write mode, the AVIOContext can be used only for writing. - * - * @param s Used to return the pointer to the created AVIOContext. - * In case of failure the pointed to value is set to NULL. - * @param url resource to access - * @param flags flags which control how the resource indicated by url - * is to be opened - * @param int_cb an interrupt callback to be used at the protocols level - * @param options A dictionary filled with protocol-private options. On return - * this parameter will be destroyed and replaced with a dict containing options - * that were not found. May be NULL. - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int avio_open2(AVIOContext **s, const char *url, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options); - -/** - * Close the resource accessed by the AVIOContext s and free it. - * This function can only be used if s was opened by avio_open(). - * - * The internal buffer is automatically flushed before closing the - * resource. - * - * @return 0 on success, an AVERROR < 0 on error. - * @see avio_closep - */ -int avio_close(AVIOContext *s); - -/** - * Close the resource accessed by the AVIOContext *s, free it - * and set the pointer pointing to it to NULL. - * This function can only be used if s was opened by avio_open(). - * - * The internal buffer is automatically flushed before closing the - * resource. - * - * @return 0 on success, an AVERROR < 0 on error. - * @see avio_close - */ -int avio_closep(AVIOContext **s); - - -/** - * Open a write only memory stream. - * - * @param s new IO context - * @return zero if no error. - */ -int avio_open_dyn_buf(AVIOContext **s); - -/** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. - * - * @param s IO context - * @param pbuffer pointer to a byte buffer - * @return the length of the byte buffer - */ -int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); - -/** - * Iterate through names of available protocols. - * - * @param opaque A private pointer representing current protocol. - * It must be a pointer to NULL on first iteration and will - * be updated by successive calls to avio_enum_protocols. - * @param output If set to 1, iterate over output protocols, - * otherwise over input protocols. - * - * @return A static string containing the name of current protocol or NULL - */ -const char *avio_enum_protocols(void **opaque, int output); - -/** - * Pause and resume playing - only meaningful if using a network streaming - * protocol (e.g. MMS). - * - * @param h IO context from which to call the read_pause function pointer - * @param pause 1 for pause, 0 for resume - */ -int avio_pause(AVIOContext *h, int pause); - -/** - * Seek to a given timestamp relative to some component stream. - * Only meaningful if using a network streaming protocol (e.g. MMS.). - * - * @param h IO context from which to call the seek function pointers - * @param stream_index The stream index that the timestamp is relative to. - * If stream_index is (-1) the timestamp should be in AV_TIME_BASE - * units from the beginning of the presentation. - * If a stream_index >= 0 is used and the protocol does not support - * seeking based on component streams, the call will fail. - * @param timestamp timestamp in AVStream.time_base units - * or if there is no stream specified then in AV_TIME_BASE units. - * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE - * and AVSEEK_FLAG_ANY. The protocol may silently ignore - * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will - * fail if used and not supported. - * @return >= 0 on success - * @see AVInputFormat::read_seek - */ -int64_t avio_seek_time(AVIOContext *h, int stream_index, - int64_t timestamp, int flags); - -/* Avoid a warning. The header can not be included because it breaks c++. */ -struct AVBPrint; - -/** - * Read contents of h into print buffer, up to max_size bytes, or up to EOF. - * - * @return 0 for success (max_size bytes read or EOF reached), negative error - * code otherwise - */ -int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); - -/** - * Accept and allocate a client context on a server context. - * @param s the server context - * @param c the client context, must be unallocated - * @return >= 0 on success or a negative value corresponding - * to an AVERROR on failure - */ -int avio_accept(AVIOContext *s, AVIOContext **c); - -/** - * Perform one step of the protocol handshake to accept a new client. - * This function must be called on a client returned by avio_accept() before - * using it as a read/write context. - * It is separate from avio_accept() because it may block. - * A step of the handshake is defined by places where the application may - * decide to change the proceedings. - * For example, on a protocol with a request header and a reply header, each - * one can constitute a step because the application may use the parameters - * from the request to change parameters in the reply; or each individual - * chunk of the request can constitute a step. - * If the handshake is already finished, avio_handshake() does nothing and - * returns 0 immediately. - * - * @param c the client context to perform the handshake on - * @return 0 on a complete and successful handshake - * > 0 if the handshake progressed, but is not complete - * < 0 for an AVERROR code - */ -int avio_handshake(AVIOContext *c); -#endif /* AVFORMAT_AVIO_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/version.h deleted file mode 100644 index ad25596d..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavformat/version.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Version macros. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_VERSION_H -#define AVFORMAT_VERSION_H - -/** - * @file - * @ingroup libavf - * Libavformat version macros - */ - -#include "libavutil/version.h" - -// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) -// Also please add any ticket numbers that you believe might be affected here -#define LIBAVFORMAT_VERSION_MAJOR 57 -#define LIBAVFORMAT_VERSION_MINOR 56 -#define LIBAVFORMAT_VERSION_MICRO 101 - -#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - * - * @note, when bumping the major version it is recommended to manually - * disable each FF_API_* in its own commit instead of disabling them all - * at once through the bump. This improves the git bisect-ability of the change. - * - */ -#ifndef FF_API_LAVF_BITEXACT -#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_LAVF_FRAC -#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_LAVF_CODEC_TB -#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_URL_FEOF -#define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_LAVF_FMT_RAWPICTURE -#define FF_API_LAVF_FMT_RAWPICTURE (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_COMPUTE_PKT_FIELDS2 -#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_OLD_OPEN_CALLBACKS -#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_LAVF_AVCTX -#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_NOCONST_GET_SIDE_DATA -#define FF_API_NOCONST_GET_SIDE_DATA (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif -#ifndef FF_API_HTTP_USER_AGENT -#define FF_API_HTTP_USER_AGENT (LIBAVFORMAT_VERSION_MAJOR < 58) -#endif - -#ifndef FF_API_R_FRAME_RATE -#define FF_API_R_FRAME_RATE 1 -#endif -#endif /* AVFORMAT_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/adler32.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/adler32.h deleted file mode 100644 index a1f035b7..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/adler32.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * copyright (c) 2006 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_adler32 - * Public header for Adler-32 hash function implementation. - */ - -#ifndef AVUTIL_ADLER32_H -#define AVUTIL_ADLER32_H - -#include -#include "attributes.h" - -/** - * @defgroup lavu_adler32 Adler-32 - * @ingroup lavu_hash - * Adler-32 hash function implementation. - * - * @{ - */ - -/** - * Calculate the Adler32 checksum of a buffer. - * - * Passing the return value to a subsequent av_adler32_update() call - * allows the checksum of multiple buffers to be calculated as though - * they were concatenated. - * - * @param adler initial checksum value - * @param buf pointer to input buffer - * @param len size of input buffer - * @return updated checksum - */ -unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, - unsigned int len) av_pure; - -/** - * @} - */ - -#endif /* AVUTIL_ADLER32_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes.h deleted file mode 100644 index 09efbda1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * copyright (c) 2007 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AES_H -#define AVUTIL_AES_H - -#include - -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_aes AES - * @ingroup lavu_crypto - * @{ - */ - -extern const int av_aes_size; - -struct AVAES; - -/** - * Allocate an AVAES context. - */ -struct AVAES *av_aes_alloc(void); - -/** - * Initialize an AVAES context. - * @param key_bits 128, 192 or 256 - * @param decrypt 0 for encryption, 1 for decryption - */ -int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); - -/** - * Encrypt or decrypt a buffer using a previously initialized context. - * @param count number of 16 byte blocks - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param iv initialization vector for CBC mode, if NULL then ECB will be used - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); - -/** - * @} - */ - -#endif /* AVUTIL_AES_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes_ctr.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes_ctr.h deleted file mode 100644 index f596fa6a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/aes_ctr.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * AES-CTR cipher - * Copyright (c) 2015 Eran Kornblau - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AES_CTR_H -#define AVUTIL_AES_CTR_H - -#include - -#include "attributes.h" -#include "version.h" - -#define AES_CTR_KEY_SIZE (16) -#define AES_CTR_IV_SIZE (8) - -struct AVAESCTR; - -/** - * Allocate an AVAESCTR context. - */ -struct AVAESCTR *av_aes_ctr_alloc(void); - -/** - * Initialize an AVAESCTR context. - * @param key encryption key, must have a length of AES_CTR_KEY_SIZE - */ -int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); - -/** - * Release an AVAESCTR context. - */ -void av_aes_ctr_free(struct AVAESCTR *a); - -/** - * Process a buffer using a previously initialized context. - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param size the size of src and dst - */ -void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); - -/** - * Get the current iv - */ -const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); - -/** - * Generate a random iv - */ -void av_aes_ctr_set_random_iv(struct AVAESCTR *a); - -/** - * Forcefully change the iv - */ -void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); - -/** - * Increment the top 64 bit of the iv (performed after each frame) - */ -void av_aes_ctr_increment_iv(struct AVAESCTR *a); - -/** - * @} - */ - -#endif /* AVUTIL_AES_CTR_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/attributes.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/attributes.h deleted file mode 100644 index 5c6b9dee..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/attributes.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Macro definitions for various function/variable attributes - */ - -#ifndef AVUTIL_ATTRIBUTES_H -#define AVUTIL_ATTRIBUTES_H - -#ifdef __GNUC__ -# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) -# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) -#else -# define AV_GCC_VERSION_AT_LEAST(x,y) 0 -# define AV_GCC_VERSION_AT_MOST(x,y) 0 -#endif - -#ifndef av_always_inline -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_always_inline __attribute__((always_inline)) inline -#elif defined(_MSC_VER) -# define av_always_inline __forceinline -#else -# define av_always_inline inline -#endif -#endif - -#ifndef av_extern_inline -#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) -# define av_extern_inline extern inline -#else -# define av_extern_inline inline -#endif -#endif - -#if AV_GCC_VERSION_AT_LEAST(3,4) -# define av_warn_unused_result __attribute__((warn_unused_result)) -#else -# define av_warn_unused_result -#endif - -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_noinline __attribute__((noinline)) -#elif defined(_MSC_VER) -# define av_noinline __declspec(noinline) -#else -# define av_noinline -#endif - -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_pure __attribute__((pure)) -#else -# define av_pure -#endif - -#if AV_GCC_VERSION_AT_LEAST(2,6) -# define av_const __attribute__((const)) -#else -# define av_const -#endif - -#if AV_GCC_VERSION_AT_LEAST(4,3) -# define av_cold __attribute__((cold)) -#else -# define av_cold -#endif - -#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) -# define av_flatten __attribute__((flatten)) -#else -# define av_flatten -#endif - -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define attribute_deprecated __attribute__((deprecated)) -#elif defined(_MSC_VER) -# define attribute_deprecated __declspec(deprecated) -#else -# define attribute_deprecated -#endif - -/** - * Disable warnings about deprecated features - * This is useful for sections of code kept for backward compatibility and - * scheduled for removal. - */ -#ifndef AV_NOWARN_DEPRECATED -#if AV_GCC_VERSION_AT_LEAST(4,6) -# define AV_NOWARN_DEPRECATED(code) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ - code \ - _Pragma("GCC diagnostic pop") -#elif defined(_MSC_VER) -# define AV_NOWARN_DEPRECATED(code) \ - __pragma(warning(push)) \ - __pragma(warning(disable : 4996)) \ - code; \ - __pragma(warning(pop)) -#else -# define AV_NOWARN_DEPRECATED(code) code -#endif -#endif - - -#if defined(__GNUC__) -# define av_unused __attribute__((unused)) -#else -# define av_unused -#endif - -/** - * Mark a variable as used and prevent the compiler from optimizing it - * away. This is useful for variables accessed only from inline - * assembler without the compiler being aware. - */ -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define av_used __attribute__((used)) -#else -# define av_used -#endif - -#if AV_GCC_VERSION_AT_LEAST(3,3) -# define av_alias __attribute__((may_alias)) -#else -# define av_alias -#endif - -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) -# define av_uninit(x) x=x -#else -# define av_uninit(x) x -#endif - -#ifdef __GNUC__ -# define av_builtin_constant_p __builtin_constant_p -# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) -#else -# define av_builtin_constant_p(x) 0 -# define av_printf_format(fmtpos, attrpos) -#endif - -#if AV_GCC_VERSION_AT_LEAST(2,5) -# define av_noreturn __attribute__((noreturn)) -#else -# define av_noreturn -#endif - -#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/audio_fifo.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/audio_fifo.h deleted file mode 100644 index d8a9194a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/audio_fifo.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Audio FIFO - * Copyright (c) 2012 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Audio FIFO Buffer - */ - -#ifndef AVUTIL_AUDIO_FIFO_H -#define AVUTIL_AUDIO_FIFO_H - -#include "avutil.h" -#include "fifo.h" -#include "samplefmt.h" - -/** - * @addtogroup lavu_audio - * @{ - * - * @defgroup lavu_audiofifo Audio FIFO Buffer - * @{ - */ - -/** - * Context for an Audio FIFO Buffer. - * - * - Operates at the sample level rather than the byte level. - * - Supports multiple channels with either planar or packed sample format. - * - Automatic reallocation when writing to a full buffer. - */ -typedef struct AVAudioFifo AVAudioFifo; - -/** - * Free an AVAudioFifo. - * - * @param af AVAudioFifo to free - */ -void av_audio_fifo_free(AVAudioFifo *af); - -/** - * Allocate an AVAudioFifo. - * - * @param sample_fmt sample format - * @param channels number of channels - * @param nb_samples initial allocation size, in samples - * @return newly allocated AVAudioFifo, or NULL on error - */ -AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, - int nb_samples); - -/** - * Reallocate an AVAudioFifo. - * - * @param af AVAudioFifo to reallocate - * @param nb_samples new allocation size, in samples - * @return 0 if OK, or negative AVERROR code on failure - */ -av_warn_unused_result -int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); - -/** - * Write data to an AVAudioFifo. - * - * The AVAudioFifo will be reallocated automatically if the available space - * is less than nb_samples. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param af AVAudioFifo to write to - * @param data audio data plane pointers - * @param nb_samples number of samples to write - * @return number of samples actually written, or negative AVERROR - * code on failure. If successful, the number of samples - * actually written will always be nb_samples. - */ -int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); - -/** - * Peek data from an AVAudioFifo. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param af AVAudioFifo to read from - * @param data audio data plane pointers - * @param nb_samples number of samples to peek - * @return number of samples actually peek, or negative AVERROR code - * on failure. The number of samples actually peek will not - * be greater than nb_samples, and will only be less than - * nb_samples if av_audio_fifo_size is less than nb_samples. - */ -int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples); - -/** - * Peek data from an AVAudioFifo. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param af AVAudioFifo to read from - * @param data audio data plane pointers - * @param nb_samples number of samples to peek - * @param offset offset from current read position - * @return number of samples actually peek, or negative AVERROR code - * on failure. The number of samples actually peek will not - * be greater than nb_samples, and will only be less than - * nb_samples if av_audio_fifo_size is less than nb_samples. - */ -int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset); - -/** - * Read data from an AVAudioFifo. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param af AVAudioFifo to read from - * @param data audio data plane pointers - * @param nb_samples number of samples to read - * @return number of samples actually read, or negative AVERROR code - * on failure. The number of samples actually read will not - * be greater than nb_samples, and will only be less than - * nb_samples if av_audio_fifo_size is less than nb_samples. - */ -int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); - -/** - * Drain data from an AVAudioFifo. - * - * Removes the data without reading it. - * - * @param af AVAudioFifo to drain - * @param nb_samples number of samples to drain - * @return 0 if OK, or negative AVERROR code on failure - */ -int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); - -/** - * Reset the AVAudioFifo buffer. - * - * This empties all data in the buffer. - * - * @param af AVAudioFifo to reset - */ -void av_audio_fifo_reset(AVAudioFifo *af); - -/** - * Get the current number of samples in the AVAudioFifo available for reading. - * - * @param af the AVAudioFifo to query - * @return number of samples available for reading - */ -int av_audio_fifo_size(AVAudioFifo *af); - -/** - * Get the current number of samples in the AVAudioFifo available for writing. - * - * @param af the AVAudioFifo to query - * @return number of samples available for writing - */ -int av_audio_fifo_space(AVAudioFifo *af); - -/** - * @} - * @} - */ - -#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avassert.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avassert.h deleted file mode 100644 index 46f3fea5..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avassert.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * copyright (c) 2010 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simple assert() macros that are a bit more flexible than ISO C assert(). - * @author Michael Niedermayer - */ - -#ifndef AVUTIL_AVASSERT_H -#define AVUTIL_AVASSERT_H - -#include -#include "avutil.h" -#include "log.h" - -/** - * assert() equivalent, that is always enabled. - */ -#define av_assert0(cond) do { \ - if (!(cond)) { \ - av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ - AV_STRINGIFY(cond), __FILE__, __LINE__); \ - abort(); \ - } \ -} while (0) - - -/** - * assert() equivalent, that does not lie in speed critical code. - * These asserts() thus can be enabled without fearing speed loss. - */ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 -#define av_assert1(cond) av_assert0(cond) -#else -#define av_assert1(cond) ((void)0) -#endif - - -/** - * assert() equivalent, that does lie in speed critical code. - */ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 -#define av_assert2(cond) av_assert0(cond) -#define av_assert2_fpu() av_assert0_fpu() -#else -#define av_assert2(cond) ((void)0) -#define av_assert2_fpu() ((void)0) -#endif - -/** - * Assert that floating point opperations can be executed. - * - * This will av_assert0() that the cpu is not in MMX state on X86 - */ -void av_assert0_fpu(void); - -#endif /* AVUTIL_AVASSERT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avconfig.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avconfig.h deleted file mode 100644 index f10aa618..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avconfig.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Generated by ffconf */ -#ifndef AVUTIL_AVCONFIG_H -#define AVUTIL_AVCONFIG_H -#define AV_HAVE_BIGENDIAN 0 -#define AV_HAVE_FAST_UNALIGNED 1 -#endif /* AVUTIL_AVCONFIG_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avstring.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avstring.h deleted file mode 100644 index dd287699..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avstring.h +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (c) 2007 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AVSTRING_H -#define AVUTIL_AVSTRING_H - -#include -#include -#include "attributes.h" - -/** - * @addtogroup lavu_string - * @{ - */ - -/** - * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to - * the address of the first character in str after the prefix. - * - * @param str input string - * @param pfx prefix to test - * @param ptr updated if the prefix is matched inside str - * @return non-zero if the prefix matches, zero otherwise - */ -int av_strstart(const char *str, const char *pfx, const char **ptr); - -/** - * Return non-zero if pfx is a prefix of str independent of case. If - * it is, *ptr is set to the address of the first character in str - * after the prefix. - * - * @param str input string - * @param pfx prefix to test - * @param ptr updated if the prefix is matched inside str - * @return non-zero if the prefix matches, zero otherwise - */ -int av_stristart(const char *str, const char *pfx, const char **ptr); - -/** - * Locate the first case-independent occurrence in the string haystack - * of the string needle. A zero-length string needle is considered to - * match at the start of haystack. - * - * This function is a case-insensitive version of the standard strstr(). - * - * @param haystack string to search in - * @param needle string to search for - * @return pointer to the located match within haystack - * or a null pointer if no match - */ -char *av_stristr(const char *haystack, const char *needle); - -/** - * Locate the first occurrence of the string needle in the string haystack - * where not more than hay_length characters are searched. A zero-length - * string needle is considered to match at the start of haystack. - * - * This function is a length-limited version of the standard strstr(). - * - * @param haystack string to search in - * @param needle string to search for - * @param hay_length length of string to search in - * @return pointer to the located match within haystack - * or a null pointer if no match - */ -char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); - -/** - * Copy the string src to dst, but no more than size - 1 bytes, and - * null-terminate dst. - * - * This function is the same as BSD strlcpy(). - * - * @param dst destination buffer - * @param src source string - * @param size size of destination buffer - * @return the length of src - * - * @warning since the return value is the length of src, src absolutely - * _must_ be a properly 0-terminated string, otherwise this will read beyond - * the end of the buffer and possibly crash. - */ -size_t av_strlcpy(char *dst, const char *src, size_t size); - -/** - * Append the string src to the string dst, but to a total length of - * no more than size - 1 bytes, and null-terminate dst. - * - * This function is similar to BSD strlcat(), but differs when - * size <= strlen(dst). - * - * @param dst destination buffer - * @param src source string - * @param size size of destination buffer - * @return the total length of src and dst - * - * @warning since the return value use the length of src and dst, these - * absolutely _must_ be a properly 0-terminated strings, otherwise this - * will read beyond the end of the buffer and possibly crash. - */ -size_t av_strlcat(char *dst, const char *src, size_t size); - -/** - * Append output to a string, according to a format. Never write out of - * the destination buffer, and always put a terminating 0 within - * the buffer. - * @param dst destination buffer (string to which the output is - * appended) - * @param size total size of the destination buffer - * @param fmt printf-compatible format string, specifying how the - * following parameters are used - * @return the length of the string that would have been generated - * if enough space had been available - */ -size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); - -/** - * Get the count of continuous non zero chars starting from the beginning. - * - * @param len maximum number of characters to check in the string, that - * is the maximum value which is returned by the function - */ -static inline size_t av_strnlen(const char *s, size_t len) -{ - size_t i; - for (i = 0; i < len && s[i]; i++) - ; - return i; -} - -/** - * Print arguments following specified format into a large enough auto - * allocated buffer. It is similar to GNU asprintf(). - * @param fmt printf-compatible format string, specifying how the - * following parameters are used. - * @return the allocated string - * @note You have to free the string yourself with av_free(). - */ -char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); - -/** - * Convert a number to an av_malloced string. - */ -char *av_d2str(double d); - -/** - * Unescape the given string until a non escaped terminating char, - * and return the token corresponding to the unescaped string. - * - * The normal \ and ' escaping is supported. Leading and trailing - * whitespaces are removed, unless they are escaped with '\' or are - * enclosed between ''. - * - * @param buf the buffer to parse, buf will be updated to point to the - * terminating char - * @param term a 0-terminated list of terminating chars - * @return the malloced unescaped string, which must be av_freed by - * the user, NULL in case of allocation failure - */ -char *av_get_token(const char **buf, const char *term); - -/** - * Split the string into several tokens which can be accessed by - * successive calls to av_strtok(). - * - * A token is defined as a sequence of characters not belonging to the - * set specified in delim. - * - * On the first call to av_strtok(), s should point to the string to - * parse, and the value of saveptr is ignored. In subsequent calls, s - * should be NULL, and saveptr should be unchanged since the previous - * call. - * - * This function is similar to strtok_r() defined in POSIX.1. - * - * @param s the string to parse, may be NULL - * @param delim 0-terminated list of token delimiters, must be non-NULL - * @param saveptr user-provided pointer which points to stored - * information necessary for av_strtok() to continue scanning the same - * string. saveptr is updated to point to the next character after the - * first delimiter found, or to NULL if the string was terminated - * @return the found token, or NULL when no token is found - */ -char *av_strtok(char *s, const char *delim, char **saveptr); - -/** - * Locale-independent conversion of ASCII isdigit. - */ -static inline av_const int av_isdigit(int c) -{ - return c >= '0' && c <= '9'; -} - -/** - * Locale-independent conversion of ASCII isgraph. - */ -static inline av_const int av_isgraph(int c) -{ - return c > 32 && c < 127; -} - -/** - * Locale-independent conversion of ASCII isspace. - */ -static inline av_const int av_isspace(int c) -{ - return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || - c == '\v'; -} - -/** - * Locale-independent conversion of ASCII characters to uppercase. - */ -static inline av_const int av_toupper(int c) -{ - if (c >= 'a' && c <= 'z') - c ^= 0x20; - return c; -} - -/** - * Locale-independent conversion of ASCII characters to lowercase. - */ -static inline av_const int av_tolower(int c) -{ - if (c >= 'A' && c <= 'Z') - c ^= 0x20; - return c; -} - -/** - * Locale-independent conversion of ASCII isxdigit. - */ -static inline av_const int av_isxdigit(int c) -{ - c = av_tolower(c); - return av_isdigit(c) || (c >= 'a' && c <= 'f'); -} - -/** - * Locale-independent case-insensitive compare. - * @note This means only ASCII-range characters are case-insensitive - */ -int av_strcasecmp(const char *a, const char *b); - -/** - * Locale-independent case-insensitive compare. - * @note This means only ASCII-range characters are case-insensitive - */ -int av_strncasecmp(const char *a, const char *b, size_t n); - - -/** - * Thread safe basename. - * @param path the path, on DOS both \ and / are considered separators. - * @return pointer to the basename substring. - */ -const char *av_basename(const char *path); - -/** - * Thread safe dirname. - * @param path the path, on DOS both \ and / are considered separators. - * @return the path with the separator replaced by the string terminator or ".". - * @note the function may change the input string. - */ -const char *av_dirname(char *path); - -/** - * Match instances of a name in a comma-separated list of names. - * List entries are checked from the start to the end of the names list, - * the first match ends further processing. If an entry prefixed with '-' - * matches, then 0 is returned. The "ALL" list entry is considered to - * match all names. - * - * @param name Name to look for. - * @param names List of names. - * @return 1 on match, 0 otherwise. - */ -int av_match_name(const char *name, const char *names); - -/** - * Append path component to the existing path. - * Path separator '/' is placed between when needed. - * Resulting string have to be freed with av_free(). - * @param path base path - * @param component component to be appended - * @return new path or NULL on error. - */ -char *av_append_path_component(const char *path, const char *component); - -enum AVEscapeMode { - AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode. - AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping. - AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping. -}; - -/** - * Consider spaces special and escape them even in the middle of the - * string. - * - * This is equivalent to adding the whitespace characters to the special - * characters lists, except it is guaranteed to use the exact same list - * of whitespace characters as the rest of libavutil. - */ -#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) - -/** - * Escape only specified special characters. - * Without this flag, escape also any characters that may be considered - * special by av_get_token(), such as the single quote. - */ -#define AV_ESCAPE_FLAG_STRICT (1 << 1) - -/** - * Escape string in src, and put the escaped string in an allocated - * string in *dst, which must be freed with av_free(). - * - * @param dst pointer where an allocated string is put - * @param src string to escape, must be non-NULL - * @param special_chars string containing the special characters which - * need to be escaped, can be NULL - * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. - * Any unknown value for mode will be considered equivalent to - * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without - * notice. - * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_ macros - * @return the length of the allocated string, or a negative error code in case of error - * @see av_bprint_escape() - */ -av_warn_unused_result -int av_escape(char **dst, const char *src, const char *special_chars, - enum AVEscapeMode mode, int flags); - -#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1 ///< accept codepoints over 0x10FFFF -#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2 ///< accept non-characters - 0xFFFE and 0xFFFF -#define AV_UTF8_FLAG_ACCEPT_SURROGATES 4 ///< accept UTF-16 surrogates codes -#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML - -#define AV_UTF8_FLAG_ACCEPT_ALL \ - AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES - -/** - * Read and decode a single UTF-8 code point (character) from the - * buffer in *buf, and update *buf to point to the next byte to - * decode. - * - * In case of an invalid byte sequence, the pointer will be updated to - * the next byte after the invalid sequence and the function will - * return an error code. - * - * Depending on the specified flags, the function will also fail in - * case the decoded code point does not belong to a valid range. - * - * @note For speed-relevant code a carefully implemented use of - * GET_UTF8() may be preferred. - * - * @param codep pointer used to return the parsed code in case of success. - * The value in *codep is set even in case the range check fails. - * @param bufp pointer to the address the first byte of the sequence - * to decode, updated by the function to point to the - * byte next after the decoded sequence - * @param buf_end pointer to the end of the buffer, points to the next - * byte past the last in the buffer. This is used to - * avoid buffer overreads (in case of an unfinished - * UTF-8 sequence towards the end of the buffer). - * @param flags a collection of AV_UTF8_FLAG_* flags - * @return >= 0 in case a sequence was successfully read, a negative - * value in case of invalid sequence - */ -av_warn_unused_result -int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, - unsigned int flags); - -/** - * Check if a name is in a list. - * @returns 0 if not found, or the 1 based index where it has been found in the - * list. - */ -int av_match_list(const char *name, const char *list, char separator); - -/** - * @} - */ - -#endif /* AVUTIL_AVSTRING_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avutil.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avutil.h deleted file mode 100644 index 29dd830b..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/avutil.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_AVUTIL_H -#define AVUTIL_AVUTIL_H - -/** - * @file - * @ingroup lavu - * Convenience header that includes @ref lavu "libavutil"'s core. - */ - -/** - * @mainpage - * - * @section ffmpeg_intro Introduction - * - * This document describes the usage of the different libraries - * provided by FFmpeg. - * - * @li @ref libavc "libavcodec" encoding/decoding library - * @li @ref lavfi "libavfilter" graph-based frame editing library - * @li @ref libavf "libavformat" I/O and muxing/demuxing library - * @li @ref lavd "libavdevice" special devices muxing/demuxing library - * @li @ref lavu "libavutil" common utility library - * @li @ref lswr "libswresample" audio resampling, format conversion and mixing - * @li @ref lpp "libpostproc" post processing library - * @li @ref libsws "libswscale" color conversion and scaling library - * - * @section ffmpeg_versioning Versioning and compatibility - * - * Each of the FFmpeg libraries contains a version.h header, which defines a - * major, minor and micro version number with the - * LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO} macros. The major version - * number is incremented with backward incompatible changes - e.g. removing - * parts of the public API, reordering public struct members, etc. The minor - * version number is incremented for backward compatible API changes or major - * new features - e.g. adding a new public function or a new decoder. The micro - * version number is incremented for smaller changes that a calling program - * might still want to check for - e.g. changing behavior in a previously - * unspecified situation. - * - * FFmpeg guarantees backward API and ABI compatibility for each library as long - * as its major version number is unchanged. This means that no public symbols - * will be removed or renamed. Types and names of the public struct members and - * values of public macros and enums will remain the same (unless they were - * explicitly declared as not part of the public API). Documented behavior will - * not change. - * - * In other words, any correct program that works with a given FFmpeg snapshot - * should work just as well without any changes with any later snapshot with the - * same major versions. This applies to both rebuilding the program against new - * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program - * links against. - * - * However, new public symbols may be added and new members may be appended to - * public structs whose size is not part of public ABI (most public structs in - * FFmpeg). New macros and enum values may be added. Behavior in undocumented - * situations may change slightly (and be documented). All those are accompanied - * by an entry in doc/APIchanges and incrementing either the minor or micro - * version number. - */ - -/** - * @defgroup lavu libavutil - * Common code shared across all FFmpeg libraries. - * - * @note - * libavutil is designed to be modular. In most cases, in order to use the - * functions provided by one component of libavutil you must explicitly include - * the specific header containing that feature. If you are only using - * media-related components, you could simply include libavutil/avutil.h, which - * brings in most of the "core" components. - * - * @{ - * - * @defgroup lavu_crypto Crypto and Hashing - * - * @{ - * @} - * - * @defgroup lavu_math Mathematics - * @{ - * - * @} - * - * @defgroup lavu_string String Manipulation - * - * @{ - * - * @} - * - * @defgroup lavu_mem Memory Management - * - * @{ - * - * @} - * - * @defgroup lavu_data Data Structures - * @{ - * - * @} - * - * @defgroup lavu_audio Audio related - * - * @{ - * - * @} - * - * @defgroup lavu_error Error Codes - * - * @{ - * - * @} - * - * @defgroup lavu_log Logging Facility - * - * @{ - * - * @} - * - * @defgroup lavu_misc Other - * - * @{ - * - * @defgroup preproc_misc Preprocessor String Macros - * - * @{ - * - * @} - * - * @defgroup version_utils Library Version Macros - * - * @{ - * - * @} - */ - - -/** - * @addtogroup lavu_ver - * @{ - */ - -/** - * Return the LIBAVUTIL_VERSION_INT constant. - */ -unsigned avutil_version(void); - -/** - * Return an informative version string. This usually is the actual release - * version number or a git commit description. This string has no fixed format - * and can change any time. It should never be parsed by code. - */ -const char *av_version_info(void); - -/** - * Return the libavutil build-time configuration. - */ -const char *avutil_configuration(void); - -/** - * Return the libavutil license. - */ -const char *avutil_license(void); - -/** - * @} - */ - -/** - * @addtogroup lavu_media Media Type - * @brief Media Type - */ - -enum AVMediaType { - AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA - AVMEDIA_TYPE_VIDEO, - AVMEDIA_TYPE_AUDIO, - AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous - AVMEDIA_TYPE_SUBTITLE, - AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse - AVMEDIA_TYPE_NB -}; - -/** - * Return a string describing the media_type enum, NULL if media_type - * is unknown. - */ -const char *av_get_media_type_string(enum AVMediaType media_type); - -/** - * @defgroup lavu_const Constants - * @{ - * - * @defgroup lavu_enc Encoding specific - * - * @note those definition should move to avcodec - * @{ - */ - -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1< - -/** - * @defgroup lavu_base64 Base64 - * @ingroup lavu_crypto - * @{ - */ - -/** - * Decode a base64-encoded string. - * - * @param out buffer for decoded data - * @param in null-terminated input string - * @param out_size size in bytes of the out buffer, must be at - * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) - * @return number of bytes written, or a negative value in case of - * invalid input - */ -int av_base64_decode(uint8_t *out, const char *in, int out_size); - -/** - * Calculate the output size in bytes needed to decode a base64 string - * with length x to a data buffer. - */ -#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) - -/** - * Encode data to base64 and null-terminate. - * - * @param out buffer for encoded data - * @param out_size size in bytes of the out buffer (including the - * null terminator), must be at least AV_BASE64_SIZE(in_size) - * @param in input buffer containing the data to encode - * @param in_size size in bytes of the in buffer - * @return out or NULL in case of error - */ -char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); - -/** - * Calculate the output size needed to base64-encode x bytes to a - * null-terminated string. - */ -#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) - - /** - * @} - */ - -#endif /* AVUTIL_BASE64_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/blowfish.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/blowfish.h deleted file mode 100644 index 9e289a40..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/blowfish.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Blowfish algorithm - * Copyright (c) 2012 Samuel Pitoiset - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_BLOWFISH_H -#define AVUTIL_BLOWFISH_H - -#include - -/** - * @defgroup lavu_blowfish Blowfish - * @ingroup lavu_crypto - * @{ - */ - -#define AV_BF_ROUNDS 16 - -typedef struct AVBlowfish { - uint32_t p[AV_BF_ROUNDS + 2]; - uint32_t s[4][256]; -} AVBlowfish; - -/** - * Allocate an AVBlowfish context. - */ -AVBlowfish *av_blowfish_alloc(void); - -/** - * Initialize an AVBlowfish context. - * - * @param ctx an AVBlowfish context - * @param key a key - * @param key_len length of the key - */ -void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); - -/** - * Encrypt or decrypt a buffer using a previously initialized context. - * - * @param ctx an AVBlowfish context - * @param xl left four bytes halves of input to be encrypted - * @param xr right four bytes halves of input to be encrypted - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, - int decrypt); - -/** - * Encrypt or decrypt a buffer using a previously initialized context. - * - * @param ctx an AVBlowfish context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param iv initialization vector for CBC mode, if NULL ECB will be used - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, - int count, uint8_t *iv, int decrypt); - -/** - * @} - */ - -#endif /* AVUTIL_BLOWFISH_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bprint.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bprint.h deleted file mode 100644 index c09b1ac1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bprint.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2012 Nicolas George - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_BPRINT_H -#define AVUTIL_BPRINT_H - -#include - -#include "attributes.h" -#include "avstring.h" - -/** - * Define a structure with extra padding to a fixed size - * This helps ensuring binary compatibility with future versions. - */ - -#define FF_PAD_STRUCTURE(name, size, ...) \ -struct ff_pad_helper_##name { __VA_ARGS__ }; \ -typedef struct name { \ - __VA_ARGS__ \ - char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \ -} name; - -/** - * Buffer to print data progressively - * - * The string buffer grows as necessary and is always 0-terminated. - * The content of the string is never accessed, and thus is - * encoding-agnostic and can even hold binary data. - * - * Small buffers are kept in the structure itself, and thus require no - * memory allocation at all (unless the contents of the buffer is needed - * after the structure goes out of scope). This is almost as lightweight as - * declaring a local "char buf[512]". - * - * The length of the string can go beyond the allocated size: the buffer is - * then truncated, but the functions still keep account of the actual total - * length. - * - * In other words, buf->len can be greater than buf->size and records the - * total length of what would have been to the buffer if there had been - * enough memory. - * - * Append operations do not need to be tested for failure: if a memory - * allocation fails, data stop being appended to the buffer, but the length - * is still updated. This situation can be tested with - * av_bprint_is_complete(). - * - * The size_max field determines several possible behaviours: - * - * size_max = -1 (= UINT_MAX) or any large value will let the buffer be - * reallocated as necessary, with an amortized linear cost. - * - * size_max = 0 prevents writing anything to the buffer: only the total - * length is computed. The write operations can then possibly be repeated in - * a buffer with exactly the necessary size - * (using size_init = size_max = len + 1). - * - * size_max = 1 is automatically replaced by the exact size available in the - * structure itself, thus ensuring no dynamic memory allocation. The - * internal buffer is large enough to hold a reasonable paragraph of text, - * such as the current paragraph. - */ - -FF_PAD_STRUCTURE(AVBPrint, 1024, - char *str; /**< string so far */ - unsigned len; /**< length so far */ - unsigned size; /**< allocated memory */ - unsigned size_max; /**< maximum allocated memory */ - char reserved_internal_buffer[1]; -) - -/** - * Convenience macros for special values for av_bprint_init() size_max - * parameter. - */ -#define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1) -#define AV_BPRINT_SIZE_AUTOMATIC 1 -#define AV_BPRINT_SIZE_COUNT_ONLY 0 - -/** - * Init a print buffer. - * - * @param buf buffer to init - * @param size_init initial size (including the final 0) - * @param size_max maximum size; - * 0 means do not write anything, just count the length; - * 1 is replaced by the maximum value for automatic storage; - * any large value means that the internal buffer will be - * reallocated as needed up to that limit; -1 is converted to - * UINT_MAX, the largest limit possible. - * Check also AV_BPRINT_SIZE_* macros. - */ -void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max); - -/** - * Init a print buffer using a pre-existing buffer. - * - * The buffer will not be reallocated. - * - * @param buf buffer structure to init - * @param buffer byte buffer to use for the string data - * @param size size of buffer - */ -void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size); - -/** - * Append a formatted string to a print buffer. - */ -void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3); - -/** - * Append a formatted string to a print buffer. - */ -void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg); - -/** - * Append char c n times to a print buffer. - */ -void av_bprint_chars(AVBPrint *buf, char c, unsigned n); - -/** - * Append data to a print buffer. - * - * param buf bprint buffer to use - * param data pointer to data - * param size size of data - */ -void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size); - -struct tm; -/** - * Append a formatted date and time to a print buffer. - * - * param buf bprint buffer to use - * param fmt date and time format string, see strftime() - * param tm broken-down time structure to translate - * - * @note due to poor design of the standard strftime function, it may - * produce poor results if the format string expands to a very long text and - * the bprint buffer is near the limit stated by the size_max option. - */ -void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm); - -/** - * Allocate bytes in the buffer for external use. - * - * @param[in] buf buffer structure - * @param[in] size required size - * @param[out] mem pointer to the memory area - * @param[out] actual_size size of the memory area after allocation; - * can be larger or smaller than size - */ -void av_bprint_get_buffer(AVBPrint *buf, unsigned size, - unsigned char **mem, unsigned *actual_size); - -/** - * Reset the string to "" but keep internal allocated data. - */ -void av_bprint_clear(AVBPrint *buf); - -/** - * Test if the print buffer is complete (not truncated). - * - * It may have been truncated due to a memory allocation failure - * or the size_max limit (compare size and size_max if necessary). - */ -static inline int av_bprint_is_complete(const AVBPrint *buf) -{ - return buf->len < buf->size; -} - -/** - * Finalize a print buffer. - * - * The print buffer can no longer be used afterwards, - * but the len and size fields are still valid. - * - * @arg[out] ret_str if not NULL, used to return a permanent copy of the - * buffer contents, or NULL if memory allocation fails; - * if NULL, the buffer is discarded and freed - * @return 0 for success or error code (probably AVERROR(ENOMEM)) - */ -int av_bprint_finalize(AVBPrint *buf, char **ret_str); - -/** - * Escape the content in src and append it to dstbuf. - * - * @param dstbuf already inited destination bprint buffer - * @param src string containing the text to escape - * @param special_chars string containing the special characters which - * need to be escaped, can be NULL - * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. - * Any unknown value for mode will be considered equivalent to - * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without - * notice. - * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_* macros - */ -void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, - enum AVEscapeMode mode, int flags); - -#endif /* AVUTIL_BPRINT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bswap.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bswap.h deleted file mode 100644 index 91cb7953..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/bswap.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * byte swapping routines - */ - -#ifndef AVUTIL_BSWAP_H -#define AVUTIL_BSWAP_H - -#include -#include "libavutil/avconfig.h" -#include "attributes.h" - -#ifdef HAVE_AV_CONFIG_H - -#include "config.h" - -#if ARCH_AARCH64 -# include "aarch64/bswap.h" -#elif ARCH_ARM -# include "arm/bswap.h" -#elif ARCH_AVR32 -# include "avr32/bswap.h" -#elif ARCH_SH4 -# include "sh4/bswap.h" -#elif ARCH_X86 -# include "x86/bswap.h" -#endif - -#endif /* HAVE_AV_CONFIG_H */ - -#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) -#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) -#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) - -#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) - -#ifndef av_bswap16 -static av_always_inline av_const uint16_t av_bswap16(uint16_t x) -{ - x= (x>>8) | (x<<8); - return x; -} -#endif - -#ifndef av_bswap32 -static av_always_inline av_const uint32_t av_bswap32(uint32_t x) -{ - return AV_BSWAP32C(x); -} -#endif - -#ifndef av_bswap64 -static inline uint64_t av_const av_bswap64(uint64_t x) -{ - return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); -} -#endif - -// be2ne ... big-endian to native-endian -// le2ne ... little-endian to native-endian - -#if AV_HAVE_BIGENDIAN -#define av_be2ne16(x) (x) -#define av_be2ne32(x) (x) -#define av_be2ne64(x) (x) -#define av_le2ne16(x) av_bswap16(x) -#define av_le2ne32(x) av_bswap32(x) -#define av_le2ne64(x) av_bswap64(x) -#define AV_BE2NEC(s, x) (x) -#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) -#else -#define av_be2ne16(x) av_bswap16(x) -#define av_be2ne32(x) av_bswap32(x) -#define av_be2ne64(x) av_bswap64(x) -#define av_le2ne16(x) (x) -#define av_le2ne32(x) (x) -#define av_le2ne64(x) (x) -#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) -#define AV_LE2NEC(s, x) (x) -#endif - -#define AV_BE2NE16C(x) AV_BE2NEC(16, x) -#define AV_BE2NE32C(x) AV_BE2NEC(32, x) -#define AV_BE2NE64C(x) AV_BE2NEC(64, x) -#define AV_LE2NE16C(x) AV_LE2NEC(16, x) -#define AV_LE2NE32C(x) AV_LE2NEC(32, x) -#define AV_LE2NE64C(x) AV_LE2NEC(64, x) - -#endif /* AVUTIL_BSWAP_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/buffer.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/buffer.h deleted file mode 100644 index 0c0ce12c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/buffer.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_buffer - * refcounted data buffer API - */ - -#ifndef AVUTIL_BUFFER_H -#define AVUTIL_BUFFER_H - -#include - -/** - * @defgroup lavu_buffer AVBuffer - * @ingroup lavu_data - * - * @{ - * AVBuffer is an API for reference-counted data buffers. - * - * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer - * represents the data buffer itself; it is opaque and not meant to be accessed - * by the caller directly, but only through AVBufferRef. However, the caller may - * e.g. compare two AVBuffer pointers to check whether two different references - * are describing the same data buffer. AVBufferRef represents a single - * reference to an AVBuffer and it is the object that may be manipulated by the - * caller directly. - * - * There are two functions provided for creating a new AVBuffer with a single - * reference -- av_buffer_alloc() to just allocate a new buffer, and - * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing - * reference, additional references may be created with av_buffer_ref(). - * Use av_buffer_unref() to free a reference (this will automatically free the - * data once all the references are freed). - * - * The convention throughout this API and the rest of FFmpeg is such that the - * buffer is considered writable if there exists only one reference to it (and - * it has not been marked as read-only). The av_buffer_is_writable() function is - * provided to check whether this is true and av_buffer_make_writable() will - * automatically create a new writable buffer when necessary. - * Of course nothing prevents the calling code from violating this convention, - * however that is safe only when all the existing references are under its - * control. - * - * @note Referencing and unreferencing the buffers is thread-safe and thus - * may be done from multiple threads simultaneously without any need for - * additional locking. - * - * @note Two different references to the same buffer can point to different - * parts of the buffer (i.e. their AVBufferRef.data will not be equal). - */ - -/** - * A reference counted buffer type. It is opaque and is meant to be used through - * references (AVBufferRef). - */ -typedef struct AVBuffer AVBuffer; - -/** - * A reference to a data buffer. - * - * The size of this struct is not a part of the public ABI and it is not meant - * to be allocated directly. - */ -typedef struct AVBufferRef { - AVBuffer *buffer; - - /** - * The data buffer. It is considered writable if and only if - * this is the only reference to the buffer, in which case - * av_buffer_is_writable() returns 1. - */ - uint8_t *data; - /** - * Size of data in bytes. - */ - int size; -} AVBufferRef; - -/** - * Allocate an AVBuffer of the given size using av_malloc(). - * - * @return an AVBufferRef of given size or NULL when out of memory - */ -AVBufferRef *av_buffer_alloc(int size); - -/** - * Same as av_buffer_alloc(), except the returned buffer will be initialized - * to zero. - */ -AVBufferRef *av_buffer_allocz(int size); - -/** - * Always treat the buffer as read-only, even when it has only one - * reference. - */ -#define AV_BUFFER_FLAG_READONLY (1 << 0) - -/** - * Create an AVBuffer from an existing array. - * - * If this function is successful, data is owned by the AVBuffer. The caller may - * only access data through the returned AVBufferRef and references derived from - * it. - * If this function fails, data is left untouched. - * @param data data array - * @param size size of data in bytes - * @param free a callback for freeing this buffer's data - * @param opaque parameter to be got for processing or passed to free - * @param flags a combination of AV_BUFFER_FLAG_* - * - * @return an AVBufferRef referring to data on success, NULL on failure. - */ -AVBufferRef *av_buffer_create(uint8_t *data, int size, - void (*free)(void *opaque, uint8_t *data), - void *opaque, int flags); - -/** - * Default free callback, which calls av_free() on the buffer data. - * This function is meant to be passed to av_buffer_create(), not called - * directly. - */ -void av_buffer_default_free(void *opaque, uint8_t *data); - -/** - * Create a new reference to an AVBuffer. - * - * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on - * failure. - */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); - -/** - * Free a given reference and automatically free the buffer if there are no more - * references to it. - * - * @param buf the reference to be freed. The pointer is set to NULL on return. - */ -void av_buffer_unref(AVBufferRef **buf); - -/** - * @return 1 if the caller may write to the data referred to by buf (which is - * true if and only if buf is the only reference to the underlying AVBuffer). - * Return 0 otherwise. - * A positive answer is valid until av_buffer_ref() is called on buf. - */ -int av_buffer_is_writable(const AVBufferRef *buf); - -/** - * @return the opaque parameter set by av_buffer_create. - */ -void *av_buffer_get_opaque(const AVBufferRef *buf); - -int av_buffer_get_ref_count(const AVBufferRef *buf); - -/** - * Create a writable reference from a given buffer reference, avoiding data copy - * if possible. - * - * @param buf buffer reference to make writable. On success, buf is either left - * untouched, or it is unreferenced and a new writable AVBufferRef is - * written in its place. On failure, buf is left untouched. - * @return 0 on success, a negative AVERROR on failure. - */ -int av_buffer_make_writable(AVBufferRef **buf); - -/** - * Reallocate a given buffer. - * - * @param buf a buffer reference to reallocate. On success, buf will be - * unreferenced and a new reference with the required size will be - * written in its place. On failure buf will be left untouched. *buf - * may be NULL, then a new buffer is allocated. - * @param size required new buffer size. - * @return 0 on success, a negative AVERROR on failure. - * - * @note the buffer is actually reallocated with av_realloc() only if it was - * initially allocated through av_buffer_realloc(NULL) and there is only one - * reference to it (i.e. the one passed to this function). In all other cases - * a new buffer is allocated and the data is copied. - */ -int av_buffer_realloc(AVBufferRef **buf, int size); - -/** - * @} - */ - -/** - * @defgroup lavu_bufferpool AVBufferPool - * @ingroup lavu_data - * - * @{ - * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. - * - * Frequently allocating and freeing large buffers may be slow. AVBufferPool is - * meant to solve this in cases when the caller needs a set of buffers of the - * same size (the most obvious use case being buffers for raw video or audio - * frames). - * - * At the beginning, the user must call av_buffer_pool_init() to create the - * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to - * get a reference to a new buffer, similar to av_buffer_alloc(). This new - * reference works in all aspects the same way as the one created by - * av_buffer_alloc(). However, when the last reference to this buffer is - * unreferenced, it is returned to the pool instead of being freed and will be - * reused for subsequent av_buffer_pool_get() calls. - * - * When the caller is done with the pool and no longer needs to allocate any new - * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. - * Once all the buffers are released, it will automatically be freed. - * - * Allocating and releasing buffers with this API is thread-safe as long as - * either the default alloc callback is used, or the user-supplied one is - * thread-safe. - */ - -/** - * The buffer pool. This structure is opaque and not meant to be accessed - * directly. It is allocated with av_buffer_pool_init() and freed with - * av_buffer_pool_uninit(). - */ -typedef struct AVBufferPool AVBufferPool; - -/** - * Allocate and initialize a buffer pool. - * - * @param size size of each buffer in this pool - * @param alloc a function that will be used to allocate new buffers when the - * pool is empty. May be NULL, then the default allocator will be used - * (av_buffer_alloc()). - * @return newly created buffer pool on success, NULL on error. - */ -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); - -/** - * Allocate and initialize a buffer pool with a more complex allocator. - * - * @param size size of each buffer in this pool - * @param opaque arbitrary user data used by the allocator - * @param alloc a function that will be used to allocate new buffers when the - * pool is empty. - * @param pool_free a function that will be called immediately before the pool - * is freed. I.e. after av_buffer_pool_can_uninit() is called - * by the pool and all the frames are returned to the pool and - * freed. It is intended to uninitialize the user opaque data. - * @return newly created buffer pool on success, NULL on error. - */ -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), - void (*pool_free)(void *opaque)); - -/** - * Mark the pool as being available for freeing. It will actually be freed only - * once all the allocated buffers associated with the pool are released. Thus it - * is safe to call this function while some of the allocated buffers are still - * in use. - * - * @param pool pointer to the pool to be freed. It will be set to NULL. - */ -void av_buffer_pool_uninit(AVBufferPool **pool); - -/** - * Allocate a new AVBuffer, reusing an old buffer from the pool when available. - * This function may be called simultaneously from multiple threads. - * - * @return a reference to the new buffer on success, NULL on error. - */ -AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); - -/** - * @} - */ - -#endif /* AVUTIL_BUFFER_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/camellia.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/camellia.h deleted file mode 100644 index e674c9b9..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/camellia.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 - * Copyright (c) 2014 Supraja Meedinti - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_CAMELLIA_H -#define AVUTIL_CAMELLIA_H - -#include - - -/** - * @file - * @brief Public header for libavutil CAMELLIA algorithm - * @defgroup lavu_camellia CAMELLIA - * @ingroup lavu_crypto - * @{ - */ - -extern const int av_camellia_size; - -struct AVCAMELLIA; - -/** - * Allocate an AVCAMELLIA context - * To free the struct: av_free(ptr) - */ -struct AVCAMELLIA *av_camellia_alloc(void); - -/** - * Initialize an AVCAMELLIA context. - * - * @param ctx an AVCAMELLIA context - * @param key a key of 16, 24, 32 bytes used for encryption/decryption - * @param key_bits number of keybits: possible are 128, 192, 256 - */ -int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); - -/** - * Encrypt or decrypt a buffer using a previously initialized context - * - * @param ctx an AVCAMELLIA context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 16 byte blocks - * @paran iv initialization vector for CBC mode, NULL for ECB mode - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); - -/** - * @} - */ -#endif /* AVUTIL_CAMELLIA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cast5.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cast5.h deleted file mode 100644 index ad5b347e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cast5.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * An implementation of the CAST128 algorithm as mentioned in RFC2144 - * Copyright (c) 2014 Supraja Meedinti - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_CAST5_H -#define AVUTIL_CAST5_H - -#include - - -/** - * @file - * @brief Public header for libavutil CAST5 algorithm - * @defgroup lavu_cast5 CAST5 - * @ingroup lavu_crypto - * @{ - */ - -extern const int av_cast5_size; - -struct AVCAST5; - -/** - * Allocate an AVCAST5 context - * To free the struct: av_free(ptr) - */ -struct AVCAST5 *av_cast5_alloc(void); -/** - * Initialize an AVCAST5 context. - * - * @param ctx an AVCAST5 context - * @param key a key of 5,6,...16 bytes used for encryption/decryption - * @param key_bits number of keybits: possible are 40,48,...,128 - * @return 0 on success, less than 0 on failure - */ -int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); - -/** - * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only - * - * @param ctx an AVCAST5 context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); - -/** - * Encrypt or decrypt a buffer using a previously initialized context - * - * @param ctx an AVCAST5 context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param iv initialization vector for CBC mode, NULL for ECB mode - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); -/** - * @} - */ -#endif /* AVUTIL_CAST5_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/channel_layout.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/channel_layout.h deleted file mode 100644 index ec7effea..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/channel_layout.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2006 Michael Niedermayer - * Copyright (c) 2008 Peter Ross - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_CHANNEL_LAYOUT_H -#define AVUTIL_CHANNEL_LAYOUT_H - -#include - -/** - * @file - * audio channel layout utility functions - */ - -/** - * @addtogroup lavu_audio - * @{ - */ - -/** - * @defgroup channel_masks Audio channel masks - * - * A channel layout is a 64-bits integer with a bit set for every channel. - * The number of bits set must be equal to the number of channels. - * The value 0 means that the channel layout is not known. - * @note this data structure is not powerful enough to handle channels - * combinations that have the same channel multiple times, such as - * dual-mono. - * - * @{ - */ -#define AV_CH_FRONT_LEFT 0x00000001 -#define AV_CH_FRONT_RIGHT 0x00000002 -#define AV_CH_FRONT_CENTER 0x00000004 -#define AV_CH_LOW_FREQUENCY 0x00000008 -#define AV_CH_BACK_LEFT 0x00000010 -#define AV_CH_BACK_RIGHT 0x00000020 -#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 -#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 -#define AV_CH_BACK_CENTER 0x00000100 -#define AV_CH_SIDE_LEFT 0x00000200 -#define AV_CH_SIDE_RIGHT 0x00000400 -#define AV_CH_TOP_CENTER 0x00000800 -#define AV_CH_TOP_FRONT_LEFT 0x00001000 -#define AV_CH_TOP_FRONT_CENTER 0x00002000 -#define AV_CH_TOP_FRONT_RIGHT 0x00004000 -#define AV_CH_TOP_BACK_LEFT 0x00008000 -#define AV_CH_TOP_BACK_CENTER 0x00010000 -#define AV_CH_TOP_BACK_RIGHT 0x00020000 -#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. -#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. -#define AV_CH_WIDE_LEFT 0x0000000080000000ULL -#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL -#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL -#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL -#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL - -/** Channel mask value used for AVCodecContext.request_channel_layout - to indicate that the user requests the channel order of the decoder output - to be the native codec channel order. */ -#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL - -/** - * @} - * @defgroup channel_mask_c Audio channel layouts - * @{ - * */ -#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) -#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) -#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) -#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) -#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) -#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) -#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) -#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) -#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) -#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) -#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) -#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) -#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) -#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) -#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) -#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) -#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) -#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) - -enum AVMatrixEncoding { - AV_MATRIX_ENCODING_NONE, - AV_MATRIX_ENCODING_DOLBY, - AV_MATRIX_ENCODING_DPLII, - AV_MATRIX_ENCODING_DPLIIX, - AV_MATRIX_ENCODING_DPLIIZ, - AV_MATRIX_ENCODING_DOLBYEX, - AV_MATRIX_ENCODING_DOLBYHEADPHONE, - AV_MATRIX_ENCODING_NB -}; - -/** - * Return a channel layout id that matches name, or 0 if no match is found. - * - * name can be one or several of the following notations, - * separated by '+' or '|': - * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, - * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); - * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, - * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); - * - a number of channels, in decimal, optionally followed by 'c', yielding - * the default channel layout for that number of channels (@see - * av_get_default_channel_layout); - * - a channel layout mask, in hexadecimal starting with "0x" (see the - * AV_CH_* macros). - * - * @warning Starting from the next major bump the trailing character - * 'c' to specify a number of channels will be required, while a - * channel layout mask could also be specified as a decimal number - * (if and only if not followed by "c"). - * - * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7" - */ -uint64_t av_get_channel_layout(const char *name); - -/** - * Return a description of a channel layout. - * If nb_channels is <= 0, it is guessed from the channel_layout. - * - * @param buf put here the string containing the channel layout - * @param buf_size size in bytes of the buffer - */ -void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); - -struct AVBPrint; -/** - * Append a description of a channel layout to a bprint buffer. - */ -void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout); - -/** - * Return the number of channels in the channel layout. - */ -int av_get_channel_layout_nb_channels(uint64_t channel_layout); - -/** - * Return default channel layout for a given number of channels. - */ -int64_t av_get_default_channel_layout(int nb_channels); - -/** - * Get the index of a channel in channel_layout. - * - * @param channel a channel layout describing exactly one channel which must be - * present in channel_layout. - * - * @return index of channel in channel_layout on success, a negative AVERROR - * on error. - */ -int av_get_channel_layout_channel_index(uint64_t channel_layout, - uint64_t channel); - -/** - * Get the channel with the given index in channel_layout. - */ -uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); - -/** - * Get the name of a given channel. - * - * @return channel name on success, NULL on error. - */ -const char *av_get_channel_name(uint64_t channel); - -/** - * Get the description of a given channel. - * - * @param channel a channel layout with a single channel - * @return channel description on success, NULL on error - */ -const char *av_get_channel_description(uint64_t channel); - -/** - * Get the value and name of a standard channel layout. - * - * @param[in] index index in an internal list, starting at 0 - * @param[out] layout channel layout mask - * @param[out] name name of the layout - * @return 0 if the layout exists, - * <0 if index is beyond the limits - */ -int av_get_standard_channel_layout(unsigned index, uint64_t *layout, - const char **name); - -/** - * @} - * @} - */ - -#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/common.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/common.h deleted file mode 100644 index 8142b31f..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/common.h +++ /dev/null @@ -1,530 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * common internal and external API header - */ - -#ifndef AVUTIL_COMMON_H -#define AVUTIL_COMMON_H - -#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C) -#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "attributes.h" -#include "macros.h" -#include "version.h" -#include "libavutil/avconfig.h" - -#if AV_HAVE_BIGENDIAN -# define AV_NE(be, le) (be) -#else -# define AV_NE(be, le) (le) -#endif - -//rounded division & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) -/* assume b>0 */ -#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -/* Fast a/(1<=0 and b>=0 */ -#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ - : ((a) + (1<<(b)) - 1) >> (b)) -/* Backwards compat. */ -#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT - -#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) -#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) - -/** - * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they - * are not representable as absolute values of their type. This is the same - * as with *abs() - * @see FFNABS() - */ -#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -/** - * Negative Absolute value. - * this works for all integers of all types. - * As with many macros, this evaluates its argument twice, it thus must not have - * a sideeffect, that is FFNABS(x++) has undefined behavior. - */ -#define FFNABS(a) ((a) <= 0 ? (a) : (-(a))) - -/** - * Comparator. - * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 - * if x == y. This is useful for instance in a qsort comparator callback. - * Furthermore, compilers are able to optimize this to branchless code, and - * there is no risk of overflow with signed types. - * As with many macros, this evaluates its argument multiple times, it thus - * must not have a side-effect. - */ -#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) -#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) - -/* misc math functions */ - -#ifdef HAVE_AV_CONFIG_H -# include "config.h" -# include "intmath.h" -#endif - -/* Pull in unguarded fallback defines at the end of this file. */ -#include "common.h" - -#ifndef av_log2 -av_const int av_log2(unsigned v); -#endif - -#ifndef av_log2_16bit -av_const int av_log2_16bit(unsigned v); -#endif - -/** - * Clip a signed integer value into the amin-amax range. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static av_always_inline av_const int av_clip_c(int a, int amin, int amax) -{ -#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * Clip a signed 64bit integer value into the amin-amax range. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax) -{ -#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * Clip a signed integer value into the 0-255 range. - * @param a value to clip - * @return clipped value - */ -static av_always_inline av_const uint8_t av_clip_uint8_c(int a) -{ - if (a&(~0xFF)) return (-a)>>31; - else return a; -} - -/** - * Clip a signed integer value into the -128,127 range. - * @param a value to clip - * @return clipped value - */ -static av_always_inline av_const int8_t av_clip_int8_c(int a) -{ - if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F; - else return a; -} - -/** - * Clip a signed integer value into the 0-65535 range. - * @param a value to clip - * @return clipped value - */ -static av_always_inline av_const uint16_t av_clip_uint16_c(int a) -{ - if (a&(~0xFFFF)) return (-a)>>31; - else return a; -} - -/** - * Clip a signed integer value into the -32768,32767 range. - * @param a value to clip - * @return clipped value - */ -static av_always_inline av_const int16_t av_clip_int16_c(int a) -{ - if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF; - else return a; -} - -/** - * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. - * @param a value to clip - * @return clipped value - */ -static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) -{ - if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF); - else return (int32_t)a; -} - -/** - * Clip a signed integer into the -(2^p),(2^p-1) range. - * @param a value to clip - * @param p bit position to clip at - * @return clipped value - */ -static av_always_inline av_const int av_clip_intp2_c(int a, int p) -{ - if (((unsigned)a + (1 << p)) & ~((2 << p) - 1)) - return (a >> 31) ^ ((1 << p) - 1); - else - return a; -} - -/** - * Clip a signed integer to an unsigned power of two range. - * @param a value to clip - * @param p bit position to clip at - * @return clipped value - */ -static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) -{ - if (a & ~((1<> 31 & ((1<= 2 - if (amin > amax) abort(); -#endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * Clip a double value into the amin-amax range. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static av_always_inline av_const double av_clipd_c(double a, double amin, double amax) -{ -#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** Compute ceil(log2(x)). - * @param x value used to compute ceil(log2(x)) - * @return computed ceiling of log2(x) - */ -static av_always_inline av_const int av_ceil_log2_c(int x) -{ - return av_log2((x - 1) << 1); -} - -/** - * Count number of bits set to one in x - * @param x value to count bits of - * @return the number of bits set to one in x - */ -static av_always_inline av_const int av_popcount_c(uint32_t x) -{ - x -= (x >> 1) & 0x55555555; - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0F0F0F0F; - x += x >> 8; - return (x + (x >> 16)) & 0x3F; -} - -/** - * Count number of bits set to one in x - * @param x value to count bits of - * @return the number of bits set to one in x - */ -static av_always_inline av_const int av_popcount64_c(uint64_t x) -{ - return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); -} - -static av_always_inline av_const int av_parity_c(uint32_t v) -{ - return av_popcount(v) & 1; -} - -#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) -#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) - -/** - * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. - * - * @param val Output value, must be an lvalue of type uint32_t. - * @param GET_BYTE Expression reading one byte from the input. - * Evaluated up to 7 times (4 for the currently - * assigned Unicode range). With a memory buffer - * input, this could be *ptr++. - * @param ERROR Expression to be evaluated on invalid input, - * typically a goto statement. - * - * @warning ERROR should not contain a loop control statement which - * could interact with the internal while loop, and should force an - * exit from the macro code (e.g. through a goto or a return) in order - * to prevent undefined results. - */ -#define GET_UTF8(val, GET_BYTE, ERROR)\ - val= (GET_BYTE);\ - {\ - uint32_t top = (val & 128) >> 1;\ - if ((val & 0xc0) == 0x80 || val >= 0xFE)\ - ERROR\ - while (val & top) {\ - int tmp= (GET_BYTE) - 128;\ - if(tmp>>6)\ - ERROR\ - val= (val<<6) + tmp;\ - top <<= 5;\ - }\ - val &= (top << 1) - 1;\ - } - -/** - * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. - * - * @param val Output value, must be an lvalue of type uint32_t. - * @param GET_16BIT Expression returning two bytes of UTF-16 data converted - * to native byte order. Evaluated one or two times. - * @param ERROR Expression to be evaluated on invalid input, - * typically a goto statement. - */ -#define GET_UTF16(val, GET_16BIT, ERROR)\ - val = GET_16BIT;\ - {\ - unsigned int hi = val - 0xD800;\ - if (hi < 0x800) {\ - val = GET_16BIT - 0xDC00;\ - if (val > 0x3FFU || hi > 0x3FFU)\ - ERROR\ - val += (hi<<10) + 0x10000;\ - }\ - }\ - -/** - * @def PUT_UTF8(val, tmp, PUT_BYTE) - * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). - * @param val is an input-only argument and should be of type uint32_t. It holds - * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If - * val is given as a function it is executed only once. - * @param tmp is a temporary variable and should be of type uint8_t. It - * represents an intermediate value during conversion that is to be - * output by PUT_BYTE. - * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. - * It could be a function or a statement, and uses tmp as the input byte. - * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be - * executed up to 4 times for values in the valid UTF-8 range and up to - * 7 times in the general case, depending on the length of the converted - * Unicode character. - */ -#define PUT_UTF8(val, tmp, PUT_BYTE)\ - {\ - int bytes, shift;\ - uint32_t in = val;\ - if (in < 0x80) {\ - tmp = in;\ - PUT_BYTE\ - } else {\ - bytes = (av_log2(in) + 4) / 5;\ - shift = (bytes - 1) * 6;\ - tmp = (256 - (256 >> bytes)) | (in >> shift);\ - PUT_BYTE\ - while (shift >= 6) {\ - shift -= 6;\ - tmp = 0x80 | ((in >> shift) & 0x3f);\ - PUT_BYTE\ - }\ - }\ - } - -/** - * @def PUT_UTF16(val, tmp, PUT_16BIT) - * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). - * @param val is an input-only argument and should be of type uint32_t. It holds - * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If - * val is given as a function it is executed only once. - * @param tmp is a temporary variable and should be of type uint16_t. It - * represents an intermediate value during conversion that is to be - * output by PUT_16BIT. - * @param PUT_16BIT writes the converted UTF-16 data to any proper destination - * in desired endianness. It could be a function or a statement, and uses tmp - * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" - * PUT_BYTE will be executed 1 or 2 times depending on input character. - */ -#define PUT_UTF16(val, tmp, PUT_16BIT)\ - {\ - uint32_t in = val;\ - if (in < 0x10000) {\ - tmp = in;\ - PUT_16BIT\ - } else {\ - tmp = 0xD800 | ((in - 0x10000) >> 10);\ - PUT_16BIT\ - tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ - PUT_16BIT\ - }\ - }\ - - - -#include "mem.h" - -#ifdef HAVE_AV_CONFIG_H -# include "internal.h" -#endif /* HAVE_AV_CONFIG_H */ - -#endif /* AVUTIL_COMMON_H */ - -/* - * The following definitions are outside the multiple inclusion guard - * to ensure they are immediately available in intmath.h. - */ - -#ifndef av_ceil_log2 -# define av_ceil_log2 av_ceil_log2_c -#endif -#ifndef av_clip -# define av_clip av_clip_c -#endif -#ifndef av_clip64 -# define av_clip64 av_clip64_c -#endif -#ifndef av_clip_uint8 -# define av_clip_uint8 av_clip_uint8_c -#endif -#ifndef av_clip_int8 -# define av_clip_int8 av_clip_int8_c -#endif -#ifndef av_clip_uint16 -# define av_clip_uint16 av_clip_uint16_c -#endif -#ifndef av_clip_int16 -# define av_clip_int16 av_clip_int16_c -#endif -#ifndef av_clipl_int32 -# define av_clipl_int32 av_clipl_int32_c -#endif -#ifndef av_clip_intp2 -# define av_clip_intp2 av_clip_intp2_c -#endif -#ifndef av_clip_uintp2 -# define av_clip_uintp2 av_clip_uintp2_c -#endif -#ifndef av_mod_uintp2 -# define av_mod_uintp2 av_mod_uintp2_c -#endif -#ifndef av_sat_add32 -# define av_sat_add32 av_sat_add32_c -#endif -#ifndef av_sat_dadd32 -# define av_sat_dadd32 av_sat_dadd32_c -#endif -#ifndef av_clipf -# define av_clipf av_clipf_c -#endif -#ifndef av_clipd -# define av_clipd av_clipd_c -#endif -#ifndef av_popcount -# define av_popcount av_popcount_c -#endif -#ifndef av_popcount64 -# define av_popcount64 av_popcount64_c -#endif -#ifndef av_parity -# define av_parity av_parity_c -#endif diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cpu.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cpu.h deleted file mode 100644 index 4bff1671..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/cpu.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_CPU_H -#define AVUTIL_CPU_H - -#include "attributes.h" - -#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ - - /* lower 16 bits - CPU features */ -#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX -#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext -#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext -#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW -#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions -#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions -#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster - ///< than regular MMX/SSE (e.g. Core1) -#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt -#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions -#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster - ///< than regular MMX/SSE (e.g. Core1) -#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions -#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower -#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions -#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions -#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions -#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used -#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) -#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions -#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions -#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction -#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used -#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions -#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 -#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 - -#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard -#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 -#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 - -#define AV_CPU_FLAG_ARMV5TE (1 << 0) -#define AV_CPU_FLAG_ARMV6 (1 << 1) -#define AV_CPU_FLAG_ARMV6T2 (1 << 2) -#define AV_CPU_FLAG_VFP (1 << 3) -#define AV_CPU_FLAG_VFPV3 (1 << 4) -#define AV_CPU_FLAG_NEON (1 << 5) -#define AV_CPU_FLAG_ARMV8 (1 << 6) -#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations -#define AV_CPU_FLAG_SETEND (1 <<16) - -/** - * Return the flags which specify extensions supported by the CPU. - * The returned value is affected by av_force_cpu_flags() if that was used - * before. So av_get_cpu_flags() can easily be used in an application to - * detect the enabled cpu flags. - */ -int av_get_cpu_flags(void); - -/** - * Disables cpu detection and forces the specified flags. - * -1 is a special case that disables forcing of specific flags. - */ -void av_force_cpu_flags(int flags); - -/** - * Set a mask on flags returned by av_get_cpu_flags(). - * This function is mainly useful for testing. - * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible - * - * @warning this function is not thread safe. - */ -attribute_deprecated void av_set_cpu_flags_mask(int mask); - -/** - * Parse CPU flags from a string. - * - * The returned flags contain the specified flags as well as related unspecified flags. - * - * This function exists only for compatibility with libav. - * Please use av_parse_cpu_caps() when possible. - * @return a combination of AV_CPU_* flags, negative on error. - */ -attribute_deprecated -int av_parse_cpu_flags(const char *s); - -/** - * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. - * - * @return negative on error. - */ -int av_parse_cpu_caps(unsigned *flags, const char *s); - -/** - * @return the number of logical CPU cores present. - */ -int av_cpu_count(void); - -#endif /* AVUTIL_CPU_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/crc.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/crc.h deleted file mode 100644 index 2a1b0d76..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/crc.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_crc32 - * Public header for CRC hash function implementation. - */ - -#ifndef AVUTIL_CRC_H -#define AVUTIL_CRC_H - -#include -#include -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_crc32 CRC - * @ingroup lavu_hash - * CRC (Cyclic Redundancy Check) hash function implementation. - * - * This module supports numerous CRC polynomials, in addition to the most - * widely used CRC-32-IEEE. See @ref AVCRCId for a list of available - * polynomials. - * - * @{ - */ - -typedef uint32_t AVCRC; - -typedef enum { - AV_CRC_8_ATM, - AV_CRC_16_ANSI, - AV_CRC_16_CCITT, - AV_CRC_32_IEEE, - AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ - AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ -#if FF_API_CRC_BIG_TABLE - AV_CRC_24_IEEE = 12, -#else - AV_CRC_24_IEEE, -#endif /* FF_API_CRC_BIG_TABLE */ - AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ -}AVCRCId; - -/** - * Initialize a CRC table. - * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 - * @param le If 1, the lowest bit represents the coefficient for the highest - * exponent of the corresponding polynomial (both for poly and - * actual CRC). - * If 0, you must swap the CRC parameter and the result of av_crc - * if you need the standard representation (can be simplified in - * most cases to e.g. bswap16): - * av_bswap32(crc << (32-bits)) - * @param bits number of bits for the CRC - * @param poly generator polynomial without the x**bits coefficient, in the - * representation as specified by le - * @param ctx_size size of ctx in bytes - * @return <0 on failure - */ -int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); - -/** - * Get an initialized standard CRC table. - * @param crc_id ID of a standard CRC - * @return a pointer to the CRC table or NULL on failure - */ -const AVCRC *av_crc_get_table(AVCRCId crc_id); - -/** - * Calculate the CRC of a block. - * @param crc CRC of previous blocks if any or initial value for CRC - * @return CRC updated with the data from the given block - * - * @see av_crc_init() "le" parameter - */ -uint32_t av_crc(const AVCRC *ctx, uint32_t crc, - const uint8_t *buffer, size_t length) av_pure; - -/** - * @} - */ - -#endif /* AVUTIL_CRC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/des.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/des.h deleted file mode 100644 index 4cf11f5b..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/des.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * DES encryption/decryption - * Copyright (c) 2007 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_DES_H -#define AVUTIL_DES_H - -#include - -/** - * @defgroup lavu_des DES - * @ingroup lavu_crypto - * @{ - */ - -typedef struct AVDES { - uint64_t round_keys[3][16]; - int triple_des; -} AVDES; - -/** - * Allocate an AVDES context. - */ -AVDES *av_des_alloc(void); - -/** - * @brief Initializes an AVDES context. - * - * @param key_bits must be 64 or 192 - * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption - * @return zero on success, negative value otherwise - */ -int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); - -/** - * @brief Encrypts / decrypts using the DES algorithm. - * - * @param count number of 8 byte blocks - * @param dst destination array, can be equal to src, must be 8-byte aligned - * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL - * @param iv initialization vector for CBC mode, if NULL then ECB will be used, - * must be 8-byte aligned - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); - -/** - * @brief Calculates CBC-MAC using the DES algorithm. - * - * @param count number of 8 byte blocks - * @param dst destination array, can be equal to src, must be 8-byte aligned - * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL - */ -void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); - -/** - * @} - */ - -#endif /* AVUTIL_DES_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/dict.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/dict.h deleted file mode 100644 index 118f1f00..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/dict.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Public dictionary API. - * @deprecated - * AVDictionary is provided for compatibility with libav. It is both in - * implementation as well as API inefficient. It does not scale and is - * extremely slow with large dictionaries. - * It is recommended that new code uses our tree container from tree.c/h - * where applicable, which uses AVL trees to achieve O(log n) performance. - */ - -#ifndef AVUTIL_DICT_H -#define AVUTIL_DICT_H - -#include - -#include "version.h" - -/** - * @addtogroup lavu_dict AVDictionary - * @ingroup lavu_data - * - * @brief Simple key:value store - * - * @{ - * Dictionaries are used for storing key:value pairs. To create - * an AVDictionary, simply pass an address of a NULL pointer to - * av_dict_set(). NULL can be used as an empty dictionary wherever - * a pointer to an AVDictionary is required. - * Use av_dict_get() to retrieve an entry or iterate over all - * entries and finally av_dict_free() to free the dictionary - * and all its contents. - * - @code - AVDictionary *d = NULL; // "create" an empty dictionary - AVDictionaryEntry *t = NULL; - - av_dict_set(&d, "foo", "bar", 0); // add an entry - - char *k = av_strdup("key"); // if your strings are already allocated, - char *v = av_strdup("value"); // you can avoid copying them like this - av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); - - while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { - <....> // iterate over all entries in d - } - av_dict_free(&d); - @endcode - */ - -#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ -#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, - ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ -#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been - allocated with av_malloc() or another memory allocation function. */ -#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been - allocated with av_malloc() or another memory allocation function. */ -#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. -#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no - delimiter is added, the strings are simply concatenated. */ -#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */ - -typedef struct AVDictionaryEntry { - char *key; - char *value; -} AVDictionaryEntry; - -typedef struct AVDictionary AVDictionary; - -/** - * Get a dictionary entry with matching key. - * - * The returned entry key or value must not be changed, or it will - * cause undefined behavior. - * - * To iterate through all the dictionary entries, you can set the matching key - * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. - * - * @param prev Set to the previous matching element to find the next. - * If set to NULL the first matching element is returned. - * @param key matching key - * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved - * @return found entry or NULL in case no matching entry was found in the dictionary - */ -AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, - const AVDictionaryEntry *prev, int flags); - -/** - * Get number of entries in dictionary. - * - * @param m dictionary - * @return number of entries in dictionary - */ -int av_dict_count(const AVDictionary *m); - -/** - * Set the given entry in *pm, overwriting an existing entry. - * - * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, - * these arguments will be freed on error. - * - * Warning: Adding a new entry to a dictionary invalidates all existing entries - * previously returned with av_dict_get. - * - * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL - * a dictionary struct is allocated and put in *pm. - * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags) - * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags). - * Passing a NULL value will cause an existing entry to be deleted. - * @return >= 0 on success otherwise an error code <0 - */ -int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); - -/** - * Convenience wrapper for av_dict_set that converts the value to a string - * and stores it. - * - * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. - */ -int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); - -/** - * Parse the key/value pairs list and add the parsed entries to a dictionary. - * - * In case of failure, all the successfully set entries are stored in - * *pm. You may need to manually free the created dictionary. - * - * @param key_val_sep a 0-terminated list of characters used to separate - * key from value - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other - * @param flags flags to use when adding to dictionary. - * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL - * are ignored since the key/value tokens will always - * be duplicated. - * @return 0 on success, negative AVERROR code on failure - */ -int av_dict_parse_string(AVDictionary **pm, const char *str, - const char *key_val_sep, const char *pairs_sep, - int flags); - -/** - * Copy entries from one AVDictionary struct into another. - * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, - * this function will allocate a struct for you and put it in *dst - * @param src pointer to source AVDictionary struct - * @param flags flags to use when setting entries in *dst - * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag - * @return 0 on success, negative AVERROR code on failure. If dst was allocated - * by this function, callers should free the associated memory. - */ -int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); - -/** - * Free all the memory allocated for an AVDictionary struct - * and all keys and values. - */ -void av_dict_free(AVDictionary **m); - -/** - * Get dictionary entries as a string. - * - * Create a string containing dictionary's entries. - * Such string may be passed back to av_dict_parse_string(). - * @note String is escaped with backslashes ('\'). - * - * @param[in] m dictionary - * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. - * Buffer must be freed by the caller when is no longer needed. - * @param[in] key_val_sep character used to separate key from value - * @param[in] pairs_sep character used to separate two pairs from each other - * @return >= 0 on success, negative on error - * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. - */ -int av_dict_get_string(const AVDictionary *m, char **buffer, - const char key_val_sep, const char pairs_sep); - -/** - * @} - */ - -#endif /* AVUTIL_DICT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/display.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/display.h deleted file mode 100644 index 39c15ee6..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/display.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014 Vittorio Giovara - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_DISPLAY_H -#define AVUTIL_DISPLAY_H - -#include -#include "common.h" - -/** - * The display transformation matrix specifies an affine transformation that - * should be applied to video frames for correct presentation. It is compatible - * with the matrices stored in the ISO/IEC 14496-12 container format. - * - * The data is a 3x3 matrix represented as a 9-element array: - * - * | a b u | - * (a, b, u, c, d, v, x, y, w) -> | c d v | - * | x y w | - * - * All numbers are stored in native endianness, as 16.16 fixed-point values, - * except for u, v and w, which are stored as 2.30 fixed-point values. - * - * The transformation maps a point (p, q) in the source (pre-transformation) - * frame to the point (p', q') in the destination (post-transformation) frame as - * follows: - * | a b u | - * (p, q, 1) . | c d v | = z * (p', q', 1) - * | x y w | - * - * The transformation can also be more explicitly written in components as - * follows: - * p' = (a * p + c * q + x) / z; - * q' = (b * p + d * q + y) / z; - * z = u * p + v * q + w - */ - -/** - * Extract the rotation component of the transformation matrix. - * - * @param matrix the transformation matrix - * @return the angle (in degrees) by which the transformation rotates the frame - * counterclockwise. The angle will be in range [-180.0, 180.0], - * or NaN if the matrix is singular. - * - * @note floating point numbers are inherently inexact, so callers are - * recommended to round the return value to nearest integer before use. - */ -double av_display_rotation_get(const int32_t matrix[9]); - -/** - * Initialize a transformation matrix describing a pure counterclockwise - * rotation by the specified angle (in degrees). - * - * @param matrix an allocated transformation matrix (will be fully overwritten - * by this function) - * @param angle rotation angle in degrees. - */ -void av_display_rotation_set(int32_t matrix[9], double angle); - -/** - * Flip the input matrix horizontally and/or vertically. - * - * @param matrix an allocated transformation matrix - * @param hflip whether the matrix should be flipped horizontally - * @param vflip whether the matrix should be flipped vertically - */ -void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); - -#endif /* AVUTIL_DISPLAY_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/downmix_info.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/downmix_info.h deleted file mode 100644 index 221cf5bf..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/downmix_info.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2014 Tim Walker - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_DOWNMIX_INFO_H -#define AVUTIL_DOWNMIX_INFO_H - -#include "frame.h" - -/** - * @file - * audio downmix medatata - */ - -/** - * @addtogroup lavu_audio - * @{ - */ - -/** - * @defgroup downmix_info Audio downmix metadata - * @{ - */ - -/** - * Possible downmix types. - */ -enum AVDownmixType { - AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ - AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ - AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ - AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ - AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ -}; - -/** - * This structure describes optional metadata relevant to a downmix procedure. - * - * All fields are set by the decoder to the value indicated in the audio - * bitstream (if present), or to a "sane" default otherwise. - */ -typedef struct AVDownmixInfo { - /** - * Type of downmix preferred by the mastering engineer. - */ - enum AVDownmixType preferred_downmix_type; - - /** - * Absolute scale factor representing the nominal level of the center - * channel during a regular downmix. - */ - double center_mix_level; - - /** - * Absolute scale factor representing the nominal level of the center - * channel during an Lt/Rt compatible downmix. - */ - double center_mix_level_ltrt; - - /** - * Absolute scale factor representing the nominal level of the surround - * channels during a regular downmix. - */ - double surround_mix_level; - - /** - * Absolute scale factor representing the nominal level of the surround - * channels during an Lt/Rt compatible downmix. - */ - double surround_mix_level_ltrt; - - /** - * Absolute scale factor representing the level at which the LFE data is - * mixed into L/R channels during downmixing. - */ - double lfe_mix_level; -} AVDownmixInfo; - -/** - * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. - * - * If the side data is absent, it is created and added to the frame. - * - * @param frame the frame for which the side data is to be obtained or created - * - * @return the AVDownmixInfo structure to be edited by the caller, or NULL if - * the structure cannot be allocated. - */ -AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); - -/** - * @} - */ - -/** - * @} - */ - -#endif /* AVUTIL_DOWNMIX_INFO_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/error.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/error.h deleted file mode 100644 index 71df4da3..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/error.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * error code definitions - */ - -#ifndef AVUTIL_ERROR_H -#define AVUTIL_ERROR_H - -#include -#include - -/** - * @addtogroup lavu_error - * - * @{ - */ - - -/* error handling */ -#if EDOM > 0 -#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. -#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. -#else -/* Some platforms have E* and errno already negated. */ -#define AVERROR(e) (e) -#define AVUNERROR(e) (e) -#endif - -#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) - -#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found -#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 -#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small -#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found -#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found -#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found -#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file -#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted -#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library -#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found -#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input -#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found -#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found -#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome -#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found - -#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found -/** - * This is semantically identical to AVERROR_BUG - * it has been introduced in Libav after our AVERROR_BUG and with a modified value. - */ -#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') -#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library -#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. -#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) -#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) -/* HTTP & RTSP errors */ -#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0') -#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') -#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') -#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') -#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') -#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') - -#define AV_ERROR_MAX_STRING_SIZE 64 - -/** - * Put a description of the AVERROR code errnum in errbuf. - * In case of failure the global variable errno is set to indicate the - * error. Even in case of failure av_strerror() will print a generic - * error message indicating the errnum provided to errbuf. - * - * @param errnum error code to describe - * @param errbuf buffer to which description is written - * @param errbuf_size the size in bytes of errbuf - * @return 0 on success, a negative value if a description for errnum - * cannot be found - */ -int av_strerror(int errnum, char *errbuf, size_t errbuf_size); - -/** - * Fill the provided buffer with a string containing an error string - * corresponding to the AVERROR code errnum. - * - * @param errbuf a buffer - * @param errbuf_size size in bytes of errbuf - * @param errnum error code to describe - * @return the buffer in input, filled with the error description - * @see av_strerror() - */ -static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) -{ - av_strerror(errnum, errbuf, errbuf_size); - return errbuf; -} - -/** - * Convenience macro, the return value should be used only directly in - * function arguments but never stand-alone. - */ -#define av_err2str(errnum) \ - av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) - -/** - * @} - */ - -#endif /* AVUTIL_ERROR_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/eval.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/eval.h deleted file mode 100644 index dacd22b9..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/eval.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2002 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simple arithmetic expression evaluator - */ - -#ifndef AVUTIL_EVAL_H -#define AVUTIL_EVAL_H - -#include "avutil.h" - -typedef struct AVExpr AVExpr; - -/** - * Parse and evaluate an expression. - * Note, this is significantly slower than av_expr_eval(). - * - * @param res a pointer to a double where is put the result value of - * the expression, or NAN in case of error - * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" - * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} - * @param const_values a zero terminated array of values for the identifiers from const_names - * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers - * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument - * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers - * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments - * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 - * @param log_ctx parent logging context - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code otherwise - */ -int av_expr_parse_and_eval(double *res, const char *s, - const char * const *const_names, const double *const_values, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - void *opaque, int log_offset, void *log_ctx); - -/** - * Parse an expression. - * - * @param expr a pointer where is put an AVExpr containing the parsed - * value in case of successful parsing, or NULL otherwise. - * The pointed to AVExpr must be freed with av_expr_free() by the user - * when it is not needed anymore. - * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" - * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} - * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers - * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument - * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers - * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments - * @param log_ctx parent logging context - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code otherwise - */ -int av_expr_parse(AVExpr **expr, const char *s, - const char * const *const_names, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - int log_offset, void *log_ctx); - -/** - * Evaluate a previously parsed expression. - * - * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names - * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 - * @return the value of the expression - */ -double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); - -/** - * Free a parsed expression previously created with av_expr_parse(). - */ -void av_expr_free(AVExpr *e); - -/** - * Parse the string in numstr and return its value as a double. If - * the string is empty, contains only whitespaces, or does not contain - * an initial substring that has the expected syntax for a - * floating-point number, no conversion is performed. In this case, - * returns a value of zero and the value returned in tail is the value - * of numstr. - * - * @param numstr a string representing a number, may contain one of - * the International System number postfixes, for example 'K', 'M', - * 'G'. If 'i' is appended after the postfix, powers of 2 are used - * instead of powers of 10. The 'B' postfix multiplies the value by - * 8, and can be appended after another postfix or used alone. This - * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. - * @param tail if non-NULL puts here the pointer to the char next - * after the last parsed character - */ -double av_strtod(const char *numstr, char **tail); - -#endif /* AVUTIL_EVAL_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ffversion.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ffversion.h deleted file mode 100644 index 50d62f93..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ffversion.h +++ /dev/null @@ -1,5 +0,0 @@ -/* Automatically generated by version.sh, do not manually edit! */ -#ifndef AVUTIL_FFVERSION_H -#define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "3.2.4" -#endif /* AVUTIL_FFVERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/fifo.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/fifo.h deleted file mode 100644 index dc7bc6f0..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/fifo.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * a very simple circular buffer FIFO implementation - */ - -#ifndef AVUTIL_FIFO_H -#define AVUTIL_FIFO_H - -#include -#include "avutil.h" -#include "attributes.h" - -typedef struct AVFifoBuffer { - uint8_t *buffer; - uint8_t *rptr, *wptr, *end; - uint32_t rndx, wndx; -} AVFifoBuffer; - -/** - * Initialize an AVFifoBuffer. - * @param size of FIFO - * @return AVFifoBuffer or NULL in case of memory allocation failure - */ -AVFifoBuffer *av_fifo_alloc(unsigned int size); - -/** - * Initialize an AVFifoBuffer. - * @param nmemb number of elements - * @param size size of the single element - * @return AVFifoBuffer or NULL in case of memory allocation failure - */ -AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size); - -/** - * Free an AVFifoBuffer. - * @param f AVFifoBuffer to free - */ -void av_fifo_free(AVFifoBuffer *f); - -/** - * Free an AVFifoBuffer and reset pointer to NULL. - * @param f AVFifoBuffer to free - */ -void av_fifo_freep(AVFifoBuffer **f); - -/** - * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. - * @param f AVFifoBuffer to reset - */ -void av_fifo_reset(AVFifoBuffer *f); - -/** - * Return the amount of data in bytes in the AVFifoBuffer, that is the - * amount of data you can read from it. - * @param f AVFifoBuffer to read from - * @return size - */ -int av_fifo_size(const AVFifoBuffer *f); - -/** - * Return the amount of space in bytes in the AVFifoBuffer, that is the - * amount of data you can write into it. - * @param f AVFifoBuffer to write into - * @return size - */ -int av_fifo_space(const AVFifoBuffer *f); - -/** - * Feed data at specific position from an AVFifoBuffer to a user-supplied callback. - * Similar as av_fifo_gereric_read but without discarding data. - * @param f AVFifoBuffer to read from - * @param offset offset from current read position - * @param buf_size number of bytes to read - * @param func generic read function - * @param dest data destination - */ -int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int)); - -/** - * Feed data from an AVFifoBuffer to a user-supplied callback. - * Similar as av_fifo_gereric_read but without discarding data. - * @param f AVFifoBuffer to read from - * @param buf_size number of bytes to read - * @param func generic read function - * @param dest data destination - */ -int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); - -/** - * Feed data from an AVFifoBuffer to a user-supplied callback. - * @param f AVFifoBuffer to read from - * @param buf_size number of bytes to read - * @param func generic read function - * @param dest data destination - */ -int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); - -/** - * Feed data from a user-supplied callback to an AVFifoBuffer. - * @param f AVFifoBuffer to write to - * @param src data source; non-const since it may be used as a - * modifiable context by the function defined in func - * @param size number of bytes to write - * @param func generic write function; the first parameter is src, - * the second is dest_buf, the third is dest_buf_size. - * func must return the number of bytes written to dest_buf, or <= 0 to - * indicate no more data available to write. - * If func is NULL, src is interpreted as a simple byte array for source data. - * @return the number of bytes written to the FIFO - */ -int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); - -/** - * Resize an AVFifoBuffer. - * In case of reallocation failure, the old FIFO is kept unchanged. - * - * @param f AVFifoBuffer to resize - * @param size new AVFifoBuffer size in bytes - * @return <0 for failure, >=0 otherwise - */ -int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); - -/** - * Enlarge an AVFifoBuffer. - * In case of reallocation failure, the old FIFO is kept unchanged. - * The new fifo size may be larger than the requested size. - * - * @param f AVFifoBuffer to resize - * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() - * @return <0 for failure, >=0 otherwise - */ -int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); - -/** - * Read and discard the specified amount of data from an AVFifoBuffer. - * @param f AVFifoBuffer to read from - * @param size amount of data to read in bytes - */ -void av_fifo_drain(AVFifoBuffer *f, int size); - -/** - * Return a pointer to the data stored in a FIFO buffer at a certain offset. - * The FIFO buffer is not modified. - * - * @param f AVFifoBuffer to peek at, f must be non-NULL - * @param offs an offset in bytes, its absolute value must be less - * than the used buffer size or the returned pointer will - * point outside to the buffer data. - * The used buffer size can be checked with av_fifo_size(). - */ -static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) -{ - uint8_t *ptr = f->rptr + offs; - if (ptr >= f->end) - ptr = f->buffer + (ptr - f->end); - else if (ptr < f->buffer) - ptr = f->end - (f->buffer - ptr); - return ptr; -} - -#endif /* AVUTIL_FIFO_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/file.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/file.h deleted file mode 100644 index 8666c7b1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/file.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_FILE_H -#define AVUTIL_FILE_H - -#include - -#include "avutil.h" - -/** - * @file - * Misc file utilities. - */ - -/** - * Read the file with name filename, and put its content in a newly - * allocated buffer or map it with mmap() when available. - * In case of success set *bufptr to the read or mmapped buffer, and - * *size to the size in bytes of the buffer in *bufptr. - * The returned buffer must be released with av_file_unmap(). - * - * @param log_offset loglevel offset used for logging - * @param log_ctx context used for logging - * @return a non negative number in case of success, a negative value - * corresponding to an AVERROR error code in case of failure - */ -av_warn_unused_result -int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, - int log_offset, void *log_ctx); - -/** - * Unmap or free the buffer bufptr created by av_file_map(). - * - * @param size size in bytes of bufptr, must be the same as returned - * by av_file_map() - */ -void av_file_unmap(uint8_t *bufptr, size_t size); - -/** - * Wrapper to work around the lack of mkstemp() on mingw. - * Also, tries to create file in /tmp first, if possible. - * *prefix can be a character constant; *filename will be allocated internally. - * @return file descriptor of opened file (or negative value corresponding to an - * AVERROR code on error) - * and opened file name in **filename. - * @note On very old libcs it is necessary to set a secure umask before - * calling this, av_tempfile() can't call umask itself as it is used in - * libraries and could interfere with the calling application. - * @deprecated as fd numbers cannot be passed saftely between libs on some platforms - */ -int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); - -#endif /* AVUTIL_FILE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/frame.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/frame.h deleted file mode 100644 index 8e51361e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/frame.h +++ /dev/null @@ -1,755 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_frame - * reference-counted frame API - */ - -#ifndef AVUTIL_FRAME_H -#define AVUTIL_FRAME_H - -#include - -#include "avutil.h" -#include "buffer.h" -#include "dict.h" -#include "rational.h" -#include "samplefmt.h" -#include "pixfmt.h" -#include "version.h" - - -/** - * @defgroup lavu_frame AVFrame - * @ingroup lavu_data - * - * @{ - * AVFrame is an abstraction for reference-counted raw multimedia data. - */ - -enum AVFrameSideDataType { - /** - * The data is the AVPanScan struct defined in libavcodec. - */ - AV_FRAME_DATA_PANSCAN, - /** - * ATSC A53 Part 4 Closed Captions. - * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. - * The number of bytes of CC data is AVFrameSideData.size. - */ - AV_FRAME_DATA_A53_CC, - /** - * Stereoscopic 3d metadata. - * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. - */ - AV_FRAME_DATA_STEREO3D, - /** - * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. - */ - AV_FRAME_DATA_MATRIXENCODING, - /** - * Metadata relevant to a downmix procedure. - * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. - */ - AV_FRAME_DATA_DOWNMIX_INFO, - /** - * ReplayGain information in the form of the AVReplayGain struct. - */ - AV_FRAME_DATA_REPLAYGAIN, - /** - * This side data contains a 3x3 transformation matrix describing an affine - * transformation that needs to be applied to the frame for correct - * presentation. - * - * See libavutil/display.h for a detailed description of the data. - */ - AV_FRAME_DATA_DISPLAYMATRIX, - /** - * Active Format Description data consisting of a single byte as specified - * in ETSI TS 101 154 using AVActiveFormatDescription enum. - */ - AV_FRAME_DATA_AFD, - /** - * Motion vectors exported by some codecs (on demand through the export_mvs - * flag set in the libavcodec AVCodecContext flags2 option). - * The data is the AVMotionVector struct defined in - * libavutil/motion_vector.h. - */ - AV_FRAME_DATA_MOTION_VECTORS, - /** - * Recommmends skipping the specified number of samples. This is exported - * only if the "skip_manual" AVOption is set in libavcodec. - * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. - * @code - * u32le number of samples to skip from start of this packet - * u32le number of samples to skip from end of this packet - * u8 reason for start skip - * u8 reason for end skip (0=padding silence, 1=convergence) - * @endcode - */ - AV_FRAME_DATA_SKIP_SAMPLES, - /** - * This side data must be associated with an audio frame and corresponds to - * enum AVAudioServiceType defined in avcodec.h. - */ - AV_FRAME_DATA_AUDIO_SERVICE_TYPE, - /** - * Mastering display metadata associated with a video frame. The payload is - * an AVMasteringDisplayMetadata type and contains information about the - * mastering display color volume. - */ - AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, - /** - * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. - * This is set on the first frame of a GOP that has a temporal reference of 0. - */ - AV_FRAME_DATA_GOP_TIMECODE -}; - -enum AVActiveFormatDescription { - AV_AFD_SAME = 8, - AV_AFD_4_3 = 9, - AV_AFD_16_9 = 10, - AV_AFD_14_9 = 11, - AV_AFD_4_3_SP_14_9 = 13, - AV_AFD_16_9_SP_14_9 = 14, - AV_AFD_SP_4_3 = 15, -}; - - -/** - * Structure to hold side data for an AVFrame. - * - * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added - * to the end with a minor bump. - */ -typedef struct AVFrameSideData { - enum AVFrameSideDataType type; - uint8_t *data; - int size; - AVDictionary *metadata; - AVBufferRef *buf; -} AVFrameSideData; - -/** - * This structure describes decoded (raw) audio or video data. - * - * AVFrame must be allocated using av_frame_alloc(). Note that this only - * allocates the AVFrame itself, the buffers for the data must be managed - * through other means (see below). - * AVFrame must be freed with av_frame_free(). - * - * AVFrame is typically allocated once and then reused multiple times to hold - * different data (e.g. a single AVFrame to hold frames received from a - * decoder). In such a case, av_frame_unref() will free any references held by - * the frame and reset it to its original clean state before it - * is reused again. - * - * The data described by an AVFrame is usually reference counted through the - * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / - * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at - * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, - * every single data plane must be contained in one of the buffers in - * AVFrame.buf or AVFrame.extended_buf. - * There may be a single buffer for all the data, or one separate buffer for - * each plane, or anything in between. - * - * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added - * to the end with a minor bump. - * Similarly fields that are marked as to be only accessed by - * av_opt_ptr() can be reordered. This allows 2 forks to add fields - * without breaking compatibility with each other. - * - * Fields can be accessed through AVOptions, the name string used, matches the - * C structure field name for fields accessible through AVOptions. The AVClass - * for AVFrame can be obtained from avcodec_get_frame_class() - */ -typedef struct AVFrame { -#define AV_NUM_DATA_POINTERS 8 - /** - * pointer to the picture/channel planes. - * This might be different from the first allocated byte - * - * Some decoders access areas outside 0,0 - width,height, please - * see avcodec_align_dimensions2(). Some filters and swscale can read - * up to 16 bytes beyond the planes, if these filters are to be used, - * then 16 extra bytes must be allocated. - * - * NOTE: Except for hwaccel formats, pointers not needed by the format - * MUST be set to NULL. - */ - uint8_t *data[AV_NUM_DATA_POINTERS]; - - /** - * For video, size in bytes of each picture line. - * For audio, size in bytes of each plane. - * - * For audio, only linesize[0] may be set. For planar audio, each channel - * plane must be the same size. - * - * For video the linesizes should be multiples of the CPUs alignment - * preference, this is 16 or 32 for modern desktop CPUs. - * Some code requires such alignment other code can be slower without - * correct alignment, for yet other it makes no difference. - * - * @note The linesize may be larger than the size of usable data -- there - * may be extra padding present for performance reasons. - */ - int linesize[AV_NUM_DATA_POINTERS]; - - /** - * pointers to the data planes/channels. - * - * For video, this should simply point to data[]. - * - * For planar audio, each channel has a separate data pointer, and - * linesize[0] contains the size of each channel buffer. - * For packed audio, there is just one data pointer, and linesize[0] - * contains the total size of the buffer for all channels. - * - * Note: Both data and extended_data should always be set in a valid frame, - * but for planar audio with more channels that can fit in data, - * extended_data must be used in order to access all channels. - */ - uint8_t **extended_data; - - /** - * width and height of the video frame - */ - int width, height; - - /** - * number of audio samples (per channel) described by this frame - */ - int nb_samples; - - /** - * format of the frame, -1 if unknown or unset - * Values correspond to enum AVPixelFormat for video frames, - * enum AVSampleFormat for audio) - */ - int format; - - /** - * 1 -> keyframe, 0-> not - */ - int key_frame; - - /** - * Picture type of the frame. - */ - enum AVPictureType pict_type; - - /** - * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. - */ - AVRational sample_aspect_ratio; - - /** - * Presentation timestamp in time_base units (time when frame should be shown to user). - */ - int64_t pts; - -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - - /** - * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) - * This is also the Presentation time of this AVFrame calculated from - * only AVPacket.dts values without pts values. - */ - int64_t pkt_dts; - - /** - * picture number in bitstream order - */ - int coded_picture_number; - /** - * picture number in display order - */ - int display_picture_number; - - /** - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) - */ - int quality; - - /** - * for some private data of the user - */ - void *opaque; - -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - - /** - * When decoding, this signals how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps) - */ - int repeat_pict; - - /** - * The content of the picture is interlaced. - */ - int interlaced_frame; - - /** - * If the content is interlaced, is top field displayed first. - */ - int top_field_first; - - /** - * Tell user application that palette has changed from previous frame. - */ - int palette_has_changed; - - /** - * reordered opaque 64 bits (generally an integer or a double precision float - * PTS but can be anything). - * The user sets AVCodecContext.reordered_opaque to represent the input at - * that time, - * the decoder reorders values as needed and sets AVFrame.reordered_opaque - * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque - * @deprecated in favor of pkt_pts - */ - int64_t reordered_opaque; - - /** - * Sample rate of the audio data. - */ - int sample_rate; - - /** - * Channel layout of the audio data. - */ - uint64_t channel_layout; - - /** - * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. This array - * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must - * also be non-NULL for all j < i. - * - * There may be at most one AVBuffer per data plane, so for video this array - * always contains all the references. For planar audio with more than - * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in - * this array. Then the extra AVBufferRef pointers are stored in the - * extended_buf array. - */ - AVBufferRef *buf[AV_NUM_DATA_POINTERS]; - - /** - * For planar audio which requires more than AV_NUM_DATA_POINTERS - * AVBufferRef pointers, this array will hold all the references which - * cannot fit into AVFrame.buf. - * - * Note that this is different from AVFrame.extended_data, which always - * contains all the pointers. This array only contains the extra pointers, - * which cannot fit into AVFrame.buf. - * - * This array is always allocated using av_malloc() by whoever constructs - * the frame. It is freed in av_frame_unref(). - */ - AVBufferRef **extended_buf; - /** - * Number of elements in extended_buf. - */ - int nb_extended_buf; - - AVFrameSideData **side_data; - int nb_side_data; - -/** - * @defgroup lavu_frame_flags AV_FRAME_FLAGS - * @ingroup lavu_frame - * Flags describing additional frame properties. - * - * @{ - */ - -/** - * The frame data may be corrupted, e.g. due to decoding errors. - */ -#define AV_FRAME_FLAG_CORRUPT (1 << 0) -/** - * A flag to mark the frames which need to be decoded, but shouldn't be output. - */ -#define AV_FRAME_FLAG_DISCARD (1 << 2) -/** - * @} - */ - - /** - * Frame flags, a combination of @ref lavu_frame_flags - */ - int flags; - - /** - * MPEG vs JPEG YUV range. - * It must be accessed using av_frame_get_color_range() and - * av_frame_set_color_range(). - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorRange color_range; - - enum AVColorPrimaries color_primaries; - - enum AVColorTransferCharacteristic color_trc; - - /** - * YUV colorspace type. - * It must be accessed using av_frame_get_colorspace() and - * av_frame_set_colorspace(). - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - enum AVColorSpace colorspace; - - enum AVChromaLocation chroma_location; - - /** - * frame timestamp estimated using various heuristics, in stream time base - * Code outside libavutil should access this field using: - * av_frame_get_best_effort_timestamp(frame) - * - encoding: unused - * - decoding: set by libavcodec, read by user. - */ - int64_t best_effort_timestamp; - - /** - * reordered pos from the last AVPacket that has been input into the decoder - * Code outside libavutil should access this field using: - * av_frame_get_pkt_pos(frame) - * - encoding: unused - * - decoding: Read by user. - */ - int64_t pkt_pos; - - /** - * duration of the corresponding packet, expressed in - * AVStream->time_base units, 0 if unknown. - * Code outside libavutil should access this field using: - * av_frame_get_pkt_duration(frame) - * - encoding: unused - * - decoding: Read by user. - */ - int64_t pkt_duration; - - /** - * metadata. - * Code outside libavutil should access this field using: - * av_frame_get_metadata(frame) - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - AVDictionary *metadata; - - /** - * decode error flags of the frame, set to a combination of - * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there - * were errors during the decoding. - * Code outside libavutil should access this field using: - * av_frame_get_decode_error_flags(frame) - * - encoding: unused - * - decoding: set by libavcodec, read by user. - */ - int decode_error_flags; -#define FF_DECODE_ERROR_INVALID_BITSTREAM 1 -#define FF_DECODE_ERROR_MISSING_REFERENCE 2 - - /** - * number of audio channels, only used for audio. - * Code outside libavutil should access this field using: - * av_frame_get_channels(frame) - * - encoding: unused - * - decoding: Read by user. - */ - int channels; - - /** - * size of the corresponding packet containing the compressed - * frame. It must be accessed using av_frame_get_pkt_size() and - * av_frame_set_pkt_size(). - * It is set to a negative value if unknown. - * - encoding: unused - * - decoding: set by libavcodec, read by user. - */ - int pkt_size; - -#if FF_API_FRAME_QP - /** - * QP table - * Not to be accessed directly from outside libavutil - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - * Not to be accessed directly from outside libavutil - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - /** - * Not to be accessed directly from outside libavutil - */ - AVBufferRef *qp_table_buf; -#endif - /** - * For hwaccel-format frames, this should be a reference to the - * AVHWFramesContext describing the frame. - */ - AVBufferRef *hw_frames_ctx; -} AVFrame; - -/** - * Accessors for some AVFrame fields. - * The position of these field in the structure is not part of the ABI, - * they should not be accessed directly outside libavutil. - */ -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -int64_t av_frame_get_channel_layout (const AVFrame *frame); -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -int av_frame_get_channels (const AVFrame *frame); -void av_frame_set_channels (AVFrame *frame, int val); -int av_frame_get_sample_rate (const AVFrame *frame); -void av_frame_set_sample_rate (AVFrame *frame, int val); -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -int av_frame_get_decode_error_flags (const AVFrame *frame); -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -int av_frame_get_pkt_size(const AVFrame *frame); -void av_frame_set_pkt_size(AVFrame *frame, int val); -AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); -#if FF_API_FRAME_QP -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); - -/** - * Get the name of a colorspace. - * @return a static string identifying the colorspace; can be NULL. - */ -const char *av_get_colorspace_name(enum AVColorSpace val); - -/** - * Allocate an AVFrame and set its fields to default values. The resulting - * struct must be freed using av_frame_free(). - * - * @return An AVFrame filled with default values or NULL on failure. - * - * @note this only allocates the AVFrame itself, not the data buffers. Those - * must be allocated through other means, e.g. with av_frame_get_buffer() or - * manually. - */ -AVFrame *av_frame_alloc(void); - -/** - * Free the frame and any dynamically allocated objects in it, - * e.g. extended_data. If the frame is reference counted, it will be - * unreferenced first. - * - * @param frame frame to be freed. The pointer will be set to NULL. - */ -void av_frame_free(AVFrame **frame); - -/** - * Set up a new reference to the data described by the source frame. - * - * Copy frame properties from src to dst and create a new reference for each - * AVBufferRef from src. - * - * If src is not reference counted, new buffers are allocated and the data is - * copied. - * - * @warning: dst MUST have been either unreferenced with av_frame_unref(dst), - * or newly allocated with av_frame_alloc() before calling this - * function, or undefined behavior will occur. - * - * @return 0 on success, a negative AVERROR on error - */ -int av_frame_ref(AVFrame *dst, const AVFrame *src); - -/** - * Create a new frame that references the same data as src. - * - * This is a shortcut for av_frame_alloc()+av_frame_ref(). - * - * @return newly created AVFrame on success, NULL on error. - */ -AVFrame *av_frame_clone(const AVFrame *src); - -/** - * Unreference all the buffers referenced by frame and reset the frame fields. - */ -void av_frame_unref(AVFrame *frame); - -/** - * Move everything contained in src to dst and reset src. - * - * @warning: dst is not unreferenced, but directly overwritten without reading - * or deallocating its contents. Call av_frame_unref(dst) manually - * before calling this function to ensure that no memory is leaked. - */ -void av_frame_move_ref(AVFrame *dst, AVFrame *src); - -/** - * Allocate new buffer(s) for audio or video data. - * - * The following fields must be set on frame before calling this function: - * - format (pixel format for video, sample format for audio) - * - width and height for video - * - nb_samples and channel_layout for audio - * - * This function will fill AVFrame.data and AVFrame.buf arrays and, if - * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. - * For planar formats, one buffer will be allocated for each plane. - * - * @warning: if frame already has been allocated, calling this function will - * leak memory. In addition, undefined behavior can occur in certain - * cases. - * - * @param frame frame in which to store the new buffers. - * @param align required buffer size alignment - * - * @return 0 on success, a negative AVERROR on error. - */ -int av_frame_get_buffer(AVFrame *frame, int align); - -/** - * Check if the frame data is writable. - * - * @return A positive value if the frame data is writable (which is true if and - * only if each of the underlying buffers has only one reference, namely the one - * stored in this frame). Return 0 otherwise. - * - * If 1 is returned the answer is valid until av_buffer_ref() is called on any - * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). - * - * @see av_frame_make_writable(), av_buffer_is_writable() - */ -int av_frame_is_writable(AVFrame *frame); - -/** - * Ensure that the frame data is writable, avoiding data copy if possible. - * - * Do nothing if the frame is writable, allocate new buffers and copy the data - * if it is not. - * - * @return 0 on success, a negative AVERROR on error. - * - * @see av_frame_is_writable(), av_buffer_is_writable(), - * av_buffer_make_writable() - */ -int av_frame_make_writable(AVFrame *frame); - -/** - * Copy the frame data from src to dst. - * - * This function does not allocate anything, dst must be already initialized and - * allocated with the same parameters as src. - * - * This function only copies the frame data (i.e. the contents of the data / - * extended data arrays), not any other properties. - * - * @return >= 0 on success, a negative AVERROR on error. - */ -int av_frame_copy(AVFrame *dst, const AVFrame *src); - -/** - * Copy only "metadata" fields from src to dst. - * - * Metadata for the purpose of this function are those fields that do not affect - * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample - * aspect ratio (for video), but not width/height or channel layout. - * Side data is also copied. - */ -int av_frame_copy_props(AVFrame *dst, const AVFrame *src); - -/** - * Get the buffer reference a given data plane is stored in. - * - * @param plane index of the data plane of interest in frame->extended_data. - * - * @return the buffer reference that contains the plane or NULL if the input - * frame is not valid. - */ -AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); - -/** - * Add a new side data to a frame. - * - * @param frame a frame to which the side data should be added - * @param type type of the added side data - * @param size size of the side data - * - * @return newly added side data on success, NULL on error - */ -AVFrameSideData *av_frame_new_side_data(AVFrame *frame, - enum AVFrameSideDataType type, - int size); - -/** - * @return a pointer to the side data of a given type on success, NULL if there - * is no side data with such type in this frame. - */ -AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, - enum AVFrameSideDataType type); - -/** - * If side data of the supplied type exists in the frame, free it and remove it - * from the frame. - */ -void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); - -/** - * @return a string identifying the side data type - */ -const char *av_frame_side_data_name(enum AVFrameSideDataType type); - -/** - * @} - */ - -#endif /* AVUTIL_FRAME_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hash.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hash.h deleted file mode 100644 index a20b8934..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hash.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2013 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_hash_generic - * Generic hashing API - */ - -#ifndef AVUTIL_HASH_H -#define AVUTIL_HASH_H - -#include - -/** - * @defgroup lavu_hash Hash Functions - * @ingroup lavu_crypto - * Hash functions useful in multimedia. - * - * Hash functions are widely used in multimedia, from error checking and - * concealment to internal regression testing. libavutil has efficient - * implementations of a variety of hash functions that may be useful for - * FFmpeg and other multimedia applications. - * - * @{ - * - * @defgroup lavu_hash_generic Generic Hashing API - * An abstraction layer for all hash functions supported by libavutil. - * - * If your application needs to support a wide range of different hash - * functions, then the Generic Hashing API is for you. It provides a generic, - * reusable API for @ref lavu_hash "all hash functions" implemented in libavutil. - * If you just need to use one particular hash function, use the @ref lavu_hash - * "individual hash" directly. - * - * @section Sample Code - * - * A basic template for using the Generic Hashing API follows: - * - * @code - * struct AVHashContext *ctx = NULL; - * const char *hash_name = NULL; - * uint8_t *output_buf = NULL; - * - * // Select from a string returned by av_hash_names() - * hash_name = ...; - * - * // Allocate a hash context - * ret = av_hash_alloc(&ctx, hash_name); - * if (ret < 0) - * return ret; - * - * // Initialize the hash context - * av_hash_init(ctx); - * - * // Update the hash context with data - * while (data_left) { - * av_hash_update(ctx, data, size); - * } - * - * // Now we have no more data, so it is time to finalize the hash and get the - * // output. But we need to first allocate an output buffer. Note that you can - * // use any memory allocation function, including malloc(), not just - * // av_malloc(). - * output_buf = av_malloc(av_hash_get_size(ctx)); - * if (!output_buf) - * return AVERROR(ENOMEM); - * - * // Finalize the hash context. - * // You can use any of the av_hash_final*() functions provided, for other - * // output formats. If you do so, be sure to adjust the memory allocation - * // above. See the function documentation below for the exact amount of extra - * // memory needed. - * av_hash_final(ctx, output_buffer); - * - * // Free the context - * av_hash_freep(&ctx); - * @endcode - * - * @section Hash Function-Specific Information - * If the CRC32 hash is selected, the #AV_CRC_32_IEEE polynomial will be - * used. - * - * If the Murmur3 hash is selected, the default seed will be used. See @ref - * lavu_murmur3_seedinfo "Murmur3" for more information. - * - * @{ - */ - -/** - * @example ffhash.c - * This example is a simple command line application that takes one or more - * arguments. It demonstrates a typical use of the hashing API with allocation, - * initialization, updating, and finalizing. - */ - -struct AVHashContext; - -/** - * Allocate a hash context for the algorithm specified by name. - * - * @return >= 0 for success, a negative error code for failure - * - * @note The context is not initialized after a call to this function; you must - * call av_hash_init() to do so. - */ -int av_hash_alloc(struct AVHashContext **ctx, const char *name); - -/** - * Get the names of available hash algorithms. - * - * This function can be used to enumerate the algorithms. - * - * @param[in] i Index of the hash algorithm, starting from 0 - * @return Pointer to a static string or `NULL` if `i` is out of range - */ -const char *av_hash_names(int i); - -/** - * Get the name of the algorithm corresponding to the given hash context. - */ -const char *av_hash_get_name(const struct AVHashContext *ctx); - -/** - * Maximum value that av_hash_get_size() will currently return. - * - * You can use this if you absolutely want or need to use static allocation for - * the output buffer and are fine with not supporting hashes newly added to - * libavutil without recompilation. - * - * @warning - * Adding new hashes with larger sizes, and increasing the macro while doing - * so, will not be considered an ABI change. To prevent your code from - * overflowing a buffer, either dynamically allocate the output buffer with - * av_hash_get_size(), or limit your use of the Hashing API to hashes that are - * already in FFmpeg during the time of compilation. - */ -#define AV_HASH_MAX_SIZE 64 - -/** - * Get the size of the resulting hash value in bytes. - * - * The maximum value this function will currently return is available as macro - * #AV_HASH_MAX_SIZE. - * - * @param[in] ctx Hash context - * @return Size of the hash value in bytes - */ -int av_hash_get_size(const struct AVHashContext *ctx); - -/** - * Initialize or reset a hash context. - * - * @param[in,out] ctx Hash context - */ -void av_hash_init(struct AVHashContext *ctx); - -/** - * Update a hash context with additional data. - * - * @param[in,out] ctx Hash context - * @param[in] src Data to be added to the hash context - * @param[in] len Size of the additional data - */ -void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); - -/** - * Finalize a hash context and compute the actual hash value. - * - * The minimum size of `dst` buffer is given by av_hash_get_size() or - * #AV_HASH_MAX_SIZE. The use of the latter macro is discouraged. - * - * It is not safe to update or finalize a hash context again, if it has already - * been finalized. - * - * @param[in,out] ctx Hash context - * @param[out] dst Where the final hash value will be stored - * - * @see av_hash_final_bin() provides an alternative API - */ -void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); - -/** - * Finalize a hash context and store the actual hash value in a buffer. - * - * It is not safe to update or finalize a hash context again, if it has already - * been finalized. - * - * If `size` is smaller than the hash size (given by av_hash_get_size()), the - * hash is truncated; if size is larger, the buffer is padded with 0. - * - * @param[in,out] ctx Hash context - * @param[out] dst Where the final hash value will be stored - * @param[in] size Number of bytes to write to `dst` - */ -void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); - -/** - * Finalize a hash context and store the hexadecimal representation of the - * actual hash value as a string. - * - * It is not safe to update or finalize a hash context again, if it has already - * been finalized. - * - * The string is always 0-terminated. - * - * If `size` is smaller than `2 * hash_size + 1`, where `hash_size` is the - * value returned by av_hash_get_size(), the string will be truncated. - * - * @param[in,out] ctx Hash context - * @param[out] dst Where the string will be stored - * @param[in] size Maximum number of bytes to write to `dst` - */ -void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); - -/** - * Finalize a hash context and store the Base64 representation of the - * actual hash value as a string. - * - * It is not safe to update or finalize a hash context again, if it has already - * been finalized. - * - * The string is always 0-terminated. - * - * If `size` is smaller than AV_BASE64_SIZE(hash_size), where `hash_size` is - * the value returned by av_hash_get_size(), the string will be truncated. - * - * @param[in,out] ctx Hash context - * @param[out] dst Where the final hash value will be stored - * @param[in] size Maximum number of bytes to write to `dst` - */ -void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); - -/** - * Free hash context and set hash context pointer to `NULL`. - * - * @param[in,out] ctx Pointer to hash context - */ -void av_hash_freep(struct AVHashContext **ctx); - -/** - * @} - * @} - */ - -#endif /* AVUTIL_HASH_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hmac.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hmac.h deleted file mode 100644 index 576a0a4f..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hmac.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2012 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_HMAC_H -#define AVUTIL_HMAC_H - -#include - -#include "version.h" -/** - * @defgroup lavu_hmac HMAC - * @ingroup lavu_crypto - * @{ - */ - -enum AVHMACType { - AV_HMAC_MD5, - AV_HMAC_SHA1, - AV_HMAC_SHA224, - AV_HMAC_SHA256, - AV_HMAC_SHA384 = 12, - AV_HMAC_SHA512, -}; - -typedef struct AVHMAC AVHMAC; - -/** - * Allocate an AVHMAC context. - * @param type The hash function used for the HMAC. - */ -AVHMAC *av_hmac_alloc(enum AVHMACType type); - -/** - * Free an AVHMAC context. - * @param ctx The context to free, may be NULL - */ -void av_hmac_free(AVHMAC *ctx); - -/** - * Initialize an AVHMAC context with an authentication key. - * @param ctx The HMAC context - * @param key The authentication key - * @param keylen The length of the key, in bytes - */ -void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); - -/** - * Hash data with the HMAC. - * @param ctx The HMAC context - * @param data The data to hash - * @param len The length of the data, in bytes - */ -void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); - -/** - * Finish hashing and output the HMAC digest. - * @param ctx The HMAC context - * @param out The output buffer to write the digest into - * @param outlen The length of the out buffer, in bytes - * @return The number of bytes written to out, or a negative error code. - */ -int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); - -/** - * Hash an array of data with a key. - * @param ctx The HMAC context - * @param data The data to hash - * @param len The length of the data, in bytes - * @param key The authentication key - * @param keylen The length of the key, in bytes - * @param out The output buffer to write the digest into - * @param outlen The length of the out buffer, in bytes - * @return The number of bytes written to out, or a negative error code. - */ -int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, - const uint8_t *key, unsigned int keylen, - uint8_t *out, unsigned int outlen); - -/** - * @} - */ - -#endif /* AVUTIL_HMAC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext.h deleted file mode 100644 index 5e2af092..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext.h +++ /dev/null @@ -1,429 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_HWCONTEXT_H -#define AVUTIL_HWCONTEXT_H - -#include "buffer.h" -#include "frame.h" -#include "log.h" -#include "pixfmt.h" - -enum AVHWDeviceType { - AV_HWDEVICE_TYPE_VDPAU, - AV_HWDEVICE_TYPE_CUDA, - AV_HWDEVICE_TYPE_VAAPI, - AV_HWDEVICE_TYPE_DXVA2, - AV_HWDEVICE_TYPE_QSV, -}; - -typedef struct AVHWDeviceInternal AVHWDeviceInternal; - -/** - * This struct aggregates all the (hardware/vendor-specific) "high-level" state, - * i.e. state that is not tied to a concrete processing configuration. - * E.g., in an API that supports hardware-accelerated encoding and decoding, - * this struct will (if possible) wrap the state that is common to both encoding - * and decoding and from which specific instances of encoders or decoders can be - * derived. - * - * This struct is reference-counted with the AVBuffer mechanism. The - * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field - * points to the actual AVHWDeviceContext. Further objects derived from - * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with - * specific properties) will hold an internal reference to it. After all the - * references are released, the AVHWDeviceContext itself will be freed, - * optionally invoking a user-specified callback for uninitializing the hardware - * state. - */ -typedef struct AVHWDeviceContext { - /** - * A class for logging. Set by av_hwdevice_ctx_alloc(). - */ - const AVClass *av_class; - - /** - * Private data used internally by libavutil. Must not be accessed in any - * way by the caller. - */ - AVHWDeviceInternal *internal; - - /** - * This field identifies the underlying API used for hardware access. - * - * This field is set when this struct is allocated and never changed - * afterwards. - */ - enum AVHWDeviceType type; - - /** - * The format-specific data, allocated and freed by libavutil along with - * this context. - * - * Should be cast by the user to the format-specific context defined in the - * corresponding header (hwcontext_*.h) and filled as described in the - * documentation before calling av_hwdevice_ctx_init(). - * - * After calling av_hwdevice_ctx_init() this struct should not be modified - * by the caller. - */ - void *hwctx; - - /** - * This field may be set by the caller before calling av_hwdevice_ctx_init(). - * - * If non-NULL, this callback will be called when the last reference to - * this context is unreferenced, immediately before it is freed. - * - * @note when other objects (e.g an AVHWFramesContext) are derived from this - * struct, this callback will be invoked after all such child objects - * are fully uninitialized and their respective destructors invoked. - */ - void (*free)(struct AVHWDeviceContext *ctx); - - /** - * Arbitrary user data, to be used e.g. by the free() callback. - */ - void *user_opaque; -} AVHWDeviceContext; - -typedef struct AVHWFramesInternal AVHWFramesInternal; - -/** - * This struct describes a set or pool of "hardware" frames (i.e. those with - * data not located in normal system memory). All the frames in the pool are - * assumed to be allocated in the same way and interchangeable. - * - * This struct is reference-counted with the AVBuffer mechanism and tied to a - * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor - * yields a reference, whose data field points to the actual AVHWFramesContext - * struct. - */ -typedef struct AVHWFramesContext { - /** - * A class for logging. - */ - const AVClass *av_class; - - /** - * Private data used internally by libavutil. Must not be accessed in any - * way by the caller. - */ - AVHWFramesInternal *internal; - - /** - * A reference to the parent AVHWDeviceContext. This reference is owned and - * managed by the enclosing AVHWFramesContext, but the caller may derive - * additional references from it. - */ - AVBufferRef *device_ref; - - /** - * The parent AVHWDeviceContext. This is simply a pointer to - * device_ref->data provided for convenience. - * - * Set by libavutil in av_hwframe_ctx_init(). - */ - AVHWDeviceContext *device_ctx; - - /** - * The format-specific data, allocated and freed automatically along with - * this context. - * - * Should be cast by the user to the format-specific context defined in the - * corresponding header (hwframe_*.h) and filled as described in the - * documentation before calling av_hwframe_ctx_init(). - * - * After any frames using this context are created, the contents of this - * struct should not be modified by the caller. - */ - void *hwctx; - - /** - * This field may be set by the caller before calling av_hwframe_ctx_init(). - * - * If non-NULL, this callback will be called when the last reference to - * this context is unreferenced, immediately before it is freed. - */ - void (*free)(struct AVHWFramesContext *ctx); - - /** - * Arbitrary user data, to be used e.g. by the free() callback. - */ - void *user_opaque; - - /** - * A pool from which the frames are allocated by av_hwframe_get_buffer(). - * This field may be set by the caller before calling av_hwframe_ctx_init(). - * The buffers returned by calling av_buffer_pool_get() on this pool must - * have the properties described in the documentation in the corresponding hw - * type's header (hwcontext_*.h). The pool will be freed strictly before - * this struct's free() callback is invoked. - * - * This field may be NULL, then libavutil will attempt to allocate a pool - * internally. Note that certain device types enforce pools allocated at - * fixed size (frame count), which cannot be extended dynamically. In such a - * case, initial_pool_size must be set appropriately. - */ - AVBufferPool *pool; - - /** - * Initial size of the frame pool. If a device type does not support - * dynamically resizing the pool, then this is also the maximum pool size. - * - * May be set by the caller before calling av_hwframe_ctx_init(). Must be - * set if pool is NULL and the device type does not support dynamic pools. - */ - int initial_pool_size; - - /** - * The pixel format identifying the underlying HW surface type. - * - * Must be a hwaccel format, i.e. the corresponding descriptor must have the - * AV_PIX_FMT_FLAG_HWACCEL flag set. - * - * Must be set by the user before calling av_hwframe_ctx_init(). - */ - enum AVPixelFormat format; - - /** - * The pixel format identifying the actual data layout of the hardware - * frames. - * - * Must be set by the caller before calling av_hwframe_ctx_init(). - * - * @note when the underlying API does not provide the exact data layout, but - * only the colorspace/bit depth, this field should be set to the fully - * planar version of that format (e.g. for 8-bit 420 YUV it should be - * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else). - */ - enum AVPixelFormat sw_format; - - /** - * The allocated dimensions of the frames in this pool. - * - * Must be set by the user before calling av_hwframe_ctx_init(). - */ - int width, height; -} AVHWFramesContext; - -/** - * Allocate an AVHWDeviceContext for a given pixel format. - * - * @param format a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set - * on the corresponding format descriptor) - * @return a reference to the newly created AVHWDeviceContext on success or NULL - * on failure. - */ -AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type); - -/** - * Finalize the device context before use. This function must be called after - * the context is filled with all the required information and before it is - * used in any way. - * - * @param ref a reference to the AVHWDeviceContext - * @return 0 on success, a negative AVERROR code on failure - */ -int av_hwdevice_ctx_init(AVBufferRef *ref); - -/** - * Open a device of the specified type and create an AVHWDeviceContext for it. - * - * This is a convenience function intended to cover the simple cases. Callers - * who need to fine-tune device creation/management should open the device - * manually and then wrap it in an AVHWDeviceContext using - * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init(). - * - * The returned context is already initialized and ready for use, the caller - * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of - * the created AVHWDeviceContext are set by this function and should not be - * touched by the caller. - * - * @param device_ctx On success, a reference to the newly-created device context - * will be written here. The reference is owned by the caller - * and must be released with av_buffer_unref() when no longer - * needed. On failure, NULL will be written to this pointer. - * @param type The type of the device to create. - * @param device A type-specific string identifying the device to open. - * @param opts A dictionary of additional (type-specific) options to use in - * opening the device. The dictionary remains owned by the caller. - * @param flags currently unused - * - * @return 0 on success, a negative AVERROR code on failure. - */ -int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type, - const char *device, AVDictionary *opts, int flags); - -/** - * Allocate an AVHWFramesContext tied to a given device context. - * - * @param device_ctx a reference to a AVHWDeviceContext. This function will make - * a new reference for internal use, the one passed to the - * function remains owned by the caller. - * @return a reference to the newly created AVHWFramesContext on success or NULL - * on failure. - */ -AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx); - -/** - * Finalize the context before use. This function must be called after the - * context is filled with all the required information and before it is attached - * to any frames. - * - * @param ref a reference to the AVHWFramesContext - * @return 0 on success, a negative AVERROR code on failure - */ -int av_hwframe_ctx_init(AVBufferRef *ref); - -/** - * Allocate a new frame attached to the given AVHWFramesContext. - * - * @param hwframe_ctx a reference to an AVHWFramesContext - * @param frame an empty (freshly allocated or unreffed) frame to be filled with - * newly allocated buffers. - * @param flags currently unused, should be set to zero - * @return 0 on success, a negative AVERROR code on failure - */ -int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags); - -/** - * Copy data to or from a hw surface. At least one of dst/src must have an - * AVHWFramesContext attached. - * - * If src has an AVHWFramesContext attached, then the format of dst (if set) - * must use one of the formats returned by av_hwframe_transfer_get_formats(src, - * AV_HWFRAME_TRANSFER_DIRECTION_FROM). - * If dst has an AVHWFramesContext attached, then the format of src must use one - * of the formats returned by av_hwframe_transfer_get_formats(dst, - * AV_HWFRAME_TRANSFER_DIRECTION_TO) - * - * dst may be "clean" (i.e. with data/buf pointers unset), in which case the - * data buffers will be allocated by this function using av_frame_get_buffer(). - * If dst->format is set, then this format will be used, otherwise (when - * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen. - * - * @param dst the destination frame. dst is not touched on failure. - * @param src the source frame. - * @param flags currently unused, should be set to zero - * @return 0 on success, a negative AVERROR error code on failure. - */ -int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags); - -enum AVHWFrameTransferDirection { - /** - * Transfer the data from the queried hw frame. - */ - AV_HWFRAME_TRANSFER_DIRECTION_FROM, - - /** - * Transfer the data to the queried hw frame. - */ - AV_HWFRAME_TRANSFER_DIRECTION_TO, -}; - -/** - * Get a list of possible source or target formats usable in - * av_hwframe_transfer_data(). - * - * @param hwframe_ctx the frame context to obtain the information for - * @param dir the direction of the transfer - * @param formats the pointer to the output format list will be written here. - * The list is terminated with AV_PIX_FMT_NONE and must be freed - * by the caller when no longer needed using av_free(). - * If this function returns successfully, the format list will - * have at least one item (not counting the terminator). - * On failure, the contents of this pointer are unspecified. - * @param flags currently unused, should be set to zero - * @return 0 on success, a negative AVERROR code on failure. - */ -int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx, - enum AVHWFrameTransferDirection dir, - enum AVPixelFormat **formats, int flags); - - -/** - * This struct describes the constraints on hardware frames attached to - * a given device with a hardware-specific configuration. This is returned - * by av_hwdevice_get_hwframe_constraints() and must be freed by - * av_hwframe_constraints_free() after use. - */ -typedef struct AVHWFramesConstraints { - /** - * A list of possible values for format in the hw_frames_ctx, - * terminated by AV_PIX_FMT_NONE. This member will always be filled. - */ - enum AVPixelFormat *valid_hw_formats; - - /** - * A list of possible values for sw_format in the hw_frames_ctx, - * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is - * not known. - */ - enum AVPixelFormat *valid_sw_formats; - - /** - * The minimum size of frames in this hw_frames_ctx. - * (Zero if not known.) - */ - int min_width; - int min_height; - - /** - * The maximum size of frames in this hw_frames_ctx. - * (INT_MAX if not known / no limit.) - */ - int max_width; - int max_height; -} AVHWFramesConstraints; - -/** - * Allocate a HW-specific configuration structure for a given HW device. - * After use, the user must free all members as required by the specific - * hardware structure being used, then free the structure itself with - * av_free(). - * - * @param device_ctx a reference to the associated AVHWDeviceContext. - * @return The newly created HW-specific configuration structure on - * success or NULL on failure. - */ -void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx); - -/** - * Get the constraints on HW frames given a device and the HW-specific - * configuration to be used with that device. If no HW-specific - * configuration is provided, returns the maximum possible capabilities - * of the device. - * - * @param device_ctx a reference to the associated AVHWDeviceContext. - * @param hwconfig a filled HW-specific configuration structure, or NULL - * to return the maximum possible capabilities of the device. - * @return AVHWFramesConstraints structure describing the constraints - * on the device, or NULL if not available. - */ -AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, - const void *hwconfig); - -/** - * Free an AVHWFrameConstraints structure. - * - * @param constraints The (filled or unfilled) AVHWFrameConstraints structure. - */ -void av_hwframe_constraints_free(AVHWFramesConstraints **constraints); - -#endif /* AVUTIL_HWCONTEXT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_cuda.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_cuda.h deleted file mode 100644 index 23a77cee..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_cuda.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef AVUTIL_HWCONTEXT_CUDA_H -#define AVUTIL_HWCONTEXT_CUDA_H - -#include - -#include "pixfmt.h" - -/** - * @file - * An API-specific header for AV_HWDEVICE_TYPE_CUDA. - * - * This API supports dynamic frame pools. AVHWFramesContext.pool must return - * AVBufferRefs whose data pointer is a CUdeviceptr. - */ - -/** - * This struct is allocated as AVHWDeviceContext.hwctx - */ -typedef struct AVCUDADeviceContext { - CUcontext cuda_ctx; -} AVCUDADeviceContext; - -/** - * AVHWFramesContext.hwctx is currently not used - */ - -#endif /* AVUTIL_HWCONTEXT_CUDA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_dxva2.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_dxva2.h deleted file mode 100644 index 6c36cb4b..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_dxva2.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef AVUTIL_HWCONTEXT_DXVA2_H -#define AVUTIL_HWCONTEXT_DXVA2_H - -/** - * @file - * An API-specific header for AV_HWDEVICE_TYPE_DXVA2. - * - * Only fixed-size pools are supported. - * - * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs - * with the data pointer set to a pointer to IDirect3DSurface9. - */ - -#include -#include - -/** - * This struct is allocated as AVHWDeviceContext.hwctx - */ -typedef struct AVDXVA2DeviceContext { - IDirect3DDeviceManager9 *devmgr; -} AVDXVA2DeviceContext; - -/** - * This struct is allocated as AVHWFramesContext.hwctx - */ -typedef struct AVDXVA2FramesContext { - /** - * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or - * DXVA2_VideoDecoderRenderTarget). Must be set by the caller. - */ - DWORD surface_type; - - /** - * The surface pool. When an external pool is not provided by the caller, - * this will be managed (allocated and filled on init, freed on uninit) by - * libavutil. - */ - IDirect3DSurface9 **surfaces; - int nb_surfaces; - - /** - * Certain drivers require the decoder to be destroyed before the surfaces. - * To allow internally managed pools to work properly in such cases, this - * field is provided. - * - * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on - * it just before the internal surface pool is freed. - */ - IDirectXVideoDecoder *decoder_to_release; -} AVDXVA2FramesContext; - -#endif /* AVUTIL_HWCONTEXT_DXVA2_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_qsv.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_qsv.h deleted file mode 100644 index b98d611c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_qsv.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_HWCONTEXT_QSV_H -#define AVUTIL_HWCONTEXT_QSV_H - -#include - -/** - * @file - * An API-specific header for AV_HWDEVICE_TYPE_QSV. - * - * This API does not support dynamic frame pools. AVHWFramesContext.pool must - * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. - */ - -/** - * This struct is allocated as AVHWDeviceContext.hwctx - */ -typedef struct AVQSVDeviceContext { - mfxSession session; -} AVQSVDeviceContext; - -/** - * This struct is allocated as AVHWFramesContext.hwctx - */ -typedef struct AVQSVFramesContext { - mfxFrameSurface1 *surfaces; - int nb_surfaces; - - /** - * A combination of MFX_MEMTYPE_* describing the frame pool. - */ - int frame_type; -} AVQSVFramesContext; - -#endif /* AVUTIL_HWCONTEXT_QSV_H */ - diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vaapi.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vaapi.h deleted file mode 100644 index 7fd1a36e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vaapi.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_HWCONTEXT_VAAPI_H -#define AVUTIL_HWCONTEXT_VAAPI_H - -#include - -/** - * @file - * API-specific header for AV_HWDEVICE_TYPE_VAAPI. - * - * Dynamic frame pools are supported, but note that any pool used as a render - * target is required to be of fixed size in order to be be usable as an - * argument to vaCreateContext(). - * - * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs - * with the data pointer set to a VASurfaceID. - */ - -/** - * VAAPI connection details. - * - * Allocated as AVHWDeviceContext.hwctx - */ -typedef struct AVVAAPIDeviceContext { - /** - * The VADisplay handle, to be filled by the user. - */ - VADisplay display; -} AVVAAPIDeviceContext; - -/** - * VAAPI-specific data associated with a frame pool. - * - * Allocated as AVHWFramesContext.hwctx. - */ -typedef struct AVVAAPIFramesContext { - /** - * Set by the user to apply surface attributes to all surfaces in - * the frame pool. If null, default settings are used. - */ - VASurfaceAttrib *attributes; - int nb_attributes; - /** - * The surfaces IDs of all surfaces in the pool after creation. - * Only valid if AVHWFramesContext.initial_pool_size was positive. - * These are intended to be used as the render_targets arguments to - * vaCreateContext(). - */ - VASurfaceID *surface_ids; - int nb_surfaces; -} AVVAAPIFramesContext; - -/** - * VAAPI hardware pipeline configuration details. - * - * Allocated with av_hwdevice_hwconfig_alloc(). - */ -typedef struct AVVAAPIHWConfig { - /** - * ID of a VAAPI pipeline configuration. - */ - VAConfigID config_id; -} AVVAAPIHWConfig; - -#endif /* AVUTIL_HWCONTEXT_VAAPI_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vdpau.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vdpau.h deleted file mode 100644 index 1b7ea1e4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/hwcontext_vdpau.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_HWCONTEXT_VDPAU_H -#define AVUTIL_HWCONTEXT_VDPAU_H - -#include - -/** - * @file - * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. - * - * This API supports dynamic frame pools. AVHWFramesContext.pool must return - * AVBufferRefs whose data pointer is a VdpVideoSurface. - */ - -/** - * This struct is allocated as AVHWDeviceContext.hwctx - */ -typedef struct AVVDPAUDeviceContext { - VdpDevice device; - VdpGetProcAddress *get_proc_address; -} AVVDPAUDeviceContext; - -/** - * AVHWFramesContext.hwctx is currently not used - */ - -#endif /* AVUTIL_HWCONTEXT_VDPAU_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/imgutils.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/imgutils.h deleted file mode 100644 index 19f34dec..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/imgutils.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_IMGUTILS_H -#define AVUTIL_IMGUTILS_H - -/** - * @file - * misc image utilities - * - * @addtogroup lavu_picture - * @{ - */ - -#include "avutil.h" -#include "pixdesc.h" -#include "rational.h" - -/** - * Compute the max pixel step for each plane of an image with a - * format described by pixdesc. - * - * The pixel step is the distance in bytes between the first byte of - * the group of bytes which describe a pixel component and the first - * byte of the successive group in the same plane for the same - * component. - * - * @param max_pixsteps an array which is filled with the max pixel step - * for each plane. Since a plane may contain different pixel - * components, the computed max_pixsteps[plane] is relative to the - * component in the plane with the max pixel step. - * @param max_pixstep_comps an array which is filled with the component - * for each plane which has the max pixel step. May be NULL. - */ -void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], - const AVPixFmtDescriptor *pixdesc); - -/** - * Compute the size of an image line with format pix_fmt and width - * width for the plane plane. - * - * @return the computed size in bytes - */ -int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); - -/** - * Fill plane linesizes for an image with pixel format pix_fmt and - * width width. - * - * @param linesizes array to be filled with the linesize for each plane - * @return >= 0 in case of success, a negative error code otherwise - */ -int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); - -/** - * Fill plane data pointers for an image with pixel format pix_fmt and - * height height. - * - * @param data pointers array to be filled with the pointer for each image plane - * @param ptr the pointer to a buffer which will contain the image - * @param linesizes the array containing the linesize for each - * plane, should be filled by av_image_fill_linesizes() - * @return the size in bytes required for the image buffer, a negative - * error code in case of failure - */ -int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, - uint8_t *ptr, const int linesizes[4]); - -/** - * Allocate an image with size w and h and pixel format pix_fmt, and - * fill pointers and linesizes accordingly. - * The allocated image buffer has to be freed by using - * av_freep(&pointers[0]). - * - * @param align the value to use for buffer size alignment - * @return the size in bytes required for the image buffer, a negative - * error code in case of failure - */ -int av_image_alloc(uint8_t *pointers[4], int linesizes[4], - int w, int h, enum AVPixelFormat pix_fmt, int align); - -/** - * Copy image plane from src to dst. - * That is, copy "height" number of lines of "bytewidth" bytes each. - * The first byte of each successive line is separated by *_linesize - * bytes. - * - * bytewidth must be contained by both absolute values of dst_linesize - * and src_linesize, otherwise the function behavior is undefined. - * - * @param dst_linesize linesize for the image plane in dst - * @param src_linesize linesize for the image plane in src - */ -void av_image_copy_plane(uint8_t *dst, int dst_linesize, - const uint8_t *src, int src_linesize, - int bytewidth, int height); - -/** - * Copy image in src_data to dst_data. - * - * @param dst_linesizes linesizes for the image in dst_data - * @param src_linesizes linesizes for the image in src_data - */ -void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], - const uint8_t *src_data[4], const int src_linesizes[4], - enum AVPixelFormat pix_fmt, int width, int height); - -/** - * Setup the data pointers and linesizes based on the specified image - * parameters and the provided array. - * - * The fields of the given image are filled in by using the src - * address which points to the image data buffer. Depending on the - * specified pixel format, one or multiple image data pointers and - * line sizes will be set. If a planar format is specified, several - * pointers will be set pointing to the different picture planes and - * the line sizes of the different planes will be stored in the - * lines_sizes array. Call with src == NULL to get the required - * size for the src buffer. - * - * To allocate the buffer and fill in the dst_data and dst_linesize in - * one call, use av_image_alloc(). - * - * @param dst_data data pointers to be filled in - * @param dst_linesizes linesizes for the image in dst_data to be filled in - * @param src buffer which will contain or contains the actual image data, can be NULL - * @param pix_fmt the pixel format of the image - * @param width the width of the image in pixels - * @param height the height of the image in pixels - * @param align the value used in src for linesize alignment - * @return the size in bytes required for src, a negative error code - * in case of failure - */ -int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], - const uint8_t *src, - enum AVPixelFormat pix_fmt, int width, int height, int align); - -/** - * Return the size in bytes of the amount of data required to store an - * image with the given parameters. - * - * @param[in] align the assumed linesize alignment - */ -int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align); - -/** - * Copy image data from an image into a buffer. - * - * av_image_get_buffer_size() can be used to compute the required size - * for the buffer to fill. - * - * @param dst a buffer into which picture data will be copied - * @param dst_size the size in bytes of dst - * @param src_data pointers containing the source image data - * @param src_linesizes linesizes for the image in src_data - * @param pix_fmt the pixel format of the source image - * @param width the width of the source image in pixels - * @param height the height of the source image in pixels - * @param align the assumed linesize alignment for dst - * @return the number of bytes written to dst, or a negative value - * (error code) on error - */ -int av_image_copy_to_buffer(uint8_t *dst, int dst_size, - const uint8_t * const src_data[4], const int src_linesize[4], - enum AVPixelFormat pix_fmt, int width, int height, int align); - -/** - * Check if the given dimension of an image is valid, meaning that all - * bytes of the image can be addressed with a signed int. - * - * @param w the width of the picture - * @param h the height of the picture - * @param log_offset the offset to sum to the log level for logging with log_ctx - * @param log_ctx the parent logging context, it may be NULL - * @return >= 0 if valid, a negative error code otherwise - */ -int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); - -/** - * Check if the given dimension of an image is valid, meaning that all - * bytes of the image can be addressed with a signed int. - * - * @param w the width of the picture - * @param h the height of the picture - * @param max_pixels the maximum number of pixels the user wants to accept - * @param pix_fmt the pixel format, can be AV_PIX_FMT_NONE if unknown. - * @param log_offset the offset to sum to the log level for logging with log_ctx - * @param log_ctx the parent logging context, it may be NULL - * @return >= 0 if valid, a negative error code otherwise - */ -int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx); - -/** - * Check if the given sample aspect ratio of an image is valid. - * - * It is considered invalid if the denominator is 0 or if applying the ratio - * to the image size would make the smaller dimension less than 1. If the - * sar numerator is 0, it is considered unknown and will return as valid. - * - * @param w width of the image - * @param h height of the image - * @param sar sample aspect ratio of the image - * @return 0 if valid, a negative AVERROR code otherwise - */ -int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); - -/** - * @} - */ - - -#endif /* AVUTIL_IMGUTILS_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intfloat.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intfloat.h deleted file mode 100644 index fe3d7ec4..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intfloat.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_INTFLOAT_H -#define AVUTIL_INTFLOAT_H - -#include -#include "attributes.h" - -union av_intfloat32 { - uint32_t i; - float f; -}; - -union av_intfloat64 { - uint64_t i; - double f; -}; - -/** - * Reinterpret a 32-bit integer as a float. - */ -static av_always_inline float av_int2float(uint32_t i) -{ - union av_intfloat32 v; - v.i = i; - return v.f; -} - -/** - * Reinterpret a float as a 32-bit integer. - */ -static av_always_inline uint32_t av_float2int(float f) -{ - union av_intfloat32 v; - v.f = f; - return v.i; -} - -/** - * Reinterpret a 64-bit integer as a double. - */ -static av_always_inline double av_int2double(uint64_t i) -{ - union av_intfloat64 v; - v.i = i; - return v.f; -} - -/** - * Reinterpret a double as a 64-bit integer. - */ -static av_always_inline uint64_t av_double2int(double f) -{ - union av_intfloat64 v; - v.f = f; - return v.i; -} - -#endif /* AVUTIL_INTFLOAT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intreadwrite.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intreadwrite.h deleted file mode 100644 index 51fbe30a..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/intreadwrite.h +++ /dev/null @@ -1,629 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_INTREADWRITE_H -#define AVUTIL_INTREADWRITE_H - -#include -#include "libavutil/avconfig.h" -#include "attributes.h" -#include "bswap.h" - -typedef union { - uint64_t u64; - uint32_t u32[2]; - uint16_t u16[4]; - uint8_t u8 [8]; - double f64; - float f32[2]; -} av_alias av_alias64; - -typedef union { - uint32_t u32; - uint16_t u16[2]; - uint8_t u8 [4]; - float f32; -} av_alias av_alias32; - -typedef union { - uint16_t u16; - uint8_t u8 [2]; -} av_alias av_alias16; - -/* - * Arch-specific headers can provide any combination of - * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. - * Preprocessor symbols must be defined, even if these are implemented - * as inline functions. - * - * R/W means read/write, B/L/N means big/little/native endianness. - * The following macros require aligned access, compared to their - * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A. - * Incorrect usage may range from abysmal performance to crash - * depending on the platform. - * - * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U. - */ - -#ifdef HAVE_AV_CONFIG_H - -#include "config.h" - -#if ARCH_ARM -# include "arm/intreadwrite.h" -#elif ARCH_AVR32 -# include "avr32/intreadwrite.h" -#elif ARCH_MIPS -# include "mips/intreadwrite.h" -#elif ARCH_PPC -# include "ppc/intreadwrite.h" -#elif ARCH_TOMI -# include "tomi/intreadwrite.h" -#elif ARCH_X86 -# include "x86/intreadwrite.h" -#endif - -#endif /* HAVE_AV_CONFIG_H */ - -/* - * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. - */ - -#if AV_HAVE_BIGENDIAN - -# if defined(AV_RN16) && !defined(AV_RB16) -# define AV_RB16(p) AV_RN16(p) -# elif !defined(AV_RN16) && defined(AV_RB16) -# define AV_RN16(p) AV_RB16(p) -# endif - -# if defined(AV_WN16) && !defined(AV_WB16) -# define AV_WB16(p, v) AV_WN16(p, v) -# elif !defined(AV_WN16) && defined(AV_WB16) -# define AV_WN16(p, v) AV_WB16(p, v) -# endif - -# if defined(AV_RN24) && !defined(AV_RB24) -# define AV_RB24(p) AV_RN24(p) -# elif !defined(AV_RN24) && defined(AV_RB24) -# define AV_RN24(p) AV_RB24(p) -# endif - -# if defined(AV_WN24) && !defined(AV_WB24) -# define AV_WB24(p, v) AV_WN24(p, v) -# elif !defined(AV_WN24) && defined(AV_WB24) -# define AV_WN24(p, v) AV_WB24(p, v) -# endif - -# if defined(AV_RN32) && !defined(AV_RB32) -# define AV_RB32(p) AV_RN32(p) -# elif !defined(AV_RN32) && defined(AV_RB32) -# define AV_RN32(p) AV_RB32(p) -# endif - -# if defined(AV_WN32) && !defined(AV_WB32) -# define AV_WB32(p, v) AV_WN32(p, v) -# elif !defined(AV_WN32) && defined(AV_WB32) -# define AV_WN32(p, v) AV_WB32(p, v) -# endif - -# if defined(AV_RN48) && !defined(AV_RB48) -# define AV_RB48(p) AV_RN48(p) -# elif !defined(AV_RN48) && defined(AV_RB48) -# define AV_RN48(p) AV_RB48(p) -# endif - -# if defined(AV_WN48) && !defined(AV_WB48) -# define AV_WB48(p, v) AV_WN48(p, v) -# elif !defined(AV_WN48) && defined(AV_WB48) -# define AV_WN48(p, v) AV_WB48(p, v) -# endif - -# if defined(AV_RN64) && !defined(AV_RB64) -# define AV_RB64(p) AV_RN64(p) -# elif !defined(AV_RN64) && defined(AV_RB64) -# define AV_RN64(p) AV_RB64(p) -# endif - -# if defined(AV_WN64) && !defined(AV_WB64) -# define AV_WB64(p, v) AV_WN64(p, v) -# elif !defined(AV_WN64) && defined(AV_WB64) -# define AV_WN64(p, v) AV_WB64(p, v) -# endif - -#else /* AV_HAVE_BIGENDIAN */ - -# if defined(AV_RN16) && !defined(AV_RL16) -# define AV_RL16(p) AV_RN16(p) -# elif !defined(AV_RN16) && defined(AV_RL16) -# define AV_RN16(p) AV_RL16(p) -# endif - -# if defined(AV_WN16) && !defined(AV_WL16) -# define AV_WL16(p, v) AV_WN16(p, v) -# elif !defined(AV_WN16) && defined(AV_WL16) -# define AV_WN16(p, v) AV_WL16(p, v) -# endif - -# if defined(AV_RN24) && !defined(AV_RL24) -# define AV_RL24(p) AV_RN24(p) -# elif !defined(AV_RN24) && defined(AV_RL24) -# define AV_RN24(p) AV_RL24(p) -# endif - -# if defined(AV_WN24) && !defined(AV_WL24) -# define AV_WL24(p, v) AV_WN24(p, v) -# elif !defined(AV_WN24) && defined(AV_WL24) -# define AV_WN24(p, v) AV_WL24(p, v) -# endif - -# if defined(AV_RN32) && !defined(AV_RL32) -# define AV_RL32(p) AV_RN32(p) -# elif !defined(AV_RN32) && defined(AV_RL32) -# define AV_RN32(p) AV_RL32(p) -# endif - -# if defined(AV_WN32) && !defined(AV_WL32) -# define AV_WL32(p, v) AV_WN32(p, v) -# elif !defined(AV_WN32) && defined(AV_WL32) -# define AV_WN32(p, v) AV_WL32(p, v) -# endif - -# if defined(AV_RN48) && !defined(AV_RL48) -# define AV_RL48(p) AV_RN48(p) -# elif !defined(AV_RN48) && defined(AV_RL48) -# define AV_RN48(p) AV_RL48(p) -# endif - -# if defined(AV_WN48) && !defined(AV_WL48) -# define AV_WL48(p, v) AV_WN48(p, v) -# elif !defined(AV_WN48) && defined(AV_WL48) -# define AV_WN48(p, v) AV_WL48(p, v) -# endif - -# if defined(AV_RN64) && !defined(AV_RL64) -# define AV_RL64(p) AV_RN64(p) -# elif !defined(AV_RN64) && defined(AV_RL64) -# define AV_RN64(p) AV_RL64(p) -# endif - -# if defined(AV_WN64) && !defined(AV_WL64) -# define AV_WL64(p, v) AV_WN64(p, v) -# elif !defined(AV_WN64) && defined(AV_WL64) -# define AV_WN64(p, v) AV_WL64(p, v) -# endif - -#endif /* !AV_HAVE_BIGENDIAN */ - -/* - * Define AV_[RW]N helper macros to simplify definitions not provided - * by per-arch headers. - */ - -#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) - -union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; -union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; -union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; - -# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) -# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) - -#elif defined(__DECC) - -# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) -# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) - -#elif AV_HAVE_FAST_UNALIGNED - -# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) -# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) - -#else - -#ifndef AV_RB16 -# define AV_RB16(x) \ - ((((const uint8_t*)(x))[0] << 8) | \ - ((const uint8_t*)(x))[1]) -#endif -#ifndef AV_WB16 -# define AV_WB16(p, darg) do { \ - unsigned d = (darg); \ - ((uint8_t*)(p))[1] = (d); \ - ((uint8_t*)(p))[0] = (d)>>8; \ - } while(0) -#endif - -#ifndef AV_RL16 -# define AV_RL16(x) \ - ((((const uint8_t*)(x))[1] << 8) | \ - ((const uint8_t*)(x))[0]) -#endif -#ifndef AV_WL16 -# define AV_WL16(p, darg) do { \ - unsigned d = (darg); \ - ((uint8_t*)(p))[0] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - } while(0) -#endif - -#ifndef AV_RB32 -# define AV_RB32(x) \ - (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ - (((const uint8_t*)(x))[1] << 16) | \ - (((const uint8_t*)(x))[2] << 8) | \ - ((const uint8_t*)(x))[3]) -#endif -#ifndef AV_WB32 -# define AV_WB32(p, darg) do { \ - unsigned d = (darg); \ - ((uint8_t*)(p))[3] = (d); \ - ((uint8_t*)(p))[2] = (d)>>8; \ - ((uint8_t*)(p))[1] = (d)>>16; \ - ((uint8_t*)(p))[0] = (d)>>24; \ - } while(0) -#endif - -#ifndef AV_RL32 -# define AV_RL32(x) \ - (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ - (((const uint8_t*)(x))[2] << 16) | \ - (((const uint8_t*)(x))[1] << 8) | \ - ((const uint8_t*)(x))[0]) -#endif -#ifndef AV_WL32 -# define AV_WL32(p, darg) do { \ - unsigned d = (darg); \ - ((uint8_t*)(p))[0] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - ((uint8_t*)(p))[2] = (d)>>16; \ - ((uint8_t*)(p))[3] = (d)>>24; \ - } while(0) -#endif - -#ifndef AV_RB64 -# define AV_RB64(x) \ - (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ - ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ - ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ - ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ - ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ - ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ - ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ - (uint64_t)((const uint8_t*)(x))[7]) -#endif -#ifndef AV_WB64 -# define AV_WB64(p, darg) do { \ - uint64_t d = (darg); \ - ((uint8_t*)(p))[7] = (d); \ - ((uint8_t*)(p))[6] = (d)>>8; \ - ((uint8_t*)(p))[5] = (d)>>16; \ - ((uint8_t*)(p))[4] = (d)>>24; \ - ((uint8_t*)(p))[3] = (d)>>32; \ - ((uint8_t*)(p))[2] = (d)>>40; \ - ((uint8_t*)(p))[1] = (d)>>48; \ - ((uint8_t*)(p))[0] = (d)>>56; \ - } while(0) -#endif - -#ifndef AV_RL64 -# define AV_RL64(x) \ - (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ - ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ - ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ - ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ - ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ - ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ - ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ - (uint64_t)((const uint8_t*)(x))[0]) -#endif -#ifndef AV_WL64 -# define AV_WL64(p, darg) do { \ - uint64_t d = (darg); \ - ((uint8_t*)(p))[0] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - ((uint8_t*)(p))[2] = (d)>>16; \ - ((uint8_t*)(p))[3] = (d)>>24; \ - ((uint8_t*)(p))[4] = (d)>>32; \ - ((uint8_t*)(p))[5] = (d)>>40; \ - ((uint8_t*)(p))[6] = (d)>>48; \ - ((uint8_t*)(p))[7] = (d)>>56; \ - } while(0) -#endif - -#if AV_HAVE_BIGENDIAN -# define AV_RN(s, p) AV_RB##s(p) -# define AV_WN(s, p, v) AV_WB##s(p, v) -#else -# define AV_RN(s, p) AV_RL##s(p) -# define AV_WN(s, p, v) AV_WL##s(p, v) -#endif - -#endif /* HAVE_FAST_UNALIGNED */ - -#ifndef AV_RN16 -# define AV_RN16(p) AV_RN(16, p) -#endif - -#ifndef AV_RN32 -# define AV_RN32(p) AV_RN(32, p) -#endif - -#ifndef AV_RN64 -# define AV_RN64(p) AV_RN(64, p) -#endif - -#ifndef AV_WN16 -# define AV_WN16(p, v) AV_WN(16, p, v) -#endif - -#ifndef AV_WN32 -# define AV_WN32(p, v) AV_WN(32, p, v) -#endif - -#ifndef AV_WN64 -# define AV_WN64(p, v) AV_WN(64, p, v) -#endif - -#if AV_HAVE_BIGENDIAN -# define AV_RB(s, p) AV_RN##s(p) -# define AV_WB(s, p, v) AV_WN##s(p, v) -# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) -# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) -#else -# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) -# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) -# define AV_RL(s, p) AV_RN##s(p) -# define AV_WL(s, p, v) AV_WN##s(p, v) -#endif - -#define AV_RB8(x) (((const uint8_t*)(x))[0]) -#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) - -#define AV_RL8(x) AV_RB8(x) -#define AV_WL8(p, d) AV_WB8(p, d) - -#ifndef AV_RB16 -# define AV_RB16(p) AV_RB(16, p) -#endif -#ifndef AV_WB16 -# define AV_WB16(p, v) AV_WB(16, p, v) -#endif - -#ifndef AV_RL16 -# define AV_RL16(p) AV_RL(16, p) -#endif -#ifndef AV_WL16 -# define AV_WL16(p, v) AV_WL(16, p, v) -#endif - -#ifndef AV_RB32 -# define AV_RB32(p) AV_RB(32, p) -#endif -#ifndef AV_WB32 -# define AV_WB32(p, v) AV_WB(32, p, v) -#endif - -#ifndef AV_RL32 -# define AV_RL32(p) AV_RL(32, p) -#endif -#ifndef AV_WL32 -# define AV_WL32(p, v) AV_WL(32, p, v) -#endif - -#ifndef AV_RB64 -# define AV_RB64(p) AV_RB(64, p) -#endif -#ifndef AV_WB64 -# define AV_WB64(p, v) AV_WB(64, p, v) -#endif - -#ifndef AV_RL64 -# define AV_RL64(p) AV_RL(64, p) -#endif -#ifndef AV_WL64 -# define AV_WL64(p, v) AV_WL(64, p, v) -#endif - -#ifndef AV_RB24 -# define AV_RB24(x) \ - ((((const uint8_t*)(x))[0] << 16) | \ - (((const uint8_t*)(x))[1] << 8) | \ - ((const uint8_t*)(x))[2]) -#endif -#ifndef AV_WB24 -# define AV_WB24(p, d) do { \ - ((uint8_t*)(p))[2] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - ((uint8_t*)(p))[0] = (d)>>16; \ - } while(0) -#endif - -#ifndef AV_RL24 -# define AV_RL24(x) \ - ((((const uint8_t*)(x))[2] << 16) | \ - (((const uint8_t*)(x))[1] << 8) | \ - ((const uint8_t*)(x))[0]) -#endif -#ifndef AV_WL24 -# define AV_WL24(p, d) do { \ - ((uint8_t*)(p))[0] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - ((uint8_t*)(p))[2] = (d)>>16; \ - } while(0) -#endif - -#ifndef AV_RB48 -# define AV_RB48(x) \ - (((uint64_t)((const uint8_t*)(x))[0] << 40) | \ - ((uint64_t)((const uint8_t*)(x))[1] << 32) | \ - ((uint64_t)((const uint8_t*)(x))[2] << 24) | \ - ((uint64_t)((const uint8_t*)(x))[3] << 16) | \ - ((uint64_t)((const uint8_t*)(x))[4] << 8) | \ - (uint64_t)((const uint8_t*)(x))[5]) -#endif -#ifndef AV_WB48 -# define AV_WB48(p, darg) do { \ - uint64_t d = (darg); \ - ((uint8_t*)(p))[5] = (d); \ - ((uint8_t*)(p))[4] = (d)>>8; \ - ((uint8_t*)(p))[3] = (d)>>16; \ - ((uint8_t*)(p))[2] = (d)>>24; \ - ((uint8_t*)(p))[1] = (d)>>32; \ - ((uint8_t*)(p))[0] = (d)>>40; \ - } while(0) -#endif - -#ifndef AV_RL48 -# define AV_RL48(x) \ - (((uint64_t)((const uint8_t*)(x))[5] << 40) | \ - ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ - ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ - ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ - ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ - (uint64_t)((const uint8_t*)(x))[0]) -#endif -#ifndef AV_WL48 -# define AV_WL48(p, darg) do { \ - uint64_t d = (darg); \ - ((uint8_t*)(p))[0] = (d); \ - ((uint8_t*)(p))[1] = (d)>>8; \ - ((uint8_t*)(p))[2] = (d)>>16; \ - ((uint8_t*)(p))[3] = (d)>>24; \ - ((uint8_t*)(p))[4] = (d)>>32; \ - ((uint8_t*)(p))[5] = (d)>>40; \ - } while(0) -#endif - -/* - * The AV_[RW]NA macros access naturally aligned data - * in a type-safe way. - */ - -#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) -#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) - -#ifndef AV_RN16A -# define AV_RN16A(p) AV_RNA(16, p) -#endif - -#ifndef AV_RN32A -# define AV_RN32A(p) AV_RNA(32, p) -#endif - -#ifndef AV_RN64A -# define AV_RN64A(p) AV_RNA(64, p) -#endif - -#ifndef AV_WN16A -# define AV_WN16A(p, v) AV_WNA(16, p, v) -#endif - -#ifndef AV_WN32A -# define AV_WN32A(p, v) AV_WNA(32, p, v) -#endif - -#ifndef AV_WN64A -# define AV_WN64A(p, v) AV_WNA(64, p, v) -#endif - -/* - * The AV_COPYxxU macros are suitable for copying data to/from unaligned - * memory locations. - */ - -#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); - -#ifndef AV_COPY16U -# define AV_COPY16U(d, s) AV_COPYU(16, d, s) -#endif - -#ifndef AV_COPY32U -# define AV_COPY32U(d, s) AV_COPYU(32, d, s) -#endif - -#ifndef AV_COPY64U -# define AV_COPY64U(d, s) AV_COPYU(64, d, s) -#endif - -#ifndef AV_COPY128U -# define AV_COPY128U(d, s) \ - do { \ - AV_COPY64U(d, s); \ - AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ - } while(0) -#endif - -/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be - * naturally aligned. They may be implemented using MMX, - * so emms_c() must be called before using any float code - * afterwards. - */ - -#define AV_COPY(n, d, s) \ - (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) - -#ifndef AV_COPY16 -# define AV_COPY16(d, s) AV_COPY(16, d, s) -#endif - -#ifndef AV_COPY32 -# define AV_COPY32(d, s) AV_COPY(32, d, s) -#endif - -#ifndef AV_COPY64 -# define AV_COPY64(d, s) AV_COPY(64, d, s) -#endif - -#ifndef AV_COPY128 -# define AV_COPY128(d, s) \ - do { \ - AV_COPY64(d, s); \ - AV_COPY64((char*)(d)+8, (char*)(s)+8); \ - } while(0) -#endif - -#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) - -#ifndef AV_SWAP64 -# define AV_SWAP64(a, b) AV_SWAP(64, a, b) -#endif - -#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) - -#ifndef AV_ZERO16 -# define AV_ZERO16(d) AV_ZERO(16, d) -#endif - -#ifndef AV_ZERO32 -# define AV_ZERO32(d) AV_ZERO(32, d) -#endif - -#ifndef AV_ZERO64 -# define AV_ZERO64(d) AV_ZERO(64, d) -#endif - -#ifndef AV_ZERO128 -# define AV_ZERO128(d) \ - do { \ - AV_ZERO64(d); \ - AV_ZERO64((char*)(d)+8); \ - } while(0) -#endif - -#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lfg.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lfg.h deleted file mode 100644 index ec90562c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lfg.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Lagged Fibonacci PRNG - * Copyright (c) 2008 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_LFG_H -#define AVUTIL_LFG_H - -typedef struct AVLFG { - unsigned int state[64]; - int index; -} AVLFG; - -void av_lfg_init(AVLFG *c, unsigned int seed); - -/** - * Get the next random unsigned 32-bit number using an ALFG. - * - * Please also consider a simple LCG like state= state*1664525+1013904223, - * it may be good enough and faster for your specific use case. - */ -static inline unsigned int av_lfg_get(AVLFG *c){ - c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; - return c->state[c->index++ & 63]; -} - -/** - * Get the next random unsigned 32-bit number using a MLFG. - * - * Please also consider av_lfg_get() above, it is faster. - */ -static inline unsigned int av_mlfg_get(AVLFG *c){ - unsigned int a= c->state[(c->index-55) & 63]; - unsigned int b= c->state[(c->index-24) & 63]; - return c->state[c->index++ & 63] = 2*a*b+a+b; -} - -/** - * Get the next two numbers generated by a Box-Muller Gaussian - * generator using the random numbers issued by lfg. - * - * @param out array where the two generated numbers are placed - */ -void av_bmg_get(AVLFG *lfg, double out[2]); - -#endif /* AVUTIL_LFG_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/log.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/log.h deleted file mode 100644 index f0a57385..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/log.h +++ /dev/null @@ -1,376 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_LOG_H -#define AVUTIL_LOG_H - -#include -#include "avutil.h" -#include "attributes.h" -#include "version.h" - -typedef enum { - AV_CLASS_CATEGORY_NA = 0, - AV_CLASS_CATEGORY_INPUT, - AV_CLASS_CATEGORY_OUTPUT, - AV_CLASS_CATEGORY_MUXER, - AV_CLASS_CATEGORY_DEMUXER, - AV_CLASS_CATEGORY_ENCODER, - AV_CLASS_CATEGORY_DECODER, - AV_CLASS_CATEGORY_FILTER, - AV_CLASS_CATEGORY_BITSTREAM_FILTER, - AV_CLASS_CATEGORY_SWSCALER, - AV_CLASS_CATEGORY_SWRESAMPLER, - AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40, - AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, - AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, - AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, - AV_CLASS_CATEGORY_DEVICE_OUTPUT, - AV_CLASS_CATEGORY_DEVICE_INPUT, - AV_CLASS_CATEGORY_NB ///< not part of ABI/API -}AVClassCategory; - -#define AV_IS_INPUT_DEVICE(category) \ - (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ - ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ - ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) - -#define AV_IS_OUTPUT_DEVICE(category) \ - (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ - ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ - ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) - -struct AVOptionRanges; - -/** - * Describe the class of an AVClass context structure. That is an - * arbitrary struct of which the first field is a pointer to an - * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). - */ -typedef struct AVClass { - /** - * The name of the class; usually it is the same name as the - * context structure type to which the AVClass is associated. - */ - const char* class_name; - - /** - * A pointer to a function which returns the name of a context - * instance ctx associated with the class. - */ - const char* (*item_name)(void* ctx); - - /** - * a pointer to the first option specified in the class if any or NULL - * - * @see av_set_default_options() - */ - const struct AVOption *option; - - /** - * LIBAVUTIL_VERSION with which this structure was created. - * This is used to allow fields to be added without requiring major - * version bumps everywhere. - */ - - int version; - - /** - * Offset in the structure where log_level_offset is stored. - * 0 means there is no such variable - */ - int log_level_offset_offset; - - /** - * Offset in the structure where a pointer to the parent context for - * logging is stored. For example a decoder could pass its AVCodecContext - * to eval as such a parent context, which an av_log() implementation - * could then leverage to display the parent context. - * The offset can be NULL. - */ - int parent_log_context_offset; - - /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - - /** - * Return an AVClass corresponding to the next potential - * AVOptions-enabled child. - * - * The difference between child_next and this is that - * child_next iterates over _already existing_ objects, while - * child_class_next iterates over _all possible_ children. - */ - const struct AVClass* (*child_class_next)(const struct AVClass *prev); - - /** - * Category used for visualization (like color) - * This is only set if the category is equal for all objects using this class. - * available since version (51 << 16 | 56 << 8 | 100) - */ - AVClassCategory category; - - /** - * Callback to return the category. - * available since version (51 << 16 | 59 << 8 | 100) - */ - AVClassCategory (*get_category)(void* ctx); - - /** - * Callback to return the supported/allowed ranges. - * available since version (52.12) - */ - int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); -} AVClass; - -/** - * @addtogroup lavu_log - * - * @{ - * - * @defgroup lavu_log_constants Logging Constants - * - * @{ - */ - -/** - * Print no output. - */ -#define AV_LOG_QUIET -8 - -/** - * Something went really wrong and we will crash now. - */ -#define AV_LOG_PANIC 0 - -/** - * Something went wrong and recovery is not possible. - * For example, no header was found for a format which depends - * on headers or an illegal combination of parameters is used. - */ -#define AV_LOG_FATAL 8 - -/** - * Something went wrong and cannot losslessly be recovered. - * However, not all future data is affected. - */ -#define AV_LOG_ERROR 16 - -/** - * Something somehow does not look correct. This may or may not - * lead to problems. An example would be the use of '-vstrict -2'. - */ -#define AV_LOG_WARNING 24 - -/** - * Standard information. - */ -#define AV_LOG_INFO 32 - -/** - * Detailed information. - */ -#define AV_LOG_VERBOSE 40 - -/** - * Stuff which is only useful for libav* developers. - */ -#define AV_LOG_DEBUG 48 - -/** - * Extremely verbose debugging, useful for libav* development. - */ -#define AV_LOG_TRACE 56 - -#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET) - -/** - * @} - */ - -/** - * Sets additional colors for extended debugging sessions. - * @code - av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); - @endcode - * Requires 256color terminal support. Uses outside debugging is not - * recommended. - */ -#define AV_LOG_C(x) ((x) << 8) - -/** - * Send the specified message to the log if the level is less than or equal - * to the current av_log_level. By default, all logging messages are sent to - * stderr. This behavior can be altered by setting a different logging callback - * function. - * @see av_log_set_callback - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct or NULL if general log. - * @param level The importance level of the message expressed using a @ref - * lavu_log_constants "Logging Constant". - * @param fmt The format string (printf-compatible) that specifies how - * subsequent arguments are converted to output. - */ -void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); - - -/** - * Send the specified message to the log if the level is less than or equal - * to the current av_log_level. By default, all logging messages are sent to - * stderr. This behavior can be altered by setting a different logging callback - * function. - * @see av_log_set_callback - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message expressed using a @ref - * lavu_log_constants "Logging Constant". - * @param fmt The format string (printf-compatible) that specifies how - * subsequent arguments are converted to output. - * @param vl The arguments referenced by the format string. - */ -void av_vlog(void *avcl, int level, const char *fmt, va_list vl); - -/** - * Get the current log level - * - * @see lavu_log_constants - * - * @return Current log level - */ -int av_log_get_level(void); - -/** - * Set the log level - * - * @see lavu_log_constants - * - * @param level Logging level - */ -void av_log_set_level(int level); - -/** - * Set the logging callback - * - * @note The callback must be thread safe, even if the application does not use - * threads itself as some codecs are multithreaded. - * - * @see av_log_default_callback - * - * @param callback A logging function with a compatible signature. - */ -void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); - -/** - * Default logging callback - * - * It prints the message to stderr, optionally colorizing it. - * - * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. - * @param level The importance level of the message expressed using a @ref - * lavu_log_constants "Logging Constant". - * @param fmt The format string (printf-compatible) that specifies how - * subsequent arguments are converted to output. - * @param vl The arguments referenced by the format string. - */ -void av_log_default_callback(void *avcl, int level, const char *fmt, - va_list vl); - -/** - * Return the context name - * - * @param ctx The AVClass context - * - * @return The AVClass class_name - */ -const char* av_default_item_name(void* ctx); -AVClassCategory av_default_get_category(void *ptr); - -/** - * Format a line of log the same way as the default callback. - * @param line buffer to receive the formatted line - * @param line_size size of the buffer - * @param print_prefix used to store whether the prefix must be printed; - * must point to a persistent integer initially set to 1 - */ -void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, - char *line, int line_size, int *print_prefix); - -/** - * Format a line of log the same way as the default callback. - * @param line buffer to receive the formatted line; - * may be NULL if line_size is 0 - * @param line_size size of the buffer; at most line_size-1 characters will - * be written to the buffer, plus one null terminator - * @param print_prefix used to store whether the prefix must be printed; - * must point to a persistent integer initially set to 1 - * @return Returns a negative value if an error occurred, otherwise returns - * the number of characters that would have been written for a - * sufficiently large buffer, not including the terminating null - * character. If the return value is not less than line_size, it means - * that the log message was truncated to fit the buffer. - */ -int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, - char *line, int line_size, int *print_prefix); - -#if FF_API_DLOG -/** - * av_dlog macros - * @deprecated unused - * Useful to print debug messages that shouldn't get compiled in normally. - */ - -#ifdef DEBUG -# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) -#else -# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) -#endif -#endif /* FF_API_DLOG */ - -/** - * Skip repeated messages, this requires the user app to use av_log() instead of - * (f)printf as the 2 would otherwise interfere and lead to - * "Last message repeated x times" messages below (f)printf messages with some - * bad luck. - * Also to receive the last, "last repeated" line if any, the user app must - * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end - */ -#define AV_LOG_SKIP_REPEATED 1 - -/** - * Include the log severity in messages originating from codecs. - * - * Results in messages such as: - * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts - */ -#define AV_LOG_PRINT_LEVEL 2 - -void av_log_set_flags(int arg); -int av_log_get_flags(void); - -/** - * @} - */ - -#endif /* AVUTIL_LOG_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lzo.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lzo.h deleted file mode 100644 index c0340399..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/lzo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * LZO 1x decompression - * copyright (c) 2006 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_LZO_H -#define AVUTIL_LZO_H - -/** - * @defgroup lavu_lzo LZO - * @ingroup lavu_crypto - * - * @{ - */ - -#include - -/** @name Error flags returned by av_lzo1x_decode - * @{ */ -/// end of the input buffer reached before decoding finished -#define AV_LZO_INPUT_DEPLETED 1 -/// decoded data did not fit into output buffer -#define AV_LZO_OUTPUT_FULL 2 -/// a reference to previously decoded data was wrong -#define AV_LZO_INVALID_BACKPTR 4 -/// a non-specific error in the compressed bitstream -#define AV_LZO_ERROR 8 -/** @} */ - -#define AV_LZO_INPUT_PADDING 8 -#define AV_LZO_OUTPUT_PADDING 12 - -/** - * @brief Decodes LZO 1x compressed data. - * @param out output buffer - * @param outlen size of output buffer, number of bytes left are returned here - * @param in input buffer - * @param inlen size of input buffer, number of bytes left are returned here - * @return 0 on success, otherwise a combination of the error flags above - * - * Make sure all buffers are appropriately padded, in must provide - * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. - */ -int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); - -/** - * @} - */ - -#endif /* AVUTIL_LZO_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/macros.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/macros.h deleted file mode 100644 index 2007ee56..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/macros.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu - * Utility Preprocessor macros - */ - -#ifndef AVUTIL_MACROS_H -#define AVUTIL_MACROS_H - -/** - * @addtogroup preproc_misc Preprocessor String Macros - * - * String manipulation macros - * - * @{ - */ - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define AV_GLUE(a, b) a ## b -#define AV_JOIN(a, b) AV_GLUE(a, b) - -/** - * @} - */ - -#define AV_PRAGMA(s) _Pragma(#s) - -#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) - -#endif /* AVUTIL_MACROS_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mastering_display_metadata.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mastering_display_metadata.h deleted file mode 100644 index 936533fe..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mastering_display_metadata.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2016 Neil Birkbeck - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H -#define AVUTIL_MASTERING_DISPLAY_METADATA_H - -#include "frame.h" -#include "rational.h" - - -/** - * Mastering display metadata capable of representing the color volume of - * the display used to master the content (SMPTE 2086:2014). - * - * To be used as payload of a AVFrameSideData or AVPacketSideData with the - * appropriate type. - * - * @note The struct should be allocated with av_mastering_display_metadata_alloc() - * and its size is not a part of the public ABI. - */ -typedef struct AVMasteringDisplayMetadata { - /** - * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). - */ - AVRational display_primaries[3][2]; - - /** - * CIE 1931 xy chromaticity coords of white point. - */ - AVRational white_point[2]; - - /** - * Min luminance of mastering display (cd/m^2). - */ - AVRational min_luminance; - - /** - * Max luminance of mastering display (cd/m^2). - */ - AVRational max_luminance; - - /** - * Flag indicating whether the display primaries (and white point) are set. - */ - int has_primaries; - - /** - * Flag indicating whether the luminance (min_ and max_) have been set. - */ - int has_luminance; - -} AVMasteringDisplayMetadata; - -/** - * Allocate an AVMasteringDisplayMetadata structure and set its fields to - * default values. The resulting struct can be freed using av_freep(). - * - * @return An AVMasteringDisplayMetadata filled with default values or NULL - * on failure. - */ -AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); - -/** - * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. - * - * @param frame The frame which side data is added to. - * - * @return The AVMasteringDisplayMetadata structure to be filled by caller. - */ -AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); - -#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mathematics.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mathematics.h deleted file mode 100644 index 54901800..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mathematics.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * copyright (c) 2005-2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @addtogroup lavu_math - * Mathematical utilities for working with timestamp and time base. - */ - -#ifndef AVUTIL_MATHEMATICS_H -#define AVUTIL_MATHEMATICS_H - -#include -#include -#include "attributes.h" -#include "rational.h" -#include "intfloat.h" - -#ifndef M_E -#define M_E 2.7182818284590452354 /* e */ -#endif -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 /* log_e 2 */ -#endif -#ifndef M_LN10 -#define M_LN10 2.30258509299404568402 /* log_e 10 */ -#endif -#ifndef M_LOG2_10 -#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ -#endif -#ifndef M_PHI -#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ -#endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 /* pi/2 */ -#endif -#ifndef M_SQRT1_2 -#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ -#endif -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#endif -#ifndef NAN -#define NAN av_int2float(0x7fc00000) -#endif -#ifndef INFINITY -#define INFINITY av_int2float(0x7f800000) -#endif - -/** - * @addtogroup lavu_math - * - * @{ - */ - -/** - * Rounding methods. - */ -enum AVRounding { - AV_ROUND_ZERO = 0, ///< Round toward zero. - AV_ROUND_INF = 1, ///< Round away from zero. - AV_ROUND_DOWN = 2, ///< Round toward -infinity. - AV_ROUND_UP = 3, ///< Round toward +infinity. - AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. - /** - * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through - * unchanged, avoiding special cases for #AV_NOPTS_VALUE. - * - * Unlike other values of the enumeration AVRounding, this value is a - * bitmask that must be used in conjunction with another value of the - * enumeration through a bitwise OR, in order to set behavior for normal - * cases. - * - * @code{.c} - * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - * // Rescaling 3: - * // Calculating 3 * 1 / 2 - * // 3 / 2 is rounded up to 2 - * // => 2 - * - * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - * // Rescaling AV_NOPTS_VALUE: - * // AV_NOPTS_VALUE == INT64_MIN - * // AV_NOPTS_VALUE is passed through - * // => AV_NOPTS_VALUE - * @endcode - */ - AV_ROUND_PASS_MINMAX = 8192, -}; - -/** - * Compute the greatest common divisor of two integer operands. - * - * @param a,b Operands - * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; - * if a == 0 and b == 0, returns 0. - */ -int64_t av_const av_gcd(int64_t a, int64_t b); - -/** - * Rescale a 64-bit integer with rounding to nearest. - * - * The operation is mathematically equivalent to `a * b / c`, but writing that - * directly can overflow. - * - * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF. - * - * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd() - */ -int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; - -/** - * Rescale a 64-bit integer with specified rounding. - * - * The operation is mathematically equivalent to `a * b / c`, but writing that - * directly can overflow, and does not support different rounding methods. - * - * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd() - */ -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const; - -/** - * Rescale a 64-bit integer by 2 rational numbers. - * - * The operation is mathematically equivalent to `a * bq / cq`. - * - * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF. - * - * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd() - */ -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; - -/** - * Rescale a 64-bit integer by 2 rational numbers with specified rounding. - * - * The operation is mathematically equivalent to `a * bq / cq`. - * - * @see av_rescale(), av_rescale_rnd(), av_rescale_q() - */ -int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, - enum AVRounding rnd) av_const; - -/** - * Compare two timestamps each in its own time base. - * - * @return One of the following values: - * - -1 if `ts_a` is before `ts_b` - * - 1 if `ts_a` is after `ts_b` - * - 0 if they represent the same position - * - * @warning - * The result of the function is undefined if one of the timestamps is outside - * the `int64_t` range when represented in the other's timebase. - */ -int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); - -/** - * Compare the remainders of two integer operands divided by a common divisor. - * - * In other words, compare the least significant `log2(mod)` bits of integers - * `a` and `b`. - * - * @code{.c} - * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2) - * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02) - * @endcode - * - * @param a,b Operands - * @param mod Divisor; must be a power of 2 - * @return - * - a negative value if `a % mod < b % mod` - * - a positive value if `a % mod > b % mod` - * - zero if `a % mod == b % mod` - */ -int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); - -/** - * Rescale a timestamp while preserving known durations. - * - * This function is designed to be called per audio packet to scale the input - * timestamp to a different time base. Compared to a simple av_rescale_q() - * call, this function is robust against possible inconsistent frame durations. - * - * The `last` parameter is a state variable that must be preserved for all - * subsequent calls for the same stream. For the first call, `*last` should be - * initialized to #AV_NOPTS_VALUE. - * - * @param[in] in_tb Input time base - * @param[in] in_ts Input timestamp - * @param[in] fs_tb Duration time base; typically this is finer-grained - * (greater) than `in_tb` and `out_tb` - * @param[in] duration Duration till the next call to this function (i.e. - * duration of the current packet/frame) - * @param[in,out] last Pointer to a timestamp expressed in terms of - * `fs_tb`, acting as a state variable - * @param[in] out_tb Output timebase - * @return Timestamp expressed in terms of `out_tb` - * - * @note In the context of this function, "duration" is in term of samples, not - * seconds. - */ -int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); - -/** - * Add a value to a timestamp. - * - * This function guarantees that when the same value is repeatly added that - * no accumulation of rounding errors occurs. - * - * @param[in] ts Input timestamp - * @param[in] ts_tb Input timestamp time base - * @param[in] inc Value to be added - * @param[in] inc_tb Time base of `inc` - */ -int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); - - -/** - * @} - */ - -#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/md5.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/md5.h deleted file mode 100644 index 9571c1fa..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/md5.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_md5 - * Public header for MD5 hash function implementation. - */ - -#ifndef AVUTIL_MD5_H -#define AVUTIL_MD5_H - -#include - -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_md5 MD5 - * @ingroup lavu_hash - * MD5 hash function implementation. - * - * @{ - */ - -extern const int av_md5_size; - -struct AVMD5; - -/** - * Allocate an AVMD5 context. - */ -struct AVMD5 *av_md5_alloc(void); - -/** - * Initialize MD5 hashing. - * - * @param ctx pointer to the function context (of size av_md5_size) - */ -void av_md5_init(struct AVMD5 *ctx); - -/** - * Update hash value. - * - * @param ctx hash function context - * @param src input data to update hash with - * @param len input data length - */ -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); - -/** - * Finish hashing and output digest value. - * - * @param ctx hash function context - * @param dst buffer where output digest value is stored - */ -void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); - -/** - * Hash an array of data. - * - * @param dst The output buffer to write the digest into - * @param src The data to hash - * @param len The length of the data, in bytes - */ -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); - -/** - * @} - */ - -#endif /* AVUTIL_MD5_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mem.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mem.h deleted file mode 100644 index 100bb0b3..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/mem.h +++ /dev/null @@ -1,702 +0,0 @@ -/** - * Add by Single - */ -#pragma clang diagnostic ignored "-Wdocumentation" - - -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_mem - * Memory handling functions - */ - -#ifndef AVUTIL_MEM_H -#define AVUTIL_MEM_H - -#include -#include - -#include "attributes.h" -#include "error.h" -#include "avutil.h" - -/** - * @addtogroup lavu_mem - * Utilities for manipulating memory. - * - * FFmpeg has several applications of memory that are not required of a typical - * program. For example, the computing-heavy components like video decoding and - * encoding can be sped up significantly through the use of aligned memory. - * - * However, for each of FFmpeg's applications of memory, there might not be a - * recognized or standardized API for that specific use. Memory alignment, for - * instance, varies wildly depending on operating systems, architectures, and - * compilers. Hence, this component of @ref libavutil is created to make - * dealing with memory consistently possible on all platforms. - * - * @{ - * - * @defgroup lavu_mem_macros Alignment Macros - * Helper macros for declaring aligned variables. - * @{ - */ - -/** - * @def DECLARE_ALIGNED(n,t,v) - * Declare a variable that is aligned in memory. - * - * @code{.c} - * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42; - * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128]; - * - * // The default-alignment equivalent would be - * uint16_t aligned_int = 42; - * uint8_t aligned_array[128]; - * @endcode - * - * @param n Minimum alignment in bytes - * @param t Type of the variable (or array element) - * @param v Name of the variable - */ - -/** - * @def DECLARE_ASM_CONST(n,t,v) - * Declare a static constant aligned variable appropriate for use in inline - * assembly code. - * - * @code{.c} - * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); - * @endcode - * - * @param n Minimum alignment in bytes - * @param t Type of the variable (or array element) - * @param v Name of the variable - */ - -#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) - #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v - #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v -#elif defined(__TI_COMPILER_VERSION__) - #define DECLARE_ALIGNED(n,t,v) \ - AV_PRAGMA(DATA_ALIGN(v,n)) \ - t __attribute__((aligned(n))) v - #define DECLARE_ASM_CONST(n,t,v) \ - AV_PRAGMA(DATA_ALIGN(v,n)) \ - static const t __attribute__((aligned(n))) v -#elif defined(__GNUC__) - #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v - #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v -#elif defined(_MSC_VER) - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v - #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v -#else - #define DECLARE_ALIGNED(n,t,v) t v - #define DECLARE_ASM_CONST(n,t,v) static const t v -#endif - -/** - * @} - */ - -/** - * @defgroup lavu_mem_attrs Function Attributes - * Function attributes applicable to memory handling functions. - * - * These function attributes can help compilers emit more useful warnings, or - * generate better code. - * @{ - */ - -/** - * @def av_malloc_attrib - * Function attribute denoting a malloc-like function. - * - * @see Function attribute `malloc` in GCC's documentation - */ - -#if AV_GCC_VERSION_AT_LEAST(3,1) - #define av_malloc_attrib __attribute__((__malloc__)) -#else - #define av_malloc_attrib -#endif - -/** - * @def av_alloc_size(...) - * Function attribute used on a function that allocates memory, whose size is - * given by the specified parameter(s). - * - * @code{.c} - * void *av_malloc(size_t size) av_alloc_size(1); - * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2); - * @endcode - * - * @param ... One or two parameter indexes, separated by a comma - * - * @see Function attribute `alloc_size` in GCC's documentation - */ - -#if AV_GCC_VERSION_AT_LEAST(4,3) - #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) -#else - #define av_alloc_size(...) -#endif - -/** - * @} - */ - -/** - * @defgroup lavu_mem_funcs Heap Management - * Functions responsible for allocating, freeing, and copying memory. - * - * All memory allocation functions have a built-in upper limit of `INT_MAX` - * bytes. This may be changed with av_max_alloc(), although exercise extreme - * caution when doing so. - * - * @{ - */ - -/** - * Allocate a memory block with alignment suitable for all memory accesses - * (including vectors if available on the CPU). - * - * @param size Size in bytes for the memory block to be allocated - * @return Pointer to the allocated block, or `NULL` if the block cannot - * be allocated - * @see av_mallocz() - */ -void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); - -/** - * Allocate a memory block with alignment suitable for all memory accesses - * (including vectors if available on the CPU) and zero all the bytes of the - * block. - * - * @param size Size in bytes for the memory block to be allocated - * @return Pointer to the allocated block, or `NULL` if it cannot be allocated - * @see av_malloc() - */ -void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); - -/** - * Allocate a memory block for an array with av_malloc(). - * - * The allocated memory will have size `size * nmemb` bytes. - * - * @param nmemb Number of element - * @param size Size of a single element - * @return Pointer to the allocated block, or `NULL` if the block cannot - * be allocated - * @see av_malloc() - */ -av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size) -{ - if (!size || nmemb >= INT_MAX / size) - return NULL; - return av_malloc(nmemb * size); -} - -/** - * Allocate a memory block for an array with av_mallocz(). - * - * The allocated memory will have size `size * nmemb` bytes. - * - * @param nmemb Number of elements - * @param size Size of the single element - * @return Pointer to the allocated block, or `NULL` if the block cannot - * be allocated - * - * @see av_mallocz() - * @see av_malloc_array() - */ -av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size) -{ - if (!size || nmemb >= INT_MAX / size) - return NULL; - return av_mallocz(nmemb * size); -} - -/** - * Non-inlined equivalent of av_mallocz_array(). - * - * Created for symmetry with the calloc() C function. - */ -void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; - -/** - * Allocate, reallocate, or free a block of memory. - * - * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is - * zero, free the memory block pointed to by `ptr`. Otherwise, expand or - * shrink that block of memory according to `size`. - * - * @param ptr Pointer to a memory block already allocated with - * av_realloc() or `NULL` - * @param size Size in bytes of the memory block to be allocated or - * reallocated - * - * @return Pointer to a newly-reallocated block or `NULL` if the block - * cannot be reallocated or the function is used to free the memory block - * - * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be - * correctly aligned. - * @see av_fast_realloc() - * @see av_reallocp() - */ -void *av_realloc(void *ptr, size_t size) av_alloc_size(2); - -/** - * Allocate, reallocate, or free a block of memory through a pointer to a - * pointer. - * - * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is - * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or - * shrink that block of memory according to `size`. - * - * @param[in,out] ptr Pointer to a pointer to a memory block already allocated - * with av_realloc(), or a pointer to `NULL`. The pointer - * is updated on success, or freed on failure. - * @param[in] size Size in bytes for the memory block to be allocated or - * reallocated - * - * @return Zero on success, an AVERROR error code on failure - * - * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be - * correctly aligned. - */ -av_warn_unused_result -int av_reallocp(void *ptr, size_t size); - -/** - * Allocate, reallocate, or free a block of memory. - * - * This function does the same thing as av_realloc(), except: - * - It takes two size arguments and allocates `nelem * elsize` bytes, - * after checking the result of the multiplication for integer overflow. - * - It frees the input block in case of failure, thus avoiding the memory - * leak with the classic - * @code{.c} - * buf = realloc(buf); - * if (!buf) - * return -1; - * @endcode - * pattern. - */ -void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); - -/** - * Allocate, reallocate, or free an array. - * - * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If - * `nmemb` is zero, free the memory block pointed to by `ptr`. - * - * @param ptr Pointer to a memory block already allocated with - * av_realloc() or `NULL` - * @param nmemb Number of elements in the array - * @param size Size of the single element of the array - * - * @return Pointer to a newly-reallocated block or NULL if the block - * cannot be reallocated or the function is used to free the memory block - * - * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be - * correctly aligned. - * @see av_reallocp_array() - */ -av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); - -/** - * Allocate, reallocate, or free an array through a pointer to a pointer. - * - * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is - * zero, free the memory block pointed to by `*ptr`. - * - * @param[in,out] ptr Pointer to a pointer to a memory block already - * allocated with av_realloc(), or a pointer to `NULL`. - * The pointer is updated on success, or freed on failure. - * @param[in] nmemb Number of elements - * @param[in] size Size of the single element - * - * @return Zero on success, an AVERROR error code on failure - * - * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be - * correctly aligned. - */ -av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); - -/** - * Reallocate the given buffer if it is not large enough, otherwise do nothing. - * - * If the given buffer is `NULL`, then a new uninitialized buffer is allocated. - * - * If the given buffer is not large enough, and reallocation fails, `NULL` is - * returned and `*size` is set to 0, but the original buffer is not changed or - * freed. - * - * A typical use pattern follows: - * - * @code{.c} - * uint8_t *buf = ...; - * uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed); - * if (!new_buf) { - * // Allocation failed; clean up original buffer - * av_freep(&buf); - * return AVERROR(ENOMEM); - * } - * @endcode - * - * @param[in,out] ptr Already allocated buffer, or `NULL` - * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is - * changed to `min_size` in case of success or 0 in - * case of failure - * @param[in] min_size New size of buffer `ptr` - * @return `ptr` if the buffer is large enough, a pointer to newly reallocated - * buffer if the buffer was not large enough, or `NULL` in case of - * error - * @see av_realloc() - * @see av_fast_malloc() - */ -void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); - -/** - * Allocate a buffer, reusing the given one if large enough. - * - * Contrary to av_fast_realloc(), the current buffer contents might not be - * preserved and on error the old buffer is freed, thus no special handling to - * avoid memleaks is necessary. - * - * `*ptr` is allowed to be `NULL`, in which case allocation always happens if - * `size_needed` is greater than 0. - * - * @code{.c} - * uint8_t *buf = ...; - * av_fast_malloc(&buf, ¤t_size, size_needed); - * if (!buf) { - * // Allocation failed; buf already freed - * return AVERROR(ENOMEM); - * } - * @endcode - * - * @param[in,out] ptr Pointer to pointer to an already allocated buffer. - * `*ptr` will be overwritten with pointer to new - * buffer on success or `NULL` on failure - * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is - * changed to `min_size` in case of success or 0 in - * case of failure - * @param[in] min_size New size of buffer `*ptr` - * @see av_realloc() - * @see av_fast_mallocz() - */ -void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); - -/** - * Allocate and clear a buffer, reusing the given one if large enough. - * - * Like av_fast_malloc(), but all newly allocated space is initially cleared. - * Reused buffer is not cleared. - * - * `*ptr` is allowed to be `NULL`, in which case allocation always happens if - * `size_needed` is greater than 0. - * - * @param[in,out] ptr Pointer to pointer to an already allocated buffer. - * `*ptr` will be overwritten with pointer to new - * buffer on success or `NULL` on failure - * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is - * changed to `min_size` in case of success or 0 in - * case of failure - * @param[in] min_size New size of buffer `*ptr` - * @see av_fast_malloc() - */ -void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); - -/** - * Free a memory block which has been allocated with a function of av_malloc() - * or av_realloc() family. - * - * @param ptr Pointer to the memory block which should be freed. - * - * @note `ptr = NULL` is explicitly allowed. - * @note It is recommended that you use av_freep() instead, to prevent leaving - * behind dangling pointers. - * @see av_freep() - */ -void av_free(void *ptr); - -/** - * Free a memory block which has been allocated with a function of av_malloc() - * or av_realloc() family, and set the pointer pointing to it to `NULL`. - * - * @code{.c} - * uint8_t *buf = av_malloc(16); - * av_free(buf); - * // buf now contains a dangling pointer to freed memory, and accidental - * // dereference of buf will result in a use-after-free, which may be a - * // security risk. - * - * uint8_t *buf = av_malloc(16); - * av_freep(&buf); - * // buf is now NULL, and accidental dereference will only result in a - * // NULL-pointer dereference. - * @endcode - * - * @param ptr Pointer to the pointer to the memory block which should be freed - * @note `*ptr = NULL` is safe and leads to no action. - * @see av_free() - */ -void av_freep(void *ptr); - -/** - * Duplicate a string. - * - * @param s String to be duplicated - * @return Pointer to a newly-allocated string containing a - * copy of `s` or `NULL` if the string cannot be allocated - * @see av_strndup() - */ -char *av_strdup(const char *s) av_malloc_attrib; - -/** - * Duplicate a substring of a string. - * - * @param s String to be duplicated - * @param len Maximum length of the resulting string (not counting the - * terminating byte) - * @return Pointer to a newly-allocated string containing a - * substring of `s` or `NULL` if the string cannot be allocated - */ -char *av_strndup(const char *s, size_t len) av_malloc_attrib; - -/** - * Duplicate a buffer with av_malloc(). - * - * @param p Buffer to be duplicated - * @param size Size in bytes of the buffer copied - * @return Pointer to a newly allocated buffer containing a - * copy of `p` or `NULL` if the buffer cannot be allocated - */ -void *av_memdup(const void *p, size_t size); - -/** - * Overlapping memcpy() implementation. - * - * @param dst Destination buffer - * @param back Number of bytes back to start copying (i.e. the initial size of - * the overlapping window); must be > 0 - * @param cnt Number of bytes to copy; must be >= 0 - * - * @note `cnt > back` is valid, this will copy the bytes we just copied, - * thus creating a repeating pattern with a period length of `back`. - */ -void av_memcpy_backptr(uint8_t *dst, int back, int cnt); - -/** - * @} - */ - -/** - * @defgroup lavu_mem_dynarray Dynamic Array - * - * Utilities to make an array grow when needed. - * - * Sometimes, the programmer would want to have an array that can grow when - * needed. The libavutil dynamic array utilities fill that need. - * - * libavutil supports two systems of appending elements onto a dynamically - * allocated array, the first one storing the pointer to the value in the - * array, and the second storing the value directly. In both systems, the - * caller is responsible for maintaining a variable containing the length of - * the array, as well as freeing of the array after use. - * - * The first system stores pointers to values in a block of dynamically - * allocated memory. Since only pointers are stored, the function does not need - * to know the size of the type. Both av_dynarray_add() and - * av_dynarray_add_nofree() implement this system. - * - * @code - * type **array = NULL; //< an array of pointers to values - * int nb = 0; //< a variable to keep track of the length of the array - * - * type to_be_added = ...; - * type to_be_added2 = ...; - * - * av_dynarray_add(&array, &nb, &to_be_added); - * if (nb == 0) - * return AVERROR(ENOMEM); - * - * av_dynarray_add(&array, &nb, &to_be_added2); - * if (nb == 0) - * return AVERROR(ENOMEM); - * - * // Now: - * // nb == 2 - * // &to_be_added == array[0] - * // &to_be_added2 == array[1] - * - * av_freep(&array); - * @endcode - * - * The second system stores the value directly in a block of memory. As a - * result, the function has to know the size of the type. av_dynarray2_add() - * implements this mechanism. - * - * @code - * type *array = NULL; //< an array of values - * int nb = 0; //< a variable to keep track of the length of the array - * - * type to_be_added = ...; - * type to_be_added2 = ...; - * - * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL); - * if (!addr) - * return AVERROR(ENOMEM); - * memcpy(addr, &to_be_added, sizeof(to_be_added)); - * - * // Shortcut of the above. - * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), - * (const void *)&to_be_added2); - * if (!addr) - * return AVERROR(ENOMEM); - * - * // Now: - * // nb == 2 - * // to_be_added == array[0] - * // to_be_added2 == array[1] - * - * av_freep(&array); - * @endcode - * - * @{ - */ - -/** - * Add the pointer to an element to a dynamic array. - * - * The array to grow is supposed to be an array of pointers to - * structures, and the element to add must be a pointer to an already - * allocated structure. - * - * The array is reallocated when its size reaches powers of 2. - * Therefore, the amortized cost of adding an element is constant. - * - * In case of success, the pointer to the array is updated in order to - * point to the new grown array, and the number pointed to by `nb_ptr` - * is incremented. - * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and - * `*nb_ptr` is set to 0. - * - * @param[in,out] tab_ptr Pointer to the array to grow - * @param[in,out] nb_ptr Pointer to the number of elements in the array - * @param[in] elem Element to add - * @see av_dynarray_add_nofree(), av_dynarray2_add() - */ -void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); - -/** - * Add an element to a dynamic array. - * - * Function has the same functionality as av_dynarray_add(), - * but it doesn't free memory on fails. It returns error code - * instead and leave current buffer untouched. - * - * @return >=0 on success, negative otherwise - * @see av_dynarray_add(), av_dynarray2_add() - */ -av_warn_unused_result -int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); - -/** - * Add an element of size `elem_size` to a dynamic array. - * - * The array is reallocated when its number of elements reaches powers of 2. - * Therefore, the amortized cost of adding an element is constant. - * - * In case of success, the pointer to the array is updated in order to - * point to the new grown array, and the number pointed to by `nb_ptr` - * is incremented. - * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and - * `*nb_ptr` is set to 0. - * - * @param[in,out] tab_ptr Pointer to the array to grow - * @param[in,out] nb_ptr Pointer to the number of elements in the array - * @param[in] elem_size Size in bytes of an element in the array - * @param[in] elem_data Pointer to the data of the element to add. If - * `NULL`, the space of the newly added element is - * allocated but left uninitialized. - * - * @return Pointer to the data of the element to copy in the newly allocated - * space - * @see av_dynarray_add(), av_dynarray_add_nofree() - */ -void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, - const uint8_t *elem_data); - -/** - * @} - */ - -/** - * @defgroup lavu_mem_misc Miscellaneous Functions - * - * Other functions related to memory allocation. - * - * @{ - */ - -/** - * Multiply two `size_t` values checking for overflow. - * - * @param[in] a,b Operands of multiplication - * @param[out] r Pointer to the result of the operation - * @return 0 on success, AVERROR(EINVAL) on overflow - */ -static inline int av_size_mult(size_t a, size_t b, size_t *r) -{ - size_t t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); - *r = t; - return 0; -} - -/** - * Set the maximum size that may be allocated in one block. - * - * The value specified with this function is effective for all libavutil's @ref - * lavu_mem_funcs "heap management functions." - * - * By default, the max value is defined as `INT_MAX`. - * - * @param max Value to be set as the new maximum size - * - * @warning Exercise extreme caution when using this function. Don't touch - * this if you do not understand the full consequence of doing so. - */ -void av_max_alloc(size_t max); - -/** - * @} - * @} - */ - -#endif /* AVUTIL_MEM_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/motion_vector.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/motion_vector.h deleted file mode 100644 index ec295563..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/motion_vector.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_MOTION_VECTOR_H -#define AVUTIL_MOTION_VECTOR_H - -#include - -typedef struct AVMotionVector { - /** - * Where the current macroblock comes from; negative value when it comes - * from the past, positive value when it comes from the future. - * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". - */ - int32_t source; - /** - * Width and height of the block. - */ - uint8_t w, h; - /** - * Absolute source position. Can be outside the frame area. - */ - int16_t src_x, src_y; - /** - * Absolute destination position. Can be outside the frame area. - */ - int16_t dst_x, dst_y; - /** - * Extra flag information. - * Currently unused. - */ - uint64_t flags; - /** - * Motion vector - * src_x = dst_x + motion_x / motion_scale - * src_y = dst_y + motion_y / motion_scale - */ - int32_t motion_x, motion_y; - uint16_t motion_scale; -} AVMotionVector; - -#endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/murmur3.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/murmur3.h deleted file mode 100644 index 6a1694c0..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/murmur3.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2013 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_murmur3 - * Public header for MurmurHash3 hash function implementation. - */ - -#ifndef AVUTIL_MURMUR3_H -#define AVUTIL_MURMUR3_H - -#include - -/** - * @defgroup lavu_murmur3 Murmur3 - * @ingroup lavu_hash - * MurmurHash3 hash function implementation. - * - * MurmurHash3 is a non-cryptographic hash function, of which three - * incompatible versions were created by its inventor Austin Appleby: - * - * - 32-bit output - * - 128-bit output for 32-bit platforms - * - 128-bit output for 64-bit platforms - * - * FFmpeg only implements the last variant: 128-bit output designed for 64-bit - * platforms. Even though the hash function was designed for 64-bit platforms, - * the function in reality works on 32-bit systems too, only with reduced - * performance. - * - * @anchor lavu_murmur3_seedinfo - * By design, MurmurHash3 requires a seed to operate. In response to this, - * libavutil provides two functions for hash initiation, one that requires a - * seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer - * as the seed, and therefore does not (av_murmur3_init()). - * - * To make hashes comparable, you should provide the same seed for all calls to - * this hash function -- if you are supplying one yourself, that is. - * - * @{ - */ - -/** - * Allocate an AVMurMur3 hash context. - * - * @return Uninitialized hash context or `NULL` in case of error - */ -struct AVMurMur3 *av_murmur3_alloc(void); - -/** - * Initialize or reinitialize an AVMurMur3 hash context with a seed. - * - * @param[out] c Hash context - * @param[in] seed Random seed - * - * @see av_murmur3_init() - * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of - * seeds for MurmurHash3. - */ -void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); - -/** - * Initialize or reinitialize an AVMurMur3 hash context. - * - * Equivalent to av_murmur3_init_seeded() with a built-in seed. - * - * @param[out] c Hash context - * - * @see av_murmur3_init_seeded() - * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of - * seeds for MurmurHash3. - */ -void av_murmur3_init(struct AVMurMur3 *c); - -/** - * Update hash context with new data. - * - * @param[out] c Hash context - * @param[in] src Input data to update hash with - * @param[in] len Number of bytes to read from `src` - */ -void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); - -/** - * Finish hashing and output digest value. - * - * @param[in,out] c Hash context - * @param[out] dst Buffer where output digest value is stored - */ -void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); - -/** - * @} - */ - -#endif /* AVUTIL_MURMUR3_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/opt.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/opt.h deleted file mode 100644 index 9430b989..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/opt.h +++ /dev/null @@ -1,865 +0,0 @@ -/* - * AVOptions - * copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_OPT_H -#define AVUTIL_OPT_H - -/** - * @file - * AVOptions - */ - -#include "rational.h" -#include "avutil.h" -#include "dict.h" -#include "log.h" -#include "pixfmt.h" -#include "samplefmt.h" -#include "version.h" - -/** - * @defgroup avoptions AVOptions - * @ingroup lavu_data - * @{ - * AVOptions provide a generic system to declare options on arbitrary structs - * ("objects"). An option can have a help text, a type and a range of possible - * values. Options may then be enumerated, read and written to. - * - * @section avoptions_implement Implementing AVOptions - * This section describes how to add AVOptions capabilities to a struct. - * - * All AVOptions-related information is stored in an AVClass. Therefore - * the first member of the struct should be a pointer to an AVClass describing it. - * The option field of the AVClass must be set to a NULL-terminated static array - * of AVOptions. Each AVOption must have a non-empty name, a type, a default - * value and for number-type AVOptions also a range of allowed values. It must - * also declare an offset in bytes from the start of the struct, where the field - * associated with this AVOption is located. Other fields in the AVOption struct - * should also be set when applicable, but are not required. - * - * The following example illustrates an AVOptions-enabled struct: - * @code - * typedef struct test_struct { - * const AVClass *class; - * int int_opt; - * char *str_opt; - * uint8_t *bin_opt; - * int bin_len; - * } test_struct; - * - * static const AVOption test_options[] = { - * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), - * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, - * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), - * AV_OPT_TYPE_STRING }, - * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), - * AV_OPT_TYPE_BINARY }, - * { NULL }, - * }; - * - * static const AVClass test_class = { - * .class_name = "test class", - * .item_name = av_default_item_name, - * .option = test_options, - * .version = LIBAVUTIL_VERSION_INT, - * }; - * @endcode - * - * Next, when allocating your struct, you must ensure that the AVClass pointer - * is set to the correct value. Then, av_opt_set_defaults() can be called to - * initialize defaults. After that the struct is ready to be used with the - * AVOptions API. - * - * When cleaning up, you may use the av_opt_free() function to automatically - * free all the allocated string and binary options. - * - * Continuing with the above example: - * - * @code - * test_struct *alloc_test_struct(void) - * { - * test_struct *ret = av_mallocz(sizeof(*ret)); - * ret->class = &test_class; - * av_opt_set_defaults(ret); - * return ret; - * } - * void free_test_struct(test_struct **foo) - * { - * av_opt_free(*foo); - * av_freep(foo); - * } - * @endcode - * - * @subsection avoptions_implement_nesting Nesting - * It may happen that an AVOptions-enabled struct contains another - * AVOptions-enabled struct as a member (e.g. AVCodecContext in - * libavcodec exports generic options, while its priv_data field exports - * codec-specific options). In such a case, it is possible to set up the - * parent struct to export a child's options. To do that, simply - * implement AVClass.child_next() and AVClass.child_class_next() in the - * parent struct's AVClass. - * Assuming that the test_struct from above now also contains a - * child_struct field: - * - * @code - * typedef struct child_struct { - * AVClass *class; - * int flags_opt; - * } child_struct; - * static const AVOption child_opts[] = { - * { "test_flags", "This is a test option of flags type.", - * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, - * { NULL }, - * }; - * static const AVClass child_class = { - * .class_name = "child class", - * .item_name = av_default_item_name, - * .option = child_opts, - * .version = LIBAVUTIL_VERSION_INT, - * }; - * - * void *child_next(void *obj, void *prev) - * { - * test_struct *t = obj; - * if (!prev && t->child_struct) - * return t->child_struct; - * return NULL - * } - * const AVClass child_class_next(const AVClass *prev) - * { - * return prev ? NULL : &child_class; - * } - * @endcode - * Putting child_next() and child_class_next() as defined above into - * test_class will now make child_struct's options accessible through - * test_struct (again, proper setup as described above needs to be done on - * child_struct right after it is created). - * - * From the above example it might not be clear why both child_next() - * and child_class_next() are needed. The distinction is that child_next() - * iterates over actually existing objects, while child_class_next() - * iterates over all possible child classes. E.g. if an AVCodecContext - * was initialized to use a codec which has private options, then its - * child_next() will return AVCodecContext.priv_data and finish - * iterating. OTOH child_class_next() on AVCodecContext.av_class will - * iterate over all available codecs with private options. - * - * @subsection avoptions_implement_named_constants Named constants - * It is possible to create named constants for options. Simply set the unit - * field of the option the constants should apply to a string and - * create the constants themselves as options of type AV_OPT_TYPE_CONST - * with their unit field set to the same string. - * Their default_val field should contain the value of the named - * constant. - * For example, to add some named constants for the test_flags option - * above, put the following into the child_opts array: - * @code - * { "test_flags", "This is a test option of flags type.", - * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, - * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, - * @endcode - * - * @section avoptions_use Using AVOptions - * This section deals with accessing options in an AVOptions-enabled struct. - * Such structs in FFmpeg are e.g. AVCodecContext in libavcodec or - * AVFormatContext in libavformat. - * - * @subsection avoptions_use_examine Examining AVOptions - * The basic functions for examining options are av_opt_next(), which iterates - * over all options defined for one object, and av_opt_find(), which searches - * for an option with the given name. - * - * The situation is more complicated with nesting. An AVOptions-enabled struct - * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag - * to av_opt_find() will make the function search children recursively. - * - * For enumerating there are basically two cases. The first is when you want to - * get all options that may potentially exist on the struct and its children - * (e.g. when constructing documentation). In that case you should call - * av_opt_child_class_next() recursively on the parent struct's AVClass. The - * second case is when you have an already initialized struct with all its - * children and you want to get all options that can be actually written or read - * from it. In that case you should call av_opt_child_next() recursively (and - * av_opt_next() on each result). - * - * @subsection avoptions_use_get_set Reading and writing AVOptions - * When setting options, you often have a string read directly from the - * user. In such a case, simply passing it to av_opt_set() is enough. For - * non-string type options, av_opt_set() will parse the string according to the - * option type. - * - * Similarly av_opt_get() will read any option type and convert it to a string - * which will be returned. Do not forget that the string is allocated, so you - * have to free it with av_free(). - * - * In some cases it may be more convenient to put all options into an - * AVDictionary and call av_opt_set_dict() on it. A specific case of this - * are the format/codec open functions in lavf/lavc which take a dictionary - * filled with option as a parameter. This makes it possible to set some options - * that cannot be set otherwise, since e.g. the input file format is not known - * before the file is actually opened. - */ - -enum AVOptionType{ - AV_OPT_TYPE_FLAGS, - AV_OPT_TYPE_INT, - AV_OPT_TYPE_INT64, - AV_OPT_TYPE_DOUBLE, - AV_OPT_TYPE_FLOAT, - AV_OPT_TYPE_STRING, - AV_OPT_TYPE_RATIONAL, - AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - AV_OPT_TYPE_DICT, - AV_OPT_TYPE_CONST = 128, - AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'), ///< offset must point to two consecutive integers - AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'), - AV_OPT_TYPE_SAMPLE_FMT = MKBETAG('S','F','M','T'), - AV_OPT_TYPE_VIDEO_RATE = MKBETAG('V','R','A','T'), ///< offset must point to AVRational - AV_OPT_TYPE_DURATION = MKBETAG('D','U','R',' '), - AV_OPT_TYPE_COLOR = MKBETAG('C','O','L','R'), - AV_OPT_TYPE_CHANNEL_LAYOUT = MKBETAG('C','H','L','A'), - AV_OPT_TYPE_BOOL = MKBETAG('B','O','O','L'), -}; - -/** - * AVOption - */ -typedef struct AVOption { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - union { - int64_t i64; - double dbl; - const char *str; - /* TODO those are unused now */ - AVRational q; - } default_val; - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#if FF_API_OPT_TYPE_METADATA -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#endif -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -/** - * The option is intended for exporting values to the caller. - */ -#define AV_OPT_FLAG_EXPORT 64 -/** - * The option may not be set through the AVOptions API, only read. - * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set. - */ -#define AV_OPT_FLAG_READONLY 128 -#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption; - -/** - * A single allowed range of values, or a single allowed value. - */ -typedef struct AVOptionRange { - const char *str; - /** - * Value range. - * For string ranges this represents the min/max length. - * For dimensions this represents the min/max pixel count or width/height in multi-component case. - */ - double value_min, value_max; - /** - * Value's component range. - * For string this represents the unicode range for chars, 0-127 limits to ASCII. - */ - double component_min, component_max; - /** - * Range flag. - * If set to 1 the struct encodes a range, if set to 0 a single value. - */ - int is_range; -} AVOptionRange; - -/** - * List of AVOptionRange structs. - */ -typedef struct AVOptionRanges { - /** - * Array of option ranges. - * - * Most of option types use just one component. - * Following describes multi-component option types: - * - * AV_OPT_TYPE_IMAGE_SIZE: - * component index 0: range of pixel count (width * height). - * component index 1: range of width. - * component index 2: range of height. - * - * @note To obtain multi-component version of this structure, user must - * provide AV_OPT_MULTI_COMPONENT_RANGE to av_opt_query_ranges or - * av_opt_query_ranges_default function. - * - * Multi-component range can be read as in following example: - * - * @code - * int range_index, component_index; - * AVOptionRanges *ranges; - * AVOptionRange *range[3]; //may require more than 3 in the future. - * av_opt_query_ranges(&ranges, obj, key, AV_OPT_MULTI_COMPONENT_RANGE); - * for (range_index = 0; range_index < ranges->nb_ranges; range_index++) { - * for (component_index = 0; component_index < ranges->nb_components; component_index++) - * range[component_index] = ranges->range[ranges->nb_ranges * component_index + range_index]; - * //do something with range here. - * } - * av_opt_freep_ranges(&ranges); - * @endcode - */ - AVOptionRange **range; - /** - * Number of ranges per component. - */ - int nb_ranges; - /** - * Number of componentes. - */ - int nb_components; -} AVOptionRanges; - -/** - * Show the obj options. - * - * @param req_flags requested flags for the options to show. Show only the - * options for which it is opt->flags & req_flags. - * @param rej_flags rejected flags for the options to show. Show only the - * options for which it is !(opt->flags & req_flags). - * @param av_log_obj log context to use for showing the options - */ -int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); - -/** - * Set the values of all AVOption fields to their default values. - * - * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) - */ -void av_opt_set_defaults(void *s); - -/** - * Set the values of all AVOption fields to their default values. Only these - * AVOption fields for which (opt->flags & mask) == flags will have their - * default applied to s. - * - * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) - * @param mask combination of AV_OPT_FLAG_* - * @param flags combination of AV_OPT_FLAG_* - */ -void av_opt_set_defaults2(void *s, int mask, int flags); - -/** - * Parse the key/value pairs list in opts. For each key/value pair - * found, stores the value in the field in ctx that is named like the - * key. ctx must be an AVClass context, storing is done using - * AVOptions. - * - * @param opts options string to parse, may be NULL - * @param key_val_sep a 0-terminated list of characters used to - * separate key from value - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other - * @return the number of successfully set key/value pairs, or a negative - * value corresponding to an AVERROR code in case of error: - * AVERROR(EINVAL) if opts cannot be parsed, - * the error code issued by av_opt_set() if a key/value pair - * cannot be set - */ -int av_set_options_string(void *ctx, const char *opts, - const char *key_val_sep, const char *pairs_sep); - -/** - * Parse the key-value pairs list in opts. For each key=value pair found, - * set the value of the corresponding option in ctx. - * - * @param ctx the AVClass object to set options on - * @param opts the options string, key-value pairs separated by a - * delimiter - * @param shorthand a NULL-terminated array of options names for shorthand - * notation: if the first field in opts has no key part, - * the key is taken from the first element of shorthand; - * then again for the second, etc., until either opts is - * finished, shorthand is finished or a named option is - * found; after that, all options must be named - * @param key_val_sep a 0-terminated list of characters used to separate - * key from value, for example '=' - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other, for example ':' or ',' - * @return the number of successfully set key=value pairs, or a negative - * value corresponding to an AVERROR code in case of error: - * AVERROR(EINVAL) if opts cannot be parsed, - * the error code issued by av_set_string3() if a key/value pair - * cannot be set - * - * Options names must use only the following characters: a-z A-Z 0-9 - . / _ - * Separators must use characters distinct from option names and from each - * other. - */ -int av_opt_set_from_string(void *ctx, const char *opts, - const char *const *shorthand, - const char *key_val_sep, const char *pairs_sep); -/** - * Free all allocated objects in obj. - */ -void av_opt_free(void *obj); - -/** - * Check whether a particular flag is set in a flags field. - * - * @param field_name the name of the flag field option - * @param flag_name the name of the flag to check - * @return non-zero if the flag is set, zero if the flag isn't set, - * isn't of the right type, or the flags field doesn't exist. - */ -int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); - -/** - * Set all the options from a given dictionary on an object. - * - * @param obj a struct whose first element is a pointer to AVClass - * @param options options to process. This dictionary will be freed and replaced - * by a new one containing all options not found in obj. - * Of course this new dictionary needs to be freed by caller - * with av_dict_free(). - * - * @return 0 on success, a negative AVERROR if some option was found in obj, - * but could not be set. - * - * @see av_dict_copy() - */ -int av_opt_set_dict(void *obj, struct AVDictionary **options); - - -/** - * Set all the options from a given dictionary on an object. - * - * @param obj a struct whose first element is a pointer to AVClass - * @param options options to process. This dictionary will be freed and replaced - * by a new one containing all options not found in obj. - * Of course this new dictionary needs to be freed by caller - * with av_dict_free(). - * @param search_flags A combination of AV_OPT_SEARCH_*. - * - * @return 0 on success, a negative AVERROR if some option was found in obj, - * but could not be set. - * - * @see av_dict_copy() - */ -int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags); - -/** - * Extract a key-value pair from the beginning of a string. - * - * @param ropts pointer to the options string, will be updated to - * point to the rest of the string (one of the pairs_sep - * or the final NUL) - * @param key_val_sep a 0-terminated list of characters used to separate - * key from value, for example '=' - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other, for example ':' or ',' - * @param flags flags; see the AV_OPT_FLAG_* values below - * @param rkey parsed key; must be freed using av_free() - * @param rval parsed value; must be freed using av_free() - * - * @return >=0 for success, or a negative value corresponding to an - * AVERROR code in case of error; in particular: - * AVERROR(EINVAL) if no key is present - * - */ -int av_opt_get_key_value(const char **ropts, - const char *key_val_sep, const char *pairs_sep, - unsigned flags, - char **rkey, char **rval); - -enum { - - /** - * Accept to parse a value without a key; the key will then be returned - * as NULL. - */ - AV_OPT_FLAG_IMPLICIT_KEY = 1, -}; - -/** - * @defgroup opt_eval_funcs Evaluating option strings - * @{ - * This group of functions can be used to evaluate option strings - * and get numbers out of them. They do the same thing as av_opt_set(), - * except the result is written into the caller-supplied pointer. - * - * @param obj a struct whose first element is a pointer to AVClass. - * @param o an option for which the string is to be evaluated. - * @param val string to be evaluated. - * @param *_out value of the string will be written here. - * - * @return 0 on success, a negative number on failure. - */ -int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); -int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); -int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); -int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); -int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); -int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); -/** - * @} - */ - -#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the - given object first. */ -/** - * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass - * instead of a required pointer to a struct containing AVClass. This is - * useful for searching for options without needing to allocate the corresponding - * object. - */ -#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) - -/** - * In av_opt_get, return NULL if the option has a pointer type and is set to NULL, - * rather than returning an empty string. - */ -#define AV_OPT_ALLOW_NULL (1 << 2) - -/** - * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than - * one component for certain option types. - * @see AVOptionRanges for details. - */ -#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12) - -/** - * Look for an option in an object. Consider only options which - * have all the specified flags set. - * - * @param[in] obj A pointer to a struct whose first element is a - * pointer to an AVClass. - * Alternatively a double pointer to an AVClass, if - * AV_OPT_SEARCH_FAKE_OBJ search flag is set. - * @param[in] name The name of the option to look for. - * @param[in] unit When searching for named constants, name of the unit - * it belongs to. - * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). - * @param search_flags A combination of AV_OPT_SEARCH_*. - * - * @return A pointer to the option found, or NULL if no option - * was found. - * - * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable - * directly with av_opt_set(). Use special calls which take an options - * AVDictionary (e.g. avformat_open_input()) to set options found with this - * flag. - */ -const AVOption *av_opt_find(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags); - -/** - * Look for an option in an object. Consider only options which - * have all the specified flags set. - * - * @param[in] obj A pointer to a struct whose first element is a - * pointer to an AVClass. - * Alternatively a double pointer to an AVClass, if - * AV_OPT_SEARCH_FAKE_OBJ search flag is set. - * @param[in] name The name of the option to look for. - * @param[in] unit When searching for named constants, name of the unit - * it belongs to. - * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). - * @param search_flags A combination of AV_OPT_SEARCH_*. - * @param[out] target_obj if non-NULL, an object to which the option belongs will be - * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present - * in search_flags. This parameter is ignored if search_flags contain - * AV_OPT_SEARCH_FAKE_OBJ. - * - * @return A pointer to the option found, or NULL if no option - * was found. - */ -const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags, void **target_obj); - -/** - * Iterate over all AVOptions belonging to obj. - * - * @param obj an AVOptions-enabled struct or a double pointer to an - * AVClass describing it. - * @param prev result of the previous call to av_opt_next() on this object - * or NULL - * @return next AVOption or NULL - */ -const AVOption *av_opt_next(const void *obj, const AVOption *prev); - -/** - * Iterate over AVOptions-enabled children of obj. - * - * @param prev result of a previous call to this function or NULL - * @return next AVOptions-enabled child or NULL - */ -void *av_opt_child_next(void *obj, void *prev); - -/** - * Iterate over potential AVOptions-enabled children of parent. - * - * @param prev result of a previous call to this function or NULL - * @return AVClass corresponding to next potential child or NULL - */ -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); - -/** - * @defgroup opt_set_funcs Option setting functions - * @{ - * Those functions set the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. In case of av_opt_set() if the field is not - * of a string type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN - * is passed here, then the option may be set on a child of obj. - * - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR_OPTION_NOT_FOUND if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - */ -int av_opt_set (void *obj, const char *name, const char *val, int search_flags); -int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); -int av_opt_set_double (void *obj, const char *name, double val, int search_flags); -int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); -int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); -int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags); -int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags); -int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); -int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags); -int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags); -/** - * @note Any old dictionary present is discarded and replaced with a copy of the new one. The - * caller still owns val is and responsible for freeing it. - */ -int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); - -/** - * Set a binary option to an integer list. - * - * @param obj AVClass object to set options on - * @param name name of the binary option - * @param val pointer to an integer list (must have the correct type with - * regard to the contents of the list) - * @param term list terminator (usually 0 or -1) - * @param flags search flags - */ -#define av_opt_set_int_list(obj, name, val, term, flags) \ - (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \ - AVERROR(EINVAL) : \ - av_opt_set_bin(obj, name, (const uint8_t *)(val), \ - av_int_list_length(val, term) * sizeof(*(val)), flags)) - -/** - * @} - */ - -/** - * @defgroup opt_get_funcs Option getting functions - * @{ - * Those functions get a value of the option with the given name from an object. - * - * @param[in] obj a struct whose first element is a pointer to an AVClass. - * @param[in] name name of the option to get. - * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN - * is passed here, then the option may be found in a child of obj. - * @param[out] out_val value of the option will be written here - * @return >=0 on success, a negative error code otherwise - */ -/** - * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller - * - * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has - * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set - * to NULL instead of an allocated empty string. - */ -int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); -int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); -int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val); -int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); -int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out); -int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt); -int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt); -int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val); -int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout); -/** - * @param[out] out_val The returned dictionary is a copy of the actual value and must - * be freed with av_dict_free() by the caller - */ -int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val); -/** - * @} - */ -/** - * Gets a pointer to the requested field in a struct. - * This function allows accessing a struct even when its fields are moved or - * renamed since the application making the access has been compiled, - * - * @returns a pointer to the field, it can be cast to the correct type and read - * or written to. - */ -void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); - -/** - * Free an AVOptionRanges struct and set it to NULL. - */ -void av_opt_freep_ranges(AVOptionRanges **ranges); - -/** - * Get a list of allowed ranges for the given option. - * - * The returned list may depend on other fields in obj like for example profile. - * - * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored - * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance - * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges - * - * The result must be freed with av_opt_freep_ranges. - * - * @return number of compontents returned on success, a negative errro code otherwise - */ -int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); - -/** - * Copy options from src object into dest object. - * - * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. - * Original memory allocated for such options is freed unless both src and dest options points to the same memory. - * - * @param dest Object to copy from - * @param src Object to copy into - * @return 0 on success, negative on error - */ -int av_opt_copy(void *dest, const void *src); - -/** - * Get a default list of allowed ranges for the given option. - * - * This list is constructed without using the AVClass.query_ranges() callback - * and can be used as fallback from within the callback. - * - * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored - * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance - * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges - * - * The result must be freed with av_opt_free_ranges. - * - * @return number of compontents returned on success, a negative errro code otherwise - */ -int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); - -/** - * Check if given option is set to its default value. - * - * Options o must belong to the obj. This function must not be called to check child's options state. - * @see av_opt_is_set_to_default_by_name(). - * - * @param obj AVClass object to check option on - * @param o option to be checked - * @return >0 when option is set to its default, - * 0 when option is not set its default, - * <0 on error - */ -int av_opt_is_set_to_default(void *obj, const AVOption *o); - -/** - * Check if given option is set to its default value. - * - * @param obj AVClass object to check option on - * @param name option name - * @param search_flags combination of AV_OPT_SEARCH_* - * @return >0 when option is set to its default, - * 0 when option is not set its default, - * <0 on error - */ -int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); - - -#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only. -#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only. - -/** - * Serialize object's options. - * - * Create a string containing object's serialized options. - * Such string may be passed back to av_opt_set_from_string() in order to restore option values. - * A key/value or pairs separator occurring in the serialized value or - * name string are escaped through the av_escape() function. - * - * @param[in] obj AVClass object to serialize - * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) - * @param[in] flags combination of AV_OPT_SERIALIZE_* flags - * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. - * Buffer must be freed by the caller when is no longer needed. - * @param[in] key_val_sep character used to separate key from value - * @param[in] pairs_sep character used to separate two pairs from each other - * @return >= 0 on success, negative on error - * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. - */ -int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, - const char key_val_sep, const char pairs_sep); -/** - * @} - */ - -#endif /* AVUTIL_OPT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/parseutils.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/parseutils.h deleted file mode 100644 index e66d24b7..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/parseutils.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_PARSEUTILS_H -#define AVUTIL_PARSEUTILS_H - -#include - -#include "rational.h" - -/** - * @file - * misc parsing utilities - */ - -/** - * Parse str and store the parsed ratio in q. - * - * Note that a ratio with infinite (1/0) or negative value is - * considered valid, so you should check on the returned value if you - * want to exclude those values. - * - * The undefined value can be expressed using the "0:0" string. - * - * @param[in,out] q pointer to the AVRational which will contain the ratio - * @param[in] str the string to parse: it has to be a string in the format - * num:den, a float number or an expression - * @param[in] max the maximum allowed numerator and denominator - * @param[in] log_offset log level offset which is applied to the log - * level of log_ctx - * @param[in] log_ctx parent logging context - * @return >= 0 on success, a negative error code otherwise - */ -int av_parse_ratio(AVRational *q, const char *str, int max, - int log_offset, void *log_ctx); - -#define av_parse_ratio_quiet(rate, str, max) \ - av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) - -/** - * Parse str and put in width_ptr and height_ptr the detected values. - * - * @param[in,out] width_ptr pointer to the variable which will contain the detected - * width value - * @param[in,out] height_ptr pointer to the variable which will contain the detected - * height value - * @param[in] str the string to parse: it has to be a string in the format - * width x height or a valid video size abbreviation. - * @return >= 0 on success, a negative error code otherwise - */ -int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Parse str and store the detected values in *rate. - * - * @param[in,out] rate pointer to the AVRational which will contain the detected - * frame rate - * @param[in] str the string to parse: it has to be a string in the format - * rate_num / rate_den, a float number or a valid video rate abbreviation - * @return >= 0 on success, a negative error code otherwise - */ -int av_parse_video_rate(AVRational *rate, const char *str); - -/** - * Put the RGBA values that correspond to color_string in rgba_color. - * - * @param color_string a string specifying a color. It can be the name of - * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, - * possibly followed by "@" and a string representing the alpha - * component. - * The alpha component may be a string composed by "0x" followed by an - * hexadecimal number or a decimal number between 0.0 and 1.0, which - * represents the opacity value (0x00/0.0 means completely transparent, - * 0xff/1.0 completely opaque). - * If the alpha component is not specified then 0xff is assumed. - * The string "random" will result in a random color. - * @param slen length of the initial part of color_string containing the - * color. It can be set to -1 if color_string is a null terminated string - * containing nothing else than the color. - * @return >= 0 in case of success, a negative value in case of - * failure (for example if color_string cannot be parsed). - */ -int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, - void *log_ctx); - -/** - * Get the name of a color from the internal table of hard-coded named - * colors. - * - * This function is meant to enumerate the color names recognized by - * av_parse_color(). - * - * @param color_idx index of the requested color, starting from 0 - * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB - * @return the color name string or NULL if color_idx is not in the array - */ -const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); - -/** - * Parse timestr and return in *time a corresponding number of - * microseconds. - * - * @param timeval puts here the number of microseconds corresponding - * to the string in timestr. If the string represents a duration, it - * is the number of microseconds contained in the time interval. If - * the string is a date, is the number of microseconds since 1st of - * January, 1970 up to the time of the parsed date. If timestr cannot - * be successfully parsed, set *time to INT64_MIN. - - * @param timestr a string representing a date or a duration. - * - If a date the syntax is: - * @code - * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] - * now - * @endcode - * If the value is "now" it takes the current time. - * Time is local time unless Z is appended, in which case it is - * interpreted as UTC. - * If the year-month-day part is not specified it takes the current - * year-month-day. - * - If a duration the syntax is: - * @code - * [-][HH:]MM:SS[.m...] - * [-]S+[.m...] - * @endcode - * @param duration flag which tells how to interpret timestr, if not - * zero timestr is interpreted as a duration, otherwise as a date - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code otherwise - */ -int av_parse_time(int64_t *timeval, const char *timestr, int duration); - -/** - * Attempt to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. - */ -int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); - -/** - * Simplified version of strptime - * - * Parse the input string p according to the format string fmt and - * store its results in the structure dt. - * This implementation supports only a subset of the formats supported - * by the standard strptime(). - * - * The supported input field descriptors are listed below. - * - %H: the hour as a decimal number, using a 24-hour clock, in the - * range '00' through '23' - * - %J: hours as a decimal number, in the range '0' through INT_MAX - * - %M: the minute as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %S: the second as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %Y: the year as a decimal number, using the Gregorian calendar - * - %m: the month as a decimal number, in the range '1' through '12' - * - %d: the day of the month as a decimal number, in the range '1' - * through '31' - * - %T: alias for '%H:%M:%S' - * - %%: a literal '%' - * - * @return a pointer to the first character not processed in this function - * call. In case the input string contains more characters than - * required by the format string the return value points right after - * the last consumed input character. In case the whole input string - * is consumed the return value points to the null byte at the end of - * the string. On failure NULL is returned. - */ -char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); - -/** - * Convert the decomposed UTC time in tm to a time_t value. - */ -time_t av_timegm(struct tm *tm); - -#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixdesc.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixdesc.h deleted file mode 100644 index a8ad5889..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixdesc.h +++ /dev/null @@ -1,394 +0,0 @@ -/* - * pixel format descriptor - * Copyright (c) 2009 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_PIXDESC_H -#define AVUTIL_PIXDESC_H - -#include - -#include "attributes.h" -#include "pixfmt.h" -#include "version.h" - -typedef struct AVComponentDescriptor { - /** - * Which of the 4 planes contains the component. - */ - int plane; - - /** - * Number of elements between 2 horizontally consecutive pixels. - * Elements are bits for bitstream formats, bytes otherwise. - */ - int step; - - /** - * Number of elements before the component of the first pixel. - * Elements are bits for bitstream formats, bytes otherwise. - */ - int offset; - - /** - * Number of least significant bits that must be shifted away - * to get the value. - */ - int shift; - - /** - * Number of bits in the component. - */ - int depth; - -#if FF_API_PLUS1_MINUS1 - /** deprecated, use step instead */ - attribute_deprecated int step_minus1; - - /** deprecated, use depth instead */ - attribute_deprecated int depth_minus1; - - /** deprecated, use offset instead */ - attribute_deprecated int offset_plus1; -#endif -} AVComponentDescriptor; - -/** - * Descriptor that unambiguously describes how the bits of a pixel are - * stored in the up to 4 data planes of an image. It also stores the - * subsampling factors and number of components. - * - * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV - * and all the YUV variants) AVPixFmtDescriptor just stores how values - * are stored not what these values represent. - */ -typedef struct AVPixFmtDescriptor { - const char *name; - uint8_t nb_components; ///< The number of components each pixel has, (1-4) - - /** - * Amount to shift the luma width right to find the chroma width. - * For YV12 this is 1 for example. - * chroma_width = AV_CEIL_RSHIFT(luma_width, log2_chroma_w) - * The note above is needed to ensure rounding up. - * This value only refers to the chroma components. - */ - uint8_t log2_chroma_w; - - /** - * Amount to shift the luma height right to find the chroma height. - * For YV12 this is 1 for example. - * chroma_height= AV_CEIL_RSHIFT(luma_height, log2_chroma_h) - * The note above is needed to ensure rounding up. - * This value only refers to the chroma components. - */ - uint8_t log2_chroma_h; - - /** - * Combination of AV_PIX_FMT_FLAG_... flags. - */ - uint64_t flags; - - /** - * Parameters that describe how pixels are packed. - * If the format has 1 or 2 components, then luma is 0. - * If the format has 3 or 4 components: - * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; - * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. - * - * If present, the Alpha channel is always the last component. - */ - AVComponentDescriptor comp[4]; - - /** - * Alternative comma-separated names. - */ - const char *alias; -} AVPixFmtDescriptor; - -/** - * Pixel format is big-endian. - */ -#define AV_PIX_FMT_FLAG_BE (1 << 0) -/** - * Pixel format has a palette in data[1], values are indexes in this palette. - */ -#define AV_PIX_FMT_FLAG_PAL (1 << 1) -/** - * All values of a component are bit-wise packed end to end. - */ -#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) -/** - * Pixel format is an HW accelerated format. - */ -#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) -/** - * At least one pixel component is not in the first data plane. - */ -#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) -/** - * The pixel format contains RGB-like data (as opposed to YUV/grayscale). - */ -#define AV_PIX_FMT_FLAG_RGB (1 << 5) - -/** - * The pixel format is "pseudo-paletted". This means that it contains a - * fixed palette in the 2nd plane but the palette is fixed/constant for each - * PIX_FMT. This allows interpreting the data as if it was PAL8, which can - * in some cases be simpler. Or the data can be interpreted purely based on - * the pixel format without using the palette. - * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 - */ -#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) - -/** - * The pixel format has an alpha channel. This is set on all formats that - * support alpha in some way. The exception is AV_PIX_FMT_PAL8, which can - * carry alpha as part of the palette. Details are explained in the - * AVPixelFormat enum, and are also encoded in the corresponding - * AVPixFmtDescriptor. - * - * The alpha is always straight, never pre-multiplied. - * - * If a codec or a filter does not support alpha, it should set all alpha to - * opaque, or use the equivalent pixel formats without alpha component, e.g. - * AV_PIX_FMT_RGB0 (or AV_PIX_FMT_RGB24 etc.) instead of AV_PIX_FMT_RGBA. - */ -#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) - -/** - * Return the number of bits per pixel used by the pixel format - * described by pixdesc. Note that this is not the same as the number - * of bits per sample. - * - * The returned number of bits refers to the number of bits actually - * used for storing the pixel information, that is padding bits are - * not counted. - */ -int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); - -/** - * Return the number of bits per pixel for the pixel format - * described by pixdesc, including any padding or unused bits. - */ -int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); - -/** - * @return a pixel format descriptor for provided pixel format or NULL if - * this pixel format is unknown. - */ -const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); - -/** - * Iterate over all pixel format descriptors known to libavutil. - * - * @param prev previous descriptor. NULL to get the first descriptor. - * - * @return next descriptor or NULL after the last descriptor - */ -const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); - -/** - * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc - * is not a valid pointer to a pixel format descriptor. - */ -enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); - -/** - * Utility function to access log2_chroma_w log2_chroma_h from - * the pixel format AVPixFmtDescriptor. - * - * See av_get_chroma_sub_sample() for a function that asserts a - * valid pixel format instead of returning an error code. - * Its recommended that you use avcodec_get_chroma_sub_sample unless - * you do check the return code! - * - * @param[in] pix_fmt the pixel format - * @param[out] h_shift store log2_chroma_w (horizontal/width shift) - * @param[out] v_shift store log2_chroma_h (vertical/height shift) - * - * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format - */ -int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, - int *h_shift, int *v_shift); - -/** - * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a - * valid pixel format. - */ -int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); - -/** - * @return the name for provided color range or NULL if unknown. - */ -const char *av_color_range_name(enum AVColorRange range); - -/** - * @return the name for provided color primaries or NULL if unknown. - */ -const char *av_color_primaries_name(enum AVColorPrimaries primaries); - -/** - * @return the name for provided color transfer or NULL if unknown. - */ -const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); - -/** - * @return the name for provided color space or NULL if unknown. - */ -const char *av_color_space_name(enum AVColorSpace space); - -/** - * @return the name for provided chroma location or NULL if unknown. - */ -const char *av_chroma_location_name(enum AVChromaLocation location); - -/** - * Return the pixel format corresponding to name. - * - * If there is no pixel format with name name, then looks for a - * pixel format with the name corresponding to the native endian - * format of name. - * For example in a little-endian system, first looks for "gray16", - * then for "gray16le". - * - * Finally if no pixel format has been found, returns AV_PIX_FMT_NONE. - */ -enum AVPixelFormat av_get_pix_fmt(const char *name); - -/** - * Return the short name for a pixel format, NULL in case pix_fmt is - * unknown. - * - * @see av_get_pix_fmt(), av_get_pix_fmt_string() - */ -const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); - -/** - * Print in buf the string corresponding to the pixel format with - * number pix_fmt, or a header if pix_fmt is negative. - * - * @param buf the buffer where to write the string - * @param buf_size the size of buf - * @param pix_fmt the number of the pixel format to print the - * corresponding info string, or a negative value to print the - * corresponding header. - */ -char *av_get_pix_fmt_string(char *buf, int buf_size, - enum AVPixelFormat pix_fmt); - -/** - * Read a line from an image, and write the values of the - * pixel format component c to dst. - * - * @param data the array containing the pointers to the planes of the image - * @param linesize the array containing the linesizes of the image - * @param desc the pixel format descriptor for the image - * @param x the horizontal coordinate of the first pixel to read - * @param y the vertical coordinate of the first pixel to read - * @param w the width of the line to read, that is the number of - * values to write to dst - * @param read_pal_component if not zero and the format is a paletted - * format writes the values corresponding to the palette - * component c in data[1] to dst, rather than the palette indexes in - * data[0]. The behavior is undefined if the format is not paletted. - */ -void av_read_image_line(uint16_t *dst, const uint8_t *data[4], - const int linesize[4], const AVPixFmtDescriptor *desc, - int x, int y, int c, int w, int read_pal_component); - -/** - * Write the values from src to the pixel format component c of an - * image line. - * - * @param src array containing the values to write - * @param data the array containing the pointers to the planes of the - * image to write into. It is supposed to be zeroed. - * @param linesize the array containing the linesizes of the image - * @param desc the pixel format descriptor for the image - * @param x the horizontal coordinate of the first pixel to write - * @param y the vertical coordinate of the first pixel to write - * @param w the width of the line to write, that is the number of - * values to write to the image line - */ -void av_write_image_line(const uint16_t *src, uint8_t *data[4], - const int linesize[4], const AVPixFmtDescriptor *desc, - int x, int y, int c, int w); - -/** - * Utility function to swap the endianness of a pixel format. - * - * @param[in] pix_fmt the pixel format - * - * @return pixel format with swapped endianness if it exists, - * otherwise AV_PIX_FMT_NONE - */ -enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); - -#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ -#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ -#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ -#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ -#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ -#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ - -/** - * Compute what kind of losses will occur when converting from one specific - * pixel format to another. - * When converting from one pixel format to another, information loss may occur. - * For example, when converting from RGB24 to GRAY, the color information will - * be lost. Similarly, other losses occur when converting from some formats to - * other formats. These losses can involve loss of chroma, but also loss of - * resolution, loss of color depth, loss due to the color space conversion, loss - * of the alpha bits or loss due to color quantization. - * av_get_fix_fmt_loss() informs you about the various types of losses - * which will occur when converting from one pixel format to another. - * - * @param[in] dst_pix_fmt destination pixel format - * @param[in] src_pix_fmt source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur - * (maximum loss for an invalid dst_pix_fmt). - */ -int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, - enum AVPixelFormat src_pix_fmt, - int has_alpha); - -/** - * Compute what kind of losses will occur when converting from one specific - * pixel format to another. - * When converting from one pixel format to another, information loss may occur. - * For example, when converting from RGB24 to GRAY, the color information will - * be lost. Similarly, other losses occur when converting from some formats to - * other formats. These losses can involve loss of chroma, but also loss of - * resolution, loss of color depth, loss due to the color space conversion, loss - * of the alpha bits or loss due to color quantization. - * av_get_fix_fmt_loss() informs you about the various types of losses - * which will occur when converting from one pixel format to another. - * - * @param[in] dst_pix_fmt destination pixel format - * @param[in] src_pix_fmt source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur - * (maximum loss for an invalid dst_pix_fmt). - */ -enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - -#endif /* AVUTIL_PIXDESC_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixelutils.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixelutils.h deleted file mode 100644 index a8dbc157..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/pixelutils.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_PIXELUTILS_H -#define AVUTIL_PIXELUTILS_H - -#include -#include -#include "common.h" - -/** - * Sum of abs(src1[x] - src2[x]) - */ -typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, - const uint8_t *src2, ptrdiff_t stride2); - -/** - * Get a potentially optimized pointer to a Sum-of-absolute-differences - * function (see the av_pixelutils_sad_fn prototype). - * - * @param w_bits 1< - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_PIXFMT_H -#define AVUTIL_PIXFMT_H - -/** - * @file - * pixel format definitions - */ - -#include "libavutil/avconfig.h" -#include "version.h" - -#define AVPALETTE_SIZE 1024 -#define AVPALETTE_COUNT 256 - -/** - * Pixel format. - * - * @note - * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little-endian CPU architectures and ARGB on - * big-endian CPUs. - * - * @par - * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB32 palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - * - * @par - * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like - * for pal8. This palette is filled in automatically by the function - * allocating the picture. - */ -enum AVPixelFormat { - AV_PIX_FMT_NONE = -1, - AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... - AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... - AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - AV_PIX_FMT_GRAY8, ///< Y , 8bpp - AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb - AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb - AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette - AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range - AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range - AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range -#if FF_API_XVMC - AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing - AV_PIX_FMT_XVMC_MPEG2_IDCT, - AV_PIX_FMT_XVMC = AV_PIX_FMT_XVMC_MPEG2_IDCT, -#endif /* FF_API_XVMC */ - AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits - AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits - AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) - AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) - AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... - AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... - AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... - AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... - - AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian - AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian - AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) - AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range - AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) -#if FF_API_VDPAU - AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers -#endif - AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian - AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian - - AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian - AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian - AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined - AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined - - AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian - AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian - AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined - AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined - -#if FF_API_VAAPI - /** @name Deprecated pixel formats */ - /**@{*/ - AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID - /**@}*/ - AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, -#else - /** - * Hardware acceleration through VA-API, data[3] contains a - * VASurfaceID. - */ - AV_PIX_FMT_VAAPI, -#endif - - AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian -#if FF_API_VDPAU - AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG-4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers -#endif - AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer - - AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined - AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined - AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined - AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined - AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha - - AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 - AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 - - AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian - AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian - - /** - * The following 12 formats have the disadvantage of needing 1 format for each bit depth. - * Notice that each 9/10 bits sample is stored in 16 bits with extra padding. - * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better. - */ - AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA - AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp - AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP - AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian - AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian - AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian - AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian - AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian - AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian - AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) - AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) - AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian - AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian - AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian - AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian - AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian - AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian - AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) - AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) - AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) - AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) - AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) - AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) - AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) - AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) - - AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface - - AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 - AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 - AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - - AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian - AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian - - AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb - - AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef - - AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian) - AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian) - - AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp - AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian - AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian - /** - * HW acceleration through QSV, data[3] contains a pointer to the - * mfxFrameSurface1 structure. - */ - AV_PIX_FMT_QSV, - /** - * HW acceleration though MMAL, data[3] contains a pointer to the - * MMAL_BUFFER_HEADER_T structure. - */ - AV_PIX_FMT_MMAL, - - AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer - - /** - * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers - * exactly as for system memory frames. - */ - AV_PIX_FMT_CUDA, - - AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined - AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined - AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined - AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined - - AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian - AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian - AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian - AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian - AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range - - AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */ - AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */ - AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */ - AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */ - AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */ - AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */ - AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */ - AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */ - AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */ - AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */ - AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */ - AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */ -#if !FF_API_XVMC - AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing -#endif /* !FF_API_XVMC */ - AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian - AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian - AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian - AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian - AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian - AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian - - AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox - - AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian - AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian - - AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian - AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian - - AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian - AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian - - AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec - - AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions -}; - -#if AV_HAVE_BIGENDIAN -# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be -#else -# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le -#endif - -#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) -#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) -#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) -#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) -#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0) -#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0) - -#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) -#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) -#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) -#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) -#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) -#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) -#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) -#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) -#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) -#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) -#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) -#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) - -#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) -#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) -#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) -#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) -#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) -#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE) -#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) -#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) -#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) -#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE) -#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE) -#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE) -#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE) -#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE) -#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) -#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) -#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) - -#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) -#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) -#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) -#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE) -#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) -#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE) -#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE) -#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE) - -#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) -#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE) -#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) -#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) - - -#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) -#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) -#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) -#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) -#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) -#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) -#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) -#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) -#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) - -#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) -#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) -#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE) -#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) - -/** - * Chromaticity coordinates of the source primaries. - */ -enum AVColorPrimaries { - AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B - AVCOL_PRI_UNSPECIFIED = 2, - AVCOL_PRI_RESERVED = 3, - AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) - - AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM - AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above - AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C - AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 - AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) - AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) - AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 D65 (2010) - AVCOL_PRI_NB ///< Not part of ABI -}; - -/** - * Color Transfer Characteristic. - */ -enum AVColorTransferCharacteristic { - AVCOL_TRC_RESERVED0 = 0, - AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 - AVCOL_TRC_UNSPECIFIED = 2, - AVCOL_TRC_RESERVED = 3, - AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM - AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG - AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC - AVCOL_TRC_SMPTE240M = 7, - AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" - AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" - AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" - AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 - AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut - AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) - AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system - AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system - AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems - AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1 - AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" - AVCOL_TRC_NB ///< Not part of ABI -}; - -/** - * YUV colorspace type. - */ -enum AVColorSpace { - AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B - AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_RESERVED = 3, - AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) - AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above - AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 - AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system - AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system - AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x - AVCOL_SPC_NB ///< Not part of ABI -}; -#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG - - -/** - * MPEG vs JPEG YUV range. - */ -enum AVColorRange { - AVCOL_RANGE_UNSPECIFIED = 0, - AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges - AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges - AVCOL_RANGE_NB ///< Not part of ABI -}; - -/** - * Location of chroma samples. - * - * Illustration showing the location of the first (top left) chroma sample of the - * image, the left shows only luma, the right - * shows the location of the chroma sample, the 2 could be imagined to overlay - * each other but are drawn separately due to limitations of ASCII - * - * 1st 2nd 1st 2nd horizontal luma sample positions - * v v v v - * ______ ______ - *1st luma line > |X X ... |3 4 X ... X are luma samples, - * | |1 2 1-6 are possible chroma positions - *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position - */ -enum AVChromaLocation { - AVCHROMA_LOC_UNSPECIFIED = 0, - AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 - AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 - AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 - AVCHROMA_LOC_TOP = 4, - AVCHROMA_LOC_BOTTOMLEFT = 5, - AVCHROMA_LOC_BOTTOM = 6, - AVCHROMA_LOC_NB ///< Not part of ABI -}; - -#endif /* AVUTIL_PIXFMT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/random_seed.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/random_seed.h deleted file mode 100644 index 0462a048..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/random_seed.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2009 Baptiste Coudurier - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_RANDOM_SEED_H -#define AVUTIL_RANDOM_SEED_H - -#include -/** - * @addtogroup lavu_crypto - * @{ - */ - -/** - * Get a seed to use in conjunction with random functions. - * This function tries to provide a good seed at a best effort bases. - * Its possible to call this function multiple times if more bits are needed. - * It can be quite slow, which is why it should only be used as seed for a faster - * PRNG. The quality of the seed depends on the platform. - */ -uint32_t av_get_random_seed(void); - -/** - * @} - */ - -#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rational.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rational.h deleted file mode 100644 index c84a6090..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rational.h +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Add by Single - */ -#pragma clang diagnostic ignored "-Wdocumentation" - - -/* - * rational numbers - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_math_rational - * Utilties for rational number calculation. - * @author Michael Niedermayer - */ - -#ifndef AVUTIL_RATIONAL_H -#define AVUTIL_RATIONAL_H - -#include -#include -#include "attributes.h" - -/** - * @defgroup lavu_math_rational AVRational - * @ingroup lavu_math - * Rational number calculation. - * - * While rational numbers can be expressed as floating-point numbers, the - * conversion process is a lossy one, so are floating-point operations. On the - * other hand, the nature of FFmpeg demands highly accurate calculation of - * timestamps. This set of rational number utilities serves as a generic - * interface for manipulating rational numbers as pairs of numerators and - * denominators. - * - * Many of the functions that operate on AVRational's have the suffix `_q`, in - * reference to the mathematical symbol "ℚ" (Q) which denotes the set of all - * rational numbers. - * - * @{ - */ - -/** - * Rational number (pair of numerator and denominator). - */ -typedef struct AVRational{ - int num; ///< Numerator - int den; ///< Denominator -} AVRational; - -/** - * Create an AVRational. - * - * Useful for compilers that do not support compound literals. - * - * @note The return value is not reduced. - * @see av_reduce() - */ -static inline AVRational av_make_q(int num, int den) -{ - AVRational r = { num, den }; - return r; -} - -/** - * Compare two rationals. - * - * @param a First rational - * @param b Second rational - * - * @return One of the following values: - * - 0 if `a == b` - * - 1 if `a > b` - * - -1 if `a < b` - * - `INT_MIN` if one of the values is of the form `0 / 0` - */ -static inline int av_cmp_q(AVRational a, AVRational b){ - const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; - - if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1; - else if(b.den && a.den) return 0; - else if(a.num && b.num) return (a.num>>31) - (b.num>>31); - else return INT_MIN; -} - -/** - * Convert an AVRational to a `double`. - * @param a AVRational to convert - * @return `a` in floating-point form - * @see av_d2q() - */ -static inline double av_q2d(AVRational a){ - return a.num / (double) a.den; -} - -/** - * Reduce a fraction. - * - * This is useful for framerate calculations. - * - * @param[out] dst_num Destination numerator - * @param[out] dst_den Destination denominator - * @param[in] num Source numerator - * @param[in] den Source denominator - * @param[in] max Maximum allowed values for `dst_num` & `dst_den` - * @return 1 if the operation is exact, 0 otherwise - */ -int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); - -/** - * Multiply two rationals. - * @param b First rational - * @param c Second rational - * @return b*c - */ -AVRational av_mul_q(AVRational b, AVRational c) av_const; - -/** - * Divide one rational by another. - * @param b First rational - * @param c Second rational - * @return b/c - */ -AVRational av_div_q(AVRational b, AVRational c) av_const; - -/** - * Add two rationals. - * @param b First rational - * @param c Second rational - * @return b+c - */ -AVRational av_add_q(AVRational b, AVRational c) av_const; - -/** - * Subtract one rational from another. - * @param b First rational - * @param c Second rational - * @return b-c - */ -AVRational av_sub_q(AVRational b, AVRational c) av_const; - -/** - * Invert a rational. - * @param q value - * @return 1 / q - */ -static av_always_inline AVRational av_inv_q(AVRational q) -{ - AVRational r = { q.den, q.num }; - return r; -} - -/** - * Convert a double precision floating point number to a rational. - * - * In case of infinity, the returned value is expressed as `{1, 0}` or - * `{-1, 0}` depending on the sign. - * - * @param d `double` to convert - * @param max Maximum allowed numerator and denominator - * @return `d` in AVRational form - * @see av_q2d() - */ -AVRational av_d2q(double d, int max) av_const; - -/** - * Find which of the two rationals is closer to another rational. - * - * @param q Rational to be compared against - * @param q1,q2 Rationals to be tested - * @return One of the following values: - * - 1 if `q1` is nearer to `q` than `q2` - * - -1 if `q2` is nearer to `q` than `q1` - * - 0 if they have the same distance - */ -int av_nearer_q(AVRational q, AVRational q1, AVRational q2); - -/** - * Find the value in a list of rationals nearest a given reference rational. - * - * @param q Reference rational - * @param q_list Array of rationals terminated by `{0, 0}` - * @return Index of the nearest value found in the array - */ -int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); - -/** - * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point - * format. - * - * @param q Rational to be converted - * @return Equivalent floating-point value, expressed as an unsigned 32-bit - * integer. - * @note The returned value is platform-indepedant. - */ -uint32_t av_q2intfloat(AVRational q); - -/** - * @} - */ - -#endif /* AVUTIL_RATIONAL_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rc4.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rc4.h deleted file mode 100644 index 029cd2ad..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/rc4.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * RC4 encryption/decryption/pseudo-random number generator - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_RC4_H -#define AVUTIL_RC4_H - -#include - -/** - * @defgroup lavu_rc4 RC4 - * @ingroup lavu_crypto - * @{ - */ - -typedef struct AVRC4 { - uint8_t state[256]; - int x, y; -} AVRC4; - -/** - * Allocate an AVRC4 context. - */ -AVRC4 *av_rc4_alloc(void); - -/** - * @brief Initializes an AVRC4 context. - * - * @param key_bits must be a multiple of 8 - * @param decrypt 0 for encryption, 1 for decryption, currently has no effect - * @return zero on success, negative value otherwise - */ -int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); - -/** - * @brief Encrypts / decrypts using the RC4 algorithm. - * - * @param count number of bytes - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst, may be NULL - * @param iv not (yet) used for RC4, should be NULL - * @param decrypt 0 for encryption, 1 for decryption, not (yet) used - */ -void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); - -/** - * @} - */ - -#endif /* AVUTIL_RC4_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/replaygain.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/replaygain.h deleted file mode 100644 index b49bf1a3..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/replaygain.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_REPLAYGAIN_H -#define AVUTIL_REPLAYGAIN_H - -#include - -/** - * ReplayGain information (see - * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). - * The size of this struct is a part of the public ABI. - */ -typedef struct AVReplayGain { - /** - * Track replay gain in microbels (divide by 100000 to get the value in dB). - * Should be set to INT32_MIN when unknown. - */ - int32_t track_gain; - /** - * Peak track amplitude, with 100000 representing full scale (but values - * may overflow). 0 when unknown. - */ - uint32_t track_peak; - /** - * Same as track_gain, but for the whole album. - */ - int32_t album_gain; - /** - * Same as track_peak, but for the whole album, - */ - uint32_t album_peak; -} AVReplayGain; - -#endif /* AVUTIL_REPLAYGAIN_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ripemd.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ripemd.h deleted file mode 100644 index 6d6bb320..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/ripemd.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer - * Copyright (C) 2013 James Almer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_ripemd - * Public header for RIPEMD hash function implementation. - */ - -#ifndef AVUTIL_RIPEMD_H -#define AVUTIL_RIPEMD_H - -#include - -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_ripemd RIPEMD - * @ingroup lavu_hash - * RIPEMD hash function implementation. - * - * @{ - */ - -extern const int av_ripemd_size; - -struct AVRIPEMD; - -/** - * Allocate an AVRIPEMD context. - */ -struct AVRIPEMD *av_ripemd_alloc(void); - -/** - * Initialize RIPEMD hashing. - * - * @param context pointer to the function context (of size av_ripemd_size) - * @param bits number of bits in digest (128, 160, 256 or 320 bits) - * @return zero if initialization succeeded, -1 otherwise - */ -int av_ripemd_init(struct AVRIPEMD* context, int bits); - -/** - * Update hash value. - * - * @param context hash function context - * @param data input data to update hash with - * @param len input data length - */ -void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); - -/** - * Finish hashing and output digest value. - * - * @param context hash function context - * @param digest buffer where output digest value is stored - */ -void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); - -/** - * @} - */ - -#endif /* AVUTIL_RIPEMD_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/samplefmt.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/samplefmt.h deleted file mode 100644 index 8cd43ae8..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/samplefmt.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_SAMPLEFMT_H -#define AVUTIL_SAMPLEFMT_H - -#include - -#include "avutil.h" -#include "attributes.h" - -/** - * @addtogroup lavu_audio - * @{ - * - * @defgroup lavu_sampfmts Audio sample formats - * - * Audio sample format enumeration and related convenience functions. - * @{ - */ - -/** - * Audio sample formats - * - * - The data described by the sample format is always in native-endian order. - * Sample values can be expressed by native C types, hence the lack of a signed - * 24-bit sample format even though it is a common raw audio data format. - * - * - The floating-point formats are based on full volume being in the range - * [-1.0, 1.0]. Any values outside this range are beyond full volume level. - * - * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg - * (such as AVFrame in libavcodec) is as follows: - * - * @par - * For planar sample formats, each audio channel is in a separate data plane, - * and linesize is the buffer size, in bytes, for a single plane. All data - * planes must be the same size. For packed sample formats, only the first data - * plane is used, and samples for each channel are interleaved. In this case, - * linesize is the buffer size, in bytes, for the 1 plane. - * - */ -enum AVSampleFormat { - AV_SAMPLE_FMT_NONE = -1, - AV_SAMPLE_FMT_U8, ///< unsigned 8 bits - AV_SAMPLE_FMT_S16, ///< signed 16 bits - AV_SAMPLE_FMT_S32, ///< signed 32 bits - AV_SAMPLE_FMT_FLT, ///< float - AV_SAMPLE_FMT_DBL, ///< double - - AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar - AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar - AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar - AV_SAMPLE_FMT_FLTP, ///< float, planar - AV_SAMPLE_FMT_DBLP, ///< double, planar - AV_SAMPLE_FMT_S64, ///< signed 64 bits - AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar - - AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically -}; - -/** - * Return the name of sample_fmt, or NULL if sample_fmt is not - * recognized. - */ -const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); - -/** - * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE - * on error. - */ -enum AVSampleFormat av_get_sample_fmt(const char *name); - -/** - * Return the planar<->packed alternative form of the given sample format, or - * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the - * requested planar/packed format, the format returned is the same as the - * input. - */ -enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); - -/** - * Get the packed alternative form of the given sample format. - * - * If the passed sample_fmt is already in packed format, the format returned is - * the same as the input. - * - * @return the packed alternative form of the given sample format or - AV_SAMPLE_FMT_NONE on error. - */ -enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); - -/** - * Get the planar alternative form of the given sample format. - * - * If the passed sample_fmt is already in planar format, the format returned is - * the same as the input. - * - * @return the planar alternative form of the given sample format or - AV_SAMPLE_FMT_NONE on error. - */ -enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); - -/** - * Generate a string corresponding to the sample format with - * sample_fmt, or a header if sample_fmt is negative. - * - * @param buf the buffer where to write the string - * @param buf_size the size of buf - * @param sample_fmt the number of the sample format to print the - * corresponding info string, or a negative value to print the - * corresponding header. - * @return the pointer to the filled buffer or NULL if sample_fmt is - * unknown or in case of other errors - */ -char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); - -/** - * Return number of bytes per sample. - * - * @param sample_fmt the sample format - * @return number of bytes per sample or zero if unknown for the given - * sample format - */ -int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); - -/** - * Check if the sample format is planar. - * - * @param sample_fmt the sample format to inspect - * @return 1 if the sample format is planar, 0 if it is interleaved - */ -int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); - -/** - * Get the required buffer size for the given audio parameters. - * - * @param[out] linesize calculated linesize, may be NULL - * @param nb_channels the number of channels - * @param nb_samples the number of samples in a single channel - * @param sample_fmt the sample format - * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return required buffer size, or negative error code on failure - */ -int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, - enum AVSampleFormat sample_fmt, int align); - -/** - * @} - * - * @defgroup lavu_sampmanip Samples manipulation - * - * Functions that manipulate audio samples - * @{ - */ - -/** - * Fill plane data pointers and linesize for samples with sample - * format sample_fmt. - * - * The audio_data array is filled with the pointers to the samples data planes: - * for planar, set the start point of each channel's data within the buffer, - * for packed, set the start point of the entire buffer only. - * - * The value pointed to by linesize is set to the aligned size of each - * channel's data buffer for planar layout, or to the aligned size of the - * buffer for all channels for packed layout. - * - * The buffer in buf must be big enough to contain all the samples - * (use av_samples_get_buffer_size() to compute its minimum size), - * otherwise the audio_data pointers will point to invalid data. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param[out] audio_data array to be filled with the pointer for each channel - * @param[out] linesize calculated linesize, may be NULL - * @param buf the pointer to a buffer containing the samples - * @param nb_channels the number of channels - * @param nb_samples the number of samples in a single channel - * @param sample_fmt the sample format - * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return minimum size in bytes required for the buffer in case - * of success at the next bump - */ -int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, - const uint8_t *buf, - int nb_channels, int nb_samples, - enum AVSampleFormat sample_fmt, int align); - -/** - * Allocate a samples buffer for nb_samples samples, and fill data pointers and - * linesize accordingly. - * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) - * Allocated data will be initialized to silence. - * - * @see enum AVSampleFormat - * The documentation for AVSampleFormat describes the data layout. - * - * @param[out] audio_data array to be filled with the pointer for each channel - * @param[out] linesize aligned size for audio buffer(s), may be NULL - * @param nb_channels number of audio channels - * @param nb_samples number of samples per channel - * @param align buffer size alignment (0 = default, 1 = no alignment) - * @return >=0 on success or a negative error code on failure - * @todo return the size of the allocated buffer in case of success at the next bump - * @see av_samples_fill_arrays() - * @see av_samples_alloc_array_and_samples() - */ -int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, - int nb_samples, enum AVSampleFormat sample_fmt, int align); - -/** - * Allocate a data pointers array, samples buffer for nb_samples - * samples, and fill data pointers and linesize accordingly. - * - * This is the same as av_samples_alloc(), but also allocates the data - * pointers array. - * - * @see av_samples_alloc() - */ -int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, - int nb_samples, enum AVSampleFormat sample_fmt, int align); - -/** - * Copy samples from src to dst. - * - * @param dst destination array of pointers to data planes - * @param src source array of pointers to data planes - * @param dst_offset offset in samples at which the data will be written to dst - * @param src_offset offset in samples at which the data will be read from src - * @param nb_samples number of samples to be copied - * @param nb_channels number of audio channels - * @param sample_fmt audio sample format - */ -int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, - int src_offset, int nb_samples, int nb_channels, - enum AVSampleFormat sample_fmt); - -/** - * Fill an audio buffer with silence. - * - * @param audio_data array of pointers to data planes - * @param offset offset in samples at which to start filling - * @param nb_samples number of samples to fill - * @param nb_channels number of audio channels - * @param sample_fmt audio sample format - */ -int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, - int nb_channels, enum AVSampleFormat sample_fmt); - -/** - * @} - * @} - */ -#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha.h deleted file mode 100644 index c7558a89..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_sha - * Public header for SHA-1 & SHA-256 hash function implementations. - */ - -#ifndef AVUTIL_SHA_H -#define AVUTIL_SHA_H - -#include - -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_sha SHA - * @ingroup lavu_hash - * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations. - * - * This module supports the following SHA hash functions: - * - * - SHA-1: 160 bits - * - SHA-224: 224 bits, as a variant of SHA-2 - * - SHA-256: 256 bits, as a variant of SHA-2 - * - * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512. - * - * @{ - */ - -extern const int av_sha_size; - -struct AVSHA; - -/** - * Allocate an AVSHA context. - */ -struct AVSHA *av_sha_alloc(void); - -/** - * Initialize SHA-1 or SHA-2 hashing. - * - * @param context pointer to the function context (of size av_sha_size) - * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) - * @return zero if initialization succeeded, -1 otherwise - */ -int av_sha_init(struct AVSHA* context, int bits); - -/** - * Update hash value. - * - * @param context hash function context - * @param data input data to update hash with - * @param len input data length - */ -void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); - -/** - * Finish hashing and output digest value. - * - * @param context hash function context - * @param digest buffer where output digest value is stored - */ -void av_sha_final(struct AVSHA* context, uint8_t *digest); - -/** - * @} - */ - -#endif /* AVUTIL_SHA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha512.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha512.h deleted file mode 100644 index 5bac184c..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/sha512.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer - * Copyright (C) 2013 James Almer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu_sha512 - * Public header for SHA-512 implementation. - */ - -#ifndef AVUTIL_SHA512_H -#define AVUTIL_SHA512_H - -#include - -#include "attributes.h" -#include "version.h" - -/** - * @defgroup lavu_sha512 SHA-512 - * @ingroup lavu_hash - * SHA-512 (Secure Hash Algorithm) hash function implementations. - * - * This module supports the following SHA-2 hash functions: - * - * - SHA-512/224: 224 bits - * - SHA-512/256: 256 bits - * - SHA-384: 384 bits - * - SHA-512: 512 bits - * - * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha. - * - * @{ - */ - -extern const int av_sha512_size; - -struct AVSHA512; - -/** - * Allocate an AVSHA512 context. - */ -struct AVSHA512 *av_sha512_alloc(void); - -/** - * Initialize SHA-2 512 hashing. - * - * @param context pointer to the function context (of size av_sha512_size) - * @param bits number of bits in digest (224, 256, 384 or 512 bits) - * @return zero if initialization succeeded, -1 otherwise - */ -int av_sha512_init(struct AVSHA512* context, int bits); - -/** - * Update hash value. - * - * @param context hash function context - * @param data input data to update hash with - * @param len input data length - */ -void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); - -/** - * Finish hashing and output digest value. - * - * @param context hash function context - * @param digest buffer where output digest value is stored - */ -void av_sha512_final(struct AVSHA512* context, uint8_t *digest); - -/** - * @} - */ - -#endif /* AVUTIL_SHA512_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/stereo3d.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/stereo3d.h deleted file mode 100644 index 19c54164..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/stereo3d.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2013 Vittorio Giovara - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_STEREO3D_H -#define AVUTIL_STEREO3D_H - -#include - -#include "frame.h" - -/** - * List of possible 3D Types - */ -enum AVStereo3DType { - /** - * Video is not stereoscopic (and metadata has to be there). - */ - AV_STEREO3D_2D, - - /** - * Views are next to each other. - * - * LLLLRRRR - * LLLLRRRR - * LLLLRRRR - * ... - */ - AV_STEREO3D_SIDEBYSIDE, - - /** - * Views are on top of each other. - * - * LLLLLLLL - * LLLLLLLL - * RRRRRRRR - * RRRRRRRR - */ - AV_STEREO3D_TOPBOTTOM, - - /** - * Views are alternated temporally. - * - * frame0 frame1 frame2 ... - * LLLLLLLL RRRRRRRR LLLLLLLL - * LLLLLLLL RRRRRRRR LLLLLLLL - * LLLLLLLL RRRRRRRR LLLLLLLL - * ... ... ... - */ - AV_STEREO3D_FRAMESEQUENCE, - - /** - * Views are packed in a checkerboard-like structure per pixel. - * - * LRLRLRLR - * RLRLRLRL - * LRLRLRLR - * ... - */ - AV_STEREO3D_CHECKERBOARD, - - /** - * Views are next to each other, but when upscaling - * apply a checkerboard pattern. - * - * LLLLRRRR L L L L R R R R - * LLLLRRRR => L L L L R R R R - * LLLLRRRR L L L L R R R R - * LLLLRRRR L L L L R R R R - */ - AV_STEREO3D_SIDEBYSIDE_QUINCUNX, - - /** - * Views are packed per line, as if interlaced. - * - * LLLLLLLL - * RRRRRRRR - * LLLLLLLL - * ... - */ - AV_STEREO3D_LINES, - - /** - * Views are packed per column. - * - * LRLRLRLR - * LRLRLRLR - * LRLRLRLR - * ... - */ - AV_STEREO3D_COLUMNS, -}; - - -/** - * Inverted views, Right/Bottom represents the left view. - */ -#define AV_STEREO3D_FLAG_INVERT (1 << 0) - -/** - * Stereo 3D type: this structure describes how two videos are packed - * within a single video surface, with additional information as needed. - * - * @note The struct must be allocated with av_stereo3d_alloc() and - * its size is not a part of the public ABI. - */ -typedef struct AVStereo3D { - /** - * How views are packed within the video. - */ - enum AVStereo3DType type; - - /** - * Additional information about the frame packing. - */ - int flags; -} AVStereo3D; - -/** - * Allocate an AVStereo3D structure and set its fields to default values. - * The resulting struct can be freed using av_freep(). - * - * @return An AVStereo3D filled with default values or NULL on failure. - */ -AVStereo3D *av_stereo3d_alloc(void); - -/** - * Allocate a complete AVFrameSideData and add it to the frame. - * - * @param frame The frame which side data is added to. - * - * @return The AVStereo3D structure to be filled by caller. - */ -AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); - -/** - * Provide a human-readable name of a given stereo3d type. - * - * @param type The input stereo3d type value. - * - * @return The name of the stereo3d value, or "unknown". - */ -const char *av_stereo3d_type_name(unsigned int type); - -/** - * Get the AVStereo3DType form a human-readable name. - * - * @param type The input string. - * - * @return The AVStereo3DType value, or -1 if not found. - */ -int av_stereo3d_from_name(const char *name); - -#endif /* AVUTIL_STEREO3D_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tea.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tea.h deleted file mode 100644 index dd929bda..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tea.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * A 32-bit implementation of the TEA algorithm - * Copyright (c) 2015 Vesselin Bontchev - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_TEA_H -#define AVUTIL_TEA_H - -#include - -/** - * @file - * @brief Public header for libavutil TEA algorithm - * @defgroup lavu_tea TEA - * @ingroup lavu_crypto - * @{ - */ - -extern const int av_tea_size; - -struct AVTEA; - -/** - * Allocate an AVTEA context - * To free the struct: av_free(ptr) - */ -struct AVTEA *av_tea_alloc(void); - -/** - * Initialize an AVTEA context. - * - * @param ctx an AVTEA context - * @param key a key of 16 bytes used for encryption/decryption - * @param rounds the number of rounds in TEA (64 is the "standard") - */ -void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); - -/** - * Encrypt or decrypt a buffer using a previously initialized context. - * - * @param ctx an AVTEA context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param iv initialization vector for CBC mode, if NULL then ECB will be used - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, - int count, uint8_t *iv, int decrypt); - -/** - * @} - */ - -#endif /* AVUTIL_TEA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/threadmessage.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/threadmessage.h deleted file mode 100644 index 8480a0a3..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/threadmessage.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with FFmpeg; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_THREADMESSAGE_H -#define AVUTIL_THREADMESSAGE_H - -typedef struct AVThreadMessageQueue AVThreadMessageQueue; - -typedef enum AVThreadMessageFlags { - - /** - * Perform non-blocking operation. - * If this flag is set, send and recv operations are non-blocking and - * return AVERROR(EAGAIN) immediately if they can not proceed. - */ - AV_THREAD_MESSAGE_NONBLOCK = 1, - -} AVThreadMessageFlags; - -/** - * Allocate a new message queue. - * - * @param mq pointer to the message queue - * @param nelem maximum number of elements in the queue - * @param elsize size of each element in the queue - * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if - * lavu was built without thread support - */ -int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, - unsigned nelem, - unsigned elsize); - -/** - * Free a message queue. - * - * The message queue must no longer be in use by another thread. - */ -void av_thread_message_queue_free(AVThreadMessageQueue **mq); - -/** - * Send a message on the queue. - */ -int av_thread_message_queue_send(AVThreadMessageQueue *mq, - void *msg, - unsigned flags); - -/** - * Receive a message from the queue. - */ -int av_thread_message_queue_recv(AVThreadMessageQueue *mq, - void *msg, - unsigned flags); - -/** - * Set the sending error code. - * - * If the error code is set to non-zero, av_thread_message_queue_send() will - * return it immediately. Conventional values, such as AVERROR_EOF or - * AVERROR(EAGAIN), can be used to cause the sending thread to stop or - * suspend its operation. - */ -void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, - int err); - -/** - * Set the receiving error code. - * - * If the error code is set to non-zero, av_thread_message_queue_recv() will - * return it immediately when there are no longer available messages. - * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used - * to cause the receiving thread to stop or suspend its operation. - */ -void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, - int err); - -/** - * Set the optional free message callback function which will be called if an - * operation is removing messages from the queue. - */ -void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, - void (*free_func)(void *msg)); - -/** - * Flush the message queue - * - * This function is mostly equivalent to reading and free-ing every message - * except that it will be done in a single operation (no lock/unlock between - * reads). - */ -void av_thread_message_flush(AVThreadMessageQueue *mq); - -#endif /* AVUTIL_THREADMESSAGE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/time.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/time.h deleted file mode 100644 index dc169b06..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/time.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2000-2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_TIME_H -#define AVUTIL_TIME_H - -#include - -/** - * Get the current time in microseconds. - */ -int64_t av_gettime(void); - -/** - * Get the current time in microseconds since some unspecified starting point. - * On platforms that support it, the time comes from a monotonic clock - * This property makes this time source ideal for measuring relative time. - * The returned values may not be monotonic on platforms where a monotonic - * clock is not available. - */ -int64_t av_gettime_relative(void); - -/** - * Indicates with a boolean result if the av_gettime_relative() time source - * is monotonic. - */ -int av_gettime_relative_is_monotonic(void); - -/** - * Sleep for a period of time. Although the duration is expressed in - * microseconds, the actual delay may be rounded to the precision of the - * system timer. - * - * @param usec Number of microseconds to sleep. - * @return zero on success or (negative) error code. - */ -int av_usleep(unsigned usec); - -#endif /* AVUTIL_TIME_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timecode.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timecode.h deleted file mode 100644 index 56e3975f..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timecode.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier - * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Timecode helpers header - */ - -#ifndef AVUTIL_TIMECODE_H -#define AVUTIL_TIMECODE_H - -#include -#include "rational.h" - -#define AV_TIMECODE_STR_SIZE 16 - -enum AVTimecodeFlag { - AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame - AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours - AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed -}; - -typedef struct { - int start; ///< timecode frame start (first base frame number) - uint32_t flags; ///< flags such as drop frame, +24 hours support, ... - AVRational rate; ///< frame rate in rational form - unsigned fps; ///< frame per second; must be consistent with the rate field -} AVTimecode; - -/** - * Adjust frame number for NTSC drop frame time code. - * - * @param framenum frame number to adjust - * @param fps frame per second, 30 or 60 - * @return adjusted frame number - * @warning adjustment is only valid in NTSC 29.97 and 59.94 - */ -int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); - -/** - * Convert frame number to SMPTE 12M binary representation. - * - * @param tc timecode data correctly initialized - * @param framenum frame number - * @return the SMPTE binary representation - * - * @note Frame number adjustment is automatically done in case of drop timecode, - * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). - * @note The frame number is relative to tc->start. - * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity - * correction (PC) bits are set to zero. - */ -uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); - -/** - * Load timecode string in buf. - * - * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long - * @param tc timecode data correctly initialized - * @param framenum frame number - * @return the buf parameter - * - * @note Timecode representation can be a negative timecode and have more than - * 24 hours, but will only be honored if the flags are correctly set. - * @note The frame number is relative to tc->start. - */ -char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); - -/** - * Get the timecode string from the SMPTE timecode format. - * - * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long - * @param tcsmpte the 32-bit SMPTE timecode - * @param prevent_df prevent the use of a drop flag when it is known the DF bit - * is arbitrary - * @return the buf parameter - */ -char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df); - -/** - * Get the timecode string from the 25-bit timecode format (MPEG GOP format). - * - * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long - * @param tc25bit the 25-bits timecode - * @return the buf parameter - */ -char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit); - -/** - * Init a timecode struct with the passed parameters. - * - * @param log_ctx a pointer to an arbitrary struct of which the first field - * is a pointer to an AVClass struct (used for av_log) - * @param tc pointer to an allocated AVTimecode - * @param rate frame rate in rational form - * @param flags miscellaneous flags such as drop frame, +24 hours, ... - * (see AVTimecodeFlag) - * @param frame_start the first frame number - * @return 0 on success, AVERROR otherwise - */ -int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); - -/** - * Parse timecode representation (hh:mm:ss[:;.]ff). - * - * @param log_ctx a pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct (used for av_log). - * @param tc pointer to an allocated AVTimecode - * @param rate frame rate in rational form - * @param str timecode string which will determine the frame start - * @return 0 on success, AVERROR otherwise - */ -int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); - -/** - * Check if the timecode feature is available for the given frame rate - * - * @return 0 if supported, <0 otherwise - */ -int av_timecode_check_frame_rate(AVRational rate); - -#endif /* AVUTIL_TIMECODE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timestamp.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timestamp.h deleted file mode 100644 index e082f01b..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/timestamp.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * timestamp utils, mostly useful for debugging/logging purposes - */ - -#ifndef AVUTIL_TIMESTAMP_H -#define AVUTIL_TIMESTAMP_H - -#include "common.h" - -#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) -#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS -#endif - -#define AV_TS_MAX_STRING_SIZE 32 - -/** - * Fill the provided buffer with a string containing a timestamp - * representation. - * - * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE - * @param ts the timestamp to represent - * @return the buffer in input - */ -static inline char *av_ts_make_string(char *buf, int64_t ts) -{ - if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); - else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts); - return buf; -} - -/** - * Convenience macro, the return value should be used only directly in - * function arguments but never stand-alone. - */ -#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) - -/** - * Fill the provided buffer with a string containing a timestamp time - * representation. - * - * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE - * @param ts the timestamp to represent - * @param tb the timebase of the timestamp - * @return the buffer in input - */ -static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) -{ - if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); - else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); - return buf; -} - -/** - * Convenience macro, the return value should be used only directly in - * function arguments but never stand-alone. - */ -#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) - -#endif /* AVUTIL_TIMESTAMP_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tree.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tree.h deleted file mode 100644 index d5e0aebf..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/tree.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * A tree container. - * @author Michael Niedermayer - */ - -#ifndef AVUTIL_TREE_H -#define AVUTIL_TREE_H - -#include "attributes.h" -#include "version.h" - -/** - * @addtogroup lavu_tree AVTree - * @ingroup lavu_data - * - * Low-complexity tree container - * - * Insertion, removal, finding equal, largest which is smaller than and - * smallest which is larger than, all have O(log n) worst-case complexity. - * @{ - */ - - -struct AVTreeNode; -extern const int av_tree_node_size; - -/** - * Allocate an AVTreeNode. - */ -struct AVTreeNode *av_tree_node_alloc(void); - -/** - * Find an element. - * @param root a pointer to the root node of the tree - * @param next If next is not NULL, then next[0] will contain the previous - * element and next[1] the next element. If either does not exist, - * then the corresponding entry in next is unchanged. - * @param cmp compare function used to compare elements in the tree, - * API identical to that of Standard C's qsort - * It is guaranteed that the first and only the first argument to cmp() - * will be the key parameter to av_tree_find(), thus it could if the - * user wants, be a different type (like an opaque context). - * @return An element with cmp(key, elem) == 0 or NULL if no such element - * exists in the tree. - */ -void *av_tree_find(const struct AVTreeNode *root, void *key, - int (*cmp)(const void *key, const void *b), void *next[2]); - -/** - * Insert or remove an element. - * - * If *next is NULL, then the supplied element will be removed if it exists. - * If *next is non-NULL, then the supplied element will be inserted, unless - * it already exists in the tree. - * - * @param rootp A pointer to a pointer to the root node of the tree; note that - * the root node can change during insertions, this is required - * to keep the tree balanced. - * @param key pointer to the element key to insert in the tree - * @param next Used to allocate and free AVTreeNodes. For insertion the user - * must set it to an allocated and zeroed object of at least - * av_tree_node_size bytes size. av_tree_insert() will set it to - * NULL if it has been consumed. - * For deleting elements *next is set to NULL by the user and - * av_tree_insert() will set it to the AVTreeNode which was - * used for the removed element. - * This allows the use of flat arrays, which have - * lower overhead compared to many malloced elements. - * You might want to define a function like: - * @code - * void *tree_insert(struct AVTreeNode **rootp, void *key, - * int (*cmp)(void *key, const void *b), - * AVTreeNode **next) - * { - * if (!*next) - * *next = av_mallocz(av_tree_node_size); - * return av_tree_insert(rootp, key, cmp, next); - * } - * void *tree_remove(struct AVTreeNode **rootp, void *key, - * int (*cmp)(void *key, const void *b, AVTreeNode **next)) - * { - * av_freep(next); - * return av_tree_insert(rootp, key, cmp, next); - * } - * @endcode - * @param cmp compare function used to compare elements in the tree, API identical - * to that of Standard C's qsort - * @return If no insertion happened, the found element; if an insertion or - * removal happened, then either key or NULL will be returned. - * Which one it is depends on the tree state and the implementation. You - * should make no assumptions that it's one or the other in the code. - */ -void *av_tree_insert(struct AVTreeNode **rootp, void *key, - int (*cmp)(const void *key, const void *b), - struct AVTreeNode **next); - -void av_tree_destroy(struct AVTreeNode *t); - -/** - * Apply enu(opaque, &elem) to all the elements in the tree in a given range. - * - * @param cmp a comparison function that returns < 0 for an element below the - * range, > 0 for an element above the range and == 0 for an - * element inside the range - * - * @note The cmp function should use the same ordering used to construct the - * tree. - */ -void av_tree_enumerate(struct AVTreeNode *t, void *opaque, - int (*cmp)(void *opaque, void *elem), - int (*enu)(void *opaque, void *elem)); - -/** - * @} - */ - -#endif /* AVUTIL_TREE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/twofish.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/twofish.h deleted file mode 100644 index 813cfecd..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/twofish.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * An implementation of the TwoFish algorithm - * Copyright (c) 2015 Supraja Meedinti - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_TWOFISH_H -#define AVUTIL_TWOFISH_H - -#include - - -/** - * @file - * @brief Public header for libavutil TWOFISH algorithm - * @defgroup lavu_twofish TWOFISH - * @ingroup lavu_crypto - * @{ - */ - -extern const int av_twofish_size; - -struct AVTWOFISH; - -/** - * Allocate an AVTWOFISH context - * To free the struct: av_free(ptr) - */ -struct AVTWOFISH *av_twofish_alloc(void); - -/** - * Initialize an AVTWOFISH context. - * - * @param ctx an AVTWOFISH context - * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption - * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise - */ -int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); - -/** - * Encrypt or decrypt a buffer using a previously initialized context - * - * @param ctx an AVTWOFISH context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 16 byte blocks - * @paran iv initialization vector for CBC mode, NULL for ECB mode - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); - -/** - * @} - */ -#endif /* AVUTIL_TWOFISH_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/version.h deleted file mode 100644 index c57ac7fa..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/version.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @ingroup lavu - * Libavutil version macros - */ - -#ifndef AVUTIL_VERSION_H -#define AVUTIL_VERSION_H - -#include "macros.h" - -/** - * @addtogroup version_utils - * - * Useful to check and match library version in order to maintain - * backward compatibility. - * - * The FFmpeg libraries follow a versioning sheme very similar to - * Semantic Versioning (http://semver.org/) - * The difference is that the component called PATCH is called MICRO in FFmpeg - * and its value is reset to 100 instead of 0 to keep it above or equal to 100. - * Also we do not increase MICRO for every bugfix or change in git master. - * - * Prior to FFmpeg 3.2 point releases did not change any lib version number to - * avoid aliassing different git master checkouts. - * Starting with FFmpeg 3.2, the released library versions will occupy - * a separate MAJOR.MINOR that is not used on the master development branch. - * That is if we branch a release of master 55.10.123 we will bump to 55.11.100 - * for the release and master will continue at 55.12.100 after it. Each new - * point release will then bump the MICRO improving the usefulness of the lib - * versions. - * - * @{ - */ - -#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) -#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c -#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) - -/** - * Extract version components from the full ::AV_VERSION_INT int as returned - * by functions like ::avformat_version() and ::avcodec_version() - */ -#define AV_VERSION_MAJOR(a) ((a) >> 16) -#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) -#define AV_VERSION_MICRO(a) ((a) & 0xFF) - -/** - * @} - */ - -/** - * @defgroup lavu_ver Version and Build diagnostics - * - * Macros and function useful to check at compiletime and at runtime - * which version of libavutil is in use. - * - * @{ - */ - -#define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 34 -#define LIBAVUTIL_VERSION_MICRO 101 - -#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ - LIBAVUTIL_VERSION_MINOR, \ - LIBAVUTIL_VERSION_MICRO) -#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ - LIBAVUTIL_VERSION_MINOR, \ - LIBAVUTIL_VERSION_MICRO) -#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT - -#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) - -/** - * @defgroup lavu_depr_guards Deprecation Guards - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - * - * @note, when bumping the major version it is recommended to manually - * disable each FF_API_* in its own commit instead of disabling them all - * at once through the bump. This improves the git bisect-ability of the change. - * - * @{ - */ - -#ifndef FF_API_VDPAU -#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_OPT_TYPE_METADATA -#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_DLOG -#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_VAAPI -#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_FRAME_QP -#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_PLUS1_MINUS1 -#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_ERROR_FRAME -#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_CRC_BIG_TABLE -#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_PKT_PTS -#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56) -#endif - - -/** - * @} - * @} - */ - -#endif /* AVUTIL_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/xtea.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/xtea.h deleted file mode 100644 index 735427c1..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libavutil/xtea.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * A 32-bit implementation of the XTEA algorithm - * Copyright (c) 2012 Samuel Pitoiset - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_XTEA_H -#define AVUTIL_XTEA_H - -#include - -/** - * @file - * @brief Public header for libavutil XTEA algorithm - * @defgroup lavu_xtea XTEA - * @ingroup lavu_crypto - * @{ - */ - -typedef struct AVXTEA { - uint32_t key[16]; -} AVXTEA; - -/** - * Allocate an AVXTEA context. - */ -AVXTEA *av_xtea_alloc(void); - -/** - * Initialize an AVXTEA context. - * - * @param ctx an AVXTEA context - * @param key a key of 16 bytes used for encryption/decryption, - * interpreted as big endian 32 bit numbers - */ -void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); - -/** - * Initialize an AVXTEA context. - * - * @param ctx an AVXTEA context - * @param key a key of 16 bytes used for encryption/decryption, - * interpreted as little endian 32 bit numbers - */ -void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); - -/** - * Encrypt or decrypt a buffer using a previously initialized context, - * in big endian format. - * - * @param ctx an AVXTEA context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param iv initialization vector for CBC mode, if NULL then ECB will be used - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, - int count, uint8_t *iv, int decrypt); - -/** - * Encrypt or decrypt a buffer using a previously initialized context, - * in little endian format. - * - * @param ctx an AVXTEA context - * @param dst destination array, can be equal to src - * @param src source array, can be equal to dst - * @param count number of 8 byte blocks - * @param iv initialization vector for CBC mode, if NULL then ECB will be used - * @param decrypt 0 for encryption, 1 for decryption - */ -void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, - int count, uint8_t *iv, int decrypt); - -/** - * @} - */ - -#endif /* AVUTIL_XTEA_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/swresample.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/swresample.h deleted file mode 100644 index a8db5c24..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/swresample.h +++ /dev/null @@ -1,583 +0,0 @@ -/* - * Copyright (C) 2011-2013 Michael Niedermayer (michaelni@gmx.at) - * - * This file is part of libswresample - * - * libswresample is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * libswresample is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with libswresample; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWRESAMPLE_SWRESAMPLE_H -#define SWRESAMPLE_SWRESAMPLE_H - -/** - * @file - * @ingroup lswr - * libswresample public header - */ - -/** - * @defgroup lswr libswresample - * @{ - * - * Audio resampling, sample format conversion and mixing library. - * - * Interaction with lswr is done through SwrContext, which is - * allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters - * must be set with the @ref avoptions API. - * - * The first thing you will need to do in order to use lswr is to allocate - * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts(). If you - * are using the former, you must set options through the @ref avoptions API. - * The latter function provides the same feature, but it allows you to set some - * common options in the same statement. - * - * For example the following code will setup conversion from planar float sample - * format to interleaved signed 16-bit integer, downsampling from 48kHz to - * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing - * matrix). This is using the swr_alloc() function. - * @code - * SwrContext *swr = swr_alloc(); - * av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); - * av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); - * av_opt_set_int(swr, "in_sample_rate", 48000, 0); - * av_opt_set_int(swr, "out_sample_rate", 44100, 0); - * av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); - * av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); - * @endcode - * - * The same job can be done using swr_alloc_set_opts() as well: - * @code - * SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context - * AV_CH_LAYOUT_STEREO, // out_ch_layout - * AV_SAMPLE_FMT_S16, // out_sample_fmt - * 44100, // out_sample_rate - * AV_CH_LAYOUT_5POINT1, // in_ch_layout - * AV_SAMPLE_FMT_FLTP, // in_sample_fmt - * 48000, // in_sample_rate - * 0, // log_offset - * NULL); // log_ctx - * @endcode - * - * Once all values have been set, it must be initialized with swr_init(). If - * you need to change the conversion parameters, you can change the parameters - * using @ref AVOptions, as described above in the first example; or by using - * swr_alloc_set_opts(), but with the first argument the allocated context. - * You must then call swr_init() again. - * - * The conversion itself is done by repeatedly calling swr_convert(). - * Note that the samples may get buffered in swr if you provide insufficient - * output space or if sample rate conversion is done, which requires "future" - * samples. Samples that do not require future input can be retrieved at any - * time by using swr_convert() (in_count can be set to 0). - * At the end of conversion the resampling buffer can be flushed by calling - * swr_convert() with NULL in and 0 in_count. - * - * The samples used in the conversion process can be managed with the libavutil - * @ref lavu_sampmanip "samples manipulation" API, including av_samples_alloc() - * function used in the following example. - * - * The delay between input and output, can at any time be found by using - * swr_get_delay(). - * - * The following code demonstrates the conversion loop assuming the parameters - * from above and caller-defined functions get_input() and handle_output(): - * @code - * uint8_t **input; - * int in_samples; - * - * while (get_input(&input, &in_samples)) { - * uint8_t *output; - * int out_samples = av_rescale_rnd(swr_get_delay(swr, 48000) + - * in_samples, 44100, 48000, AV_ROUND_UP); - * av_samples_alloc(&output, NULL, 2, out_samples, - * AV_SAMPLE_FMT_S16, 0); - * out_samples = swr_convert(swr, &output, out_samples, - * input, in_samples); - * handle_output(output, out_samples); - * av_freep(&output); - * } - * @endcode - * - * When the conversion is finished, the conversion - * context and everything associated with it must be freed with swr_free(). - * A swr_close() function is also available, but it exists mainly for - * compatibility with libavresample, and is not required to be called. - * - * There will be no memory leak if the data is not completely flushed before - * swr_free(). - */ - -#include -#include "libavutil/channel_layout.h" -#include "libavutil/frame.h" -#include "libavutil/samplefmt.h" - -#include "libswresample/version.h" - -#if LIBSWRESAMPLE_VERSION_MAJOR < 1 -#define SWR_CH_MAX 32 ///< Maximum number of channels -#endif - -/** - * @name Option constants - * These constants are used for the @ref avoptions interface for lswr. - * @{ - * - */ - -#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate -//TODO use int resample ? -//long term TODO can we enable this dynamically? - -/** Dithering algorithms */ -enum SwrDitherType { - SWR_DITHER_NONE = 0, - SWR_DITHER_RECTANGULAR, - SWR_DITHER_TRIANGULAR, - SWR_DITHER_TRIANGULAR_HIGHPASS, - - SWR_DITHER_NS = 64, ///< not part of API/ABI - SWR_DITHER_NS_LIPSHITZ, - SWR_DITHER_NS_F_WEIGHTED, - SWR_DITHER_NS_MODIFIED_E_WEIGHTED, - SWR_DITHER_NS_IMPROVED_E_WEIGHTED, - SWR_DITHER_NS_SHIBATA, - SWR_DITHER_NS_LOW_SHIBATA, - SWR_DITHER_NS_HIGH_SHIBATA, - SWR_DITHER_NB, ///< not part of API/ABI -}; - -/** Resampling Engines */ -enum SwrEngine { - SWR_ENGINE_SWR, /**< SW Resampler */ - SWR_ENGINE_SOXR, /**< SoX Resampler */ - SWR_ENGINE_NB, ///< not part of API/ABI -}; - -/** Resampling Filter Types */ -enum SwrFilterType { - SWR_FILTER_TYPE_CUBIC, /**< Cubic */ - SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall windowed sinc */ - SWR_FILTER_TYPE_KAISER, /**< Kaiser windowed sinc */ -}; - -/** - * @} - */ - -/** - * The libswresample context. Unlike libavcodec and libavformat, this structure - * is opaque. This means that if you would like to set options, you must use - * the @ref avoptions API and cannot directly set values to members of the - * structure. - */ -typedef struct SwrContext SwrContext; - -/** - * Get the AVClass for SwrContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - * @return the AVClass of SwrContext - */ -const AVClass *swr_get_class(void); - -/** - * @name SwrContext constructor functions - * @{ - */ - -/** - * Allocate SwrContext. - * - * If you use this function you will need to set the parameters (manually or - * with swr_alloc_set_opts()) before calling swr_init(). - * - * @see swr_alloc_set_opts(), swr_init(), swr_free() - * @return NULL on error, allocated context otherwise - */ -struct SwrContext *swr_alloc(void); - -/** - * Initialize context after user parameters have been set. - * @note The context must be configured using the AVOption API. - * - * @see av_opt_set_int() - * @see av_opt_set_dict() - * - * @param[in,out] s Swr context to initialize - * @return AVERROR error code in case of failure. - */ -int swr_init(struct SwrContext *s); - -/** - * Check whether an swr context has been initialized or not. - * - * @param[in] s Swr context to check - * @see swr_init() - * @return positive if it has been initialized, 0 if not initialized - */ -int swr_is_initialized(struct SwrContext *s); - -/** - * Allocate SwrContext if needed and set/reset common parameters. - * - * This function does not require s to be allocated with swr_alloc(). On the - * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters - * on the allocated context. - * - * @param s existing Swr context if available, or NULL if not - * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) - * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). - * @param out_sample_rate output sample rate (frequency in Hz) - * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) - * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). - * @param in_sample_rate input sample rate (frequency in Hz) - * @param log_offset logging level offset - * @param log_ctx parent logging context, can be NULL - * - * @see swr_init(), swr_free() - * @return NULL on error, allocated context otherwise - */ -struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, - int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, - int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, - int log_offset, void *log_ctx); - -/** - * @} - * - * @name SwrContext destructor functions - * @{ - */ - -/** - * Free the given SwrContext and set the pointer to NULL. - * - * @param[in] s a pointer to a pointer to Swr context - */ -void swr_free(struct SwrContext **s); - -/** - * Closes the context so that swr_is_initialized() returns 0. - * - * The context can be brought back to life by running swr_init(), - * swr_init() can also be used without swr_close(). - * This function is mainly provided for simplifying the usecase - * where one tries to support libavresample and libswresample. - * - * @param[in,out] s Swr context to be closed - */ -void swr_close(struct SwrContext *s); - -/** - * @} - * - * @name Core conversion functions - * @{ - */ - -/** Convert audio. - * - * in and in_count can be set to 0 to flush the last few samples out at the - * end. - * - * If more input is provided than output space, then the input will be buffered. - * You can avoid this buffering by using swr_get_out_samples() to retrieve an - * upper bound on the required number of output samples for the given number of - * input samples. Conversion will run directly without copying whenever possible. - * - * @param s allocated Swr context, with parameters set - * @param out output buffers, only the first one need be set in case of packed audio - * @param out_count amount of space available for output in samples per channel - * @param in input buffers, only the first one need to be set in case of packed audio - * @param in_count number of input samples available in one channel - * - * @return number of samples output per channel, negative value on error - */ -int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, - const uint8_t **in , int in_count); - -/** - * Convert the next timestamp from input to output - * timestamps are in 1/(in_sample_rate * out_sample_rate) units. - * - * @note There are 2 slightly differently behaving modes. - * @li When automatic timestamp compensation is not used, (min_compensation >= FLT_MAX) - * in this case timestamps will be passed through with delays compensated - * @li When automatic timestamp compensation is used, (min_compensation < FLT_MAX) - * in this case the output timestamps will match output sample numbers. - * See ffmpeg-resampler(1) for the two modes of compensation. - * - * @param s[in] initialized Swr context - * @param pts[in] timestamp for the next input sample, INT64_MIN if unknown - * @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are - * function used internally for timestamp compensation. - * @return the output timestamp for the next output sample - */ -int64_t swr_next_pts(struct SwrContext *s, int64_t pts); - -/** - * @} - * - * @name Low-level option setting functions - * These functons provide a means to set low-level options that is not possible - * with the AVOption API. - * @{ - */ - -/** - * Activate resampling compensation ("soft" compensation). This function is - * internally called when needed in swr_next_pts(). - * - * @param[in,out] s allocated Swr context. If it is not initialized, - * or SWR_FLAG_RESAMPLE is not set, swr_init() is - * called with the flag set. - * @param[in] sample_delta delta in PTS per sample - * @param[in] compensation_distance number of samples to compensate for - * @return >= 0 on success, AVERROR error codes if: - * @li @c s is NULL, - * @li @c compensation_distance is less than 0, - * @li @c compensation_distance is 0 but sample_delta is not, - * @li compensation unsupported by resampler, or - * @li swr_init() fails when called. - */ -int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance); - -/** - * Set a customized input channel mapping. - * - * @param[in,out] s allocated Swr context, not yet initialized - * @param[in] channel_map customized input channel mapping (array of channel - * indexes, -1 for a muted channel) - * @return >= 0 on success, or AVERROR error code in case of failure. - */ -int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); - -/** - * Generate a channel mixing matrix. - * - * This function is the one used internally by libswresample for building the - * default mixing matrix. It is made public just as a utility function for - * building custom matrices. - * - * @param in_layout input channel layout - * @param out_layout output channel layout - * @param center_mix_level mix level for the center channel - * @param surround_mix_level mix level for the surround channel(s) - * @param lfe_mix_level mix level for the low-frequency effects channel - * @param rematrix_maxval if 1.0, coefficients will be normalized to prevent - * overflow. if INT_MAX, coefficients will not be - * normalized. - * @param[out] matrix mixing coefficients; matrix[i + stride * o] is - * the weight of input channel i in output channel o. - * @param stride distance between adjacent input channels in the - * matrix array - * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii) - * @param log_ctx parent logging context, can be NULL - * @return 0 on success, negative AVERROR code on failure - */ -int swr_build_matrix(uint64_t in_layout, uint64_t out_layout, - double center_mix_level, double surround_mix_level, - double lfe_mix_level, double rematrix_maxval, - double rematrix_volume, double *matrix, - int stride, enum AVMatrixEncoding matrix_encoding, - void *log_ctx); - -/** - * Set a customized remix matrix. - * - * @param s allocated Swr context, not yet initialized - * @param matrix remix coefficients; matrix[i + stride * o] is - * the weight of input channel i in output channel o - * @param stride offset between lines of the matrix - * @return >= 0 on success, or AVERROR error code in case of failure. - */ -int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride); - -/** - * @} - * - * @name Sample handling functions - * @{ - */ - -/** - * Drops the specified number of output samples. - * - * This function, along with swr_inject_silence(), is called by swr_next_pts() - * if needed for "hard" compensation. - * - * @param s allocated Swr context - * @param count number of samples to be dropped - * - * @return >= 0 on success, or a negative AVERROR code on failure - */ -int swr_drop_output(struct SwrContext *s, int count); - -/** - * Injects the specified number of silence samples. - * - * This function, along with swr_drop_output(), is called by swr_next_pts() - * if needed for "hard" compensation. - * - * @param s allocated Swr context - * @param count number of samples to be dropped - * - * @return >= 0 on success, or a negative AVERROR code on failure - */ -int swr_inject_silence(struct SwrContext *s, int count); - -/** - * Gets the delay the next input sample will experience relative to the next output sample. - * - * Swresample can buffer data if more input has been provided than available - * output space, also converting between sample rates needs a delay. - * This function returns the sum of all such delays. - * The exact delay is not necessarily an integer value in either input or - * output sample rate. Especially when downsampling by a large value, the - * output sample rate may be a poor choice to represent the delay, similarly - * for upsampling and the input sample rate. - * - * @param s swr context - * @param base timebase in which the returned delay will be: - * @li if it's set to 1 the returned delay is in seconds - * @li if it's set to 1000 the returned delay is in milliseconds - * @li if it's set to the input sample rate then the returned - * delay is in input samples - * @li if it's set to the output sample rate then the returned - * delay is in output samples - * @li if it's the least common multiple of in_sample_rate and - * out_sample_rate then an exact rounding-free delay will be - * returned - * @returns the delay in 1 / @c base units. - */ -int64_t swr_get_delay(struct SwrContext *s, int64_t base); - -/** - * Find an upper bound on the number of samples that the next swr_convert - * call will output, if called with in_samples of input samples. This - * depends on the internal state, and anything changing the internal state - * (like further swr_convert() calls) will may change the number of samples - * swr_get_out_samples() returns for the same number of input samples. - * - * @param in_samples number of input samples. - * @note any call to swr_inject_silence(), swr_convert(), swr_next_pts() - * or swr_set_compensation() invalidates this limit - * @note it is recommended to pass the correct available buffer size - * to all functions like swr_convert() even if swr_get_out_samples() - * indicates that less would be used. - * @returns an upper bound on the number of samples that the next swr_convert - * will output or a negative value to indicate an error - */ -int swr_get_out_samples(struct SwrContext *s, int in_samples); - -/** - * @} - * - * @name Configuration accessors - * @{ - */ - -/** - * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. - * - * This is useful to check if the build-time libswresample has the same version - * as the run-time one. - * - * @returns the unsigned int-typed version - */ -unsigned swresample_version(void); - -/** - * Return the swr build-time configuration. - * - * @returns the build-time @c ./configure flags - */ -const char *swresample_configuration(void); - -/** - * Return the swr license. - * - * @returns the license of libswresample, determined at build-time - */ -const char *swresample_license(void); - -/** - * @} - * - * @name AVFrame based API - * @{ - */ - -/** - * Convert the samples in the input AVFrame and write them to the output AVFrame. - * - * Input and output AVFrames must have channel_layout, sample_rate and format set. - * - * If the output AVFrame does not have the data pointers allocated the nb_samples - * field will be set using av_frame_get_buffer() - * is called to allocate the frame. - * - * The output AVFrame can be NULL or have fewer allocated samples than required. - * In this case, any remaining samples not written to the output will be added - * to an internal FIFO buffer, to be returned at the next call to this function - * or to swr_convert(). - * - * If converting sample rate, there may be data remaining in the internal - * resampling delay buffer. swr_get_delay() tells the number of - * remaining samples. To get this data as output, call this function or - * swr_convert() with NULL input. - * - * If the SwrContext configuration does not match the output and - * input AVFrame settings the conversion does not take place and depending on - * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED - * or the result of a bitwise-OR of them is returned. - * - * @see swr_delay() - * @see swr_convert() - * @see swr_get_delay() - * - * @param swr audio resample context - * @param output output AVFrame - * @param input input AVFrame - * @return 0 on success, AVERROR on failure or nonmatching - * configuration. - */ -int swr_convert_frame(SwrContext *swr, - AVFrame *output, const AVFrame *input); - -/** - * Configure or reconfigure the SwrContext using the information - * provided by the AVFrames. - * - * The original resampling context is reset even on failure. - * The function calls swr_close() internally if the context is open. - * - * @see swr_close(); - * - * @param swr audio resample context - * @param output output AVFrame - * @param input input AVFrame - * @return 0 on success, AVERROR on failure. - */ -int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in); - -/** - * @} - * @} - */ - -#endif /* SWRESAMPLE_SWRESAMPLE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/version.h deleted file mode 100644 index 68515498..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswresample/version.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Version macros. - * - * This file is part of libswresample - * - * libswresample is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * libswresample is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with libswresample; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWRESAMPLE_VERSION_H -#define SWRESAMPLE_VERSION_H - -/** - * @file - * Libswresample version macros - */ - -#include "libavutil/avutil.h" - -#define LIBSWRESAMPLE_VERSION_MAJOR 2 -#define LIBSWRESAMPLE_VERSION_MINOR 3 -#define LIBSWRESAMPLE_VERSION_MICRO 100 - -#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ - LIBSWRESAMPLE_VERSION_MINOR, \ - LIBSWRESAMPLE_VERSION_MICRO) -#define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ - LIBSWRESAMPLE_VERSION_MINOR, \ - LIBSWRESAMPLE_VERSION_MICRO) -#define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT - -#define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) - -#endif /* SWRESAMPLE_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/swscale.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/swscale.h deleted file mode 100644 index 7713f51e..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/swscale.h +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (C) 2001-2011 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWSCALE_SWSCALE_H -#define SWSCALE_SWSCALE_H - -/** - * @file - * @ingroup libsws - * external API header - */ - -#include - -#include "libavutil/avutil.h" -#include "libavutil/log.h" -#include "libavutil/pixfmt.h" -#include "version.h" - -/** - * @defgroup libsws libswscale - * Color conversion and scaling library. - * - * @{ - * - * Return the LIBSWSCALE_VERSION_INT constant. - */ -unsigned swscale_version(void); - -/** - * Return the libswscale build-time configuration. - */ -const char *swscale_configuration(void); - -/** - * Return the libswscale license. - */ -const char *swscale_license(void); - -/* values for the flags, the stuff on the command line is different */ -#define SWS_FAST_BILINEAR 1 -#define SWS_BILINEAR 2 -#define SWS_BICUBIC 4 -#define SWS_X 8 -#define SWS_POINT 0x10 -#define SWS_AREA 0x20 -#define SWS_BICUBLIN 0x40 -#define SWS_GAUSS 0x80 -#define SWS_SINC 0x100 -#define SWS_LANCZOS 0x200 -#define SWS_SPLINE 0x400 - -#define SWS_SRC_V_CHR_DROP_MASK 0x30000 -#define SWS_SRC_V_CHR_DROP_SHIFT 16 - -#define SWS_PARAM_DEFAULT 123456 - -#define SWS_PRINT_INFO 0x1000 - -//the following 3 flags are not completely implemented -//internal chrominance subsampling info -#define SWS_FULL_CHR_H_INT 0x2000 -//input subsampling info -#define SWS_FULL_CHR_H_INP 0x4000 -#define SWS_DIRECT_BGR 0x8000 -#define SWS_ACCURATE_RND 0x40000 -#define SWS_BITEXACT 0x80000 -#define SWS_ERROR_DIFFUSION 0x800000 - -#define SWS_MAX_REDUCE_CUTOFF 0.002 - -#define SWS_CS_ITU709 1 -#define SWS_CS_FCC 4 -#define SWS_CS_ITU601 5 -#define SWS_CS_ITU624 5 -#define SWS_CS_SMPTE170M 5 -#define SWS_CS_SMPTE240M 7 -#define SWS_CS_DEFAULT 5 -#define SWS_CS_BT2020 9 - -/** - * Return a pointer to yuv<->rgb coefficients for the given colorspace - * suitable for sws_setColorspaceDetails(). - * - * @param colorspace One of the SWS_CS_* macros. If invalid, - * SWS_CS_DEFAULT is used. - */ -const int *sws_getCoefficients(int colorspace); - -// when used for filters they must have an odd number of elements -// coeffs cannot be shared between vectors -typedef struct SwsVector { - double *coeff; ///< pointer to the list of coefficients - int length; ///< number of coefficients in the vector -} SwsVector; - -// vectors can be shared -typedef struct SwsFilter { - SwsVector *lumH; - SwsVector *lumV; - SwsVector *chrH; - SwsVector *chrV; -} SwsFilter; - -struct SwsContext; - -/** - * Return a positive value if pix_fmt is a supported input format, 0 - * otherwise. - */ -int sws_isSupportedInput(enum AVPixelFormat pix_fmt); - -/** - * Return a positive value if pix_fmt is a supported output format, 0 - * otherwise. - */ -int sws_isSupportedOutput(enum AVPixelFormat pix_fmt); - -/** - * @param[in] pix_fmt the pixel format - * @return a positive value if an endianness conversion for pix_fmt is - * supported, 0 otherwise. - */ -int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt); - -/** - * Allocate an empty SwsContext. This must be filled and passed to - * sws_init_context(). For filling see AVOptions, options.c and - * sws_setColorspaceDetails(). - */ -struct SwsContext *sws_alloc_context(void); - -/** - * Initialize the swscaler context sws_context. - * - * @return zero or positive value on success, a negative value on - * error - */ -av_warn_unused_result -int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); - -/** - * Free the swscaler context swsContext. - * If swsContext is NULL, then does nothing. - */ -void sws_freeContext(struct SwsContext *swsContext); - -/** - * Allocate and return an SwsContext. You need it to perform - * scaling/conversion operations using sws_scale(). - * - * @param srcW the width of the source image - * @param srcH the height of the source image - * @param srcFormat the source image format - * @param dstW the width of the destination image - * @param dstH the height of the destination image - * @param dstFormat the destination image format - * @param flags specify which algorithm and options to use for rescaling - * @param param extra parameters to tune the used scaler - * For SWS_BICUBIC param[0] and [1] tune the shape of the basis - * function, param[0] tunes f(1) and param[1] f´(1) - * For SWS_GAUSS param[0] tunes the exponent and thus cutoff - * frequency - * For SWS_LANCZOS param[0] tunes the width of the window function - * @return a pointer to an allocated context, or NULL in case of error - * @note this function is to be removed after a saner alternative is - * written - */ -struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, - int dstW, int dstH, enum AVPixelFormat dstFormat, - int flags, SwsFilter *srcFilter, - SwsFilter *dstFilter, const double *param); - -/** - * Scale the image slice in srcSlice and put the resulting scaled - * slice in the image in dst. A slice is a sequence of consecutive - * rows in an image. - * - * Slices have to be provided in sequential order, either in - * top-bottom or bottom-top order. If slices are provided in - * non-sequential order the behavior of the function is undefined. - * - * @param c the scaling context previously created with - * sws_getContext() - * @param srcSlice the array containing the pointers to the planes of - * the source slice - * @param srcStride the array containing the strides for each plane of - * the source image - * @param srcSliceY the position in the source image of the slice to - * process, that is the number (counted starting from - * zero) in the image of the first row of the slice - * @param srcSliceH the height of the source slice, that is the number - * of rows in the slice - * @param dst the array containing the pointers to the planes of - * the destination image - * @param dstStride the array containing the strides for each plane of - * the destination image - * @return the height of the output slice - */ -int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], - const int srcStride[], int srcSliceY, int srcSliceH, - uint8_t *const dst[], const int dstStride[]); - -/** - * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg) - * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg) - * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x] - * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x] - * @param brightness 16.16 fixed point brightness correction - * @param contrast 16.16 fixed point contrast correction - * @param saturation 16.16 fixed point saturation correction - * @return -1 if not supported - */ -int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], - int srcRange, const int table[4], int dstRange, - int brightness, int contrast, int saturation); - -/** - * @return -1 if not supported - */ -int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, - int *srcRange, int **table, int *dstRange, - int *brightness, int *contrast, int *saturation); - -/** - * Allocate and return an uninitialized vector with length coefficients. - */ -SwsVector *sws_allocVec(int length); - -/** - * Return a normalized Gaussian curve used to filter stuff - * quality = 3 is high quality, lower is lower quality. - */ -SwsVector *sws_getGaussianVec(double variance, double quality); - -/** - * Scale all the coefficients of a by the scalar value. - */ -void sws_scaleVec(SwsVector *a, double scalar); - -/** - * Scale all the coefficients of a so that their sum equals height. - */ -void sws_normalizeVec(SwsVector *a, double height); - -#if FF_API_SWS_VECTOR -attribute_deprecated SwsVector *sws_getConstVec(double c, int length); -attribute_deprecated SwsVector *sws_getIdentityVec(void); -attribute_deprecated void sws_convVec(SwsVector *a, SwsVector *b); -attribute_deprecated void sws_addVec(SwsVector *a, SwsVector *b); -attribute_deprecated void sws_subVec(SwsVector *a, SwsVector *b); -attribute_deprecated void sws_shiftVec(SwsVector *a, int shift); -attribute_deprecated SwsVector *sws_cloneVec(SwsVector *a); -attribute_deprecated void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); -#endif - -void sws_freeVec(SwsVector *a); - -SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, - float lumaSharpen, float chromaSharpen, - float chromaHShift, float chromaVShift, - int verbose); -void sws_freeFilter(SwsFilter *filter); - -/** - * Check if context can be reused, otherwise reallocate a new one. - * - * If context is NULL, just calls sws_getContext() to get a new - * context. Otherwise, checks if the parameters are the ones already - * saved in context. If that is the case, returns the current - * context. Otherwise, frees context and gets a new context with - * the new parameters. - * - * Be warned that srcFilter and dstFilter are not checked, they - * are assumed to remain the same. - */ -struct SwsContext *sws_getCachedContext(struct SwsContext *context, - int srcW, int srcH, enum AVPixelFormat srcFormat, - int dstW, int dstH, enum AVPixelFormat dstFormat, - int flags, SwsFilter *srcFilter, - SwsFilter *dstFilter, const double *param); - -/** - * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. - * - * The output frame will have the same packed format as the palette. - * - * @param src source frame buffer - * @param dst destination frame buffer - * @param num_pixels number of pixels to convert - * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src - */ -void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); - -/** - * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. - * - * With the palette format "ABCD", the destination frame ends up with the format "ABC". - * - * @param src source frame buffer - * @param dst destination frame buffer - * @param num_pixels number of pixels to convert - * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src - */ -void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); - -/** - * Get the AVClass for swsContext. It can be used in combination with - * AV_OPT_SEARCH_FAKE_OBJ for examining options. - * - * @see av_opt_find(). - */ -const AVClass *sws_get_class(void); - -/** - * @} - */ - -#endif /* SWSCALE_SWSCALE_H */ diff --git a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/version.h b/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/version.h deleted file mode 100644 index ee536723..00000000 --- a/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/include/libswscale/version.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SWSCALE_VERSION_H -#define SWSCALE_VERSION_H - -/** - * @file - * swscale version macros - */ - -#include "libavutil/version.h" - -#define LIBSWSCALE_VERSION_MAJOR 4 -#define LIBSWSCALE_VERSION_MINOR 2 -#define LIBSWSCALE_VERSION_MICRO 100 - -#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ - LIBSWSCALE_VERSION_MINOR, \ - LIBSWSCALE_VERSION_MICRO) -#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ - LIBSWSCALE_VERSION_MINOR, \ - LIBSWSCALE_VERSION_MICRO) -#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT - -#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - -#ifndef FF_API_SWS_VECTOR -#define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6) -#endif - -#endif /* SWSCALE_VERSION_H */ diff --git a/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.h b/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.h new file mode 100644 index 00000000..a3ab60d3 --- /dev/null +++ b/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.h @@ -0,0 +1,18 @@ +// +// SGFFmpeg.h +// SGPlayer +// +// Created by Single on 2018/8/2. +// Copyright © 2018 single. All rights reserved. +// + +#import +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdocumentation" +#import "avformat.h" +#import "imgutils.h" +#import "swresample.h" +#import "swscale.h" +#pragma clang diagnostic pop + +void SGFFmpegSetupIfNeeded(void); diff --git a/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.m b/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.m new file mode 100644 index 00000000..c6c49da5 --- /dev/null +++ b/SGPlayer/Classes/Core/SGFFmpeg/SGFFmpeg.m @@ -0,0 +1,24 @@ +// +// SGFFmpeg.m +// SGPlayer +// +// Created by Single on 2018/8/2. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGFFmpeg.h" + +static void SGFFmpegLogCallback(void * context, int level, const char * format, va_list args) +{ +// NSString * message = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args]; +// NSLog(@"SGFFLog : %@", message); +} + +void SGFFmpegSetupIfNeeded(void) +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + av_log_set_callback(SGFFmpegLogCallback); + avformat_network_init(); + }); +} diff --git a/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.h b/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.h deleted file mode 100644 index 29b79e67..00000000 --- a/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// SGFingerRotation.h -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -@interface SGFingerRotation : NSObject - -+ (instancetype)fingerRotation; - -+ (CGFloat)degress; - -@property (nonatomic, assign) CGFloat x; -@property (nonatomic, assign) CGFloat y; - -- (void)clean; - -@end diff --git a/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.m b/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.m deleted file mode 100644 index 64dd1de6..00000000 --- a/SGPlayer/Classes/Core/SGMatrix/SGFingerRotation.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// SGFingerRotation.m -// SGPlayer -// -// Created by Single on 17/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGFingerRotation.h" - -@implementation SGFingerRotation - -+ (instancetype)fingerRotation -{ - return [[self alloc] init]; -} - -+ (CGFloat)degress -{ - return 60.0; -} - -- (void)clean -{ - self.x = 0; - self.y = 0; -} - -@end diff --git a/SGPlayer/Classes/Core/SGMatrix/SGMatrix.h b/SGPlayer/Classes/Core/SGMatrix/SGMatrix.h deleted file mode 100644 index 1f698e83..00000000 --- a/SGPlayer/Classes/Core/SGMatrix/SGMatrix.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// SGMatrix.h -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import -#import "SGFingerRotation.h" - -@interface SGMatrix : NSObject - -- (BOOL)singleMatrixWithSize:(CGSize)size matrix:(GLKMatrix4 *)matrix fingerRotation:(SGFingerRotation *)fingerRotation; -- (BOOL)doubleMatrixWithSize:(CGSize)size leftMatrix:(GLKMatrix4 *)leftMatrix rightMatrix:(GLKMatrix4 *)rightMatrix; - -@end diff --git a/SGPlayer/Classes/Core/SGMatrix/SGMatrix.m b/SGPlayer/Classes/Core/SGMatrix/SGMatrix.m deleted file mode 100644 index 4a5297ed..00000000 --- a/SGPlayer/Classes/Core/SGMatrix/SGMatrix.m +++ /dev/null @@ -1,106 +0,0 @@ -// -// SGMatrix.m -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGMatrix.h" -#import "SGPlayerMacro.h" - -#if SGPLATFORM_TARGET_OS_IPHONE -#import "SGSensors.h" -#endif - -@interface SGMatrix () - -#if SGPLATFORM_TARGET_OS_IPHONE -@property (nonatomic, strong) SGSensors * sensors; -#endif - -@end - -@implementation SGMatrix - -- (instancetype)init -{ - if (self = [super init]) { - [self setupSensors]; - } - return self; -} - -#pragma mark - sensors - -- (void)setupSensors -{ -#if SGPLATFORM_TARGET_OS_IPHONE - self.sensors = [[SGSensors alloc] init]; - [self.sensors start]; -#endif -} - -- (BOOL)singleMatrixWithSize:(CGSize)size matrix:(GLKMatrix4 *)matrix fingerRotation:(SGFingerRotation *)fingerRotation -{ -#if SGPLATFORM_TARGET_OS_IPHONE - if (!self.sensors.isReady) return NO; -#endif - - GLKMatrix4 modelViewMatrix = GLKMatrix4Identity; - modelViewMatrix = GLKMatrix4RotateX(modelViewMatrix, -fingerRotation.x); -#if SGPLATFORM_TARGET_OS_IPHONE - modelViewMatrix = GLKMatrix4Multiply(modelViewMatrix, self.sensors.modelView); -#endif - modelViewMatrix = GLKMatrix4RotateY(modelViewMatrix, fingerRotation.y); - - float aspect = fabs(size.width / size.height); - GLKMatrix4 mvpMatrix = GLKMatrix4Identity; - GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians([SGFingerRotation degress]), aspect, 0.1f, 400.0f); - GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 0.0, 0, 0, -1000, 0, 1, 0); - mvpMatrix = GLKMatrix4Multiply(projectionMatrix, viewMatrix); - mvpMatrix = GLKMatrix4Multiply(mvpMatrix, modelViewMatrix); - - * matrix = mvpMatrix; - - return YES; -} - -- (BOOL)doubleMatrixWithSize:(CGSize)size leftMatrix:(GLKMatrix4 *)leftMatrix rightMatrix:(GLKMatrix4 *)rightMatrix -{ -#if SGPLATFORM_TARGET_OS_IPHONE - if (!self.sensors.isReady) return NO; - GLKMatrix4 modelViewMatrix = self.sensors.modelView; -#else - GLKMatrix4 modelViewMatrix = GLKMatrix4Identity; -#endif - - float aspect = fabs(size.width / 2 / size.height); - GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians([SGFingerRotation degress]), aspect, 0.1f, 400.0f); - - CGFloat distance = 0.012; - - GLKMatrix4 leftViewMatrix = GLKMatrix4MakeLookAt(-distance, 0, 0.0, 0, 0, -1000, 0, 1, 0); - GLKMatrix4 rightViewMatrix = GLKMatrix4MakeLookAt(distance, 0, 0.0, 0, 0, -1000, 0, 1, 0); - - GLKMatrix4 leftMvpMatrix = GLKMatrix4Multiply(projectionMatrix, leftViewMatrix); - GLKMatrix4 rightMvpMatrix = GLKMatrix4Multiply(projectionMatrix, rightViewMatrix); - - leftMvpMatrix = GLKMatrix4Multiply(leftMvpMatrix, modelViewMatrix); - rightMvpMatrix = GLKMatrix4Multiply(rightMvpMatrix, modelViewMatrix); - - * leftMatrix = leftMvpMatrix; - * rightMatrix = rightMvpMatrix; - - return YES; -} - -- (void)dealloc -{ -#if SGPLATFORM_TARGET_OS_IPHONE - [self.sensors stop]; -#endif - SGPlayerLog(@"%@ release", self.class); -} - -@end diff --git a/SGPlayer/Classes/Core/SGMatrix/SGSensors.h b/SGPlayer/Classes/Core/SGMatrix/SGSensors.h deleted file mode 100644 index 70efc5e0..00000000 --- a/SGPlayer/Classes/Core/SGMatrix/SGSensors.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SGSensors.h -// SGPlayer -// -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -@interface SGSensors : NSObject - -@property (nonatomic, assign, readonly, getter=isReady) BOOL ready; - -- (void)start; -- (void)stop; - -- (GLKMatrix4)modelView; - -@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetal.h b/SGPlayer/Classes/Core/SGMetal/SGMetal.h new file mode 100644 index 00000000..f3da3384 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetal.h @@ -0,0 +1,31 @@ +// +// SGMetal.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#ifndef SGMetal_h +#define SGMetal_h + +#import +#import + +#import "SGMetalTypes.h" +#import "SGMetalRenderer.h" +#import "SGMetalViewport.h" +#import "SGMetalProjection.h" +#import "SGMetalTextureLoader.h" + +#import "SGMetalModel.h" +#import "SGMetalPlaneModel.h" +#import "SGMetalSphereModel.h" + +#import "SGMetalRenderPipeline.h" +#import "SGMetalYUVRenderPipeline.h" +#import "SGMetalNV12RenderPipeline.h" +#import "SGMetalBGRARenderPipeline.h" +#import "SGMetalRenderPipelinePool.h" + +#endif /* SGMetal_h */ diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.h b/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.h new file mode 100644 index 00000000..4721080b --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.h @@ -0,0 +1,13 @@ +// +// SGMetalBGRARenderPipeline.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderPipeline.h" + +@interface SGMetalBGRARenderPipeline : SGMetalRenderPipeline + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.m b/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.m new file mode 100644 index 00000000..521d3b2a --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalBGRARenderPipeline.m @@ -0,0 +1,26 @@ +// +// SGMetalBGRARenderPipeline.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalBGRARenderPipeline.h" + +@implementation SGMetalBGRARenderPipeline + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super initWithDevice:device]) { + self.library = [self.device newDefaultLibrary]; + self.descriptor = [[MTLRenderPipelineDescriptor alloc] init]; + self.descriptor.vertexFunction = [self.library newFunctionWithName:@"vertexShader"]; + self.descriptor.fragmentFunction = [self.library newFunctionWithName:@"fragmentShaderBGRA"]; + self.descriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; + self.state = [self.device newRenderPipelineStateWithDescriptor:self.descriptor error:nil]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalModel.h b/SGPlayer/Classes/Core/SGMetal/SGMetalModel.h new file mode 100644 index 00000000..bf2d24e8 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalModel.h @@ -0,0 +1,22 @@ +// +// SGMetalModel.h +// MetalTest +// +// Created by Single on 2019/6/24. +// Copyright © 2019 Single. All rights reserved. +// + +#import + +@interface SGMetalModel : NSObject + +- (instancetype)initWithDevice:(id)device; + +@property (nonatomic) NSUInteger indexCount; +@property (nonatomic) MTLIndexType indexType; +@property (nonatomic) MTLPrimitiveType primitiveType; +@property (nonatomic, strong) id device; +@property (nonatomic, strong) id indexBuffer; +@property (nonatomic, strong) id vertexBuffer; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalModel.m b/SGPlayer/Classes/Core/SGMetal/SGMetalModel.m new file mode 100644 index 00000000..d0a07a27 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalModel.m @@ -0,0 +1,21 @@ +// +// SGMetalModel.m +// MetalTest +// +// Created by Single on 2019/6/24. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalModel.h" + +@implementation SGMetalModel + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.h b/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.h new file mode 100644 index 00000000..3e3d0378 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.h @@ -0,0 +1,13 @@ +// +// SGMetalNV12RenderPipeline.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderPipeline.h" + +@interface SGMetalNV12RenderPipeline : SGMetalRenderPipeline + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.m b/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.m new file mode 100644 index 00000000..84079eed --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalNV12RenderPipeline.m @@ -0,0 +1,26 @@ +// +// SGMetalNV12RenderPipeline.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalNV12RenderPipeline.h" + +@implementation SGMetalNV12RenderPipeline + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super initWithDevice:device]) { + self.library = [self.device newDefaultLibrary]; + self.descriptor = [[MTLRenderPipelineDescriptor alloc] init]; + self.descriptor.vertexFunction = [self.library newFunctionWithName:@"vertexShader"]; + self.descriptor.fragmentFunction = [self.library newFunctionWithName:@"fragmentShaderNV12"]; + self.descriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; + self.state = [self.device newRenderPipelineStateWithDescriptor:self.descriptor error:nil]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.h b/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.h new file mode 100644 index 00000000..127c961e --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.h @@ -0,0 +1,13 @@ +// +// SGMetalPlaneModel.h +// MetalTest +// +// Created by Single on 2019/6/25. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalModel.h" + +@interface SGMetalPlaneModel : SGMetalModel + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.m b/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.m new file mode 100644 index 00000000..51fe5da7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalPlaneModel.m @@ -0,0 +1,37 @@ +// +// SGMetalPlaneModel.m +// MetalTest +// +// Created by Single on 2019/6/25. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalPlaneModel.h" +#import "SGMetalTypes.h" + +@implementation SGMetalPlaneModel + +static const UInt32 indices[] = { + 0, 1, 3, 0, 3, 2, +}; + +static const SGMetalVertex vertices[] = { + { { -1.0, -1.0, 0.0, 1.0 }, { 0.0, 1.0 } }, + { { -1.0, 1.0, 0.0, 1.0 }, { 0.0, 0.0 } }, + { { 1.0, -1.0, 0.0, 1.0 }, { 1.0, 1.0 } }, + { { 1.0, 1.0, 0.0, 1.0 }, { 1.0, 0.0 } }, +}; + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super initWithDevice:device]) { + self.indexCount = 6; + self.indexType = MTLIndexTypeUInt32; + self.primitiveType = MTLPrimitiveTypeTriangle; + self.indexBuffer = [self.device newBufferWithBytes:indices length:sizeof(indices) options:MTLResourceStorageModeShared]; + self.vertexBuffer = [self.device newBufferWithBytes:vertices length:sizeof(vertices) options:MTLResourceStorageModeShared]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.h b/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.h new file mode 100644 index 00000000..810ca87d --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.h @@ -0,0 +1,20 @@ +// +// SGMetalProjection.h +// SGPlayer +// +// Created by Single on 2019/6/28. +// Copyright © 2019 single. All rights reserved. +// + +#import +#import + +@interface SGMetalProjection : NSObject + +- (instancetype)initWithDevice:(id)device; + +@property (nonatomic) GLKMatrix4 matrix; +@property (nonatomic, strong) id device; +@property (nonatomic, strong) id matrixBuffer; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.m b/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.m new file mode 100644 index 00000000..1d3634d4 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalProjection.m @@ -0,0 +1,38 @@ +// +// SGMetalProjection.m +// SGPlayer +// +// Created by Single on 2019/6/28. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGMetalProjection.h" +#import "SGMetalTypes.h" + +@implementation SGMetalProjection + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + self.matrixBuffer = [device newBufferWithLength:sizeof(SGMetalMatrix) options:MTLResourceStorageModeShared]; + } + return self; +} + +- (void)setMatrix:(GLKMatrix4)matrix +{ + self->_matrix = matrix; + ((SGMetalMatrix *)self.matrixBuffer.contents)->mvp = SGMatrixFloat4x4FromGLKMatrix4(matrix); +} + +static matrix_float4x4 SGMatrixFloat4x4FromGLKMatrix4(GLKMatrix4 matrix) +{ + return (matrix_float4x4){{ + {matrix.m00, matrix.m01, matrix.m02, matrix.m03}, + {matrix.m10, matrix.m11, matrix.m12, matrix.m13}, + {matrix.m20, matrix.m21, matrix.m22, matrix.m23}, + {matrix.m30, matrix.m31, matrix.m32, matrix.m33}}}; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.h b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.h new file mode 100644 index 00000000..6e9da3dc --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.h @@ -0,0 +1,20 @@ +// +// SGMetalRenderPipeline.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import + +@interface SGMetalRenderPipeline : NSObject + +- (instancetype)initWithDevice:(id)device; + +@property (nonatomic, strong) id device; +@property (nonatomic, strong) id library; +@property (nonatomic, strong) id state; +@property (nonatomic, strong) MTLRenderPipelineDescriptor *descriptor; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.m b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.m new file mode 100644 index 00000000..36884d1b --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipeline.m @@ -0,0 +1,22 @@ +// +// SGMetalRenderPipeline.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderPipeline.h" + +@implementation SGMetalRenderPipeline + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + } + return self; +} + +@end + diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.h b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.h new file mode 100644 index 00000000..a1cd5754 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.h @@ -0,0 +1,20 @@ +// +// SGMetalRenderPipelinePool.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import +#import "SGMetalRenderPipeline.h" +#import + +@interface SGMetalRenderPipelinePool : NSObject + +- (instancetype)initWithDevice:(id)device; + +- (SGMetalRenderPipeline *)pipelineWithCVPixelFormat:(OSType)pixpelFormat; +- (SGMetalRenderPipeline *)pipelineWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.m b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.m new file mode 100644 index 00000000..9de2b4e9 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderPipelinePool.m @@ -0,0 +1,74 @@ +// +// SGMetalRenderPipelinePool.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderPipelinePool.h" +#import "SGMetalYUVRenderPipeline.h" +#import "SGMetalNV12RenderPipeline.h" +#import "SGMetalBGRARenderPipeline.h" + +@interface SGMetalRenderPipelinePool () + +@property (nonatomic, strong) id device; +@property (nonatomic, strong) SGMetalRenderPipeline *yuv; +@property (nonatomic, strong) SGMetalRenderPipeline *nv12; +@property (nonatomic, strong) SGMetalRenderPipeline *bgra; + +@end + +@implementation SGMetalRenderPipelinePool + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + } + return self; +} + +- (SGMetalRenderPipeline *)pipelineWithCVPixelFormat:(OSType)pixpelFormat +{ + if (pixpelFormat == kCVPixelFormatType_420YpCbCr8Planar) { + return self.yuv; + } else if (pixpelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) { + return self.nv12; + } else if (pixpelFormat == kCVPixelFormatType_32BGRA) { + return self.bgra; + } + return nil; +} + +- (SGMetalRenderPipeline *)pipelineWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer +{ + return [self pipelineWithCVPixelFormat:CVPixelBufferGetPixelFormatType(pixelBuffer)]; +} + +- (SGMetalRenderPipeline *)yuv +{ + if (_yuv == nil) { + _yuv = [[SGMetalYUVRenderPipeline alloc] initWithDevice:self.device]; + } + return _yuv; +} + +- (SGMetalRenderPipeline *)nv12 +{ + if (_nv12 == nil) { + _nv12 = [[SGMetalNV12RenderPipeline alloc] initWithDevice:self.device]; + } + return _nv12; +} + +- (SGMetalRenderPipeline *)bgra +{ + if (_bgra == nil) { + _bgra = [[SGMetalBGRARenderPipeline alloc] initWithDevice:self.device]; + } + return _bgra; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.h b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.h new file mode 100644 index 00000000..3c3b37cf --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.h @@ -0,0 +1,26 @@ +// +// SGMetalRenderer.h +// MetalTest +// +// Created by Single on 2019/6/24. +// Copyright © 2019 Single. All rights reserved. +// + +#import +#import +#import "SGMetalModel.h" +#import "SGMetalProjection.h" +#import "SGMetalRenderPipeline.h" + +@interface SGMetalRenderer : NSObject + +- (instancetype)initWithDevice:(id)device; + +- (id)drawModel:(SGMetalModel *)model + viewports:(MTLViewport[])viewports + pipeline:(SGMetalRenderPipeline *)pipeline + projections:(NSArray *)projections + inputTextures:(NSArray> *)inputTextures + outputTexture:(id)outputTexture; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.m b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.m new file mode 100644 index 00000000..5a0d12ce --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalRenderer.m @@ -0,0 +1,64 @@ +// +// SGMetalRenderer.m +// MetalTest +// +// Created by Single on 2019/6/24. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderer.h" +#import "SGMetalTypes.h" + +@interface SGMetalRenderer () + +@property (nonatomic, strong) id device; +@property (nonatomic, strong) id commandQueue; +@property (nonatomic, strong) MTLRenderPassDescriptor *renderPassDescriptor; + +@end + +@implementation SGMetalRenderer + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + self.commandQueue = [self.device newCommandQueue]; + self.renderPassDescriptor = [[MTLRenderPassDescriptor alloc] init]; + self.renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(0, 0, 0, 1); + self.renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionClear; + self.renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore; + } + return self; +} + +- (id)drawModel:(SGMetalModel *)model + viewports:(MTLViewport[])viewports + pipeline:(SGMetalRenderPipeline *)pipeline + projections:(NSArray *)projections + inputTextures:(NSArray> *)inputTextures + outputTexture:(id)outputTexture +{ + self.renderPassDescriptor.colorAttachments[0].texture = outputTexture; + id commandBuffer = [self.commandQueue commandBuffer]; + id encoder = [commandBuffer renderCommandEncoderWithDescriptor:self.renderPassDescriptor]; + [encoder setCullMode:MTLCullModeNone]; + [encoder setRenderPipelineState:pipeline.state]; + [encoder setVertexBuffer:model.vertexBuffer offset:0 atIndex:0]; + for (NSUInteger i = 0; i < inputTextures.count; i++) { + [encoder setFragmentTexture:inputTextures[i] atIndex:i]; + } + for (NSUInteger i = 0; i < projections.count; i++) { + [encoder setViewport:viewports[i]]; + [encoder setVertexBuffer:projections[i].matrixBuffer offset:0 atIndex:1]; + [encoder drawIndexedPrimitives:model.primitiveType + indexCount:model.indexCount + indexType:model.indexType + indexBuffer:model.indexBuffer + indexBufferOffset:0]; + } + [encoder endEncoding]; + return commandBuffer; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalShader.metal b/SGPlayer/Classes/Core/SGMetal/SGMetalShader.metal new file mode 100644 index 00000000..a5729b2a --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalShader.metal @@ -0,0 +1,82 @@ +// +// SGMetalShader.metal +// MetalTest +// +// Created by Single on 2019/6/21. +// Copyright © 2019 Single. All rights reserved. +// + +#include + +using namespace metal; + +#import "SGMetalTypes.h" + +typedef struct { + float4 position [[position]]; + float2 texCoord; +} ColorInOut; + +/** + * Vertex + */ +vertex ColorInOut vertexShader( uint vertexID [[ vertex_id ]], + constant SGMetalVertex * in [[ buffer(0) ]], + constant SGMetalMatrix & uniforms [[ buffer(1) ]]) +{ + ColorInOut out; + out.position = uniforms.mvp * in[vertexID].position; + out.texCoord = in[vertexID].texCoord; + return out; +} + +/** + * Fragment - BGRA + */ +fragment float4 fragmentShaderBGRA(ColorInOut in [[ stage_in ]], + texture2d texture [[ texture(0) ]]) +{ + constexpr sampler linearSampler(mip_filter::nearest, + mag_filter::linear, + min_filter::linear); + return float4(texture.sample(linearSampler, in.texCoord)); +} + +/** + * Fragment - NV12 + */ +fragment float4 fragmentShaderNV12(ColorInOut in [[ stage_in ]], + texture2d textureY [[ texture(0) ]], + texture2d textureUV [[ texture(1) ]]) +{ + constexpr sampler linearSampler(mip_filter::nearest, + mag_filter::linear, + min_filter::linear); + float y = textureY .sample(linearSampler, in.texCoord).r; + float u = textureUV.sample(linearSampler, in.texCoord).r - 0.5; + float v = textureUV.sample(linearSampler, in.texCoord).g - 0.5; + float r = y + 1.402 * v; + float g = y - 0.344 * u - 0.714 * v; + float b = y + 1.772 * u; + return float4(r, g, b, 1.0); +} + +/** + * Fragment - YUV + */ +fragment float4 fragmentShaderYUV(ColorInOut in [[ stage_in ]], + texture2d textureY [[ texture(0) ]], + texture2d textureU [[ texture(1) ]], + texture2d textureV [[ texture(2) ]]) +{ + constexpr sampler linearSampler(mip_filter::nearest, + mag_filter::linear, + min_filter::linear); + float y = textureY.sample(linearSampler, in.texCoord).r; + float u = textureU.sample(linearSampler, in.texCoord).r - 0.5; + float v = textureV.sample(linearSampler, in.texCoord).r - 0.5; + float r = y + 1.402 * v; + float g = y - 0.344 * u - 0.714 * v; + float b = y + 1.772 * u; + return float4(r, g, b, 1.0); +} diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.h b/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.h new file mode 100644 index 00000000..1faf12a5 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.h @@ -0,0 +1,13 @@ +// +// SGMetalSphereModel.h +// MetalTest +// +// Created by Single on 2019/6/25. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalModel.h" + +@interface SGMetalSphereModel : SGMetalModel + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.m b/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.m new file mode 100644 index 00000000..287b5876 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalSphereModel.m @@ -0,0 +1,60 @@ +// +// SGMetalSphereModel.m +// MetalTest +// +// Created by Single on 2019/6/25. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalSphereModel.h" +#import "SGMetalTypes.h" + +@implementation SGMetalSphereModel + +static int const slicesCount = 200; +static int const parallelsCount = slicesCount / 2; +static int const indicesCount = slicesCount * parallelsCount * 6; +static int const verticesCount = (slicesCount + 1) * (parallelsCount + 1); + +static UInt32 indices [indicesCount]; +static SGMetalVertex vertices[verticesCount]; + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super initWithDevice:device]) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + int runCount = 0; + float const radius = 1.0f; + float const step = (2.0f * M_PI) / (float)slicesCount; + for (int i = 0; i < parallelsCount + 1; i++) { + for (int j = 0; j < slicesCount + 1; j++) { + SGMetalVertex vertex; + vertex.position[0] = radius * sinf(step * (float)i) * cosf(step * (float)j); + vertex.position[1] = radius * cosf(step * (float)i); + vertex.position[2] = radius * sinf(step * (float)i) * sinf(step * (float)j); + vertex.position[3] = 1.0; + vertex.texCoord[0] = (float)j / (float)slicesCount; + vertex.texCoord[1] = (float)i / (float)parallelsCount; + vertices[i * (slicesCount + 1) + j] = vertex; + if (i < parallelsCount && j < slicesCount) { + indices[runCount++] = i * (slicesCount + 1) + j; + indices[runCount++] = (i + 1) * (slicesCount + 1) + j; + indices[runCount++] = (i + 1) * (slicesCount + 1) + (j + 1); + indices[runCount++] = i * (slicesCount + 1) + j; + indices[runCount++] = (i + 1) * (slicesCount + 1) + (j + 1); + indices[runCount++] = i * (slicesCount + 1) + (j + 1); + } + } + } + }); + self.indexCount = indicesCount; + self.indexType = MTLIndexTypeUInt32; + self.primitiveType = MTLPrimitiveTypeTriangle; + self.indexBuffer = [self.device newBufferWithBytes:indices length:sizeof(indices) options:MTLResourceStorageModeShared]; + self.vertexBuffer = [self.device newBufferWithBytes:vertices length:sizeof(vertices) options:MTLResourceStorageModeShared]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.h b/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.h new file mode 100644 index 00000000..e6548c1c --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.h @@ -0,0 +1,30 @@ +// +// SGMetalTextureLoader.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import +#import + +@interface SGMetalTextureLoader : NSObject + +- (instancetype)initWithDevice:(id)device; + +- (NSArray> *)texturesWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer; + +- (NSArray> *)texturesWithCVPixelFormat:(OSType)pixelFormat + width:(NSUInteger)width + height:(NSUInteger)height + bytes:(void **)bytes + bytesPerRow:(int *)bytesPerRow; + +- (id)textureWithPixelFormat:(MTLPixelFormat)pixelFormat + width:(NSUInteger)width + height:(NSUInteger)height + bytes:(void *)bytes + bytesPerRow:(NSUInteger)bytesPerRow; + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.m b/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.m new file mode 100644 index 00000000..b66ba7a7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalTextureLoader.m @@ -0,0 +1,157 @@ +// +// SGMetalTextureLoader.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalTextureLoader.h" + +@interface SGMetalTextureLoader () + +@property (nonatomic, strong) id device; +@property (nonatomic) CVMetalTextureCacheRef textureCache; + +@end + +@implementation SGMetalTextureLoader + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super init]) { + self.device = device; + } + return self; +} + +- (void)dealloc +{ + if (self.textureCache) { + CVMetalTextureCacheFlush(self.textureCache, 0); + CFRelease(self.textureCache); + self.textureCache = NULL; + } +} + +- (NSArray> *)texturesWithCVPixelBuffer:(CVPixelBufferRef)pixelBuffer +{ + if (!self.textureCache) { + CVMetalTextureCacheCreate(NULL, NULL, self.device, NULL, &_textureCache); + } + CVMetalTextureRef texture; + NSMutableArray *textures = [NSMutableArray array]; + OSType formatType = CVPixelBufferGetPixelFormatType(pixelBuffer); + if (formatType == kCVPixelFormatType_420YpCbCr8Planar) { + for (NSUInteger i = 0; i < 3; i++) { + CVMetalTextureCacheCreateTextureFromImage(NULL, + self.textureCache, + pixelBuffer, + NULL, + MTLPixelFormatR8Unorm, + CVPixelBufferGetWidthOfPlane(pixelBuffer, i), + CVPixelBufferGetHeightOfPlane(pixelBuffer, i), + i, + &texture); + [textures addObject:CVMetalTextureGetTexture(texture)]; + CVBufferRelease(texture); + texture = NULL; + } + } else if (formatType == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) { + MTLPixelFormat formats[2] = {MTLPixelFormatR8Unorm, MTLPixelFormatRG8Unorm}; + for (NSUInteger i = 0; i < 2; i++) { + CVMetalTextureCacheCreateTextureFromImage(NULL, + self.textureCache, + pixelBuffer, + NULL, + formats[i], + CVPixelBufferGetWidthOfPlane(pixelBuffer, i), + CVPixelBufferGetHeightOfPlane(pixelBuffer, i), + i, + &texture); + [textures addObject:CVMetalTextureGetTexture(texture)]; + CVBufferRelease(texture); + texture = NULL; + } + } else if (formatType == kCVPixelFormatType_32BGRA) { + CVMetalTextureCacheCreateTextureFromImage(NULL, + self.textureCache, + pixelBuffer, + NULL, + MTLPixelFormatBGRA8Unorm, + CVPixelBufferGetWidth(pixelBuffer), + CVPixelBufferGetHeight(pixelBuffer), + 0, + &texture); + [textures addObject:CVMetalTextureGetTexture(texture)]; + CVBufferRelease(texture); + } + return textures.count ? textures : nil; +} + +- (NSArray> *)texturesWithCVPixelFormat:(OSType)pixelFormat + width:(NSUInteger)width + height:(NSUInteger)height + bytes:(void **)bytes + bytesPerRow:(int *)bytesPerRow +{ + static NSUInteger const channelCount = 3; + NSUInteger planes = 0; + NSUInteger widths[channelCount] = {0}; + NSUInteger heights[channelCount] = {0}; + MTLPixelFormat formats[channelCount] = {0}; + if (pixelFormat == kCVPixelFormatType_420YpCbCr8Planar) { + planes = 3; + widths[0] = width; + widths[1] = width / 2; + widths[2] = width / 2; + heights[0] = height; + heights[1] = height / 2; + heights[2] = height / 2; + formats[0] = MTLPixelFormatR8Unorm; + formats[1] = MTLPixelFormatR8Unorm; + formats[2] = MTLPixelFormatR8Unorm; + } else if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) { + planes = 2; + widths[0] = width; + widths[1] = width / 2; + heights[0] = height; + heights[1] = height / 2; + formats[0] = MTLPixelFormatR8Unorm; + formats[1] = MTLPixelFormatRG8Unorm; + } else if (pixelFormat == kCVPixelFormatType_32BGRA) { + planes = 1; + widths[0] = width; + heights[0] = height; + formats[0] = MTLPixelFormatBGRA8Unorm; + } else { + return nil; + } + NSMutableArray> *textures = [NSMutableArray array]; + for (NSUInteger i = 0; i < planes; i++) { + id texture = [self textureWithPixelFormat:formats[i] + width:widths[i] + height:heights[i] + bytes:bytes[i] + bytesPerRow:bytesPerRow[i]]; + [textures addObject:texture]; + } + return textures.count ? textures : nil; +} + +- (id)textureWithPixelFormat:(MTLPixelFormat)pixelFormat + width:(NSUInteger)width + height:(NSUInteger)height + bytes:(void *)bytes + bytesPerRow:(NSUInteger)bytesPerRow +{ + MTLTextureDescriptor *descriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixelFormat width:width height:height mipmapped:NO]; + id texture = [self.device newTextureWithDescriptor:descriptor]; + [texture replaceRegion:MTLRegionMake2D(0, 0, width, height) + mipmapLevel:0 + withBytes:bytes + bytesPerRow:bytesPerRow]; + return texture; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalTypes.h b/SGPlayer/Classes/Core/SGMetal/SGMetalTypes.h new file mode 100644 index 00000000..025d9864 --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalTypes.h @@ -0,0 +1,23 @@ +// +// SGMetalTypes.h +// MetalTest +// +// Created by Single on 2019/6/21. +// Copyright © 2019 Single. All rights reserved. +// + +#ifndef SGMetalTypes_h +#define SGMetalTypes_h + +#include + +typedef struct { + vector_float4 position; + vector_float2 texCoord; +} SGMetalVertex; + +typedef struct { + matrix_float4x4 mvp; +} SGMetalMatrix; + +#endif /* SGMetalTypes_h */ diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.h b/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.h new file mode 100644 index 00000000..4beff3ae --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.h @@ -0,0 +1,25 @@ +// +// SGMetalViewport.h +// SGPlayer +// +// Created by Single on 2019/6/27. +// Copyright © 2019 single. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, SGMetalViewportMode) { + SGMetalViewportModeResize = 0, + SGMetalViewportModeResizeAspect = 1, + SGMetalViewportModeResizeAspectFill = 2, +}; + +@interface SGMetalViewport : NSObject + ++ (MTLViewport)viewportWithLayerSize:(MTLSize)layerSize; ++ (MTLViewport)viewportWithLayerSizeForLeft:(MTLSize)layerSize; ++ (MTLViewport)viewportWithLayerSizeForRight:(MTLSize)layerSize; ++ (MTLViewport)viewportWithLayerSize:(MTLSize)layerSize textureSize:(MTLSize)textureSize mode:(SGMetalViewportMode)mode; + + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.m b/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.m new file mode 100644 index 00000000..fcce55ad --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalViewport.m @@ -0,0 +1,81 @@ +// +// SGMetalViewport.m +// SGPlayer +// +// Created by Single on 2019/6/27. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGMetalViewport.h" + +@implementation SGMetalViewport + ++ (MTLViewport)viewportWithLayerSize:(MTLSize)layerSize +{ + MTLViewport viewport = {0, 0, layerSize.width, layerSize.height, 0, 0}; + return viewport; +} + ++ (MTLViewport)viewportWithLayerSizeForLeft:(MTLSize)layerSize +{ + MTLViewport viewport = {0, 0, layerSize.width / 2, layerSize.height, 0, 0}; + return viewport; +} + ++ (MTLViewport)viewportWithLayerSizeForRight:(MTLSize)layerSize +{ + MTLViewport viewport = {layerSize.width / 2, 0, layerSize.width / 2, layerSize.height, 0, 0}; + return viewport; +} + ++ (MTLViewport)viewportWithLayerSize:(MTLSize)layerSize textureSize:(MTLSize)textureSize mode:(SGMetalViewportMode)mode +{ + MTLViewport viewport = {0, 0, layerSize.width, layerSize.height, 0, 0}; + switch (mode) { + case SGMetalViewportModeResize: + break; + case SGMetalViewportModeResizeAspect: { + Float64 layerAspect = (Float64)layerSize.width / layerSize.height; + Float64 textureAspect = (Float64)textureSize.width / textureSize.height; + if (fabs(layerAspect - textureAspect) <= 0.0001) { + + } else if (layerAspect < textureAspect) { + Float64 height = layerSize.width / textureAspect; + viewport.originX = 0; + viewport.originY = (layerSize.height - height) / 2; + viewport.width = layerSize.width; + viewport.height = height; + } else if (layerAspect > textureAspect) { + Float64 width = layerSize.height * textureAspect; + viewport.originX = (layerSize.width - width) / 2; + viewport.originY = 0; + viewport.width = width; + viewport.height = layerSize.height; + } + } + break; + case SGMetalViewportModeResizeAspectFill: { + Float64 layerAspect = (Float64)layerSize.width / layerSize.height; + Float64 textureAspect = (Float64)textureSize.width / textureSize.height; + if (fabs(layerAspect - textureAspect) <= 0.0001) { + + } else if (layerAspect < textureAspect) { + Float64 width = layerSize.height * textureAspect; + viewport.originX = (layerSize.width - width) / 2; + viewport.originY = 0; + viewport.width = width; + viewport.height = layerSize.height; + } else if (layerAspect > textureAspect) { + Float64 height = layerSize.width / textureAspect; + viewport.originX = 0; + viewport.originY = (layerSize.height - height) / 2; + viewport.width = layerSize.width; + viewport.height = height; + } + } + break; + } + return viewport; +} + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.h b/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.h new file mode 100644 index 00000000..852db47a --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.h @@ -0,0 +1,13 @@ +// +// SGMetalYUVRenderPipeline.h +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalRenderPipeline.h" + +@interface SGMetalYUVRenderPipeline : SGMetalRenderPipeline + +@end diff --git a/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.m b/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.m new file mode 100644 index 00000000..ea92d23a --- /dev/null +++ b/SGPlayer/Classes/Core/SGMetal/SGMetalYUVRenderPipeline.m @@ -0,0 +1,26 @@ +// +// SGMetalYUVRenderPipeline.m +// MetalTest +// +// Created by Single on 2019/6/26. +// Copyright © 2019 Single. All rights reserved. +// + +#import "SGMetalYUVRenderPipeline.h" + +@implementation SGMetalYUVRenderPipeline + +- (instancetype)initWithDevice:(id)device +{ + if (self = [super initWithDevice:device]) { + self.library = [self.device newDefaultLibrary]; + self.descriptor = [[MTLRenderPipelineDescriptor alloc] init]; + self.descriptor.vertexFunction = [self.library newFunctionWithName:@"vertexShader"]; + self.descriptor.fragmentFunction = [self.library newFunctionWithName:@"fragmentShaderYUV"]; + self.descriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; + self.state = [self.device newRenderPipelineStateWithDescriptor:self.descriptor error:nil]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.h b/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.h new file mode 100644 index 00000000..d1d50870 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.h @@ -0,0 +1,43 @@ +// +// SGDecoderOptions.h +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import + +@interface SGDecoderOptions : NSObject + +/** + * + */ +@property (nonatomic, copy) NSDictionary *options; + +/** + * + */ +@property (nonatomic) BOOL threadsAuto; + +/** + * + */ +@property (nonatomic) BOOL refcountedFrames; + +/** + * + */ +@property (nonatomic) BOOL hardwareDecodeH264; + +/** + * + */ +@property (nonatomic) BOOL hardwareDecodeH265; + +/** + * + */ +@property (nonatomic) OSType preferredPixelFormat; + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.m b/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.m new file mode 100644 index 00000000..07d47644 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGDecoderOptions.m @@ -0,0 +1,39 @@ +// +// SGDecoderOptions.m +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGDecoderOptions.h" +#import "SGMapping.h" + +@implementation SGDecoderOptions + +- (id)copyWithZone:(NSZone *)zone +{ + SGDecoderOptions *obj = [[SGDecoderOptions alloc] init]; + obj->_options = self->_options.copy; + obj->_threadsAuto = self->_threadsAuto; + obj->_refcountedFrames = self->_refcountedFrames; + obj->_hardwareDecodeH264 = self->_hardwareDecodeH264; + obj->_hardwareDecodeH265 = self->_hardwareDecodeH265; + obj->_preferredPixelFormat = self->_preferredPixelFormat; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_options = nil; + self->_threadsAuto = YES; + self->_refcountedFrames = YES; + self->_hardwareDecodeH264 = YES; + self->_hardwareDecodeH265 = YES; + self->_preferredPixelFormat = SGPixelFormatFF2AV(AV_PIX_FMT_NV12); + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.h b/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.h new file mode 100644 index 00000000..4d5f98cc --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.h @@ -0,0 +1,18 @@ +// +// SGDemuxerOptions.h +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import + +@interface SGDemuxerOptions : NSObject + +/** + * + */ +@property (nonatomic, copy) NSDictionary *options; + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.m b/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.m new file mode 100644 index 00000000..ac827bd0 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGDemuxerOptions.m @@ -0,0 +1,30 @@ +// +// SGDemuxerOptions.m +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGDemuxerOptions.h" + +@implementation SGDemuxerOptions + +- (id)copyWithZone:(NSZone *)zone +{ + SGDemuxerOptions *obj = [[SGDemuxerOptions alloc] init]; + obj->_options = self->_options.copy; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_options = @{@"timeout" : @(20 * 1000 * 1000), + @"reconnect" : @(1), + @"user-agent" : @"SGPlayer"}; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGOptions.h b/SGPlayer/Classes/Core/SGOption/SGOptions.h new file mode 100644 index 00000000..fb212be4 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGOptions.h @@ -0,0 +1,42 @@ +// +// SGOptions.h +// SGPlayer iOS +// +// Created by Single on 2018/10/29. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGProcessorOptions.h" +#import "SGRendererOptions.h" +#import "SGDecoderOptions.h" +#import "SGDemuxerOptions.h" + +@interface SGOptions : NSObject + +/** + * + */ ++ (instancetype)sharedOptions; + +/** + * + */ +@property (nonatomic, strong) SGDemuxerOptions *demuxer; + +/** + * + */ +@property (nonatomic, strong) SGDecoderOptions *decoder; + +/** + * + */ +@property (nonatomic, strong) SGProcessorOptions *processor; + +/** + * + */ +@property (nonatomic, strong) SGRendererOptions *renderer; + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGOptions.m b/SGPlayer/Classes/Core/SGOption/SGOptions.m new file mode 100644 index 00000000..8c1b62d4 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGOptions.m @@ -0,0 +1,44 @@ +// +// SGOptions.m +// SGPlayer iOS +// +// Created by Single on 2018/10/29. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGOptions.h" + +@implementation SGOptions + ++ (instancetype)sharedOptions +{ + static SGOptions *obj = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + obj = [[SGOptions alloc] init]; + }); + return obj; +} + +- (id)copyWithZone:(NSZone *)zone +{ + SGOptions *obj = [[SGOptions alloc] init]; + obj->_demuxer = self->_demuxer.copy; + obj->_decoder = self->_decoder.copy; + obj->_processor = self->_processor.copy; + obj->_renderer = self->_renderer.copy; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_demuxer = [[SGDemuxerOptions alloc] init]; + self->_decoder = [[SGDecoderOptions alloc] init]; + self->_processor = [[SGProcessorOptions alloc] init]; + self->_renderer = [[SGRendererOptions alloc] init]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.h b/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.h new file mode 100644 index 00000000..3b3f855c --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.h @@ -0,0 +1,23 @@ +// +// SGProcessorOptions.h +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import + +@interface SGProcessorOptions : NSObject + +/** + * + */ +@property (nonatomic, copy) Class audioClass; + +/** + * + */ +@property (nonatomic, copy) Class videoClass; + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.m b/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.m new file mode 100644 index 00000000..a7332c6d --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGProcessorOptions.m @@ -0,0 +1,32 @@ +// +// SGProcessorOptions.m +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGProcessorOptions.h" +#import "SGAudioProcessor.h" +#import "SGVideoProcessor.h" + +@implementation SGProcessorOptions + +- (id)copyWithZone:(NSZone *)zone +{ + SGProcessorOptions *obj = [[SGProcessorOptions alloc] init]; + obj->_audioClass = self->_audioClass.copy; + obj->_videoClass = self->_videoClass.copy; + return obj; +} + +- (instancetype)init +{ + if (self = [super init]) { + self->_audioClass = [SGAudioProcessor class]; + self->_videoClass = [SGVideoProcessor class]; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGRendererOptions.h b/SGPlayer/Classes/Core/SGOption/SGRendererOptions.h new file mode 100644 index 00000000..bd7690ff --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGRendererOptions.h @@ -0,0 +1,13 @@ +// +// SGRendererOptions.h +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import + +@interface SGRendererOptions : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGOption/SGRendererOptions.m b/SGPlayer/Classes/Core/SGOption/SGRendererOptions.m new file mode 100644 index 00000000..926d2661 --- /dev/null +++ b/SGPlayer/Classes/Core/SGOption/SGRendererOptions.m @@ -0,0 +1,19 @@ +// +// SGRendererOptions.m +// SGPlayer +// +// Created by Single on 2019/6/14. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGRendererOptions.h" + +@implementation SGRendererOptions + +- (id)copyWithZone:(NSZone *)zone +{ + SGRendererOptions *obj = [[SGRendererOptions alloc] init]; + return obj; +} + +@end diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.h new file mode 100644 index 00000000..21fe149d --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.h @@ -0,0 +1,19 @@ +// +// SGPLFColor.h +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFObject.h" + +#if SGPLATFORM_TARGET_OS_MAC + +typedef NSColor SGPLFColor; + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +typedef UIColor SGPLFColor; + +#endif diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.m b/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.m new file mode 100644 index 00000000..85c1ae5d --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFColor.m @@ -0,0 +1,9 @@ +// +// SGPLFColor.m +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFColor.h" diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.h new file mode 100644 index 00000000..86809083 --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.h @@ -0,0 +1,32 @@ +// +// SGPLFImage.h +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFObject.h" +#import +#import + +#if SGPLATFORM_TARGET_OS_MAC + +typedef NSImage SGPLFImage; + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +typedef UIImage SGPLFImage; + +#endif + +SGPLFImage * SGPLFImageWithCGImage(CGImageRef image); + +// CVPixelBufferRef +SGPLFImage * SGPLFImageWithCVPixelBuffer(CVPixelBufferRef pixelBuffer); +CIImage * SGPLFImageCIImageWithCVPexelBuffer(CVPixelBufferRef pixelBuffer); +CGImageRef SGPLFImageCGImageWithCVPexelBuffer(CVPixelBufferRef pixelBuffer); + +// RGB data buffer +SGPLFImage * SGPLFImageWithRGBData(uint8_t *rgb_data, int linesize, int width, int height); +CGImageRef SGPLFImageCGImageWithRGBData(uint8_t *rgb_data, int linesize, int width, int height); diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.m b/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.m new file mode 100644 index 00000000..fd0ecc79 --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFImage.m @@ -0,0 +1,125 @@ +// +// SGPLFImage.m +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFImage.h" + +#if SGPLATFORM_TARGET_OS_MAC + +SGPLFImage * SGPLFImageWithCGImage(CGImageRef image) +{ + return [[NSImage alloc] initWithCGImage:image size:CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image))]; +} + +SGPLFImage * SGPLFImageWithCVPixelBuffer(CVPixelBufferRef pixelBuffer) +{ + CIImage *ciImage = SGPLFImageCIImageWithCVPexelBuffer(pixelBuffer); + if (!ciImage) return nil; + NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:ciImage]; + NSImage *image = [[NSImage alloc] initWithSize:imageRep.size]; + [image addRepresentation:imageRep]; + return image; +} + +CIImage * SGPLFImageCIImageWithCVPexelBuffer(CVPixelBufferRef pixelBuffer) +{ + if (@available(macOS 10.11, *)) { + CIImage *image = [CIImage imageWithCVPixelBuffer:pixelBuffer]; + return image; + } else { + return nil; + } +} + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +SGPLFImage * SGPLFImageWithCGImage(CGImageRef image) +{ + return [UIImage imageWithCGImage:image]; +} + +SGPLFImage * SGPLFImageWithCVPixelBuffer(CVPixelBufferRef pixelBuffer) +{ + CIImage *ciImage = SGPLFImageCIImageWithCVPexelBuffer(pixelBuffer); + if (!ciImage) return nil; + return [UIImage imageWithCIImage:ciImage]; +} + +CIImage * SGPLFImageCIImageWithCVPexelBuffer(CVPixelBufferRef pixelBuffer) +{ + CIImage *image = [CIImage imageWithCVPixelBuffer:pixelBuffer]; + return image; +} + +#endif + +CGImageRef SGPLFImageCGImageWithCVPexelBuffer(CVPixelBufferRef pixelBuffer) +{ + CVPixelBufferLockBaseAddress(pixelBuffer, 0); + + size_t count = CVPixelBufferGetPlaneCount(pixelBuffer); + if (count > 1) { + CVPixelBufferUnlockBaseAddress(pixelBuffer, 0); + return nil; + } + + uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(pixelBuffer); + size_t bytesPerRow = CVPixelBufferGetBytesPerRow(pixelBuffer); + size_t width = CVPixelBufferGetWidth(pixelBuffer); + size_t height = CVPixelBufferGetHeight(pixelBuffer); + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(baseAddress, + width, + height, + 8, + bytesPerRow, + colorSpace, + kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst); + + CGImageRef imageRef = CGBitmapContextCreateImage(context); + + CGColorSpaceRelease(colorSpace); + CGContextRelease(context); + + CVPixelBufferUnlockBaseAddress(pixelBuffer, 0); + + return imageRef; +} + +SGPLFImage * SGPLFImageWithRGBData(uint8_t *rgb_data, int linesize, int width, int height) +{ + CGImageRef imageRef = SGPLFImageCGImageWithRGBData(rgb_data, linesize, width, height); + if (!imageRef) return nil; + SGPLFImage *image = SGPLFImageWithCGImage(imageRef); + CGImageRelease(imageRef); + return image; +} + +CGImageRef SGPLFImageCGImageWithRGBData(uint8_t *rgb_data, int linesize, int width, int height) +{ + CFDataRef data = CFDataCreate(kCFAllocatorDefault, rgb_data, linesize * height); + CGDataProviderRef provider = CGDataProviderCreateWithCFData(data); + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGImageRef imageRef = CGImageCreate(width, + height, + 8, + 24, + linesize, + colorSpace, + kCGBitmapByteOrderDefault, + provider, + NULL, + NO, + kCGRenderingIntentDefault); + CGColorSpaceRelease(colorSpace); + CGDataProviderRelease(provider); + CFRelease(data); + + return imageRef; +} + diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFObject.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFObject.h new file mode 100644 index 00000000..6bda397d --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFObject.h @@ -0,0 +1,24 @@ +// +// SGPLFObject.h +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#ifndef SGPLFObject_h +#define SGPLFObject_h + +#import "SGPLFTargets.h" + +#if SGPLATFORM_TARGET_OS_MAC + +#import + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +#import + +#endif + +#endif /* SGPLFObject_h */ diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.h new file mode 100644 index 00000000..b2b94ce6 --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.h @@ -0,0 +1,21 @@ +// +// SGPLFScreen.h +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFObject.h" + +#if SGPLATFORM_TARGET_OS_MAC + +typedef NSScreen SGPLFScreen; + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +typedef UIScreen SGPLFScreen; + +#endif + +CGFloat SGPLFScreenGetScale(void); diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.m b/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.m new file mode 100644 index 00000000..b4c23044 --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFScreen.m @@ -0,0 +1,25 @@ +// +// SGPLFScreen.m +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFScreen.h" + +#if SGPLATFORM_TARGET_OS_MAC + +CGFloat SGPLFScreenGetScale(void) +{ + return [NSScreen mainScreen].backingScaleFactor; +} + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +CGFloat SGPLFScreenGetScale(void) +{ + return [UIScreen mainScreen].scale; +} + +#endif diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFTargets.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFTargets.h new file mode 100644 index 00000000..a98ce3bb --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFTargets.h @@ -0,0 +1,22 @@ +// +// SGPLFTargets.h +// SGPlatform +// +// Created by Single on 2017/2/23. +// Copyright © 2017年 single. All rights reserved. +// + +#ifndef SGPLFTargets_h +#define SGPLFTargets_h + +#import + +#define SGPLATFORM_TARGET_OS_MAC TARGET_OS_OSX +#define SGPLATFORM_TARGET_OS_IPHONE TARGET_OS_IOS +#define SGPLATFORM_TARGET_OS_TV TARGET_OS_TV + +#define SGPLATFORM_TARGET_OS_MAC_OR_IPHONE (SGPLATFORM_TARGET_OS_MAC || SGPLATFORM_TARGET_OS_IPHONE) +#define SGPLATFORM_TARGET_OS_MAC_OR_TV (SGPLATFORM_TARGET_OS_MAC || SGPLATFORM_TARGET_OS_TV) +#define SGPLATFORM_TARGET_OS_IPHONE_OR_TV (SGPLATFORM_TARGET_OS_IPHONE || SGPLATFORM_TARGET_OS_TV) + +#endif /* SGPLFTargets_h */ diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFView.h b/SGPlayer/Classes/Core/SGPlatform/SGPLFView.h new file mode 100644 index 00000000..33be8cbc --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFView.h @@ -0,0 +1,26 @@ +// +// SGPLFView.h +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFObject.h" +#import "SGPLFImage.h" +#import "SGPLFColor.h" + +#if SGPLATFORM_TARGET_OS_MAC + +typedef NSView SGPLFView; + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +typedef UIView SGPLFView; + +#endif + +void SGPLFViewSetBackgroundColor(SGPLFView *view, SGPLFColor *color); +void SGPLFViewInsertSubview(SGPLFView *superView, SGPLFView *subView, NSInteger index); + +SGPLFImage * SGPLFViewGetCurrentSnapshot(SGPLFView *view); diff --git a/SGPlayer/Classes/Core/SGPlatform/SGPLFView.m b/SGPlayer/Classes/Core/SGPlatform/SGPLFView.m new file mode 100644 index 00000000..d4f15f59 --- /dev/null +++ b/SGPlayer/Classes/Core/SGPlatform/SGPLFView.m @@ -0,0 +1,75 @@ +// +// SGPLFView.m +// SGPlatform +// +// Created by Single on 2017/2/24. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPLFView.h" +#import "SGPLFScreen.h" + +#if SGPLATFORM_TARGET_OS_MAC + +void SGPLFViewSetBackgroundColor(SGPLFView *view, SGPLFColor *color) +{ + view.wantsLayer = YES; + view.layer.backgroundColor = color.CGColor; +} + +void SGPLFViewInsertSubview(SGPLFView *superView, SGPLFView *subView, NSInteger index) +{ + if (superView.subviews.count > index) { + NSView *obj = [superView.subviews objectAtIndex:index]; + [superView addSubview:subView positioned:NSWindowBelow relativeTo:obj]; + } else { + [superView addSubview:subView]; + } +} + +SGPLFImage *SGPLFViewGetCurrentSnapshot(SGPLFView *view) +{ + CGSize size = CGSizeMake(view.bounds.size.width * SGPLFScreenGetScale(), + view.bounds.size.height * SGPLFScreenGetScale()); + CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(nil, + size.width, + size.height, + 8, + size.width * 4, + rgbColorSpace, + (CGBitmapInfo)kCGImageAlphaPremultipliedLast); + [view.layer renderInContext:context]; + CGImageRef imageRef = CGBitmapContextCreateImage(context); + NSImage *image = [[NSImage alloc] initWithCGImage:imageRef size:size]; + CGColorSpaceRelease(rgbColorSpace); + CGContextRelease(context); + CGImageRelease(imageRef); + return image; +} + +#elif SGPLATFORM_TARGET_OS_IPHONE_OR_TV + +void SGPLFViewSetBackgroundColor(SGPLFView *view, SGPLFColor *color) +{ + view.backgroundColor = color; +} + +void SGPLFViewInsertSubview(SGPLFView *superView, SGPLFView *subView, NSInteger index) +{ + [superView insertSubview:subView atIndex:index]; +} + +SGPLFImage * SGPLFViewGetCurrentSnapshot(SGPLFView *view) +{ + CGSize size = CGSizeMake(view.bounds.size.width * SGPLFScreenGetScale(), + view.bounds.size.height * SGPLFScreenGetScale()); + CGRect rect = CGRectMake(0, 0, size.width, size.height); + UIGraphicsBeginImageContextWithOptions(size, NO, 0); + [view drawViewHierarchyInRect:rect afterScreenUpdates:YES]; + SGPLFImage * image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return image; +} + +#endif diff --git a/SGPlayer/Classes/Core/SGPlayerBuildConfig.h b/SGPlayer/Classes/Core/SGPlayerBuildConfig.h deleted file mode 100644 index 0aa86c2f..00000000 --- a/SGPlayer/Classes/Core/SGPlayerBuildConfig.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// SGPlayerBuildConfig.h -// SGPlayer -// -// Created by Single on 2017/11/2. -// Copyright © 2017年 single. All rights reserved. -// - -#ifndef SGPlayerBuildConfig_h -#define SGPlayerBuildConfig_h - - -#define SGPlayerBuildConfig_FFmpeg_Enable 1 -#define SGPlayerBuildConfig_FFmpeg_Disable !SGPlayerBuildConfig_FFmpeg_Enable - - -#endif diff --git a/SGPlayer/Classes/Core/SGPlayerMacro.h b/SGPlayer/Classes/Core/SGPlayerMacro.h deleted file mode 100644 index 5dc04f48..00000000 --- a/SGPlayer/Classes/Core/SGPlayerMacro.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// SGPlayerMacro.h -// SGPlayer -// -// Created by Single on 16/6/29. -// Copyright © 2016年 single. All rights reserved. -// - -#ifndef SGPlayerMacro_h -#define SGPlayerMacro_h - - -#import - -// weak self -#define SGWeakSelf __weak typeof(self) weakSelf = self; -#define SGStrongSelf __strong typeof(weakSelf) strongSelf = weakSelf; - -// log level -#ifdef DEBUG -#define SGPlayerLog(...) NSLog(__VA_ARGS__) -#else -#define SGPlayerLog(...) -#endif - - -#endif diff --git a/SGPlayer/Classes/Core/SGPlayerNotification.h b/SGPlayer/Classes/Core/SGPlayerNotification.h deleted file mode 100644 index f396cd70..00000000 --- a/SGPlayer/Classes/Core/SGPlayerNotification.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// SGNotification.h -// SGPlayer -// -// Created by Single on 16/8/15. -// Copyright © 2016年 single. All rights reserved. -// - -#import -#import "SGPlayerImp.h" -#import "SGPlayerAction.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SGPlayer (SGPlayerNotification) -@property (nonatomic, strong, nullable) SGError * error; -@end - -@interface SGPlayerNotification : NSObject - -+ (void)postPlayer:(SGPlayer *)player error:(SGError *)error; -+ (void)postPlayer:(SGPlayer *)player statePrevious:(SGPlayerState)previous current:(SGPlayerState)current; -+ (void)postPlayer:(SGPlayer *)player progressPercent:(NSNumber *)percent current:(NSNumber *)current total:(NSNumber *)total; -+ (void)postPlayer:(SGPlayer *)player playablePercent:(NSNumber *)percent current:(NSNumber *)current total:(NSNumber *)total; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SGPlayer/Classes/Core/SGPlayerNotification.m b/SGPlayer/Classes/Core/SGPlayerNotification.m deleted file mode 100644 index 4b9d4d92..00000000 --- a/SGPlayer/Classes/Core/SGPlayerNotification.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// SGNotification.m -// SGPlayer -// -// Created by Single on 16/8/15. -// Copyright © 2016年 single. All rights reserved. -// - -#import "SGPlayerNotification.h" - -@implementation SGPlayerNotification - -+ (void)postPlayer:(SGPlayer *)player error:(SGError *)error -{ - if (!player || !error) return; - NSDictionary * userInfo = @{ - SGPlayerErrorKey : error - }; - player.error = error; - [self postNotificationName:SGPlayerErrorNotificationName object:player userInfo:userInfo]; -} - -+ (void)postPlayer:(SGPlayer *)player statePrevious:(SGPlayerState)previous current:(SGPlayerState)current -{ - if (!player) return; - NSDictionary * userInfo = @{ - SGPlayerStatePreviousKey : @(previous), - SGPlayerStateCurrentKey : @(current) - }; - [self postNotificationName:SGPlayerStateChangeNotificationName object:player userInfo:userInfo]; -} - -+ (void)postPlayer:(SGPlayer *)player progressPercent:(NSNumber *)percent current:(NSNumber *)current total:(NSNumber *)total -{ - if (!player) return; - if (![percent isKindOfClass:[NSNumber class]]) percent = @(0); - if (![current isKindOfClass:[NSNumber class]]) current = @(0); - if (![total isKindOfClass:[NSNumber class]]) total = @(0); - NSDictionary * userInfo = @{ - SGPlayerProgressPercentKey : percent, - SGPlayerProgressCurrentKey : current, - SGPlayerProgressTotalKey : total - }; - [self postNotificationName:SGPlayerProgressChangeNotificationName object:player userInfo:userInfo]; -} - -+ (void)postPlayer:(SGPlayer *)player playablePercent:(NSNumber *)percent current:(NSNumber *)current total:(NSNumber *)total -{ - if (!player) return; - if (![percent isKindOfClass:[NSNumber class]]) percent = @(0); - if (![current isKindOfClass:[NSNumber class]]) current = @(0); - if (![total isKindOfClass:[NSNumber class]]) total = @(0); - NSDictionary * userInfo = @{ - SGPlayerPlayablePercentKey : percent, - SGPlayerPlayableCurrentKey : current, - SGPlayerPlayableTotalKey : total, - }; - [self postNotificationName:SGPlayerPlayableChangeNotificationName object:player userInfo:userInfo]; -} - -+ (void)postNotificationName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:name object:object userInfo:userInfo]; - }); -} - -@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.h b/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.h new file mode 100644 index 00000000..0795a571 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.h @@ -0,0 +1,30 @@ +// +// SGAudioFormatter.h +// SGPlayer iOS +// +// Created by Single on 2018/10/30. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGAudioDescriptor.h" +#import "SGAudioFrame.h" + +@interface SGAudioFormatter : NSObject + +/** + * + */ +@property (nonatomic, copy) SGAudioDescriptor *descriptor; + +/** + * + */ +- (SGAudioFrame *)format:(SGAudioFrame *)frame; + +/** + * + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.m b/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.m new file mode 100644 index 00000000..24bfd8c0 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioFormatter.m @@ -0,0 +1,64 @@ +// +// SGAudioFormatter.m +// SGPlayer iOS +// +// Created by Single on 2018/10/30. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioFormatter.h" +#import "SGFrame+Internal.h" +#import "SGSWResample.h" + +@interface SGAudioFormatter () + +@property (nonatomic, strong, readonly) SGSWResample *context; + +@end + +@implementation SGAudioFormatter + +- (SGAudioFrame *)format:(SGAudioFrame *)frame +{ + if (![frame isKindOfClass:[SGAudioFrame class]]) { + [frame unlock]; + return nil; + } + if (![self->_context.inputDescriptor isEqualToDescriptor:frame.descriptor] || + ![self->_context.outputDescriptor isEqualToDescriptor:self->_descriptor]) { + self->_context = nil; + SGSWResample *context = [[SGSWResample alloc] init]; + context.inputDescriptor = frame.descriptor; + context.outputDescriptor = self->_descriptor; + if ([context open]) { + self->_context = context; + } + } + if (!self->_context) { + [frame unlock]; + return nil; + } + int nb_planes = self->_descriptor.numberOfPlanes; + int nb_samples = [self->_context write:frame.data nb_samples:frame.numberOfSamples]; + CMTime start = frame.timeStamp; + CMTime duration = CMTimeMake(nb_samples, self->_descriptor.sampleRate); + SGAudioFrame *ret = [SGAudioFrame audioFrameWithDescriptor:self->_descriptor numberOfSamples:nb_samples]; + uint8_t *data[SGFramePlaneCount] = {NULL}; + for (int i = 0; i < nb_planes; i++) { + data[i] = ret.core->data[i]; + } + [self->_context read:data nb_samples:nb_samples]; + SGCodecDescriptor *cd = [[SGCodecDescriptor alloc] init]; + cd.track = frame.track; + [ret setCodecDescriptor:cd]; + [ret fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + [frame unlock]; + return ret; +} + +- (void)flush +{ + self->_context = nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.h b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.h new file mode 100644 index 00000000..c814f7a4 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.h @@ -0,0 +1,59 @@ +// +// SGAudioMixer.h +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGAudioDescriptor.h" +#import "SGAudioFrame.h" +#import "SGCapacity.h" + +@interface SGAudioMixer : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithTracks:(NSArray *)tracks weights:(NSArray *)weights descriptor:(SGAudioDescriptor *)descriptor; + +/** + * + */ +@property (nonatomic, copy, readonly) SGAudioDescriptor *descriptor; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy) NSArray *weights; + +/** + * + */ +- (SGAudioFrame *)putFrame:(SGAudioFrame *)frame; + +/** + * + */ +- (SGAudioFrame *)finish; + +/** + * + */ +- (SGCapacity)capacity; + +/** + * + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.m b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.m new file mode 100644 index 00000000..c83ce128 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixer.m @@ -0,0 +1,211 @@ +// +// SGAudioMixer.m +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioMixer.h" +#import "SGFrame+Internal.h" +#import "SGAudioMixerUnit.h" + +@interface SGAudioMixer () + +@property (nonatomic, readonly) CMTime startTime; +@property (nonatomic, strong, readonly) NSMutableDictionary *units; + +@end + +@implementation SGAudioMixer + +- (instancetype)initWithTracks:(NSArray *)tracks weights:(NSArray *)weights descriptor:(SGAudioDescriptor *)descriptor +{ + if (self = [super init]) { + self->_tracks = [tracks copy]; + self->_weights = [weights copy]; + self->_descriptor = [descriptor copy]; + self->_startTime = kCMTimeNegativeInfinity; + self->_units = [NSMutableDictionary dictionary]; + for (SGTrack *obj in self->_tracks) { + [self->_units setObject:[[SGAudioMixerUnit alloc] init] forKey:@(obj.index)]; + } + } + return self; +} + +#pragma mark - Control + +- (SGAudioFrame *)putFrame:(SGAudioFrame *)frame +{ + if (self->_tracks.count <= 1) { + return frame; + } + if (CMTimeCompare(CMTimeAdd(frame.timeStamp, frame.duration), self->_startTime) <= 0) { + [frame unlock]; + return nil; + } + NSAssert([self->_descriptor isEqualToDescriptor:frame.descriptor], @"Invalid Format."); + NSAssert(self->_descriptor.format == AV_SAMPLE_FMT_FLTP, @"Invalid Format."); + SGAudioMixerUnit *unit = [self->_units objectForKey:@(frame.track.index)]; + BOOL ret = [unit putFrame:frame]; + [frame unlock]; + if (ret) { + return [self mixForPutFrame]; + } + return nil; +} + +- (SGAudioFrame *)finish +{ + if (self->_tracks.count <= 1) { + return nil; + } + return [self mixForFinish]; +} + +- (SGCapacity)capacity +{ + __block SGCapacity capacity = SGCapacityCreate(); + [self->_units enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, SGAudioMixerUnit *obj, BOOL *stop) { + capacity = SGCapacityMaximum(capacity, obj.capacity); + }]; + return capacity; +} + +- (void)flush +{ + [self->_units enumerateKeysAndObjectsUsingBlock:^(id key, SGAudioMixerUnit *obj, BOOL *stop) { + [obj flush]; + }]; + self->_startTime = kCMTimeNegativeInfinity; +} + +#pragma mark - Mix + +- (SGAudioFrame *)mixForPutFrame +{ + __block CMTime start = kCMTimePositiveInfinity; + __block CMTime end = kCMTimePositiveInfinity; + __block CMTime maximumDuration = kCMTimeZero; + [self->_units enumerateKeysAndObjectsUsingBlock:^(id key, SGAudioMixerUnit *obj, BOOL *stop) { + if (CMTIMERANGE_IS_INVALID(obj.timeRange)) { + return; + } + start = CMTimeMinimum(start, obj.timeRange.start); + start = CMTimeMaximum(start, self->_startTime); + end = CMTimeMinimum(end, CMTimeRangeGetEnd(obj.timeRange)); + maximumDuration = CMTimeMaximum(maximumDuration, obj.timeRange.duration); + }]; + if (CMTimeCompare(maximumDuration, CMTimeMake(8, 100)) < 0) { + return nil; + } + return [self mixWithRange:CMTimeRangeFromTimeToTime(start, end)]; +} + +- (SGAudioFrame *)mixForFinish +{ + __block CMTime start = kCMTimePositiveInfinity; + __block CMTime end = kCMTimeNegativeInfinity; + [self->_units enumerateKeysAndObjectsUsingBlock:^(id key, SGAudioMixerUnit *obj, BOOL *stop) { + if (CMTIMERANGE_IS_INVALID(obj.timeRange)) { + return; + } + start = CMTimeMinimum(start, obj.timeRange.start); + start = CMTimeMaximum(start, self->_startTime); + end = CMTimeMaximum(end, CMTimeRangeGetEnd(obj.timeRange)); + }]; + if (CMTimeCompare(CMTimeSubtract(end, start), kCMTimeZero) <= 0) { + return nil; + } + SGAudioFrame *frame = [self mixWithRange:CMTimeRangeFromTimeToTime(start, end)]; + [self->_units enumerateKeysAndObjectsUsingBlock:^(id key, SGAudioMixerUnit *obj, BOOL *stop) { + [obj flush]; + }]; + return frame; +} + +- (SGAudioFrame *)mixWithRange:(CMTimeRange)range +{ + if (CMTIMERANGE_IS_INVALID(range)) { + return nil; + } + self->_startTime = CMTimeRangeGetEnd(range); + + NSArray *weights = self->_weights; + if (weights.count != self->_tracks.count) { + NSMutableArray *obj = [NSMutableArray array]; + for (int i = 0; i < self->_tracks.count; i++) { + [obj addObject:@(1.0 / self->_tracks.count)]; + } + weights = [obj copy]; + } else { + Float64 sum = 0; + for (NSNumber *obj in weights) { + sum += obj.doubleValue; + } + NSMutableArray *obj = [NSMutableArray array]; + for (int i = 0; i < self->_tracks.count; i++) { + [obj addObject:@(weights[i].doubleValue / sum)]; + } + weights = [obj copy]; + } + + CMTime start = range.start; + CMTime duration = range.duration; + SGAudioDescriptor *descriptor = self->_descriptor; + int numberOfSamples = (int)CMTimeConvertScale(duration, descriptor.sampleRate, kCMTimeRoundingMethod_RoundTowardZero).value; + SGAudioFrame *ret = [SGAudioFrame audioFrameWithDescriptor:descriptor numberOfSamples:numberOfSamples]; + NSMutableDictionary *list = [NSMutableDictionary dictionary]; + for (SGTrack *obj in self->_tracks) { + NSArray *frames = [self->_units[@(obj.index)] framesToEndTime:CMTimeRangeGetEnd(range)]; + if (frames.count > 0) { + [list setObject:frames forKey:@(obj.index)]; + } + } + NSMutableArray *discontinuous = [NSMutableArray array]; + for (int t = 0; t < self->_tracks.count; t++) { + int lastEE = 0; + for (SGAudioFrame *obj in list[@(self->_tracks[t].index)]) { + int s = (int)CMTimeConvertScale(CMTimeSubtract(obj.timeStamp, start), descriptor.sampleRate, kCMTimeRoundingMethod_RoundTowardZero).value; + int e = s + obj.numberOfSamples; + int ss = MAX(0, s); + int ee = MIN(numberOfSamples, e); + if (ss - lastEE != 0) { + NSRange range = NSMakeRange(MIN(ss, lastEE), ABS(ss - lastEE)); + [discontinuous addObject:[NSValue valueWithRange:range]]; + } + lastEE = ee; + for (int i = ss; i < ee; i++) { + for (int c = 0; c < descriptor.numberOfPlanes; c++) { + ((float *)ret.core->data[c])[i] += (((float *)obj.data[c])[i - s] * weights[t].floatValue); + } + } + } + } + for (NSValue *obj in discontinuous) { + NSRange range = obj.rangeValue; + for (int c = 0; c < descriptor.numberOfPlanes; c++) { + float value = 0; + if (range.location > 0) { + value += ((float *)ret.core->data[c])[range.location - 1] * 0.5; + } + if (NSMaxRange(range) < numberOfSamples - 1) { + value += ((float *)ret.core->data[c])[NSMaxRange(range)] * 0.5; + } + for (int i = (int)range.location; i < NSMaxRange(range); i++) { + ((float *)ret.core->data[c])[i] = value; + } + } + } + [list enumerateKeysAndObjectsUsingBlock:^(id key, NSArray *objs, BOOL *stop) { + for (SGAudioFrame *obj in objs) { + [obj unlock]; + } + }]; + [ret setCodecDescriptor:[[SGCodecDescriptor alloc] init]]; + [ret fillWithTimeStamp:start decodeTimeStamp:start duration:duration]; + return ret; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.h b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.h new file mode 100644 index 00000000..28bd7b52 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.h @@ -0,0 +1,40 @@ +// +// SGAudioMixerUnit.h +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGAudioFrame.h" +#import "SGCapacity.h" + +@interface SGAudioMixerUnit : NSObject + +/** + * + */ +@property (nonatomic, readonly) CMTimeRange timeRange; + +/** + * + */ +- (BOOL)putFrame:(SGAudioFrame *)frame; + +/** + * + */ +- (NSArray *)framesToEndTime:(CMTime)endTime; + +/** + * + */ +- (SGCapacity)capacity; + +/** + * + */ +- (void)flush; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.m b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.m new file mode 100644 index 00000000..7d706a8d --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioMixerUnit.m @@ -0,0 +1,100 @@ +// +// SGAudioMixerUnit.m +// SGPlayer +// +// Created by Single on 2018/11/29. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioMixerUnit.h" + +@interface SGAudioMixerUnit () + +{ + SGCapacity _capacity; +} + +@property (nonatomic, strong, readonly) NSMutableArray *frames; + +@end + +@implementation SGAudioMixerUnit + +- (instancetype)init +{ + if (self = [super init]) { + [self flush]; + } + return self; +} + +- (void)dealloc +{ + for (SGAudioFrame *obj in self->_frames) { + [obj unlock]; + } +} + +#pragma mark - Control + +- (BOOL)putFrame:(SGAudioFrame *)frame +{ + if (CMTIMERANGE_IS_VALID(self->_timeRange) && + CMTimeCompare(CMTimeAdd(frame.timeStamp, frame.duration), CMTimeRangeGetEnd(self->_timeRange)) <= 0) { + return NO; + } + [frame lock]; + [self->_frames addObject:frame]; + [self updateTimeRange]; + return YES; +} + +- (NSArray *)framesToEndTime:(CMTime)endTime +{ + NSMutableArray *ret = [NSMutableArray array]; + NSMutableArray *remove = [NSMutableArray array]; + for (SGAudioFrame *obj in self->_frames) { + if (CMTimeCompare(obj.timeStamp, endTime) < 0) { + [obj lock]; + [ret addObject:obj]; + } + if (CMTimeCompare(CMTimeAdd(obj.timeStamp, obj.duration), endTime) <= 0) { + [obj unlock]; + [remove addObject:obj]; + } + } + [self->_frames removeObjectsInArray:remove]; + [self updateTimeRange]; + return [ret copy]; +} + +- (SGCapacity)capacity +{ + return self->_capacity; +} + +- (void)flush +{ + for (SGAudioFrame *obj in self->_frames) { + [obj unlock]; + } + self->_capacity = SGCapacityCreate(); + self->_frames = [NSMutableArray array]; + self->_timeRange = kCMTimeRangeInvalid; +} + +#pragma mark - Internal + +- (void)updateTimeRange +{ + self->_capacity.count = (int)self->_frames.count; + if (self->_frames.count == 0) { + self->_timeRange = kCMTimeRangeInvalid; + } else { + CMTime start = self->_frames.firstObject.timeStamp; + CMTime end = CMTimeAdd(self->_frames.lastObject.timeStamp, self->_frames.lastObject.duration); + self->_timeRange = CMTimeRangeFromTimeToTime(start, end); + } +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.h b/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.h new file mode 100644 index 00000000..26627443 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.h @@ -0,0 +1,19 @@ +// +// SGAudioProcessor.h +// SGPlayer +// +// Created by Single on 2018/11/28. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGProcessor.h" +#import "SGAudioDescriptor.h" + +@interface SGAudioProcessor : NSObject + +/** + * + */ +- (void)setDescriptor:(SGAudioDescriptor *)descriptor; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.m b/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.m new file mode 100644 index 00000000..d1d9b71d --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGAudioProcessor.m @@ -0,0 +1,82 @@ +// +// SGAudioProcessor.m +// SGPlayer +// +// Created by Single on 2018/11/28. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGAudioProcessor.h" +#import "SGAudioFormatter.h" +#import "SGAudioMixer.h" + +@interface SGAudioProcessor () + +@property (nonatomic, strong, readonly) SGAudioMixer *mixer; +@property (nonatomic, strong, readonly) SGTrackSelection *selection; +@property (nonatomic, strong, readonly) SGAudioDescriptor *descriptor; +@property (nonatomic, strong, readonly) NSMutableDictionary *formatters; + +@end + +@implementation SGAudioProcessor + +- (void)setDescriptor:(SGAudioDescriptor *)descriptor +{ + self->_descriptor = [descriptor copy]; +} + +- (void)setSelection:(SGTrackSelection *)selection action:(SGTrackSelectionAction)action +{ + self->_selection = [selection copy]; + if (action & SGTrackSelectionActionTracks) { + self->_mixer = [[SGAudioMixer alloc] initWithTracks:selection.tracks weights:selection.weights descriptor:self->_descriptor]; + self->_formatters = [NSMutableDictionary dictionary]; + for (SGTrack *track in selection.tracks) { + SGAudioFormatter *formatter = [[SGAudioFormatter alloc] init]; + formatter.descriptor = self->_descriptor; + [self->_formatters setObject:formatter forKey:@(track.index)]; + } + } else if (action & SGTrackSelectionActionWeights) { + self->_mixer.weights = selection.weights; + } +} + +- (__kindof SGFrame *)putFrame:(__kindof SGFrame *)frame +{ + if (![self->_selection.tracks containsObject:frame.track]) { + [frame unlock]; + return nil; + } + frame = [self->_formatters[@(frame.track.index)] format:frame]; + if (frame) { + return [self->_mixer putFrame:frame]; + } + return nil; +} + +- (SGAudioFrame *)finish +{ + return [self->_mixer finish]; +} + +- (SGCapacity)capacity +{ + return [self->_mixer capacity]; +} + +- (void)flush +{ + [self->_mixer flush]; + [self->_formatters enumerateKeysAndObjectsUsingBlock:^(id key, SGAudioFormatter *obj, BOOL *stop) { + [obj flush]; + }]; +} + +- (void)close +{ + self->_mixer = nil; + self->_formatters = nil; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGProcessor.h b/SGPlayer/Classes/Core/SGProcessor/SGProcessor.h new file mode 100644 index 00000000..1c5a8bd5 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGProcessor.h @@ -0,0 +1,46 @@ +// +// SGProcessor.h +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import +#import "SGTrackSelection.h" +#import "SGCapacity.h" +#import "SGFrame.h" + +@protocol SGProcessor + +/** + * + */ +- (void)setSelection:(SGTrackSelection *)selection action:(SGTrackSelectionAction)action; + +/** + * + */ +- (__kindof SGFrame *)putFrame:(__kindof SGFrame *)frame; + +/** + * + */ +- (__kindof SGFrame *)finish; + +/** + * + */ +- (SGCapacity)capacity; + +/** + * + */ +- (void)flush; + +/** + * + */ +- (void)close; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSWResample.h b/SGPlayer/Classes/Core/SGProcessor/SGSWResample.h new file mode 100644 index 00000000..0a2fa89b --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSWResample.h @@ -0,0 +1,35 @@ +// +// SGSWResample.h +// SGPlayer iOS +// +// Created by Single on 2018/10/30. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGAudioDescriptor.h" + +@interface SGSWResample : NSObject + +/** + * + */ +@property (nonatomic, copy) SGAudioDescriptor *inputDescriptor; +@property (nonatomic, copy) SGAudioDescriptor *outputDescriptor; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (int)write:(uint8_t **)data nb_samples:(int)nb_samples; + +/** + * + */ +- (int)read:(uint8_t **)data nb_samples:(int)nb_samples; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSWResample.m b/SGPlayer/Classes/Core/SGProcessor/SGSWResample.m new file mode 100644 index 00000000..609c17cf --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSWResample.m @@ -0,0 +1,86 @@ +// +// SGSWResample.m +// SGPlayer iOS +// +// Created by Single on 2018/10/30. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSWResample.h" +#import "SGFFmpeg.h" +#import "SGFrame.h" + +@interface SGSWResample () + +{ + AVBufferRef *_buffer[SGFramePlaneCount]; +} + +@property (nonatomic, readonly) SwrContext *context; + +@end + +@implementation SGSWResample + +- (void)dealloc +{ + if (self->_context) { + swr_free(&_context); + self->_context = nil; + } + for (int i = 0; i < SGFramePlaneCount; i++) { + av_buffer_unref(&self->_buffer[i]); + self->_buffer[i] = nil; + } +} + +- (BOOL)open +{ + if (!self->_inputDescriptor || + !self->_outputDescriptor) { + return NO; + } + self->_context = swr_alloc_set_opts(NULL, + self->_outputDescriptor.channelLayout, + self->_outputDescriptor.format, + self->_outputDescriptor.sampleRate, + self->_inputDescriptor.channelLayout, + self->_inputDescriptor.format, + self->_inputDescriptor.sampleRate, + 0, NULL); + if (swr_init(self->_context) < 0) { + return NO; + } + return YES; +} + +- (int)write:(uint8_t **)data nb_samples:(int)nb_samples +{ + int numberOfPlanes = self->_outputDescriptor.numberOfPlanes; + int numberOfSamples = swr_get_out_samples(self->_context, nb_samples); + int linesize = [self->_outputDescriptor linesize:numberOfSamples]; + uint8_t *o_data[SGFramePlaneCount] = {NULL}; + for (int i = 0; i < numberOfPlanes; i++) { + if (!self->_buffer[i] || self->_buffer[i]->size < linesize) { + av_buffer_realloc(&self->_buffer[i], linesize); + } + o_data[i] = self->_buffer[i]->data; + } + return swr_convert(self->_context, + (uint8_t **)o_data, + numberOfSamples, + (const uint8_t **)data, + nb_samples); +} + +- (int)read:(uint8_t **)data nb_samples:(int)nb_samples +{ + int numberOfPlanes = self->_outputDescriptor.numberOfPlanes; + int linesize = [self->_outputDescriptor linesize:nb_samples]; + for (int i = 0; i < numberOfPlanes; i++) { + memcpy(data[i], self->_buffer[i]->data, linesize); + } + return nb_samples; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSWScale.h b/SGPlayer/Classes/Core/SGProcessor/SGSWScale.h new file mode 100644 index 00000000..caac2cc6 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSWScale.h @@ -0,0 +1,29 @@ +// +// SGSWScale.h +// SGPlayer iOS +// +// Created by Single on 2018/8/28. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGVideoDescriptor.h" + +@interface SGSWScale : NSObject + +@property (nonatomic, copy) SGVideoDescriptor *inputDescriptor; +@property (nonatomic, copy) SGVideoDescriptor *outputDescriptor; + +@property (nonatomic) int flags; // SWS_FAST_BILINEAR + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (int)convert:(const uint8_t * const [])inputData inputLinesize:(const int[])inputLinesize outputData:(uint8_t * const [])outputData outputLinesize:(const int[])outputLinesize; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSWScale.m b/SGPlayer/Classes/Core/SGProcessor/SGSWScale.m new file mode 100644 index 00000000..f87eb081 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSWScale.m @@ -0,0 +1,65 @@ +// +// SGSWScale.m +// SGPlayer iOS +// +// Created by Single on 2018/8/28. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSWScale.h" +#import "SGFFmpeg.h" + +@interface SGSWScale () + +@property (nonatomic, readonly) struct SwsContext *context; + +@end + +@implementation SGSWScale + +- (instancetype)init +{ + if (self = [super init]) { + self->_flags = SWS_FAST_BILINEAR; + } + return self; +} + +- (void)dealloc +{ + if (self->_context) { + sws_freeContext(self->_context); + self->_context = nil; + } +} + +- (BOOL)open +{ + if (!self->_inputDescriptor || + !self->_outputDescriptor) { + return NO; + } + self->_context = sws_getCachedContext(self->_context, + self->_inputDescriptor.width, + self->_inputDescriptor.height, + self->_inputDescriptor.format, + self->_outputDescriptor.width, + self->_outputDescriptor.height, + self->_outputDescriptor.format, + self->_flags, + NULL, NULL, NULL); + return self->_context ? YES : NO; +} + +- (int)convert:(const uint8_t *const [])inputData inputLinesize:(const int [])inputLinesize outputData:(uint8_t *const [])outputData outputLinesize:(const int [])outputLinesize +{ + return sws_scale(self->_context, + inputData, + inputLinesize, + 0, + self->_inputDescriptor.height, + outputData, + outputLinesize);; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSonic.h b/SGPlayer/Classes/Core/SGProcessor/SGSonic.h new file mode 100644 index 00000000..f026e730 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSonic.h @@ -0,0 +1,80 @@ +// +// SGSonic.h +// SGPlayer +// +// Created by Single on 2018/12/20. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGAudioDescriptor.h" + +@interface SGSonic : NSObject + +/** + * + */ ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithDescriptor:(SGAudioDescriptor *)descriptor; + +/** + * + */ +@property (nonatomic, copy, readonly) SGAudioDescriptor *descriptor; + +/** + * + */ +@property (nonatomic) float speed; + +/** + * + */ +@property (nonatomic) float pitch; + +/** + * + */ +@property (nonatomic) float rate; + +/** + * + */ +@property (nonatomic) float volume; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (int)flush; + +/** + * + */ +- (int)samplesInput; + +/** + * + */ +- (int)samplesAvailable; + +/** + * + */ +- (int)write:(uint8_t **)data nb_samples:(int)nb_samples; + +/** + * + */ +- (int)read:(uint8_t **)data nb_samples:(int)nb_samples; + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGSonic.m b/SGPlayer/Classes/Core/SGProcessor/SGSonic.m new file mode 100644 index 00000000..3a9226d7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGSonic.m @@ -0,0 +1,171 @@ +// +// SGSonic.m +// SGPlayer +// +// Created by Single on 2018/12/20. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGSonic.h" +#import "SGFFmpeg.h" +#import "sonic.h" + +@interface SGSonic () + +@property (nonatomic) sonicStream sonic; +@property (nonatomic) AVBufferRef *buffer; + +@end + +@implementation SGSonic + +- (instancetype)initWithDescriptor:(SGAudioDescriptor *)descriptor +{ + if (self = [super init]) { + self->_descriptor = [descriptor copy]; + self->_speed = 1.0; + self->_pitch = 1.0; + self->_rate = 1.0; + self->_volume = 1.0; + } + return self; +} + +- (void)dealloc +{ + if (self->_sonic) { + sonicDestroyStream(self->_sonic); + self->_sonic = nil; + } + if (self->_buffer) { + av_buffer_unref(&self->_buffer); + self->_buffer = nil; + } +} + +- (BOOL)open +{ + if (!self->_sonic) { + int format = self->_descriptor.format; + if (format != AV_SAMPLE_FMT_U8 && + format != AV_SAMPLE_FMT_U8P && + format != AV_SAMPLE_FMT_S16 && + format != AV_SAMPLE_FMT_S16P && + format != AV_SAMPLE_FMT_FLT && + format != AV_SAMPLE_FMT_FLTP) { + return NO; + } + int channels = self->_descriptor.numberOfChannels; + int sampleRate = self->_descriptor.sampleRate; + self->_sonic = sonicCreateStream(sampleRate, channels); + sonicSetSpeed(self->_sonic, self->_speed); + sonicSetPitch(self->_sonic, self->_pitch); + sonicSetRate(self->_sonic, self->_rate); + sonicSetRate(self->_sonic, self->_volume); + } + return YES; +} + +- (int)flush +{ + if (!self->_sonic) { + return 0; + } + sonicFlushStream(self->_sonic); + return sonicSamplesAvailable(self->_sonic); +} + +- (int)samplesInput +{ + if (!self->_sonic) { + return 0; + } + return sonicSamplesInput(self->_sonic); +} + +- (int)samplesAvailable +{ + if (!self->_sonic) { + return 0; + } + return sonicSamplesAvailable(self->_sonic); +} + +- (int)write:(uint8_t **)data nb_samples:(int)nb_samples +{ + if (!self->_sonic) { + return 0; + } + void *samples = data[0]; + int planes = self->_descriptor.numberOfPlanes; + if (planes > 1) { + int size = [self->_descriptor linesize:nb_samples] * planes; + if (!self->_buffer || self->_buffer->size < size) { + av_buffer_realloc(&self->_buffer, size); + } + samples = self->_buffer->data; + } + if (planes > 1) { + int bytes = self->_descriptor.bytesPerSample; + for (int i = 0; i < nb_samples; i++) { + for (int j = 0; j < planes; j++) { + memcpy(samples + (i * bytes * planes + j * bytes), + data[j] + (i * bytes), + bytes); + } + } + } + int format = self->_descriptor.format; + if (format == AV_SAMPLE_FMT_U8 || + format == AV_SAMPLE_FMT_U8P) { + sonicWriteUnsignedCharToStream(self->_sonic, samples, nb_samples); + } else if (format == AV_SAMPLE_FMT_S16 || + format == AV_SAMPLE_FMT_S16P) { + sonicWriteShortToStream(self->_sonic, samples, nb_samples); + } else if (format == AV_SAMPLE_FMT_FLT || + format == AV_SAMPLE_FMT_FLTP) { + sonicWriteFloatToStream(self->_sonic, samples, nb_samples); + } + return sonicSamplesAvailable(self->_sonic); +} + +- (int)read:(uint8_t **)data nb_samples:(int)nb_samples +{ + if (!self->_sonic) { + return 0; + } + void *samples = data[0]; + int planes = self->_descriptor.numberOfPlanes; + if (planes > 1) { + int size = [self->_descriptor linesize:nb_samples] * planes; + if (!self->_buffer || self->_buffer->size < size) { + av_buffer_realloc(&self->_buffer, size); + } + samples = self->_buffer->data; + } + int ret = 0; + int format = self->_descriptor.format; + if (format == AV_SAMPLE_FMT_U8 || + format == AV_SAMPLE_FMT_U8P) { + ret = sonicReadUnsignedCharFromStream(self->_sonic, samples, nb_samples); + } else if (format == AV_SAMPLE_FMT_S16 || + format == AV_SAMPLE_FMT_S16P) { + ret = sonicReadShortFromStream(self->_sonic, samples, nb_samples); + } else if (format == AV_SAMPLE_FMT_FLT || + format == AV_SAMPLE_FMT_FLTP) { + ret = sonicReadFloatFromStream(self->_sonic, samples, nb_samples); + } + if (planes > 1) { + int bytes = self->_descriptor.bytesPerSample; + for (int i = 0; i < nb_samples; i++) { + for (int j = 0; j < planes; j++) { + memcpy(data[j] + (i * bytes), + samples + (i * bytes * planes + j * bytes), + bytes); + } + } + } + return ret; +} + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.h b/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.h new file mode 100644 index 00000000..a4f24831 --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.h @@ -0,0 +1,13 @@ +// +// SGVideoProcessor.h +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGProcessor.h" + +@interface SGVideoProcessor : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.m b/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.m new file mode 100644 index 00000000..e41f517e --- /dev/null +++ b/SGPlayer/Classes/Core/SGProcessor/SGVideoProcessor.m @@ -0,0 +1,53 @@ +// +// SGVideoProcessor.m +// SGPlayer +// +// Created by Single on 2019/8/13. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGVideoProcessor.h" + +@interface SGVideoProcessor () + +@property (nonatomic, strong, readonly) SGTrackSelection *selection; + +@end + +@implementation SGVideoProcessor + +- (void)setSelection:(SGTrackSelection *)selection action:(SGTrackSelectionAction)action +{ + self->_selection = [selection copy]; +} + +- (__kindof SGFrame *)putFrame:(__kindof SGFrame *)frame +{ + if (![self->_selection.tracks containsObject:frame.track]) { + [frame unlock]; + return nil; + } + return frame; +} + +- (__kindof SGFrame *)finish +{ + return nil; +} + +- (SGCapacity)capacity +{ + return SGCapacityCreate(); +} + +- (void)flush +{ + +} + +- (void)close +{ + +} + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.h b/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.h new file mode 100644 index 00000000..a304a642 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.h @@ -0,0 +1,18 @@ +// +// SGAudioRenderer.h +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import + +@interface SGAudioRenderer : NSObject + +/** + * + */ +@property (nonatomic) Float64 volume; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.m b/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.m new file mode 100644 index 00000000..12e5dd09 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGAudioRenderer.m @@ -0,0 +1,348 @@ +// +// SGAudioRenderer.m +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGAudioRenderer.h" +#import "SGRenderer+Internal.h" +#import "SGAudioPlayer.h" +#import "SGAudioFrame.h" +#import "SGOptions.h" +#import "SGFFmpeg.h" +#import "SGLock.h" + +@interface SGAudioRenderer () + +{ + struct { + SGRenderableState state; + CMTime renderTime; + CMTime renderDuration; + int bufferCopiedFrames; + int currentFrameCopiedFrames; + } _flags; + SGCapacity _capacity; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) SGClock *clock; +@property (nonatomic, strong, readonly) SGAudioPlayer *player; +@property (nonatomic, strong, readonly) SGAudioFrame *currentFrame; + +@end + +@implementation SGAudioRenderer + +@synthesize rate = _rate; +@synthesize volume = _volume; +@synthesize options = _options; +@synthesize delegate = _delegate; +@synthesize descriptor = _descriptor; + +- (instancetype)init +{ + NSAssert(NO, @"Invalid Function."); + return nil; +} + +- (instancetype)initWithClock:(SGClock *)clock +{ + if (self = [super init]) { + self->_clock = clock; + self->_rate = 1.0; + self->_volume = 1.0; + self->_lock = [[NSLock alloc] init]; + self->_capacity = SGCapacityCreate(); + self->_options = [SGOptions sharedOptions].renderer.copy; + self->_descriptor = [[SGAudioDescriptor alloc] init]; + } + return self; +} + +- (void)dealloc +{ + [self close]; +} + +#pragma mark - Setter & Getter + +- (SGBlock)setState:(SGRenderableState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + self->_flags.state = state; + return ^{ + [self.delegate renderable:self didChangeState:state]; + }; +} + +- (SGRenderableState)state +{ + __block SGRenderableState ret = SGRenderableStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (SGCapacity)capacity +{ + __block SGCapacity ret; + SGLockEXE00(self->_lock, ^{ + ret = self->_capacity; + }); + return ret; +} + +- (void)setRate:(Float64)rate +{ + SGLockCondEXE11(self->_lock, ^BOOL { + return self->_rate != rate; + }, ^SGBlock { + self->_rate = rate; + return nil; + }, ^BOOL(SGBlock block) { + self->_player.rate = rate; + return YES; + }); +} + +- (Float64)rate +{ + __block Float64 ret = 1.0; + SGLockEXE00(self->_lock, ^{ + ret = self->_rate; + }); + return ret; +} + +- (void)setVolume:(Float64)volume +{ + SGLockCondEXE11(self->_lock, ^BOOL { + return self->_volume != volume; + }, ^SGBlock { + self->_volume = volume; + return nil; + }, ^BOOL(SGBlock block) { + self->_player.volume = volume; + return YES; + }); +} + +- (Float64)volume +{ + __block Float64 ret = 1.0f; + SGLockEXE00(self->_lock, ^{ + ret = self->_volume; + }); + return ret; +} + +- (SGAudioDescriptor *)descriptor +{ + __block SGAudioDescriptor *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = self->_descriptor; + }); + return ret; +} + +#pragma mark - Interface + +- (BOOL)open +{ + __block Float64 rate = 1.0; + __block Float64 volume = 1.0; + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStateNone; + }, ^SGBlock { + rate = self->_rate; + volume = self->_volume; + return [self setState:SGRenderableStatePaused]; + }, ^BOOL(SGBlock block) { + block(); + self->_player = [[SGAudioPlayer alloc] init]; + self->_player.delegate = self; + self->_player.volume = volume; + self->_player.rate = rate; + return YES; + }); +} + +- (BOOL)close +{ + return SGLockEXE11(self->_lock, ^SGBlock { + self->_flags.currentFrameCopiedFrames = 0; + self->_flags.bufferCopiedFrames = 0; + self->_flags.renderTime = kCMTimeZero; + self->_flags.renderDuration = kCMTimeZero; + self->_capacity = SGCapacityCreate(); + [self->_currentFrame unlock]; + self->_currentFrame = nil; + return [self setState:SGRenderableStateNone]; + }, ^BOOL(SGBlock block) { + [self->_player pause]; + self->_player = nil; + block(); + return YES; + }); +} + +- (BOOL)pause +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStateRendering || self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + return [self setState:SGRenderableStatePaused]; + }, ^BOOL(SGBlock block) { + [self->_player pause]; + block(); + return YES; + }); +} + +- (BOOL)resume +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStatePaused || self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + return [self setState:SGRenderableStateRendering]; + }, ^BOOL(SGBlock block) { + [self->_player play]; + block(); + return YES; + }); +} + +- (BOOL)flush +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStatePaused || self->_flags.state == SGRenderableStateRendering || self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + [self->_currentFrame unlock]; + self->_currentFrame = nil; + self->_flags.currentFrameCopiedFrames = 0; + self->_flags.bufferCopiedFrames = 0; + self->_flags.renderTime = kCMTimeZero; + self->_flags.renderDuration = kCMTimeZero; + return ^{}; + }, ^BOOL(SGBlock block) { + [self->_player flush]; + block(); + return YES; + }); +} + +- (BOOL)finish +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStateRendering || self->_flags.state == SGRenderableStatePaused; + }, ^SGBlock { + return [self setState:SGRenderableStateFinished]; + }, ^BOOL(SGBlock block) { + [self->_player pause]; + block(); + return YES; + }); +} + + +#pragma mark - SGAudioPlayerDelegate + +- (void)audioPlayer:(SGAudioPlayer *)player render:(const AudioTimeStamp *)timeStamp data:(AudioBufferList *)data numberOfFrames:(UInt32)numberOfFrames +{ + [self->_lock lock]; + self->_flags.bufferCopiedFrames = 0; + self->_flags.renderTime = kCMTimeZero; + self->_flags.renderDuration = kCMTimeZero; + if (self->_flags.state != SGRenderableStateRendering) { + [self->_lock unlock]; + return; + } + UInt32 bufferLeftFrames = numberOfFrames; + while (YES) { + if (bufferLeftFrames <= 0) { + [self->_lock unlock]; + break; + } + if (!self->_currentFrame) { + [self->_lock unlock]; + SGAudioFrame *frame = [self.delegate renderable:self fetchFrame:nil]; + if (!frame) { + break; + } + [self->_lock lock]; + self->_currentFrame = frame; + } + SGAudioDescriptor *descriptor = self->_currentFrame.descriptor; + NSAssert(descriptor.format == AV_SAMPLE_FMT_FLTP, @"Invaild audio frame format."); + UInt32 currentFrameLeftFrames = self->_currentFrame.numberOfSamples - self->_flags.currentFrameCopiedFrames; + UInt32 framesToCopy = MIN(bufferLeftFrames, currentFrameLeftFrames); + UInt32 sizeToCopy = framesToCopy * (UInt32)sizeof(float); + UInt32 bufferOffset = self->_flags.bufferCopiedFrames * (UInt32)sizeof(float); + UInt32 currentFrameOffset = self->_flags.currentFrameCopiedFrames * (UInt32)sizeof(float); + for (int i = 0; i < data->mNumberBuffers && i < descriptor.numberOfChannels; i++) { + memcpy(data->mBuffers[i].mData + bufferOffset, self->_currentFrame.data[i] + currentFrameOffset, sizeToCopy); + } + if (self->_flags.bufferCopiedFrames == 0) { + CMTime duration = CMTimeMultiplyByRatio(self->_currentFrame.duration, self->_flags.currentFrameCopiedFrames, self->_currentFrame.numberOfSamples); + self->_flags.renderTime = CMTimeAdd(self->_currentFrame.timeStamp, duration); + } + CMTime duration = CMTimeMultiplyByRatio(self->_currentFrame.duration, framesToCopy, self->_currentFrame.numberOfSamples); + self->_flags.renderDuration = CMTimeAdd(self->_flags.renderDuration, duration); + self->_flags.bufferCopiedFrames += framesToCopy; + self->_flags.currentFrameCopiedFrames += framesToCopy; + if (self->_currentFrame.numberOfSamples <= self->_flags.currentFrameCopiedFrames) { + [self->_currentFrame unlock]; + self->_currentFrame = nil; + self->_flags.currentFrameCopiedFrames = 0; + } + bufferLeftFrames -= framesToCopy; + } + UInt32 framesCopied = numberOfFrames - bufferLeftFrames; + UInt32 sizeCopied = framesCopied * (UInt32)sizeof(float); + for (int i = 0; i < data->mNumberBuffers; i++) { + UInt32 sizeLeft = data->mBuffers[i].mDataByteSize - sizeCopied; + if (sizeLeft > 0) { + memset(data->mBuffers[i].mData + sizeCopied, 0, sizeLeft); + } + } +} + +- (void)audioPlayer:(SGAudioPlayer *)player didRender:(const AudioTimeStamp *)timestamp +{ + [self->_lock lock]; + CMTime renderTime = self->_flags.renderTime; + CMTime renderDuration = CMTimeMultiplyByFloat64(self->_flags.renderDuration, self->_rate); + CMTime frameDuration = !self->_currentFrame ? kCMTimeZero : CMTimeMultiplyByRatio(self->_currentFrame.duration, self->_currentFrame.numberOfSamples - self->_flags.currentFrameCopiedFrames, self->_currentFrame.numberOfSamples); + SGBlock clockBlock = ^{}; + if (self->_flags.state == SGRenderableStateRendering) { + if (self->_flags.bufferCopiedFrames) { + clockBlock = ^{ + [self->_clock setAudioTime:renderTime running:YES]; + }; + } else { + clockBlock = ^{ + [self->_clock setAudioTime:kCMTimeInvalid running:NO]; + }; + } + } + SGCapacity capacity = SGCapacityCreate(); + capacity.duration = CMTimeAdd(renderDuration, frameDuration); + SGBlock capacityBlock = ^{}; + if (!SGCapacityIsEqual(self->_capacity, capacity)) { + self->_capacity = capacity; + capacityBlock = ^{ + [self.delegate renderable:self didChangeCapacity:capacity]; + }; + } + [self->_lock unlock]; + clockBlock(); + capacityBlock(); +} + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGClock+Internal.h b/SGPlayer/Classes/Core/SGRenderer/SGClock+Internal.h new file mode 100644 index 00000000..2d6a5cd8 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGClock+Internal.h @@ -0,0 +1,75 @@ +// +// SGRenderer+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/11/1. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGClock.h" +#import "SGDefines.h" + +@protocol SGClockDelegate; + +@interface SGClock () + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic) Float64 rate; + +/** + * + */ +@property (nonatomic, readonly) CMTime currentTime; + +/** + * + */ +- (void)setAudioTime:(CMTime)time running:(BOOL)running; + +/** + * + */ +- (void)setVideoTime:(CMTime)time; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)pause; + +/** + * + */ +- (BOOL)resume; + +/** + * + */ +- (BOOL)flush; + +@end + +@protocol SGClockDelegate + +/** + * + */ +- (void)clock:(SGClock *)clock didChcnageCurrentTime:(CMTime)currentTime; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGClock.h b/SGPlayer/Classes/Core/SGRenderer/SGClock.h new file mode 100644 index 00000000..e913d1d7 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGClock.h @@ -0,0 +1,13 @@ +// +// SGClock.h +// SGPlayer +// +// Created by Single on 2018/6/14. +// Copyright © 2018 single. All rights reserved. +// + +#import + +@interface SGClock : NSObject + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGClock.m b/SGPlayer/Classes/Core/SGRenderer/SGClock.m new file mode 100644 index 00000000..e328810b --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGClock.m @@ -0,0 +1,170 @@ +// +// SGClock.m +// SGPlayer +// +// Created by Single on 2018/6/14. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGClock.h" +#import "SGClock+Internal.h" +#import "SGLock.h" +#import "SGTime.h" + +@interface SGClock () + +{ + BOOL _audioRunning; + BOOL _videoRunning; + CMClockRef _masterClock; + CMTimebaseRef _audioTimebase; + CMTimebaseRef _videoTimebase; + CMTimebaseRef _playbackTimebase; +} + +@property (nonatomic, strong, readonly) NSLock *lock; + +@end + +@implementation SGClock + +@synthesize rate = _rate; + +- (instancetype)init +{ + if (self = [super init]) { + self->_rate = 1.0; + self->_lock = [[NSLock alloc] init]; + self->_masterClock = CMClockGetHostTimeClock(); + } + return self; +} + +- (void)setRate:(Float64)rate +{ + SGLockEXE00(self->_lock, ^{ + self->_rate = rate; + }); +} + +- (Float64)rate +{ + __block Float64 ret = 1.0; + SGLockEXE00(self->_lock, ^{ + ret = self->_rate; + }); + return ret; +} + +- (CMTime)currentTime +{ + __block CMTime ret = kCMTimeZero; + SGLockEXE00(self->_lock, ^{ + if (self->_audioRunning) { + ret = CMTimebaseGetTime(self->_audioTimebase); + } else { + ret = CMTimebaseGetTime(self->_videoTimebase); + } + }); + return ret; +} + +- (void)setAudioTime:(CMTime)time running:(BOOL)running +{ + SGLockEXE00(self->_lock, ^{ + if (CMTIME_IS_NUMERIC(time)) { + if (self->_audioRunning != running || self->_videoRunning == NO) { + self->_audioRunning = running; + self->_videoRunning = YES; + CMTime playbackTime = CMTimebaseGetTime(self->_playbackTimebase); + CMTimebaseSetRateAndAnchorTime(self->_videoTimebase, 1.0, time, playbackTime); + CMTimebaseSetRateAndAnchorTime(self->_audioTimebase, running ? 1.0 : 0.0, time, playbackTime); + } else { + CMTimebaseSetTime(self->_audioTimebase, time); + CMTimebaseSetTime(self->_videoTimebase, time); + } + [self.delegate clock:self didChcnageCurrentTime:time]; + } else if (self->_audioRunning != running) { + self->_audioRunning = running; + CMTimebaseSetRate(self->_audioTimebase, running ? 1.0 : 0.0); + } + }); +} + +- (void)setVideoTime:(CMTime)time +{ + SGLockCondEXE00(self->_lock, ^BOOL{ + return self->_audioRunning == NO && CMTIME_IS_NUMERIC(time); + }, ^{ + if (self->_videoRunning == NO) { + self->_videoRunning = YES; + CMTimebaseSetTime(self->_videoTimebase, time); + CMTimebaseSetRate(self->_videoTimebase, 1.0); + } + [self.delegate clock:self didChcnageCurrentTime:time]; + }); +} + +- (BOOL)open +{ + return SGLockCondEXE00(self->_lock, ^BOOL{ + return self->_audioTimebase == NULL; + }, ^{ + CMTimebaseCreateWithMasterClock(NULL, self->_masterClock, &self->_playbackTimebase); + CMTimebaseSetRateAndAnchorTime(self->_playbackTimebase, 0.0, kCMTimeZero, CMClockGetTime(self->_masterClock)); + CMTimebaseCreateWithMasterTimebase(NULL, self->_playbackTimebase, &self->_audioTimebase); + CMTimebaseCreateWithMasterTimebase(NULL, self->_playbackTimebase, &self->_videoTimebase); + self->_audioRunning = NO; + self->_videoRunning = NO; + CMTime playbackTime = CMTimebaseGetTime(self->_playbackTimebase); + CMTimebaseSetRateAndAnchorTime(self->_audioTimebase, 0.0, kCMTimeZero, playbackTime); + CMTimebaseSetRateAndAnchorTime(self->_videoTimebase, 0.0, kCMTimeZero, playbackTime); + }); +} + +- (BOOL)close +{ + return SGLockEXE00(self->_lock, ^{ + self->_audioRunning = NO; + self->_videoRunning = NO; + if (self->_audioTimebase) { + CFRelease(self->_audioTimebase); + self->_audioTimebase = NULL; + } + if (self->_videoTimebase) { + CFRelease(self->_videoTimebase); + self->_videoTimebase = NULL; + } + if (self->_playbackTimebase) { + CFRelease(self->_playbackTimebase); + self->_playbackTimebase = NULL; + } + }); +} + +- (BOOL)pause +{ + return SGLockEXE00(self->_lock, ^{ + CMTimebaseSetRate(self->_playbackTimebase, 0.0); + }); +} + +- (BOOL)resume +{ + return SGLockEXE00(self->_lock, ^{ + CMTimebaseSetRate(self->_playbackTimebase, self->_rate); + }); +} + +- (BOOL)flush +{ + return SGLockEXE00(self->_lock, ^{ + self->_audioRunning = NO; + self->_videoRunning = NO; + CMTime playbackTime = CMTimebaseGetTime(self->_playbackTimebase); + CMTimebaseSetRateAndAnchorTime(self->_audioTimebase, 0.0, kCMTimeZero, playbackTime); + CMTimebaseSetRateAndAnchorTime(self->_videoTimebase, 0.0, kCMTimeZero, playbackTime); + }); +} + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.h b/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.h new file mode 100644 index 00000000..34f1b94b --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.h @@ -0,0 +1,21 @@ +// +// SGRenderTimer.h +// SGPlayer +// +// Created by Single on 2019/6/28. +// Copyright © 2019 single. All rights reserved. +// + +#import + +@interface SGRenderTimer : NSObject + +- (instancetype)initWithHandler:(dispatch_block_t)handler; + +@property (nonatomic) NSTimeInterval timeInterval; +@property (nonatomic) BOOL paused; + +- (void)start; +- (void)stop; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.m b/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.m new file mode 100644 index 00000000..a8ecac6d --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGRenderTimer.m @@ -0,0 +1,83 @@ +// +// SGRenderTimer.m +// SGPlayer +// +// Created by Single on 2019/6/28. +// Copyright © 2019 single. All rights reserved. +// + +#import "SGRenderTimer.h" + +@interface SGRenderTimer () + +@property (nonatomic, copy) dispatch_block_t handler; +@property (nonatomic, strong) NSTimer *timer; + +@end + +@implementation SGRenderTimer + +- (instancetype)initWithHandler:(dispatch_block_t)handler +{ + if (self = [super init]) { + self.handler = handler; + } + return self; +} + +- (void)dealloc +{ + [self stop]; +} + +- (void)timerHandler +{ + if (self.handler) { + self.handler(); + } +} + +- (void)setTimeInterval:(NSTimeInterval)timeInterval +{ + if (self->_timeInterval != timeInterval) { + self->_timeInterval = timeInterval; + [self start]; + } +} + +- (void)setPaused:(BOOL)paused +{ + if (self->_paused != paused) { + self->_paused = paused; + [self fire]; + } +} + +- (void)start +{ + [self stop]; + self->_timer = [NSTimer timerWithTimeInterval:self->_timeInterval + target:self + selector:@selector(timerHandler) + userInfo:nil + repeats:YES]; + [[NSRunLoop mainRunLoop] addTimer:self->_timer + forMode:NSRunLoopCommonModes]; + [self fire]; +} + +- (void)stop +{ + [self->_timer invalidate]; + self->_timer = nil; +} + +- (void)fire +{ + self->_timer.fireDate = + self->_paused ? + [NSDate distantFuture] : + [NSDate distantPast]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGRenderable.h b/SGPlayer/Classes/Core/SGRenderer/SGRenderable.h new file mode 100644 index 00000000..b67cac9b --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGRenderable.h @@ -0,0 +1,98 @@ +// +// SGRenderable.h +// SGPlayer +// +// Created by Single on 2018/1/19. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGRendererOptions.h" +#import "SGCapacity.h" +#import "SGFrame.h" + +@protocol SGRenderableDelegate; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGRenderableState) { + SGRenderableStateNone = 0, + SGRenderableStateRendering = 1, + SGRenderableStatePaused = 2, + SGRenderableStateFinished = 3, + SGRenderableStateFailed = 4, +}; + +@protocol SGRenderable + +/** + * + */ +@property (nonatomic, strong) SGRendererOptions *options; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, readonly) SGRenderableState state; + +/** + * + */ +- (SGCapacity)capacity; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)pause; + +/** + * + */ +- (BOOL)resume; + +/** + * + */ +- (BOOL)flush; + +/** + * + */ +- (BOOL)finish; + +@end + +@protocol SGRenderableDelegate + +/** + * + */ +- (void)renderable:(id)renderable didChangeState:(SGRenderableState)state; + +/** + * + */ +- (void)renderable:(id)renderable didChangeCapacity:(SGCapacity)capacity; + +/** + * + */ +- (__kindof SGFrame *)renderable:(id)renderable fetchFrame:(SGTimeReader)timeReader; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGRenderer+Internal.h b/SGPlayer/Classes/Core/SGRenderer/SGRenderer+Internal.h new file mode 100644 index 00000000..b04dede3 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGRenderer+Internal.h @@ -0,0 +1,54 @@ +// +// SGRenderer+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/11/1. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGRenderable.h" +#import "SGAudioDescriptor.h" +#import "SGAudioRenderer.h" +#import "SGVideoRenderer.h" +#import "SGClock+Internal.h" + +@class SGAudioFormatter; + +@interface SGAudioRenderer () + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithClock:(SGClock *)clock; + +/** + * + */ +@property (nonatomic) Float64 rate; + +/** + * + */ +@property (nonatomic, copy, readonly) SGAudioDescriptor *descriptor; + +@end + +@interface SGVideoRenderer () + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithClock:(SGClock *)clock; + +/** + * + */ +@property (nonatomic) Float64 rate; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.h b/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.h new file mode 100644 index 00000000..5b660d32 --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.h @@ -0,0 +1,64 @@ +// +// SGVideoRenderer.h +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGVideoFrame.h" +#import "SGVRViewport.h" +#import "SGPLFImage.h" +#import "SGPLFView.h" + +typedef NS_ENUM(NSUInteger, SGDisplayMode) { + SGDisplayModePlane = 0, + SGDisplayModeVR = 1, + SGDisplayModeVRBox = 2, +}; + +typedef NS_ENUM(NSUInteger, SGScalingMode) { + SGScalingModeResize = 0, + SGScalingModeResizeAspect = 1, + SGScalingModeResizeAspectFill = 2, +}; + +@interface SGVideoRenderer : NSObject + +/** + * Main thread only. + */ +@property (nonatomic, strong) SGPLFView *view; + +/** + * Main thread only. + */ +@property (nonatomic, strong, readonly) SGVRViewport *viewport; + +/** + * Main thread only. + */ +@property (nonatomic, copy) void (^frameOutput)(SGVideoFrame *frame); + +/** + * Main thread only. + */ +@property (nonatomic) NSInteger preferredFramesPerSecond; + +/** + * Main thread only. + */ +@property (nonatomic) SGScalingMode scalingMode; + +/** + * Main thread only. + */ +@property (nonatomic) SGDisplayMode displayMode; + +/** + * Main thread only. + */ +- (SGPLFImage *)currentImage; + +@end diff --git a/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.m b/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.m new file mode 100644 index 00000000..5d887ceb --- /dev/null +++ b/SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.m @@ -0,0 +1,590 @@ +// +// SGVideoRenderer.m +// SGPlayer +// +// Created by Single on 2018/1/22. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGVideoRenderer.h" +#import "SGRenderer+Internal.h" +#import "SGVRProjection.h" +#import "SGRenderTimer.h" +#import "SGOptions.h" +#import "SGMapping.h" +#import "SGMetal.h" +#import "SGMacro.h" +#import "SGLock.h" + +@interface SGVideoRenderer () + +{ + struct { + SGRenderableState state; + BOOL hasNewFrame; + NSUInteger framesFetched; + NSUInteger framesDisplayed; + NSTimeInterval currentFrameEndTime; + } _flags; + SGCapacity _capacity; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) SGClock *clock; +@property (nonatomic, strong, readonly) SGRenderTimer *fetchTimer; +@property (nonatomic, strong, readonly) SGVideoFrame *currentFrame; +@property (nonatomic, strong, readonly) SGVRProjection *matrixMaker; + +@property (nonatomic, strong, readonly) MTKView *metalView; +@property (nonatomic, strong, readonly) SGMetalModel *planeModel; +@property (nonatomic, strong, readonly) SGMetalModel *sphereModel; +@property (nonatomic, strong, readonly) SGMetalRenderer *renderer; +@property (nonatomic, strong, readonly) SGMetalProjection *projection1; +@property (nonatomic, strong, readonly) SGMetalProjection *projection2; +@property (nonatomic, strong, readonly) SGMetalRenderPipeline *pipeline; +@property (nonatomic, strong, readonly) SGMetalTextureLoader *textureLoader; +@property (nonatomic, strong, readonly) SGMetalRenderPipelinePool *pipelinePool; + +@end + +@implementation SGVideoRenderer + +@synthesize rate = _rate; +@synthesize options = _options; +@synthesize delegate = _delegate; + +- (instancetype)init +{ + NSAssert(NO, @"Invalid Function."); + return nil; +} + +- (instancetype)initWithClock:(SGClock *)clock +{ + if (self = [super init]) { + self->_clock = clock; + self->_rate = 1.0; + self->_lock = [[NSLock alloc] init]; + self->_capacity = SGCapacityCreate(); + self->_preferredFramesPerSecond = 30; + self->_displayMode = SGDisplayModePlane; + self->_scalingMode = SGScalingModeResizeAspect; + self->_matrixMaker = [[SGVRProjection alloc] init]; + self->_options = [SGOptions sharedOptions].renderer.copy; + } + return self; +} + +- (void)dealloc +{ + [self performSelectorOnMainThread:@selector(destoryDrawingLoop) + withObject:nil + waitUntilDone:YES]; + [self->_currentFrame unlock]; + self->_currentFrame = nil; +} + +#pragma mark - Setter & Getter + +- (SGBlock)setState:(SGRenderableState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + self->_flags.state = state; + return ^{ + [self->_delegate renderable:self didChangeState:state]; + }; +} + +- (SGRenderableState)state +{ + __block SGRenderableState ret = SGRenderableStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (SGCapacity)capacity +{ + __block SGCapacity ret; + SGLockEXE00(self->_lock, ^{ + ret = self->_capacity; + }); + return ret; +} + +- (void)setRate:(Float64)rate +{ + SGLockEXE00(self->_lock, ^{ + self->_rate = rate; + }); +} + +- (Float64)rate +{ + __block Float64 ret = 1.0; + SGLockEXE00(self->_lock, ^{ + ret = self->_rate; + }); + return ret; +} + +- (SGVRViewport *)viewport +{ + return self->_matrixMaker.viewport; +} + +- (SGPLFImage *)currentImage +{ + __block SGPLFImage *ret = nil; + SGLockCondEXE11(self->_lock, ^BOOL { + return self->_currentFrame != nil; + }, ^SGBlock { + SGVideoFrame *frame = self->_currentFrame; + [frame lock]; + return ^{ + ret = [frame image]; + [frame unlock]; + }; + }, ^BOOL(SGBlock block) { + block(); + return YES; + }); + return ret; +} + +#pragma mark - Interface + +- (BOOL)open +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGRenderableStateNone; + }, ^SGBlock { + return [self setState:SGRenderableStatePaused]; + }, ^BOOL(SGBlock block) { + block(); + [self performSelectorOnMainThread:@selector(setupDrawingLoop) + withObject:nil + waitUntilDone:YES]; + return YES; + }); +} + +- (BOOL)close +{ + return SGLockEXE11(self->_lock, ^SGBlock { + SGBlock b1 = [self setState:SGRenderableStateNone]; + [self->_currentFrame unlock]; + self->_currentFrame = nil; + self->_flags.hasNewFrame = NO; + self->_flags.framesFetched = 0; + self->_flags.framesDisplayed = 0; + self->_capacity = SGCapacityCreate(); + return ^{b1();}; + }, ^BOOL(SGBlock block) { + [self performSelectorOnMainThread:@selector(destoryDrawingLoop) + withObject:nil + waitUntilDone:YES]; + block(); + return YES; + }); +} + +- (BOOL)pause +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return + self->_flags.state == SGRenderableStateRendering || + self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + return [self setState:SGRenderableStatePaused]; + }, ^BOOL(SGBlock block) { + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + return YES; + }); +} + +- (BOOL)resume +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return + self->_flags.state == SGRenderableStatePaused || + self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + return [self setState:SGRenderableStateRendering]; + }, ^BOOL(SGBlock block) { + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + return YES; + }); +} + +- (BOOL)flush +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return + self->_flags.state == SGRenderableStatePaused || + self->_flags.state == SGRenderableStateRendering || + self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock { + [self->_currentFrame unlock]; + self->_currentFrame = nil; + self->_flags.hasNewFrame = NO; + self->_flags.framesFetched = 0; + self->_flags.framesDisplayed = 0; + return nil; + }, ^BOOL(SGBlock block) { + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + return YES; + }); +} + +- (BOOL)finish +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return + self->_flags.state == SGRenderableStateRendering || + self->_flags.state == SGRenderableStatePaused; + }, ^SGBlock { + return [self setState:SGRenderableStateFinished]; + }, ^BOOL(SGBlock block) { + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + return YES; + }); +} + +#pragma mark - Fecth + +- (void)fetchTimerHandler +{ + BOOL shouldFetch = NO; + BOOL shouldPause = NO; + [self->_lock lock]; + if (self->_flags.state == SGRenderableStateRendering || + (self->_flags.state == SGRenderableStatePaused && + self->_flags.framesFetched == 0)) { + shouldFetch = YES; + } else if (self->_flags.state != SGRenderableStateRendering) { + shouldPause = YES; + } + [self->_lock unlock]; + if (shouldPause) { + self->_fetchTimer.paused = YES; + } + if (!shouldFetch) { + return; + } + __block NSUInteger framesFetched = 0; + __block NSTimeInterval currentMediaTime = CACurrentMediaTime(); + SGWeakify(self) + SGVideoFrame *newFrame = [self->_delegate renderable:self fetchFrame:^BOOL(CMTime *desire, BOOL *drop) { + SGStrongify(self) + return SGLockCondEXE10(self->_lock, ^BOOL { + framesFetched = self->_flags.framesFetched; + return self->_currentFrame && framesFetched != 0; + }, ^SGBlock { + return ^{ + currentMediaTime = CACurrentMediaTime(); + *desire = self->_clock.currentTime; + *drop = YES; + }; + }); + }]; + SGLockCondEXE10(self->_lock, ^BOOL { + return !newFrame || framesFetched == self->_flags.framesFetched; + }, ^SGBlock { + SGBlock b1 = ^{}, b2 = ^{}, b3 = ^{}; + SGCapacity capacity = SGCapacityCreate(); + if (newFrame) { + [newFrame lock]; + CMTime time = newFrame.timeStamp; + CMTime duration = CMTimeMultiplyByFloat64(newFrame.duration, self->_rate); + capacity.duration = duration; + [self->_currentFrame unlock]; + self->_currentFrame = newFrame; + self->_flags.hasNewFrame = YES; + self->_flags.framesFetched += 1; + self->_flags.currentFrameEndTime = currentMediaTime + CMTimeGetSeconds(duration); + if (self->_frameOutput) { + [newFrame lock]; + b1 = ^{ + self->_frameOutput(newFrame); + [newFrame unlock]; + }; + } + b2 = ^{ + [self->_clock setVideoTime:time]; + }; + } else if (currentMediaTime < self->_flags.currentFrameEndTime) { + capacity.duration = SGCMTimeMakeWithSeconds(self->_flags.currentFrameEndTime - currentMediaTime); + } + if (!SGCapacityIsEqual(self->_capacity, capacity)) { + self->_capacity = capacity; + b3 = ^{ + [self->_delegate renderable:self didChangeCapacity:capacity]; + }; + } + return ^{b1(); b2(); b3();}; + }); + [newFrame unlock]; +} + +#pragma mark - MTKViewDelegate + +- (void)drawInMTKView:(MTKView *)view +{ + [self->_lock lock]; + SGVideoFrame *frame = self->_currentFrame; + NSUInteger width = frame.descriptor.width; + NSUInteger height = frame.descriptor.height; + if (!frame || width == 0 || height == 0) { + [self->_lock unlock]; + return; + } + BOOL shouldDraw = NO; + if (self->_flags.hasNewFrame || + self->_flags.framesDisplayed == 0 || + (self->_displayMode == SGDisplayModeVR || + self->_displayMode == SGDisplayModeVRBox)) { + shouldDraw = YES; + } + if (!shouldDraw) { + BOOL shouldPause = self->_flags.state != SGRenderableStateRendering; + [self->_lock unlock]; + if (shouldPause) { + self->_metalView.paused = YES; + } + return; + } + NSUInteger framesFetched = self->_flags.framesFetched; + [frame lock]; + [self->_lock unlock]; + SGDisplayMode displayMode = self->_displayMode; + SGMetalModel *model = displayMode == SGDisplayModePlane ? self->_planeModel : self->_sphereModel; + SGMetalRenderPipeline *pipeline = [self->_pipelinePool pipelineWithCVPixelFormat:frame.descriptor.cv_format]; + if (!model || !pipeline) { + [frame unlock]; + return; + } + GLKMatrix4 baseMatrix = GLKMatrix4Identity; + NSInteger rotate = [frame.metadata[@"rotate"] integerValue]; + if (rotate && (rotate % 90) == 0) { + float radians = GLKMathDegreesToRadians(-rotate); + baseMatrix = GLKMatrix4RotateZ(baseMatrix, radians); + width = frame.descriptor.width * ABS(cos(radians)) + frame.descriptor.height * ABS(sin(radians)); + height = frame.descriptor.width * ABS(sin(radians)) + frame.descriptor.height * ABS(cos(radians)); + } + NSArray> *textures = nil; + if (frame.pixelBuffer) { + textures = [self->_textureLoader texturesWithCVPixelBuffer:frame.pixelBuffer]; + } else { + textures = [self->_textureLoader texturesWithCVPixelFormat:frame.descriptor.cv_format + width:frame.descriptor.width + height:frame.descriptor.height + bytes:(void **)frame.data + bytesPerRow:frame.linesize]; + } + [frame unlock]; + if (!textures.count) { + return; + } + MTLViewport viewports[2] = {}; + NSArray *projections = nil; + id drawable = [(CAMetalLayer *)self->_metalView.layer nextDrawable]; + MTLSize textureSize = MTLSizeMake(width, height, 0); + MTLSize layerSize = MTLSizeMake(drawable.texture.width, drawable.texture.height, 0); + switch (displayMode) { + case SGDisplayModePlane: { + self->_projection1.matrix = baseMatrix; + projections = @[self->_projection1]; + viewports[0] = [SGMetalViewport viewportWithLayerSize:layerSize textureSize:textureSize mode:SGScaling2Viewport(self->_scalingMode)]; + } + break; + case SGDisplayModeVR: { + GLKMatrix4 matrix = GLKMatrix4Identity; + Float64 aspect = (Float64)drawable.texture.width / drawable.texture.height; + if (![self->_matrixMaker matrixWithAspect:aspect matrix1:&matrix]) { + break; + } + self->_projection1.matrix = GLKMatrix4Multiply(baseMatrix, matrix); + projections = @[self->_projection1]; + viewports[0] = [SGMetalViewport viewportWithLayerSize:layerSize]; + } + break; + case SGDisplayModeVRBox: { + GLKMatrix4 matrix1 = GLKMatrix4Identity; + GLKMatrix4 matrix2 = GLKMatrix4Identity; + Float64 aspect = (Float64)drawable.texture.width / drawable.texture.height / 2.0; + if (![self->_matrixMaker matrixWithAspect:aspect matrix1:&matrix1 matrix2:&matrix2]) { + break; + } + self->_projection1.matrix = GLKMatrix4Multiply(baseMatrix, matrix1); + self->_projection2.matrix = GLKMatrix4Multiply(baseMatrix, matrix2); + projections = @[self->_projection1, self->_projection2]; + viewports[0] = [SGMetalViewport viewportWithLayerSizeForLeft:layerSize]; + viewports[1] = [SGMetalViewport viewportWithLayerSizeForRight:layerSize]; + } + break; + } + if (projections.count) { + id commandBuffer = [self.renderer drawModel:model + viewports:viewports + pipeline:pipeline + projections:projections + inputTextures:textures + outputTexture:drawable.texture]; + [commandBuffer presentDrawable:drawable]; + [commandBuffer commit]; + [self->_lock lock]; + if (self->_flags.framesFetched == framesFetched) { + self->_flags.framesDisplayed += 1; + self->_flags.hasNewFrame = NO; + } + [self->_lock unlock]; + } +} + +- (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size +{ + SGLockCondEXE10(self->_lock, ^BOOL{ + return + self->_flags.state == SGRenderableStateRendering || + self->_flags.state == SGRenderableStatePaused || + self->_flags.state == SGRenderableStateFinished; + }, ^SGBlock{ + self->_flags.framesDisplayed = 0; + return ^{ + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + }; + }); +} + +#pragma mark - Metal + +- (void)setupDrawingLoop +{ + id device = MTLCreateSystemDefaultDevice(); + self->_renderer = [[SGMetalRenderer alloc] initWithDevice:device]; + self->_planeModel = [[SGMetalPlaneModel alloc] initWithDevice:device]; + self->_projection1 = [[SGMetalProjection alloc] initWithDevice:device]; + self->_projection2 = [[SGMetalProjection alloc] initWithDevice:device]; + self->_sphereModel = [[SGMetalSphereModel alloc] initWithDevice:device]; + self->_textureLoader = [[SGMetalTextureLoader alloc] initWithDevice:device]; + self->_pipelinePool = [[SGMetalRenderPipelinePool alloc] initWithDevice:device]; + self->_metalView = [[MTKView alloc] initWithFrame:CGRectZero device:device]; + self->_metalView.preferredFramesPerSecond = self->_preferredFramesPerSecond; + self->_metalView.translatesAutoresizingMaskIntoConstraints = NO; + self->_metalView.colorPixelFormat = MTLPixelFormatBGRA8Unorm; + self->_metalView.delegate = self; + SGWeakify(self) + self->_fetchTimer = [[SGRenderTimer alloc] initWithHandler:^{ + SGStrongify(self) + [self fetchTimerHandler]; + }]; + [self updateMetalView]; + [self updateTimeInterval]; +} + +- (void)destoryDrawingLoop +{ + [self->_fetchTimer stop]; + self->_fetchTimer = nil; + [self->_metalView removeFromSuperview]; + self->_metalView = nil; + self->_renderer = nil; + self->_planeModel = nil; + self->_sphereModel = nil; + self->_projection1 = nil; + self->_projection2 = nil; + self->_pipelinePool = nil; + self->_textureLoader = nil; +} + +- (void)setView:(SGPLFView *)view +{ + if (self->_view != view) { + self->_view = view; + [self updateMetalView]; + } +} + +- (void)setPreferredFramesPerSecond:(NSInteger)preferredFramesPerSecond +{ + if (self->_preferredFramesPerSecond != preferredFramesPerSecond) { + self->_preferredFramesPerSecond = preferredFramesPerSecond; + [self updateTimeInterval]; + } +} + +- (void)setDisplayMode:(SGDisplayMode)displayMode +{ + if (self->_displayMode != displayMode) { + self->_displayMode = displayMode; + SGLockCondEXE10(self->_lock, ^BOOL{ + return + self->_displayMode != SGDisplayModePlane && + (self->_flags.state == SGRenderableStateRendering || + self->_flags.state == SGRenderableStatePaused || + self->_flags.state == SGRenderableStateFinished); + }, ^SGBlock{ + return ^{ + self->_metalView.paused = NO; + self->_fetchTimer.paused = NO; + }; + }); + } +} + +- (void)updateMetalView +{ + if (self->_view && + self->_metalView && + self->_metalView.superview != self->_view) { + SGPLFViewInsertSubview(self->_view, self->_metalView, 0); + NSLayoutConstraint *c1 = [NSLayoutConstraint constraintWithItem:self->_metalView + attribute:NSLayoutAttributeTop + relatedBy:NSLayoutRelationEqual + toItem:self->_view + attribute:NSLayoutAttributeTop + multiplier:1.0 + constant:0.0]; + NSLayoutConstraint *c2 = [NSLayoutConstraint constraintWithItem:self->_metalView + attribute:NSLayoutAttributeLeft + relatedBy:NSLayoutRelationEqual + toItem:self->_view + attribute:NSLayoutAttributeLeft + multiplier:1.0 + constant:0.0]; + NSLayoutConstraint *c3 = [NSLayoutConstraint constraintWithItem:self->_metalView + attribute:NSLayoutAttributeBottom + relatedBy:NSLayoutRelationEqual + toItem:self->_view + attribute:NSLayoutAttributeBottom + multiplier:1.0 + constant:0.0]; + NSLayoutConstraint *c4 = [NSLayoutConstraint constraintWithItem:self->_metalView + attribute:NSLayoutAttributeRight + relatedBy:NSLayoutRelationEqual + toItem:self->_view + attribute:NSLayoutAttributeRight + multiplier:1.0 + constant:0.0]; + [self->_view addConstraints:@[c1, c2, c3, c4]]; + } else { + [self->_metalView removeFromSuperview]; + } +} + +- (void)updateTimeInterval +{ + self->_fetchTimer.timeInterval = 0.5 / self->_preferredFramesPerSecond; + self->_metalView.preferredFramesPerSecond = self->_preferredFramesPerSecond; +} + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGFrameOutput.h b/SGPlayer/Classes/Core/SGSession/SGFrameOutput.h new file mode 100644 index 00000000..ae29dec6 --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGFrameOutput.h @@ -0,0 +1,151 @@ +// +// SGFrameOutput.h +// SGPlayer iOS +// +// Created by Single on 2018/10/22. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import "SGDemuxerOptions.h" +#import "SGDecoderOptions.h" +#import "SGCapacity.h" +#import "SGAsset.h" +#import "SGFrame.h" + +@protocol SGFrameOutputDelegate; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGFrameOutputState) { + SGFrameOutputStateNone = 0, + SGFrameOutputStateOpening = 1, + SGFrameOutputStateOpened = 2, + SGFrameOutputStateReading = 3, + SGFrameOutputStateSeeking = 4, + SGFrameOutputStateFinished = 5, + SGFrameOutputStateClosed = 6, + SGFrameOutputStateFailed = 7, +}; + +@interface SGFrameOutput : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithAsset:(SGAsset *)asset; + +/** + * + */ +@property (nonatomic, copy) SGDemuxerOptions *demuxerOptions; + +/** + * + */ +@property (nonatomic, copy) SGDecoderOptions *decoderOptions; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, readonly) SGFrameOutputState state; + +/** + * + */ +@property (nonatomic, copy, readonly) NSError *error; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)start; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)pause:(SGMediaType)type; + +/** + * + */ +- (BOOL)resume:(SGMediaType)type; + +/** + * + */ +- (BOOL)seekable; + +/** + * + */ +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result; + +/** + * + */ +- (BOOL)selectTracks:(NSArray *)tracks; + +/** + * + */ +- (NSArray *)selectedTracks; + +/** + * + */ +- (SGCapacity)capacityWithType:(SGMediaType)type; + +@end + +@protocol SGFrameOutputDelegate + +/** + * + */ +- (void)frameOutput:(SGFrameOutput *)frameOutput didChangeState:(SGFrameOutputState)state; + +/** + * + */ +- (void)frameOutput:(SGFrameOutput *)frameOutput didChangeCapacity:(SGCapacity)capacity type:(SGMediaType)type; + +/** + * + */ +- (void)frameOutput:(SGFrameOutput *)frameOutput didOutputFrame:(__kindof SGFrame *)frame; + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGFrameOutput.m b/SGPlayer/Classes/Core/SGSession/SGFrameOutput.m new file mode 100644 index 00000000..9158c5b1 --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGFrameOutput.m @@ -0,0 +1,371 @@ +// +// SGFrameOutput.m +// SGPlayer iOS +// +// Created by Single on 2018/10/22. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGFrameOutput.h" +#import "SGAudioDecoder.h" +#import "SGVideoDecoder.h" +#import "SGPacketOutput.h" +#import "SGDecodeLoop.h" +#import "SGMacro.h" +#import "SGLock.h" + +@interface SGFrameOutput () + +{ + struct { + NSError *error; + SGFrameOutputState state; + } _flags; + BOOL _capacityFlags[8]; + SGCapacity _capacities[8]; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) SGDecodeLoop *audioDecoder; +@property (nonatomic, strong, readonly) SGDecodeLoop *videoDecoder; +@property (nonatomic, strong, readonly) SGPacketOutput *packetOutput; +@property (nonatomic, strong, readonly) NSArray *selectedTracks; +@property (nonatomic, strong, readonly) NSArray *finishedTracks; + +@end + +@implementation SGFrameOutput + +@synthesize selectedTracks = _selectedTracks; +@synthesize finishedTracks = _finishedTracks; + +- (instancetype)initWithAsset:(SGAsset *)asset +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_audioDecoder = [[SGDecodeLoop alloc] initWithDecodableClass:[SGAudioDecoder class]]; + self->_audioDecoder.delegate = self; + self->_videoDecoder = [[SGDecodeLoop alloc] initWithDecodableClass:[SGVideoDecoder class]]; + self->_videoDecoder.delegate = self; + self->_packetOutput = [[SGPacketOutput alloc] initWithAsset:asset]; + self->_packetOutput.delegate = self; + for (int i = 0; i < 8; i++) { + self->_capacityFlags[i] = NO; + self->_capacities[i] = SGCapacityCreate(); + } + } + return self; +} + +- (void)dealloc +{ + SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGFrameOutputStateClosed; + }, ^SGBlock { + [self setState:SGFrameOutputStateClosed]; + [self->_packetOutput close]; + [self->_audioDecoder close]; + [self->_videoDecoder close]; + return nil; + }); +} + +#pragma mark - Mapping + +SGGet0Map(CMTime, duration, self->_packetOutput) +SGGet0Map(NSDictionary *, metadata, self->_packetOutput) +SGGet0Map(NSArray *, tracks, self->_packetOutput) +SGGet0Map(SGDemuxerOptions *, demuxerOptions, self->_packetOutput) +SGSet1Map(void, setDemuxerOptions, SGDemuxerOptions *, self->_packetOutput) +SGGet00Map(SGDecoderOptions *, decoderOptions, options, self->_audioDecoder) + +#pragma mark - Setter & Getter + +- (void)setDecoderOptions:(SGDecoderOptions *)decoderOptions +{ + self->_audioDecoder.options = decoderOptions; + self->_videoDecoder.options = decoderOptions; +} + +- (SGBlock)setState:(SGFrameOutputState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + self->_flags.state = state; + return ^{ + [self->_delegate frameOutput:self didChangeState:state]; + }; +} + +- (SGFrameOutputState)state +{ + __block SGFrameOutputState ret = SGFrameOutputStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (NSError *)error +{ + __block NSError *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = [self->_flags.error copy]; + }); + return ret; +} + +- (BOOL)selectTracks:(NSArray *)tracks +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return ![self->_selectedTracks isEqualToArray:tracks]; + }, ^SGBlock { + self->_selectedTracks = [tracks copy]; + return nil; + }); +} + +- (NSArray *)selectedTracks +{ + __block NSArray *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = [self->_selectedTracks copy]; + }); + return ret; +} + +- (NSArray *)finishedTracks +{ + __block NSArray *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = [self->_finishedTracks copy]; + }); + return ret; +} + +- (SGCapacity)capacityWithType:(SGMediaType)type +{ + __block SGCapacity ret; + SGLockEXE00(self->_lock, ^{ + ret = self->_capacities[type]; + }); + return ret; +} + +#pragma mark - Control + +- (BOOL)open +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGFrameOutputStateNone; + }, ^SGBlock { + return [self setState:SGFrameOutputStateOpening]; + }, ^BOOL(SGBlock block) { + block(); + return [self->_packetOutput open]; + }); +} + +- (BOOL)start +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGFrameOutputStateOpened; + }, ^SGBlock { + return [self setState:SGFrameOutputStateReading]; + }, ^BOOL(SGBlock block) { + block(); + return [self->_packetOutput resume]; + }); +} + +- (BOOL)close +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state != SGFrameOutputStateClosed; + }, ^SGBlock { + return [self setState:SGFrameOutputStateClosed]; + }, ^BOOL(SGBlock block) { + block(); + [self->_packetOutput close]; + [self->_audioDecoder close]; + [self->_videoDecoder close]; + return YES; + }); +} + +- (BOOL)pause:(SGMediaType)type +{ + return SGLockEXE00(self->_lock, ^{ + if (type == SGMediaTypeAudio) { + [self->_audioDecoder pause]; + } else if (type == SGMediaTypeVideo) { + [self->_videoDecoder pause]; + } + }); +} + +- (BOOL)resume:(SGMediaType)type +{ + return SGLockEXE00(self->_lock, ^{ + if (type == SGMediaTypeAudio) { + [self->_audioDecoder resume]; + } else if (type == SGMediaTypeVideo) { + [self->_videoDecoder resume]; + } + }); +} + +- (BOOL)seekable +{ + return [self->_packetOutput seekable]; +} + +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result +{ + SGWeakify(self) + return [self->_packetOutput seekToTime:time result:^(CMTime time, NSError *error) { + SGStrongify(self) + if (!error) { + [self->_audioDecoder flush]; + [self->_videoDecoder flush]; + } + if (result) { + result(time, error); + } + }]; +} + +#pragma mark - SGPacketOutputDelegate + +- (void)packetOutput:(SGPacketOutput *)packetOutput didChangeState:(SGPacketOutputState)state +{ + SGLockEXE10(self->_lock, ^SGBlock { + SGBlock b1 = ^{}, b2 = ^{}, b3 = ^{}; + switch (state) { + case SGPacketOutputStateOpened: { + b1 = [self setState:SGFrameOutputStateOpened]; + int nb_a = 0, nb_v = 0; + NSMutableArray *tracks = [NSMutableArray array]; + for (SGTrack *obj in packetOutput.tracks) { + if (obj.type == SGMediaTypeAudio && nb_a == 0) { + [tracks addObject:obj]; + nb_a += 1; + } else if (obj.type == SGMediaTypeVideo && nb_v == 0) { + [tracks addObject:obj]; + nb_v += 1; + } + if (nb_a && nb_v) { + break; + } + } + self->_selectedTracks = [tracks copy]; + if (nb_a) { + [self->_audioDecoder open]; + } + if (nb_v) { + [self->_videoDecoder open]; + } + } + break; + case SGPacketOutputStateReading: + b1 = [self setState:SGFrameOutputStateReading]; + break; + case SGPacketOutputStateSeeking: + b1 = [self setState:SGFrameOutputStateSeeking]; + break; + case SGPacketOutputStateFinished: { + NSArray *tracks = self->_selectedTracks; + b1 = ^{ + [self->_audioDecoder finish:tracks]; + [self->_videoDecoder finish:tracks]; + }; + } + break; + case SGPacketOutputStateFailed: + self->_flags.error = [packetOutput.error copy]; + b1 = [self setState:SGFrameOutputStateFailed]; + break; + default: + break; + } + return ^{ + b1(); b2(); b3(); + }; + }); +} + +- (void)packetOutput:(SGPacketOutput *)packetOutput didOutputPacket:(SGPacket *)packet +{ + SGLockEXE10(self->_lock, ^SGBlock { + SGBlock b1 = ^{}; + if ([self->_selectedTracks containsObject:packet.track]) { + SGDecodeLoop *decoder = nil; + if (packet.track.type == SGMediaTypeAudio) { + decoder = self->_audioDecoder; + } else if (packet.track.type == SGMediaTypeVideo) { + decoder = self->_videoDecoder; + } + b1 = ^{ + [decoder putPacket:packet]; + }; + } + return b1; + }); +} + +#pragma mark - SGDecoderDelegate + +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didChangeState:(SGDecodeLoopState)state +{ + +} + +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didChangeCapacity:(SGCapacity)capacity +{ + __block SGBlock finished = ^{}; + __block SGMediaType type = SGMediaTypeUnknown; + SGLockCondEXE11(self->_lock, ^BOOL { + if (decodeLoop == self->_audioDecoder) { + type = SGMediaTypeAudio; + } else if (decodeLoop == self->_videoDecoder) { + type = SGMediaTypeVideo; + } + return !SGCapacityIsEqual(self->_capacities[type], capacity); + }, ^SGBlock { + self->_capacityFlags[type] = YES; + self->_capacities[type] = capacity; + SGCapacity ac = self->_capacities[SGMediaTypeAudio]; + SGCapacity vc = self->_capacities[SGMediaTypeVideo]; + int size = ac.size + vc.size; + BOOL enough = NO; + if ((!self->_capacityFlags[SGMediaTypeAudio] || SGCapacityIsEnough(ac)) && + (!self->_capacityFlags[SGMediaTypeVideo] || SGCapacityIsEnough(vc))) { + enough = YES; + } + if ((!self->_capacityFlags[SGMediaTypeAudio] || SGCapacityIsEmpty(ac)) && + (!self->_capacityFlags[SGMediaTypeVideo] || SGCapacityIsEmpty(vc)) && + self->_packetOutput.state == SGPacketOutputStateFinished) { + finished = [self setState:SGFrameOutputStateFinished]; + } + return ^{ + if (enough || (size > 15 * 1024 * 1024)) { + [self->_packetOutput pause]; + } else { + [self->_packetOutput resume]; + } + }; + }, ^BOOL(SGBlock block) { + block(); + [self->_delegate frameOutput:self didChangeCapacity:capacity type:type]; + finished(); + return YES; + }); +} + +- (void)decodeLoop:(SGDecodeLoop *)decodeLoop didOutputFrame:(__kindof SGFrame *)frame +{ + [self->_delegate frameOutput:self didOutputFrame:frame]; +} + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGPacketOutput.h b/SGPlayer/Classes/Core/SGSession/SGPacketOutput.h new file mode 100644 index 00000000..d0a24bb1 --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGPacketOutput.h @@ -0,0 +1,120 @@ +// +// SGURLSource.h +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGDemuxerOptions.h" +#import "SGPacket.h" +#import "SGAsset.h" + +@protocol SGPacketOutputDelegate; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGPacketOutputState) { + SGPacketOutputStateNone = 0, + SGPacketOutputStateOpening = 1, + SGPacketOutputStateOpened = 2, + SGPacketOutputStateReading = 3, + SGPacketOutputStatePaused = 4, + SGPacketOutputStateSeeking = 5, + SGPacketOutputStateFinished = 6, + SGPacketOutputStateClosed = 7, + SGPacketOutputStateFailed = 8, +}; + +@interface SGPacketOutput : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithAsset:(SGAsset *)asset; + +/** + * + */ +@property (nonatomic, copy) SGDemuxerOptions *demuxerOptions; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, readonly) SGPacketOutputState state; + +/** + * + */ +@property (nonatomic, copy, readonly) NSError *error; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)pause; + +/** + * + */ +- (BOOL)resume; + +/** + * + */ +- (BOOL)seekable; + +/** + * + */ +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result; + +@end + +@protocol SGPacketOutputDelegate + +/** + * + */ +- (void)packetOutput:(SGPacketOutput *)packetOutput didChangeState:(SGPacketOutputState)state; + +/** + * + */ +- (void)packetOutput:(SGPacketOutput *)packetOutput didOutputPacket:(SGPacket *)packet; + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGPacketOutput.m b/SGPlayer/Classes/Core/SGSession/SGPacketOutput.m new file mode 100644 index 00000000..cb2e5fec --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGPacketOutput.m @@ -0,0 +1,294 @@ +// +// SGURLSource.m +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGPacketOutput.h" +#import "SGAsset+Internal.h" +#import "SGDemuxable.h" +#import "SGError.h" +#import "SGMacro.h" +#import "SGLock.h" + +@interface SGPacketOutput () + +{ + struct { + NSError *error; + SGPacketOutputState state; + } _flags; + struct { + CMTime seekTime; + CMTime seekingTime; + SGSeekResult seekResult; + } _seekFlags; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) NSCondition *wakeup; +@property (nonatomic, strong, readonly) id demuxable; +@property (nonatomic, strong, readonly) NSOperationQueue *operationQueue; + +@end + +@implementation SGPacketOutput + +- (instancetype)initWithAsset:(SGAsset *)asset +{ + if (self = [super init]) { + self->_demuxable = [asset newDemuxable]; + self->_demuxable.delegate = self; + self->_lock = [[NSLock alloc] init]; + self->_wakeup = [[NSCondition alloc] init]; + } + return self; +} + +- (void)dealloc +{ + SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGPacketOutputStateClosed; + }, ^SGBlock { + [self setState:SGPacketOutputStateClosed]; + [self->_operationQueue cancelAllOperations]; + [self->_operationQueue waitUntilAllOperationsAreFinished]; + return nil; + }); +} + +#pragma mark - Mapping + +SGGet0Map(CMTime, duration, self->_demuxable) +SGGet0Map(NSDictionary *, metadata, self->_demuxable) +SGGet0Map(NSArray *, tracks, self->_demuxable) +SGGet0Map(SGDemuxerOptions *, options, self->_demuxable) +SGSet1Map(void, setOptions, SGDemuxerOptions *, self->_demuxable) + +#pragma mark - Setter & Getter + +- (SGBlock)setState:(SGPacketOutputState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + self->_flags.state = state; + [self->_wakeup lock]; + [self->_wakeup broadcast]; + [self->_wakeup unlock]; + return ^{ + [self->_delegate packetOutput:self didChangeState:state]; + }; +} + +- (SGPacketOutputState)state +{ + __block SGPacketOutputState ret = SGPacketOutputStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (NSError *)error +{ + __block NSError *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = [self->_flags.error copy]; + }); + return ret; +} + +#pragma mark - Control + +- (BOOL)open +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGPacketOutputStateNone; + }, ^SGBlock { + return [self setState:SGPacketOutputStateOpening]; + }, ^BOOL(SGBlock block) { + block(); + NSOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(runningThread) object:nil]; + self->_operationQueue = [[NSOperationQueue alloc] init]; + self->_operationQueue.qualityOfService = NSQualityOfServiceUserInteractive; + [self->_operationQueue addOperation:operation]; + return YES; + }); +} + +- (BOOL)close +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state != SGPacketOutputStateClosed; + }, ^SGBlock { + return [self setState:SGPacketOutputStateClosed]; + }, ^BOOL(SGBlock block) { + block(); + [self->_operationQueue cancelAllOperations]; + [self->_operationQueue waitUntilAllOperationsAreFinished]; + return YES; + }); +} + +- (BOOL)pause +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return + self->_flags.state == SGPacketOutputStateReading || + self->_flags.state == SGPacketOutputStateSeeking; + }, ^SGBlock { + return [self setState:SGPacketOutputStatePaused]; + }); +} + +- (BOOL)resume +{ + return SGLockCondEXE10(self->_lock, ^BOOL { + return + self->_flags.state == SGPacketOutputStatePaused || + self->_flags.state == SGPacketOutputStateOpened; + }, ^SGBlock { + return [self setState:SGPacketOutputStateReading]; + }); +} + +#pragma mark - Seeking + +- (BOOL)seekable +{ + return [self->_demuxable seekable] == nil; +} + +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result +{ + if (![self seekable]) { + return NO; + } + return SGLockCondEXE10(self->_lock, ^BOOL { + return + self->_flags.state == SGPacketOutputStateReading || + self->_flags.state == SGPacketOutputStatePaused || + self->_flags.state == SGPacketOutputStateSeeking || + self->_flags.state == SGPacketOutputStateFinished; + }, ^SGBlock { + SGBlock b1 = ^{}, b2 = ^{}; + if (self->_seekFlags.seekResult) { + CMTime lastSeekTime = self->_seekFlags.seekTime; + SGSeekResult lastSeekResult = self->_seekFlags.seekResult; + b1 = ^{ + lastSeekResult(lastSeekTime, + SGCreateError(SGErrorCodePacketOutputCancelSeek, + SGActionCodePacketOutputSeek)); + }; + } + self->_seekFlags.seekTime = time; + self->_seekFlags.seekResult = [result copy]; + b2 = [self setState:SGPacketOutputStateSeeking]; + return ^{ + b1(); b2(); + }; + }); +} + +#pragma mark - Threading + +- (void)runningThread +{ + while (YES) { + @autoreleasepool { + [self->_lock lock]; + if (self->_flags.state == SGPacketOutputStateNone || + self->_flags.state == SGPacketOutputStateClosed || + self->_flags.state == SGPacketOutputStateFailed) { + [self->_lock unlock]; + break; + } else if (self->_flags.state == SGPacketOutputStateOpening) { + [self->_lock unlock]; + NSError *error = [self->_demuxable open]; + [self->_lock lock]; + if (self->_flags.state != SGPacketOutputStateOpening) { + [self->_lock unlock]; + continue; + } + self->_flags.error = error; + SGBlock b1 = [self setState:error ? SGPacketOutputStateFailed : SGPacketOutputStateOpened]; + [self->_lock unlock]; + b1(); + continue; + } else if (self->_flags.state == SGPacketOutputStateOpened || + self->_flags.state == SGPacketOutputStatePaused || + self->_flags.state == SGPacketOutputStateFinished) { + [self->_wakeup lock]; + [self->_lock unlock]; + [self->_wakeup wait]; + [self->_wakeup unlock]; + continue; + } else if (self->_flags.state == SGPacketOutputStateSeeking) { + self->_seekFlags.seekingTime = self->_seekFlags.seekTime; + CMTime seeking_time = self->_seekFlags.seekingTime; + [self->_lock unlock]; + NSError *error = [self->_demuxable seekToTime:seeking_time]; + [self->_lock lock]; + if (self->_flags.state == SGPacketOutputStateSeeking && + CMTimeCompare(self->_seekFlags.seekTime, seeking_time) != 0) { + [self->_lock unlock]; + continue; + } + SGBlock b1 = ^{}, b2 = ^{}; + if (self->_seekFlags.seekResult) { + CMTime seekTime = self->_seekFlags.seekTime; + SGSeekResult seek_result = self->_seekFlags.seekResult; + b1 = ^{ + seek_result(seekTime, error); + }; + } + if (self->_flags.state == SGPacketOutputStateSeeking) { + b2 = [self setState:SGPacketOutputStateReading]; + } + self->_seekFlags.seekTime = kCMTimeZero; + self->_seekFlags.seekingTime = kCMTimeZero; + self->_seekFlags.seekResult = nil; + [self->_lock unlock]; + b1(); b2(); + continue; + } else if (self->_flags.state == SGPacketOutputStateReading) { + [self->_lock unlock]; + SGPacket *packet = nil; + NSError *error = [self->_demuxable nextPacket:&packet]; + if (error) { + SGLockCondEXE10(self->_lock, ^BOOL{ + return self->_flags.state == SGPacketOutputStateReading; + }, ^SGBlock{ + return [self setState:SGPacketOutputStateFinished]; + }); + } else { + [self->_delegate packetOutput:self didOutputPacket:packet]; + [packet unlock]; + } + continue; + } + } + } + [self->_demuxable close]; +} + +#pragma mark - SGDemuxableDelegate + +- (BOOL)demuxableShouldAbortBlockingFunctions:(id)demuxable +{ + return SGLockCondEXE00(self->_lock, ^BOOL { + switch (self->_flags.state) { + case SGPacketOutputStateFinished: + case SGPacketOutputStateClosed: + case SGPacketOutputStateFailed: + return YES; + default: + return NO; + } + }, nil); +} + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGPlayerItem+Internal.h b/SGPlayer/Classes/Core/SGSession/SGPlayerItem+Internal.h new file mode 100644 index 00000000..48dffd09 --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGPlayerItem+Internal.h @@ -0,0 +1,125 @@ +// +// SGPlayerItem+Internal.h +// SGPlayer iOS +// +// Created by Single on 2018/10/25. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGPlayerItem.h" +#import "SGProcessorOptions.h" +#import "SGAudioDescriptor.h" +#import "SGDemuxerOptions.h" +#import "SGDecoderOptions.h" +#import "SGCapacity.h" +#import "SGFrame.h" + +@protocol SGPlayerItemDelegate; + +/** + * + */ +typedef NS_ENUM(NSUInteger, SGPlayerItemState) { + SGPlayerItemStateNone = 0, + SGPlayerItemStateOpening = 1, + SGPlayerItemStateOpened = 2, + SGPlayerItemStateReading = 3, + SGPlayerItemStateSeeking = 4, + SGPlayerItemStateFinished = 5, + SGPlayerItemStateClosed = 6, + SGPlayerItemStateFailed = 7, +}; + +@interface SGPlayerItem () + +/** + * + */ +@property (nonatomic, copy) SGDemuxerOptions *demuxerOptions; + +/** + * + */ +@property (nonatomic, copy) SGDecoderOptions *decoderOptions; + +/** + * + */ +@property (nonatomic, copy) SGProcessorOptions *processorOptions; + +/** + * + */ +@property (nonatomic, weak) id delegate; + +/** + * + */ +@property (nonatomic, readonly) SGPlayerItemState state; + +/** + * + */ +- (BOOL)open; + +/** + * + */ +- (BOOL)start; + +/** + * + */ +- (BOOL)close; + +/** + * + */ +- (BOOL)seekable; + +/** + * + */ +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result; + +/** + * + */ +- (SGCapacity)capacityWithType:(SGMediaType)type; + +/** + * + */ +- (BOOL)isAvailable:(SGMediaType)type; + +/** + * + */ +- (BOOL)isFinished:(SGMediaType)type; + +/** + * + */ +@property (nonatomic, copy) SGAudioDescriptor *audioDescriptor; + +/** + * + */ +- (__kindof SGFrame *)copyAudioFrame:(SGTimeReader)timeReader; +- (__kindof SGFrame *)copyVideoFrame:(SGTimeReader)timeReader; + +@end + +@protocol SGPlayerItemDelegate + +/** + * + */ +- (void)playerItem:(SGPlayerItem *)playerItem didChangeState:(SGPlayerItemState)state; + +/** + * + */ +- (void)playerItem:(SGPlayerItem *)playerItem didChangeCapacity:(SGCapacity)capacity type:(SGMediaType)type; + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGPlayerItem.h b/SGPlayer/Classes/Core/SGSession/SGPlayerItem.h new file mode 100644 index 00000000..9e18728c --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGPlayerItem.h @@ -0,0 +1,64 @@ +// +// SGPlayerItem.h +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import +#import "SGTrackSelection.h" +#import "SGAsset.h" +#import "SGTrack.h" + +@interface SGPlayerItem : NSObject + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; + +/** + * + */ +- (instancetype)initWithAsset:(SGAsset *)asset; + +/** + * + */ +@property (nonatomic, copy, readonly) NSError *error; + +/** + * + */ +@property (nonatomic, copy, readonly) NSArray *tracks; + +/** + * + */ +@property (nonatomic, copy, readonly) NSDictionary *metadata; + +/** + * + */ +@property (nonatomic, readonly) CMTime duration; + +/** + * + */ +@property (nonatomic, copy, readonly) SGTrackSelection *audioSelection; + +/** + * + */ +- (void)setAudioSelection:(SGTrackSelection *)audioSelection action:(SGTrackSelectionAction)action; + +/** + * + */ +@property (nonatomic, copy, readonly) SGTrackSelection *videoSelection; + +/** + * + */ +- (void)setVideoSelection:(SGTrackSelection *)videoSelection action:(SGTrackSelectionAction)action; + +@end diff --git a/SGPlayer/Classes/Core/SGSession/SGPlayerItem.m b/SGPlayer/Classes/Core/SGSession/SGPlayerItem.m new file mode 100644 index 00000000..b5f455fa --- /dev/null +++ b/SGPlayer/Classes/Core/SGSession/SGPlayerItem.m @@ -0,0 +1,468 @@ +// +// SGPlayerItem.m +// SGPlayer +// +// Created by Single on 2018/1/16. +// Copyright © 2018年 single. All rights reserved. +// + +#import "SGPlayerItem.h" +#import "SGPlayerItem+Internal.h" +#import "SGAudioProcessor.h" +#import "SGVideoProcessor.h" +#import "SGObjectQueue.h" +#import "SGFrameOutput.h" +#import "SGMacro.h" +#import "SGLock.h" + +@interface SGPlayerItem () + +{ + struct { + NSError *error; + SGPlayerItemState state; + BOOL audioFinished; + BOOL videoFinished; + } _flags; + BOOL _capacityFlags[8]; + SGCapacity _capacities[8]; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) SGObjectQueue *audioQueue; +@property (nonatomic, strong, readonly) SGObjectQueue *videoQueue; +@property (nonatomic, strong, readonly) SGFrameOutput *frameOutput; +@property (nonatomic, strong, readonly) SGAudioProcessor *audioProcessor; +@property (nonatomic, strong, readonly) SGVideoProcessor *videoProcessor; + +@end + +@implementation SGPlayerItem + +- (instancetype)initWithAsset:(SGAsset *)asset +{ + if (self = [super init]) { + self->_lock = [[NSLock alloc] init]; + self->_frameOutput = [[SGFrameOutput alloc] initWithAsset:asset]; + self->_frameOutput.delegate = self; + self->_audioQueue = [[SGObjectQueue alloc] init]; + self->_videoQueue = [[SGObjectQueue alloc] init]; + self->_audioDescriptor = [[SGAudioDescriptor alloc] init]; + for (int i = 0; i < 8; i++) { + self->_capacityFlags[i] = NO; + self->_capacities[i] = SGCapacityCreate(); + } + } + return self; +} + +- (void)dealloc +{ + SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.state != SGPlayerItemStateClosed; + }, ^SGBlock { + [self setState:SGPlayerItemStateClosed]; + [self->_frameOutput close]; + SGLockEXE00(self->_lock, ^{ + [self->_audioProcessor close]; + [self->_videoProcessor close]; + [self->_audioQueue destroy]; + [self->_videoQueue destroy]; + }); + return nil; + }); +} + +#pragma mark - Mapping + +SGGet0Map(CMTime, duration, self->_frameOutput) +SGGet0Map(NSDictionary *, metadata, self->_frameOutput) +SGGet0Map(NSArray *, tracks, self->_frameOutput) +SGGet0Map(SGDemuxerOptions *, demuxerOptions, self->_frameOutput) +SGGet0Map(SGDecoderOptions *, decoderOptions, self->_frameOutput) +SGSet1Map(void, setDemuxerOptions, SGDemuxerOptions *, self->_frameOutput) +SGSet1Map(void, setDecoderOptions, SGDecoderOptions *, self->_frameOutput) + +#pragma mark - Setter & Getter + +- (SGBlock)setState:(SGPlayerItemState)state +{ + if (self->_flags.state == state) { + return ^{}; + } + self->_flags.state = state; + return ^{ + [self->_delegate playerItem:self didChangeState:state]; + }; +} + +- (SGPlayerItemState)state +{ + __block SGPlayerItemState ret = SGPlayerItemStateNone; + SGLockEXE00(self->_lock, ^{ + ret = self->_flags.state; + }); + return ret; +} + +- (NSError *)error +{ + __block NSError *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = [self->_flags.error copy]; + }); + return ret; +} + +- (SGCapacity)capacityWithType:(SGMediaType)type +{ + __block SGCapacity ret; + SGLockEXE00(self->_lock, ^{ + ret = self->_capacities[type]; + }); + return ret; +} + +- (BOOL)isAvailable:(SGMediaType)type +{ + __block BOOL ret = NO; + SGLockEXE00(self->_lock, ^{ + if (type == SGMediaTypeAudio) { + ret = self->_audioSelection.tracks.count > 0; + } else if (type == SGMediaTypeVideo) { + ret = self->_videoSelection.tracks.count > 0; + } + }); + return ret; +} + +- (BOOL)isFinished:(SGMediaType)type +{ + __block BOOL ret = NO; + SGLockEXE00(self->_lock, ^{ + if (type == SGMediaTypeAudio) { + ret = self->_flags.audioFinished; + } else if (type == SGMediaTypeVideo) { + ret = self->_flags.videoFinished; + } + }); + return ret; +} + +- (void)setAudioSelection:(SGTrackSelection *)audioSelection action:(SGTrackSelectionAction)action +{ + SGLockEXE10(self->_lock, ^SGBlock { + self->_audioSelection = [audioSelection copy]; + if (action & SGTrackSelectionActionTracks) { + NSMutableArray *m = [NSMutableArray array]; + [m addObjectsFromArray:self->_audioSelection.tracks]; + [m addObjectsFromArray:self->_videoSelection.tracks]; + [self->_frameOutput selectTracks:[m copy]]; + } + if (action > 0) { + [self->_audioProcessor setSelection:self->_audioSelection action:action]; + } + return nil; + }); +} + +- (void)setVideoSelection:(SGTrackSelection *)videoSelection action:(SGTrackSelectionAction)action +{ + SGLockEXE10(self->_lock, ^SGBlock { + self->_videoSelection = [videoSelection copy]; + if (action & SGTrackSelectionActionTracks) { + NSMutableArray *m = [NSMutableArray array]; + [m addObjectsFromArray:self->_audioSelection.tracks]; + [m addObjectsFromArray:self->_videoSelection.tracks]; + [self->_frameOutput selectTracks:[m copy]]; + } + if (action > 0) { + [self->_videoProcessor setSelection:self->_videoSelection action:action]; + } + return nil; + }); +} + +#pragma mark - Control + +- (BOOL)open +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGPlayerItemStateNone; + }, ^SGBlock { + return [self setState:SGPlayerItemStateOpening]; + }, ^BOOL(SGBlock block) { + block(); + return [self->_frameOutput open]; + }); +} + +- (BOOL)start +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state == SGPlayerItemStateOpened; + }, ^SGBlock { + return [self setState:SGPlayerItemStateReading];; + }, ^BOOL(SGBlock block) { + block(); + return [self->_frameOutput start]; + }); +} + +- (BOOL)close +{ + return SGLockCondEXE11(self->_lock, ^BOOL { + return self->_flags.state != SGPlayerItemStateClosed; + }, ^SGBlock { + return [self setState:SGPlayerItemStateClosed]; + }, ^BOOL(SGBlock block) { + block(); + [self->_frameOutput close]; + SGLockEXE00(self->_lock, ^{ + [self->_audioProcessor close]; + [self->_videoProcessor close]; + [self->_audioQueue destroy]; + [self->_videoQueue destroy]; + }); + return YES; + }); +} + +- (BOOL)seekable +{ + return self->_frameOutput.seekable; +} + +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result +{ + SGWeakify(self) + return ![self->_frameOutput seekToTime:time result:^(CMTime time, NSError *error) { + SGStrongify(self) + if (!error) { + SGLockEXE10(self->_lock, ^SGBlock { + [self->_audioProcessor flush]; + [self->_videoProcessor flush]; + [self->_audioQueue flush]; + [self->_videoQueue flush]; + SGBlock b1 = [self setFrameQueueCapacity:SGMediaTypeAudio]; + SGBlock b2 = [self setFrameQueueCapacity:SGMediaTypeVideo]; + return ^{b1(); b2();}; + }); + } + if (result) { + result(time, error); + } + }]; +} + +- (SGFrame *)copyAudioFrame:(SGTimeReader)timeReader +{ + __block SGFrame *ret = nil; + SGLockEXE10(self->_lock, ^SGBlock { + uint64_t discarded = 0; + BOOL success = [self->_audioQueue getObjectAsync:&ret timeReader:timeReader discarded:&discarded]; + if (success || discarded) { + return [self setFrameQueueCapacity:SGMediaTypeAudio]; + }; + return nil; + }); + return ret; +} + +- (SGFrame *)copyVideoFrame:(SGTimeReader)timeReader +{ + __block SGFrame *ret = nil; + SGLockEXE10(self->_lock, ^SGBlock { + uint64_t discarded = 0; + BOOL success = [self->_videoQueue getObjectAsync:&ret timeReader:timeReader discarded:&discarded]; + if (success || discarded) { + return [self setFrameQueueCapacity:SGMediaTypeVideo]; + }; + return nil; + }); + return ret; +} + +#pragma mark - SGFrameOutputDelegate + +- (void)frameOutput:(SGFrameOutput *)frameOutput didChangeState:(SGFrameOutputState)state +{ + switch (state) { + case SGFrameOutputStateOpened: { + SGLockEXE10(self->_lock, ^SGBlock { + NSMutableArray *video = [NSMutableArray array]; + NSMutableArray *audio = [NSMutableArray array]; + for (SGTrack *obj in frameOutput.selectedTracks) { + if (obj.type == SGMediaTypeAudio) { + [audio addObject:obj]; + } else if (obj.type == SGMediaTypeVideo) { + [video addObject:obj]; + } + } + if (audio.count > 0) { + SGTrackSelectionAction action = 0; + action |= SGTrackSelectionActionTracks; + action |= SGTrackSelectionActionWeights; + self->_audioSelection = [[SGTrackSelection alloc] init]; + self->_audioSelection.tracks = @[audio.firstObject]; + self->_audioSelection.weights = @[@(1.0)]; + self->_audioProcessor = [[self->_processorOptions.audioClass alloc] init]; + [self->_audioProcessor setDescriptor:self->_audioDescriptor]; + [self->_audioProcessor setSelection:self->_audioSelection action:action]; + } + if (video.count > 0) { + SGTrackSelectionAction action = 0; + action |= SGTrackSelectionActionTracks; + action |= SGTrackSelectionActionWeights; + self->_videoSelection = [[SGTrackSelection alloc] init]; + self->_videoSelection.tracks = @[video.firstObject]; + self->_videoSelection.weights = @[@(1.0)]; + self->_videoProcessor = [[self->_processorOptions.videoClass alloc] init]; + [self->_videoProcessor setSelection:self->_videoSelection action:action]; + } + return [self setState:SGPlayerItemStateOpened]; + }); + } + break; + case SGFrameOutputStateReading: { + SGLockEXE10(self->_lock, ^SGBlock { + return [self setState:SGPlayerItemStateReading]; + }); + } + break; + case SGFrameOutputStateSeeking: { + SGLockEXE10(self->_lock, ^SGBlock { + return [self setState:SGPlayerItemStateSeeking]; + }); + } + break; + case SGFrameOutputStateFinished: { + SGLockEXE10(self->_lock, ^SGBlock { + SGFrame *aobj = [self->_audioProcessor finish]; + if (aobj) { + [self->_audioQueue putObjectSync:aobj]; + [aobj unlock]; + } + SGFrame *vobj = [self->_videoProcessor finish]; + if (vobj) { + [self->_videoQueue putObjectSync:vobj]; + [vobj unlock]; + } + SGBlock b1 = [self setFrameQueueCapacity:SGMediaTypeAudio]; + SGBlock b2 = [self setFrameQueueCapacity:SGMediaTypeVideo]; + SGBlock b3 = [self setFinishedIfNeeded]; + return ^{b1(); b2(); b3();}; + }); + } + break; + case SGFrameOutputStateFailed: { + SGLockEXE10(self->_lock, ^SGBlock { + self->_flags.error = [frameOutput.error copy]; + return [self setState:SGPlayerItemStateFailed]; + }); + } + break; + default: + break; + } +} + +- (void)frameOutput:(SGFrameOutput *)frameOutput didChangeCapacity:(SGCapacity)capacity type:(SGMediaType)type +{ + SGLockEXE10(self->_lock, ^SGBlock { + SGCapacity additional = [self frameQueueCapacity:type]; + return [self setCapacity:SGCapacityAdd(capacity, additional) type:type]; + }); +} + +- (void)frameOutput:(SGFrameOutput *)frameOutput didOutputFrame:(__kindof SGFrame *)frame +{ + __block __kindof SGFrame *obj = frame; + [obj lock]; + SGLockEXE10(self->_lock, ^SGBlock { + SGMediaType type = obj.track.type; + if (type == SGMediaTypeAudio) { + obj = [self->_audioProcessor putFrame:obj]; + if (!obj) { + return nil; + } + [self->_audioQueue putObjectSync:obj]; + return [self setFrameQueueCapacity:SGMediaTypeAudio]; + } else if (type == SGMediaTypeVideo) { + obj = [self->_videoProcessor putFrame:obj]; + if (!obj) { + return nil; + } + [self->_videoQueue putObjectSync:obj]; + return [self setFrameQueueCapacity:SGMediaTypeVideo]; + } + return nil; + }); + [obj unlock]; +} + +#pragma mark - Capacity + +- (SGBlock)setFrameQueueCapacity:(SGMediaType)type +{ + BOOL paused = NO; + if (type == SGMediaTypeAudio) { + paused = _audioQueue.capacity.count > 5; + } else if (type == SGMediaTypeVideo) { + paused = _videoQueue.capacity.count > 3; + } + SGBlock b1 = ^{ + if (paused) { + [self->_frameOutput pause:type]; + } else { + [self->_frameOutput resume:type]; + } + }; + SGCapacity capacity = [self frameQueueCapacity:type]; + SGCapacity additional = [self->_frameOutput capacityWithType:type]; + SGBlock b2 = [self setCapacity:SGCapacityAdd(capacity, additional) type:type]; + return ^{b1(); b2();}; +} + +- (SGCapacity)frameQueueCapacity:(SGMediaType)type +{ + SGCapacity capacity = SGCapacityCreate(); + if (type == SGMediaTypeAudio) { + capacity = self->_audioQueue.capacity; + capacity = SGCapacityAdd(capacity, self->_audioProcessor.capacity); + } else if (type == SGMediaTypeVideo) { + capacity = self->_videoQueue.capacity; + capacity = SGCapacityAdd(capacity, self->_videoProcessor.capacity); + } + return capacity; +} + +- (SGBlock)setCapacity:(SGCapacity)capacity type:(SGMediaType)type +{ + SGCapacity obj = self->_capacities[type]; + if (SGCapacityIsEqual(obj, capacity)) { + return ^{}; + } + self->_capacityFlags[type] = YES; + self->_capacities[type] = capacity; + SGBlock b1 = ^{ + [self->_delegate playerItem:self didChangeCapacity:capacity type:type]; + }; + SGBlock b2 = [self setFinishedIfNeeded]; + return ^{b1(); b2();}; +} + +- (SGBlock)setFinishedIfNeeded +{ + BOOL nomore = self->_frameOutput.state == SGFrameOutputStateFinished; + SGCapacity ac = self->_capacities[SGMediaTypeAudio]; + SGCapacity vc = self->_capacities[SGMediaTypeVideo]; + self->_flags.audioFinished = nomore && (!self->_capacityFlags[SGMediaTypeAudio] || SGCapacityIsEmpty(ac)); + self->_flags.videoFinished = nomore && (!self->_capacityFlags[SGMediaTypeVideo] || SGCapacityIsEmpty(vc)); + if (self->_flags.audioFinished && self->_flags.videoFinished) { + return [self setState:SGPlayerItemStateFinished]; + } + return ^{}; +} + +@end diff --git a/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.h b/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.h deleted file mode 100644 index 8a72c28d..00000000 --- a/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SGPlayer+DisplayView.h -// SGPlayer -// -// Created by Single on 12/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGPlayerImp.h" -#import "SGDisplayView.h" - -@interface SGPlayer (DisplayView) - -@property (nonatomic, strong, readonly) SGDisplayView * displayView; - -@end diff --git a/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.m b/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.m deleted file mode 100644 index 9542e44d..00000000 --- a/SGPlayer/Classes/Core/SGTools/SGPlayer+DisplayView.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// SGPlayer+DisplayView.m -// SGPlayer -// -// Created by Single on 12/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGPlayer+DisplayView.h" - -@implementation SGPlayer (DisplayView) - -@dynamic displayView; - -@end diff --git a/SGPlayer/Classes/Core/SGTools/SGYUVTools.h b/SGPlayer/Classes/Core/SGTools/SGYUVTools.h deleted file mode 100644 index 9160213a..00000000 --- a/SGPlayer/Classes/Core/SGTools/SGYUVTools.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SGYUVTools.h -// SGPlayer -// -// Created by Single on 2017/3/2. -// Copyright © 2017年 single. All rights reserved. -// - -#import -#import "pixfmt.h" - -int SGYUVChannelFilterNeedSize(int linesize, int width, int height, int channel_count); -void SGYUVChannelFilter(UInt8 * src, int linesize, int width, int height, UInt8 * dst, size_t dstsize, int channel_count); -SGPLFImage * SGYUVConvertToImage(UInt8 * src_data[], int src_linesize[], int width, int height, enum AVPixelFormat pixelFormat); diff --git a/SGPlayer/Classes/Core/SGTools/SGYUVTools.m b/SGPlayer/Classes/Core/SGTools/SGYUVTools.m deleted file mode 100644 index cd73cfef..00000000 --- a/SGPlayer/Classes/Core/SGTools/SGYUVTools.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// SGYUVTools.m -// SGPlayer -// -// Created by Single on 2017/3/2. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGYUVTools.h" -#import "swscale.h" -#import "imgutils.h" -#import "avformat.h" - -int SGYUVChannelFilterNeedSize(int linesize, int width, int height, int channel_count) -{ - width = MIN(linesize, width); - return width * height * channel_count; -} - -void SGYUVChannelFilter(UInt8 * src, int linesize, int width, int height, UInt8 * dst, size_t dstsize, int channel_count) -{ - width = MIN(linesize, width); - UInt8 * temp = dst; - memset(dst, 0, dstsize); - for (int i = 0; i < height; i++) { - memcpy(temp, src, width * channel_count); - temp += (width * channel_count); - src += linesize; - } -} - -SGPLFImage * SGYUVConvertToImage(UInt8 * src_data[], int src_linesize[], int width, int height, enum AVPixelFormat pixelFormat) -{ - struct SwsContext * sws_context = NULL; - sws_context = sws_getCachedContext(sws_context, - width, - height, - pixelFormat, - width, - height, - AV_PIX_FMT_RGB24, - SWS_FAST_BILINEAR, - NULL, NULL, NULL); - if (!sws_context) return nil; - - uint8_t * data[AV_NUM_DATA_POINTERS]; - int linesize[AV_NUM_DATA_POINTERS]; - - int result = av_image_alloc(data, linesize, width, height, AV_PIX_FMT_RGB24, 1); - if (result < 0) { - if (sws_context) { - sws_freeContext(sws_context); - } - return nil; - } - - result = sws_scale(sws_context, (const uint8_t **)src_data, src_linesize, 0, height, data, linesize); - if (sws_context) { - sws_freeContext(sws_context); - } - if (result < 0) return nil; - if (linesize[0] <= 0 || data[0] == NULL) return nil; - - SGPLFImage * image = SGPLFImageWithRGBData(data[0], linesize[0], width, height); - av_freep(&data[0]); - - return image; -} diff --git a/SGPlayer/Classes/Core/SGVR/SGMotionSensor.h b/SGPlayer/Classes/Core/SGVR/SGMotionSensor.h new file mode 100644 index 00000000..3eb32c37 --- /dev/null +++ b/SGPlayer/Classes/Core/SGVR/SGMotionSensor.h @@ -0,0 +1,20 @@ +// +// SGMotionSensor.h +// SGPlayer iOS +// +// Created by Single on 2018/8/23. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import + +@interface SGMotionSensor : NSObject + +@property (nonatomic, readonly) BOOL ready; +@property (nonatomic, readonly) GLKMatrix4 matrix; + +- (void)start; +- (void)stop; + +@end diff --git a/SGPlayer/Classes/Core/SGMatrix/SGSensors.m b/SGPlayer/Classes/Core/SGVR/SGMotionSensor.m similarity index 78% rename from SGPlayer/Classes/Core/SGMatrix/SGSensors.m rename to SGPlayer/Classes/Core/SGVR/SGMotionSensor.m index 40e973ad..47fecd35 100644 --- a/SGPlayer/Classes/Core/SGMatrix/SGSensors.m +++ b/SGPlayer/Classes/Core/SGVR/SGMotionSensor.m @@ -1,60 +1,49 @@ // -// SGSensors.m -// SGPlayer +// SGMotionSensor.m +// SGPlayer iOS // -// Created by Single on 16/01/2017. -// Copyright © 2017 single. All rights reserved. +// Created by Single on 2018/8/23. +// Copyright © 2018 single. All rights reserved. // -#import "SGSensors.h" +#import "SGMotionSensor.h" #import -@interface SGSensors () +@interface SGMotionSensor () +@property (nonatomic) CGFloat defalutRotateY; +@property (nonatomic) GLKMatrix4 deviceToDisplay; +@property (nonatomic) GLKMatrix4 worldToInertialReferenceFrame; @property (nonatomic, strong) CMMotionManager * manager; -@property (nonatomic, assign) UIInterfaceOrientation orientation; -@property (nonatomic, assign) CGFloat defalutRotateY; -@property (nonatomic, assign) GLKMatrix4 deviceToDisplay; -@property (nonatomic, assign) GLKMatrix4 worldToInertialReferenceFrame; +@property (nonatomic) UIInterfaceOrientation orientation; @end -@implementation SGSensors +@implementation SGMotionSensor - (instancetype)init { if (self = [super init]) { + self.deviceToDisplay = GLKMatrix4Identity; self.manager = [[CMMotionManager alloc] init]; self.worldToInertialReferenceFrame = [self getRotateEulerMatrixX:-90 Y:0 Z:90]; - self.deviceToDisplay = GLKMatrix4Identity; switch ([UIApplication sharedApplication].statusBarOrientation) { case UIInterfaceOrientationPortrait: case UIInterfaceOrientationUnknown: case UIInterfaceOrientationPortraitUpsideDown: - { self.defalutRotateY = 0; - } break; case UIInterfaceOrientationLandscapeRight: - { self.defalutRotateY = -90; - } break; case UIInterfaceOrientationLandscapeLeft: - { self.defalutRotateY = 90; - } break; } } return self; } -- (void)updateDeviceOrientation:(UIInterfaceOrientation)orientation -{ - self.orientation = orientation; -} - - (void)setOrientation:(UIInterfaceOrientation)orientation { if (_orientation != orientation) { @@ -62,41 +51,32 @@ - (void)setOrientation:(UIInterfaceOrientation)orientation switch (orientation) { case UIInterfaceOrientationPortrait: case UIInterfaceOrientationUnknown: - { self.deviceToDisplay = GLKMatrix4Identity; - } break; case UIInterfaceOrientationPortraitUpsideDown: - { self.deviceToDisplay = [self getRotateEulerMatrixX:0 Y:0 Z:180]; - } break; case UIInterfaceOrientationLandscapeRight: - { self.deviceToDisplay = [self getRotateEulerMatrixX:0 Y:0 Z:-90]; - } break; case UIInterfaceOrientationLandscapeLeft: - { self.deviceToDisplay = [self getRotateEulerMatrixX:0 Y:0 Z:90]; - } break; } } } -- (BOOL)isReady +- (BOOL)ready { if (self.manager.isDeviceMotionAvailable) { return self.manager.deviceMotion && self.manager.isDeviceMotionActive; - } else { - return YES; } + return YES; } - (void)start { - if (!self.isReady && !self.manager.isDeviceMotionActive) { + if (!self.ready && !self.manager.isDeviceMotionActive) { self.manager.deviceMotionUpdateInterval = 0.01; [self.manager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXArbitraryZVertical]; } @@ -108,23 +88,23 @@ - (void)stop self.manager = nil; } -- (GLKMatrix4)modelView +- (GLKMatrix4)matrix { - if (!self.manager.isDeviceMotionAvailable || !self.manager.isDeviceMotionActive) { + if (!self.manager.isDeviceMotionActive || + !self.manager.isDeviceMotionAvailable) { return GLKMatrix4Identity; } - CMDeviceMotion * motion = self.manager.deviceMotion; - if (!motion) return GLKMatrix4Identity; - - [self updateDeviceOrientation:[UIApplication sharedApplication].statusBarOrientation]; + if (!motion) { + return GLKMatrix4Identity; + } + self.orientation = [UIApplication sharedApplication].statusBarOrientation; CMRotationMatrix rotationMatrix = motion.attitude.rotationMatrix; GLKMatrix4 inertialReferenceFrameToDevice = GLKMatrix4Transpose([self glMatrixFromRotationMatrix:rotationMatrix]); GLKMatrix4 worldToDevice = GLKMatrix4Multiply(inertialReferenceFrameToDevice, self.worldToInertialReferenceFrame); GLKMatrix4 worldToDisplay = GLKMatrix4Multiply(self.deviceToDisplay, worldToDevice); - - worldToDisplay = GLKMatrix4RotateY(worldToDisplay, GLKMathDegreesToRadians(self.defalutRotateY)); - return worldToDisplay; + GLKMatrix4 ret = GLKMatrix4RotateY(worldToDisplay, GLKMathDegreesToRadians(self.defalutRotateY)); + return ret; } - (GLKMatrix4)glMatrixFromRotationMatrix:(CMRotationMatrix)rotationMatrix diff --git a/SGPlayer/Classes/Core/SGVR/SGVRProjection.h b/SGPlayer/Classes/Core/SGVR/SGVRProjection.h new file mode 100644 index 00000000..111b7e6b --- /dev/null +++ b/SGPlayer/Classes/Core/SGVR/SGVRProjection.h @@ -0,0 +1,22 @@ +// +// SGVRProjection.h +// SGPlayer iOS +// +// Created by Single on 2018/8/23. +// Copyright © 2018 single. All rights reserved. +// + +#import +#import +#import "SGVRViewport.h" + +@interface SGVRProjection : NSObject + +@property (nonatomic, strong) SGVRViewport * viewport; + +- (BOOL)ready; +- (BOOL)matrixWithAspect:(Float64)aspect matrix1:(GLKMatrix4 *)matrix1; +- (BOOL)matrixWithAspect:(Float64)aspect matrix1:(GLKMatrix4 *)matrix1 matrix2:(GLKMatrix4 *)matrix2; + +@end + diff --git a/SGPlayer/Classes/Core/SGVR/SGVRProjection.m b/SGPlayer/Classes/Core/SGVR/SGVRProjection.m new file mode 100644 index 00000000..05d1cbfb --- /dev/null +++ b/SGPlayer/Classes/Core/SGVR/SGVRProjection.m @@ -0,0 +1,146 @@ +// +// SGVRProjection.m +// SGPlayer iOS +// +// Created by Single on 2018/8/23. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGVRProjection.h" +#import "SGPLFTargets.h" +#if SGPLATFORM_TARGET_OS_IPHONE +#import "SGMotionSensor.h" +#endif + +@interface SGVRProjection () + +#if SGPLATFORM_TARGET_OS_IPHONE +@property (nonatomic, strong) SGMotionSensor * sensor; +#endif +@property (nonatomic) GLKMatrix4 lastMatrix11; +@property (nonatomic) GLKMatrix4 lastMatrix21; +@property (nonatomic) GLKMatrix4 lastMatrix22; +@property (nonatomic) BOOL lastMatrix1Available; +@property (nonatomic) BOOL lastMatrix2Available; + +@end + +@implementation SGVRProjection + +- (instancetype)init +{ + if (self = [super init]) { + self.viewport = [[SGVRViewport alloc] init]; + } + return self; +} + +- (void)dealloc +{ + [self stop]; +} + +- (void)start +{ +#if SGPLATFORM_TARGET_OS_IPHONE + if (!self.sensor) { + self.sensor = [[SGMotionSensor alloc] init]; + [self.sensor start]; + } +#endif +} + +- (void)stop +{ +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.sensor) { + [self.sensor stop]; + self.sensor = nil; + self.lastMatrix1Available = NO; + self.lastMatrix2Available = NO; + } +#endif +} + +- (BOOL)ready +{ +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.viewport.sensorEnable) { + [self start]; + return self.sensor.ready; + } +#endif + return YES; +} + +- (BOOL)matrixWithAspect:(Float64)aspect matrix1:(GLKMatrix4 *)matrix1 +{ +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.viewport.sensorEnable) { + [self start]; + if (!self.sensor.ready) { + if (self.lastMatrix1Available) { + * matrix1 = self.lastMatrix11; + return YES; + } + return NO; + } + } +#endif + GLKMatrix4 modelMatrix = GLKMatrix4Identity; + modelMatrix = GLKMatrix4RotateX(modelMatrix, GLKMathDegreesToRadians(self.viewport.y) * (self.viewport.flipY ? -1 : 1)); +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.viewport.sensorEnable) { + modelMatrix = GLKMatrix4Multiply(modelMatrix, self.sensor.matrix); + } +#endif + modelMatrix = GLKMatrix4RotateY(modelMatrix, GLKMathDegreesToRadians(self.viewport.x) * (self.viewport.flipX ? -1 : 1)); + GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 0.0, 0, 0, -1000, 0, 1, 0); + GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(self.viewport.degress), aspect, 0.1f, 400.0f); + GLKMatrix4 modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, viewMatrix); + modelViewProjectionMatrix = GLKMatrix4Multiply(modelViewProjectionMatrix, modelMatrix); + *matrix1 = modelViewProjectionMatrix; + self.lastMatrix1Available = YES; + self.lastMatrix11 = modelViewProjectionMatrix; + return YES; +} + +- (BOOL)matrixWithAspect:(Float64)aspect matrix1:(GLKMatrix4 *)matrix1 matrix2:(GLKMatrix4 *)matrix2 +{ +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.viewport.sensorEnable) { + [self start]; + if (!self.sensor.ready) { + if (self.lastMatrix2Available) { + * matrix1 = self.lastMatrix21; + * matrix2 = self.lastMatrix22; + return YES; + } + return NO; + } + } +#endif + float distance = 0.012; + GLKMatrix4 modelMatrix = GLKMatrix4Identity; + modelMatrix = GLKMatrix4RotateX(modelMatrix, GLKMathDegreesToRadians(self.viewport.y) * (self.viewport.flipY ? -1 : 1)); +#if SGPLATFORM_TARGET_OS_IPHONE + if (self.viewport.sensorEnable) { + modelMatrix = GLKMatrix4Multiply(modelMatrix, self.sensor.matrix); + } +#endif + GLKMatrix4 leftViewMatrix = GLKMatrix4MakeLookAt(-distance, 0, 0.0, 0, 0, -1000, 0, 1, 0); + GLKMatrix4 rightViewMatrix = GLKMatrix4MakeLookAt(distance, 0, 0.0, 0, 0, -1000, 0, 1, 0); + GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(self.viewport.degress), aspect, 0.1f, 400.0f); + GLKMatrix4 modelViewProjectionMatrix1 = GLKMatrix4Multiply(projectionMatrix, leftViewMatrix); + GLKMatrix4 modelViewProjectionMatrix2 = GLKMatrix4Multiply(projectionMatrix, rightViewMatrix); + modelViewProjectionMatrix1 = GLKMatrix4Multiply(modelViewProjectionMatrix1, modelMatrix); + modelViewProjectionMatrix2 = GLKMatrix4Multiply(modelViewProjectionMatrix2, modelMatrix); + *matrix1 = modelViewProjectionMatrix1; + *matrix2 = modelViewProjectionMatrix2; + self.lastMatrix2Available = YES; + self.lastMatrix21 = modelViewProjectionMatrix1; + self.lastMatrix22 = modelViewProjectionMatrix2; + return YES; +} + +@end diff --git a/SGPlayer/Classes/Core/SGVR/SGVRViewport.h b/SGPlayer/Classes/Core/SGVR/SGVRViewport.h new file mode 100644 index 00000000..39251f55 --- /dev/null +++ b/SGPlayer/Classes/Core/SGVR/SGVRViewport.h @@ -0,0 +1,20 @@ +// +// SGVRViewport.h +// SGPlayer +// +// Created by Single on 2018/8/27. +// Copyright © 2018 single. All rights reserved. +// + +#import + +@interface SGVRViewport : NSObject + +@property (nonatomic) Float64 degress; // Default value is 60. +@property (nonatomic) Float64 x; // Default value is 0, range is (-360, 360). +@property (nonatomic) Float64 y; // Default value is 0, range is (-360, 360). +@property (nonatomic) BOOL flipX; // Default value is NO. +@property (nonatomic) BOOL flipY; // Default value is NO. +@property (nonatomic) BOOL sensorEnable; // Default value is YES. + +@end diff --git a/SGPlayer/Classes/Core/SGVR/SGVRViewport.m b/SGPlayer/Classes/Core/SGVR/SGVRViewport.m new file mode 100644 index 00000000..661bbe06 --- /dev/null +++ b/SGPlayer/Classes/Core/SGVR/SGVRViewport.m @@ -0,0 +1,26 @@ +// +// SGVRViewport.m +// SGPlayer +// +// Created by Single on 2018/8/27. +// Copyright © 2018 single. All rights reserved. +// + +#import "SGVRViewport.h" + +@implementation SGVRViewport + +- (instancetype)init +{ + if (self = [super init]) { + self.degress = 60; + self.x = 0; + self.y = 0; + self.flipX = NO; + self.flipY = NO; + self.sensorEnable = YES; + } + return self; +} + +@end diff --git a/SGPlayer/Classes/Core/Vendor/sonic/sonic.c b/SGPlayer/Classes/Core/Vendor/sonic/sonic.c new file mode 100644 index 00000000..174225ae --- /dev/null +++ b/SGPlayer/Classes/Core/Vendor/sonic/sonic.c @@ -0,0 +1,1178 @@ +/* Sonic library + Copyright 2010 + Bill Cox + This file is part of the Sonic Library. + + This file is licensed under the Apache 2.0 license. +*/ + +#include "sonic.h" + +#include +#include +#include +#include +#include +#include + +/* + The following code was used to generate the following sinc lookup table. + + #include + #include + #include + + double findHannWeight(int N, double x) { + return 0.5*(1.0 - cos(2*M_PI*x/N)); + } + + double findSincCoefficient(int N, double x) { + double hannWindowWeight = findHannWeight(N, x); + double sincWeight; + + x -= N/2.0; + if (x > 1e-9 || x < -1e-9) { + sincWeight = sin(M_PI*x)/(M_PI*x); + } else { + sincWeight = 1.0; + } + return hannWindowWeight*sincWeight; + } + + int main() { + double x; + int i; + int N = 12; + + for (i = 0, x = 0.0; x <= N; x += 0.02, i++) { + printf("%u %d\n", i, (int)(SHRT_MAX*findSincCoefficient(N, x))); + } + return 0; + } +*/ + +/* The number of points to use in the sinc FIR filter for resampling. */ +#define SINC_FILTER_POINTS \ + 12 /* I am not able to hear improvement with higher N. */ +#define SINC_TABLE_SIZE 601 + +/* Lookup table for windowed sinc function of SINC_FILTER_POINTS points. */ +static short sincTable[SINC_TABLE_SIZE] = { + 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, -2, + -3, -4, -6, -7, -9, -10, -12, -14, -17, -19, -21, + -24, -26, -29, -32, -34, -37, -40, -42, -44, -47, -48, + -50, -51, -52, -53, -53, -53, -52, -50, -48, -46, -43, + -39, -34, -29, -22, -16, -8, 0, 9, 19, 29, 41, + 53, 65, 79, 92, 107, 121, 137, 152, 168, 184, 200, + 215, 231, 247, 262, 276, 291, 304, 317, 328, 339, 348, + 357, 363, 369, 372, 374, 375, 373, 369, 363, 355, 345, + 332, 318, 300, 281, 259, 234, 208, 178, 147, 113, 77, + 39, 0, -41, -85, -130, -177, -225, -274, -324, -375, -426, + -478, -530, -581, -632, -682, -731, -779, -825, -870, -912, -951, + -989, -1023, -1053, -1080, -1104, -1123, -1138, -1149, -1154, -1155, -1151, + -1141, -1125, -1105, -1078, -1046, -1007, -963, -913, -857, -796, -728, + -655, -576, -492, -403, -309, -210, -107, 0, 111, 225, 342, + 462, 584, 708, 833, 958, 1084, 1209, 1333, 1455, 1575, 1693, + 1807, 1916, 2022, 2122, 2216, 2304, 2384, 2457, 2522, 2579, 2625, + 2663, 2689, 2706, 2711, 2705, 2687, 2657, 2614, 2559, 2491, 2411, + 2317, 2211, 2092, 1960, 1815, 1658, 1489, 1308, 1115, 912, 698, + 474, 241, 0, -249, -506, -769, -1037, -1310, -1586, -1864, -2144, + -2424, -2703, -2980, -3254, -3523, -3787, -4043, -4291, -4529, -4757, -4972, + -5174, -5360, -5531, -5685, -5819, -5935, -6029, -6101, -6150, -6175, -6175, + -6149, -6096, -6015, -5905, -5767, -5599, -5401, -5172, -4912, -4621, -4298, + -3944, -3558, -3141, -2693, -2214, -1705, -1166, -597, 0, 625, 1277, + 1955, 2658, 3386, 4135, 4906, 5697, 6506, 7332, 8173, 9027, 9893, + 10769, 11654, 12544, 13439, 14335, 15232, 16128, 17019, 17904, 18782, 19649, + 20504, 21345, 22170, 22977, 23763, 24527, 25268, 25982, 26669, 27327, 27953, + 28547, 29107, 29632, 30119, 30569, 30979, 31349, 31678, 31964, 32208, 32408, + 32565, 32677, 32744, 32767, 32744, 32677, 32565, 32408, 32208, 31964, 31678, + 31349, 30979, 30569, 30119, 29632, 29107, 28547, 27953, 27327, 26669, 25982, + 25268, 24527, 23763, 22977, 22170, 21345, 20504, 19649, 18782, 17904, 17019, + 16128, 15232, 14335, 13439, 12544, 11654, 10769, 9893, 9027, 8173, 7332, + 6506, 5697, 4906, 4135, 3386, 2658, 1955, 1277, 625, 0, -597, + -1166, -1705, -2214, -2693, -3141, -3558, -3944, -4298, -4621, -4912, -5172, + -5401, -5599, -5767, -5905, -6015, -6096, -6149, -6175, -6175, -6150, -6101, + -6029, -5935, -5819, -5685, -5531, -5360, -5174, -4972, -4757, -4529, -4291, + -4043, -3787, -3523, -3254, -2980, -2703, -2424, -2144, -1864, -1586, -1310, + -1037, -769, -506, -249, 0, 241, 474, 698, 912, 1115, 1308, + 1489, 1658, 1815, 1960, 2092, 2211, 2317, 2411, 2491, 2559, 2614, + 2657, 2687, 2705, 2711, 2706, 2689, 2663, 2625, 2579, 2522, 2457, + 2384, 2304, 2216, 2122, 2022, 1916, 1807, 1693, 1575, 1455, 1333, + 1209, 1084, 958, 833, 708, 584, 462, 342, 225, 111, 0, + -107, -210, -309, -403, -492, -576, -655, -728, -796, -857, -913, + -963, -1007, -1046, -1078, -1105, -1125, -1141, -1151, -1155, -1154, -1149, + -1138, -1123, -1104, -1080, -1053, -1023, -989, -951, -912, -870, -825, + -779, -731, -682, -632, -581, -530, -478, -426, -375, -324, -274, + -225, -177, -130, -85, -41, 0, 39, 77, 113, 147, 178, + 208, 234, 259, 281, 300, 318, 332, 345, 355, 363, 369, + 373, 375, 374, 372, 369, 363, 357, 348, 339, 328, 317, + 304, 291, 276, 262, 247, 231, 215, 200, 184, 168, 152, + 137, 121, 107, 92, 79, 65, 53, 41, 29, 19, 9, + 0, -8, -16, -22, -29, -34, -39, -43, -46, -48, -50, + -52, -53, -53, -53, -52, -51, -50, -48, -47, -44, -42, + -40, -37, -34, -32, -29, -26, -24, -21, -19, -17, -14, + -12, -10, -9, -7, -6, -4, -3, -2, -2, -1, -1, + 0, 0, 0, 0, 0, 0, 0}; + +struct sonicStreamStruct { +#ifdef SONIC_SPECTROGRAM + sonicSpectrogram spectrogram; +#endif /* SONIC_SPECTROGRAM */ + short* inputBuffer; + short* outputBuffer; + short* pitchBuffer; + short* downSampleBuffer; + float speed; + float volume; + float pitch; + float rate; + int oldRatePosition; + int newRatePosition; + int useChordPitch; + int quality; + int numChannels; + int inputBufferSize; + int pitchBufferSize; + int outputBufferSize; + int numInputSamples; + int numOutputSamples; + int numPitchSamples; + int minPeriod; + int maxPeriod; + int maxRequired; + int remainingInputToCopy; + int sampleRate; + int prevPeriod; + int prevMinDiff; + float avePower; +}; + +#ifdef SONIC_SPECTROGRAM + +/* Compute a spectrogram on the fly. */ +void sonicComputeSpectrogram(sonicStream stream) { + stream->spectrogram = sonicCreateSpectrogram(stream->sampleRate); + /* Force changeSpeed to be called to compute the spectrogram. */ + sonicSetSpeed(stream, 2.0); +} + +/* Get the spectrogram. */ +sonicSpectrogram sonicGetSpectrogram(sonicStream stream) { + return stream->spectrogram; +} + +#endif + +/* Scale the samples by the factor. */ +static void scaleSamples(short* samples, int numSamples, float volume) { + int fixedPointVolume = volume * 4096.0f; + int value; + + while (numSamples--) { + value = (*samples * fixedPointVolume) >> 12; + if (value > 32767) { + value = 32767; + } else if (value < -32767) { + value = -32767; + } + *samples++ = value; + } +} + +/* Get the speed of the stream. */ +float sonicGetSpeed(sonicStream stream) { return stream->speed; } + +/* Set the speed of the stream. */ +void sonicSetSpeed(sonicStream stream, float speed) { stream->speed = speed; } + +/* Get the pitch of the stream. */ +float sonicGetPitch(sonicStream stream) { return stream->pitch; } + +/* Set the pitch of the stream. */ +void sonicSetPitch(sonicStream stream, float pitch) { stream->pitch = pitch; } + +/* Get the rate of the stream. */ +float sonicGetRate(sonicStream stream) { return stream->rate; } + +/* Set the playback rate of the stream. This scales pitch and speed at the same + time. */ +void sonicSetRate(sonicStream stream, float rate) { + stream->rate = rate; + + stream->oldRatePosition = 0; + stream->newRatePosition = 0; +} + +/* Get the vocal chord pitch setting. */ +int sonicGetChordPitch(sonicStream stream) { return stream->useChordPitch; } + +/* Set the vocal chord mode for pitch computation. Default is off. */ +void sonicSetChordPitch(sonicStream stream, int useChordPitch) { + stream->useChordPitch = useChordPitch; +} + +/* Get the quality setting. */ +int sonicGetQuality(sonicStream stream) { return stream->quality; } + +/* Set the "quality". Default 0 is virtually as good as 1, but very much + faster. */ +void sonicSetQuality(sonicStream stream, int quality) { + stream->quality = quality; +} + +/* Get the scaling factor of the stream. */ +float sonicGetVolume(sonicStream stream) { return stream->volume; } + +/* Set the scaling factor of the stream. */ +void sonicSetVolume(sonicStream stream, float volume) { + stream->volume = volume; +} + +/* Free stream buffers. */ +static void freeStreamBuffers(sonicStream stream) { + if (stream->inputBuffer != NULL) { + free(stream->inputBuffer); + } + if (stream->outputBuffer != NULL) { + free(stream->outputBuffer); + } + if (stream->pitchBuffer != NULL) { + free(stream->pitchBuffer); + } + if (stream->downSampleBuffer != NULL) { + free(stream->downSampleBuffer); + } +} + +/* Destroy the sonic stream. */ +void sonicDestroyStream(sonicStream stream) { +#ifdef SONIC_SPECTROGRAM + if (stream->spectrogram != NULL) { + sonicDestroySpectrogram(stream->spectrogram); + } +#endif /* SONIC_SPECTROGRAM */ + freeStreamBuffers(stream); + free(stream); +} + +/* Allocate stream buffers. */ +static int allocateStreamBuffers(sonicStream stream, int sampleRate, + int numChannels) { + int minPeriod = sampleRate / SONIC_MAX_PITCH; + int maxPeriod = sampleRate / SONIC_MIN_PITCH; + int maxRequired = 2 * maxPeriod; + + stream->inputBufferSize = maxRequired; + stream->inputBuffer = + (short*)calloc(maxRequired, sizeof(short) * numChannels); + if (stream->inputBuffer == NULL) { + sonicDestroyStream(stream); + return 0; + } + stream->outputBufferSize = maxRequired; + stream->outputBuffer = + (short*)calloc(maxRequired, sizeof(short) * numChannels); + if (stream->outputBuffer == NULL) { + sonicDestroyStream(stream); + return 0; + } + stream->pitchBufferSize = maxRequired; + stream->pitchBuffer = + (short*)calloc(maxRequired, sizeof(short) * numChannels); + if (stream->pitchBuffer == NULL) { + sonicDestroyStream(stream); + return 0; + } + stream->downSampleBuffer = (short*)calloc(maxRequired, sizeof(short)); + if (stream->downSampleBuffer == NULL) { + sonicDestroyStream(stream); + return 0; + } + stream->sampleRate = sampleRate; + stream->numChannels = numChannels; + stream->oldRatePosition = 0; + stream->newRatePosition = 0; + stream->minPeriod = minPeriod; + stream->maxPeriod = maxPeriod; + stream->maxRequired = maxRequired; + stream->prevPeriod = 0; + return 1; +} + +/* Create a sonic stream. Return NULL only if we are out of memory and cannot + allocate the stream. */ +sonicStream sonicCreateStream(int sampleRate, int numChannels) { + sonicStream stream = (sonicStream)calloc(1, sizeof(struct sonicStreamStruct)); + + if (stream == NULL) { + return NULL; + } + if (!allocateStreamBuffers(stream, sampleRate, numChannels)) { + return NULL; + } + stream->speed = 1.0f; + stream->pitch = 1.0f; + stream->volume = 1.0f; + stream->rate = 1.0f; + stream->oldRatePosition = 0; + stream->newRatePosition = 0; + stream->useChordPitch = 0; + stream->quality = 0; + stream->avePower = 50.0f; + return stream; +} + +/* Get the sample rate of the stream. */ +int sonicGetSampleRate(sonicStream stream) { return stream->sampleRate; } + +/* Set the sample rate of the stream. This will cause samples buffered in the + stream to be lost. */ +void sonicSetSampleRate(sonicStream stream, int sampleRate) { + freeStreamBuffers(stream); + allocateStreamBuffers(stream, sampleRate, stream->numChannels); +} + +/* Get the number of channels. */ +int sonicGetNumChannels(sonicStream stream) { return stream->numChannels; } + +/* Set the num channels of the stream. This will cause samples buffered in the + stream to be lost. */ +void sonicSetNumChannels(sonicStream stream, int numChannels) { + freeStreamBuffers(stream); + allocateStreamBuffers(stream, stream->sampleRate, numChannels); +} + +/* Enlarge the output buffer if needed. */ +static int enlargeOutputBufferIfNeeded(sonicStream stream, int numSamples) { + if (stream->numOutputSamples + numSamples > stream->outputBufferSize) { + stream->outputBufferSize += (stream->outputBufferSize >> 1) + numSamples; + stream->outputBuffer = (short*)realloc( + stream->outputBuffer, + stream->outputBufferSize * sizeof(short) * stream->numChannels); + if (stream->outputBuffer == NULL) { + return 0; + } + } + return 1; +} + +/* Enlarge the input buffer if needed. */ +static int enlargeInputBufferIfNeeded(sonicStream stream, int numSamples) { + if (stream->numInputSamples + numSamples > stream->inputBufferSize) { + stream->inputBufferSize += (stream->inputBufferSize >> 1) + numSamples; + stream->inputBuffer = (short*)realloc( + stream->inputBuffer, + stream->inputBufferSize * sizeof(short) * stream->numChannels); + if (stream->inputBuffer == NULL) { + return 0; + } + } + return 1; +} + +/* Add the input samples to the input buffer. */ +static int addFloatSamplesToInputBuffer(sonicStream stream, float* samples, + int numSamples) { + short* buffer; + int count = numSamples * stream->numChannels; + + if (numSamples == 0) { + return 1; + } + if (!enlargeInputBufferIfNeeded(stream, numSamples)) { + return 0; + } + buffer = stream->inputBuffer + stream->numInputSamples * stream->numChannels; + while (count--) { + *buffer++ = (*samples++) * 32767.0f; + } + stream->numInputSamples += numSamples; + return 1; +} + +/* Add the input samples to the input buffer. */ +static int addShortSamplesToInputBuffer(sonicStream stream, short* samples, + int numSamples) { + if (numSamples == 0) { + return 1; + } + if (!enlargeInputBufferIfNeeded(stream, numSamples)) { + return 0; + } + memcpy(stream->inputBuffer + stream->numInputSamples * stream->numChannels, + samples, numSamples * sizeof(short) * stream->numChannels); + stream->numInputSamples += numSamples; + return 1; +} + +/* Add the input samples to the input buffer. */ +static int addUnsignedCharSamplesToInputBuffer(sonicStream stream, + unsigned char* samples, + int numSamples) { + short* buffer; + int count = numSamples * stream->numChannels; + + if (numSamples == 0) { + return 1; + } + if (!enlargeInputBufferIfNeeded(stream, numSamples)) { + return 0; + } + buffer = stream->inputBuffer + stream->numInputSamples * stream->numChannels; + while (count--) { + *buffer++ = (*samples++ - 128) << 8; + } + stream->numInputSamples += numSamples; + return 1; +} + +/* Remove input samples that we have already processed. */ +static void removeInputSamples(sonicStream stream, int position) { + int remainingSamples = stream->numInputSamples - position; + + if (remainingSamples > 0) { + memmove(stream->inputBuffer, + stream->inputBuffer + position * stream->numChannels, + remainingSamples * sizeof(short) * stream->numChannels); + } + stream->numInputSamples = remainingSamples; +} + +/* Just copy from the array to the output buffer */ +static int copyToOutput(sonicStream stream, short* samples, int numSamples) { + if (!enlargeOutputBufferIfNeeded(stream, numSamples)) { + return 0; + } + memcpy(stream->outputBuffer + stream->numOutputSamples * stream->numChannels, + samples, numSamples * sizeof(short) * stream->numChannels); + stream->numOutputSamples += numSamples; + return 1; +} + +/* Just copy from the input buffer to the output buffer. Return 0 if we fail to + resize the output buffer. Otherwise, return numSamples */ +static int copyInputToOutput(sonicStream stream, int position) { + int numSamples = stream->remainingInputToCopy; + + if (numSamples > stream->maxRequired) { + numSamples = stream->maxRequired; + } + if (!copyToOutput(stream, + stream->inputBuffer + position * stream->numChannels, + numSamples)) { + return 0; + } + stream->remainingInputToCopy -= numSamples; + return numSamples; +} + +/* Read data out of the stream. Sometimes no data will be available, and zero + is returned, which is not an error condition. */ +int sonicReadFloatFromStream(sonicStream stream, float* samples, + int maxSamples) { + int numSamples = stream->numOutputSamples; + int remainingSamples = 0; + short* buffer; + int count; + + if (numSamples == 0) { + return 0; + } + if (numSamples > maxSamples) { + remainingSamples = numSamples - maxSamples; + numSamples = maxSamples; + } + buffer = stream->outputBuffer; + count = numSamples * stream->numChannels; + while (count--) { + *samples++ = (*buffer++) / 32767.0f; + } + if (remainingSamples > 0) { + memmove(stream->outputBuffer, + stream->outputBuffer + numSamples * stream->numChannels, + remainingSamples * sizeof(short) * stream->numChannels); + } + stream->numOutputSamples = remainingSamples; + return numSamples; +} + +/* Read short data out of the stream. Sometimes no data will be available, and + zero is returned, which is not an error condition. */ +int sonicReadShortFromStream(sonicStream stream, short* samples, + int maxSamples) { + int numSamples = stream->numOutputSamples; + int remainingSamples = 0; + + if (numSamples == 0) { + return 0; + } + if (numSamples > maxSamples) { + remainingSamples = numSamples - maxSamples; + numSamples = maxSamples; + } + memcpy(samples, stream->outputBuffer, + numSamples * sizeof(short) * stream->numChannels); + if (remainingSamples > 0) { + memmove(stream->outputBuffer, + stream->outputBuffer + numSamples * stream->numChannels, + remainingSamples * sizeof(short) * stream->numChannels); + } + stream->numOutputSamples = remainingSamples; + return numSamples; +} + +/* Read unsigned char data out of the stream. Sometimes no data will be + available, and zero is returned, which is not an error condition. */ +int sonicReadUnsignedCharFromStream(sonicStream stream, unsigned char* samples, + int maxSamples) { + int numSamples = stream->numOutputSamples; + int remainingSamples = 0; + short* buffer; + int count; + + if (numSamples == 0) { + return 0; + } + if (numSamples > maxSamples) { + remainingSamples = numSamples - maxSamples; + numSamples = maxSamples; + } + buffer = stream->outputBuffer; + count = numSamples * stream->numChannels; + while (count--) { + *samples++ = (char)((*buffer++) >> 8) + 128; + } + if (remainingSamples > 0) { + memmove(stream->outputBuffer, + stream->outputBuffer + numSamples * stream->numChannels, + remainingSamples * sizeof(short) * stream->numChannels); + } + stream->numOutputSamples = remainingSamples; + return numSamples; +} + +/* Force the sonic stream to generate output using whatever data it currently + has. No extra delay will be added to the output, but flushing in the middle + of words could introduce distortion. */ +int sonicFlushStream(sonicStream stream) { + int maxRequired = stream->maxRequired; + int remainingSamples = stream->numInputSamples; + float speed = stream->speed / stream->pitch; + float rate = stream->rate * stream->pitch; + int expectedOutputSamples = + stream->numOutputSamples + + (int)((remainingSamples / speed + stream->numPitchSamples) / rate + 0.5f); + + /* Add enough silence to flush both input and pitch buffers. */ + if (!enlargeInputBufferIfNeeded(stream, remainingSamples + 2 * maxRequired)) { + return 0; + } + memset(stream->inputBuffer + remainingSamples * stream->numChannels, 0, + 2 * maxRequired * sizeof(short) * stream->numChannels); + stream->numInputSamples += 2 * maxRequired; + if (!sonicWriteShortToStream(stream, NULL, 0)) { + return 0; + } + /* Throw away any extra samples we generated due to the silence we added */ + if (stream->numOutputSamples > expectedOutputSamples) { + stream->numOutputSamples = expectedOutputSamples; + } + /* Empty input and pitch buffers */ + stream->numInputSamples = 0; + stream->remainingInputToCopy = 0; + stream->numPitchSamples = 0; + return 1; +} + +/* Return the number of samples in the output buffer */ +int sonicSamplesInput(sonicStream stream) { + return stream->numInputSamples; +} + +/* Return the number of samples in the output buffer */ +int sonicSamplesAvailable(sonicStream stream) { + return stream->numOutputSamples; +} + +/* If skip is greater than one, average skip samples together and write them to + the down-sample buffer. If numChannels is greater than one, mix the channels + together as we down sample. */ +static void downSampleInput(sonicStream stream, short* samples, int skip) { + int numSamples = stream->maxRequired / skip; + int samplesPerValue = stream->numChannels * skip; + int i, j; + int value; + short* downSamples = stream->downSampleBuffer; + + for (i = 0; i < numSamples; i++) { + value = 0; + for (j = 0; j < samplesPerValue; j++) { + value += *samples++; + } + value /= samplesPerValue; + *downSamples++ = value; + } +} + +/* Find the best frequency match in the range, and given a sample skip multiple. + For now, just find the pitch of the first channel. */ +static int findPitchPeriodInRange(short* samples, int minPeriod, int maxPeriod, + int* retMinDiff, int* retMaxDiff) { + int period, bestPeriod = 0, worstPeriod = 255; + short* s; + short* p; + short sVal, pVal; + unsigned long diff, minDiff = 1, maxDiff = 0; + int i; + + for (period = minPeriod; period <= maxPeriod; period++) { + diff = 0; + s = samples; + p = samples + period; + for (i = 0; i < period; i++) { + sVal = *s++; + pVal = *p++; + diff += sVal >= pVal ? (unsigned short)(sVal - pVal) + : (unsigned short)(pVal - sVal); + } + /* Note that the highest number of samples we add into diff will be less + than 256, since we skip samples. Thus, diff is a 24 bit number, and + we can safely multiply by numSamples without overflow */ + /* if (bestPeriod == 0 || (bestPeriod*3/2 > period && diff*bestPeriod < + minDiff*period) || diff*bestPeriod < (minDiff >> 1)*period) {*/ + if (bestPeriod == 0 || diff * bestPeriod < minDiff * period) { + minDiff = diff; + bestPeriod = period; + } + if (diff * worstPeriod > maxDiff * period) { + maxDiff = diff; + worstPeriod = period; + } + } + *retMinDiff = (int)(minDiff / bestPeriod); + *retMaxDiff = (int)(maxDiff / worstPeriod); + return bestPeriod; +} + +/* At abrupt ends of voiced words, we can have pitch periods that are better + approximated by the previous pitch period estimate. Try to detect this case. + */ +static int prevPeriodBetter(sonicStream stream, int period, int minDiff, + int maxDiff, int preferNewPeriod) { + if (minDiff == 0 || stream->prevPeriod == 0) { + return 0; + } + if (preferNewPeriod) { + if (maxDiff > minDiff * 3) { + /* Got a reasonable match this period */ + return 0; + } + if (minDiff * 2 <= stream->prevMinDiff * 3) { + /* Mismatch is not that much greater this period */ + return 0; + } + } else { + if (minDiff <= stream->prevMinDiff) { + return 0; + } + } + return 1; +} + +/* Find the pitch period. This is a critical step, and we may have to try + multiple ways to get a good answer. This version uses Average Magnitude + Difference Function (AMDF). To improve speed, we down sample by an integer + factor get in the 11KHz range, and then do it again with a narrower + frequency range without down sampling */ +static int findPitchPeriod(sonicStream stream, short* samples, + int preferNewPeriod) { + int minPeriod = stream->minPeriod; + int maxPeriod = stream->maxPeriod; + int sampleRate = stream->sampleRate; + int minDiff, maxDiff, retPeriod; + int skip = 1; + int period; + + if (sampleRate > SONIC_AMDF_FREQ && stream->quality == 0) { + skip = sampleRate / SONIC_AMDF_FREQ; + } + if (stream->numChannels == 1 && skip == 1) { + period = findPitchPeriodInRange(samples, minPeriod, maxPeriod, &minDiff, + &maxDiff); + } else { + downSampleInput(stream, samples, skip); + period = findPitchPeriodInRange(stream->downSampleBuffer, minPeriod / skip, + maxPeriod / skip, &minDiff, &maxDiff); + if (skip != 1) { + period *= skip; + minPeriod = period - (skip << 2); + maxPeriod = period + (skip << 2); + if (minPeriod < stream->minPeriod) { + minPeriod = stream->minPeriod; + } + if (maxPeriod > stream->maxPeriod) { + maxPeriod = stream->maxPeriod; + } + if (stream->numChannels == 1) { + period = findPitchPeriodInRange(samples, minPeriod, maxPeriod, &minDiff, + &maxDiff); + } else { + downSampleInput(stream, samples, 1); + period = findPitchPeriodInRange(stream->downSampleBuffer, minPeriod, + maxPeriod, &minDiff, &maxDiff); + } + } + } + if (prevPeriodBetter(stream, period, minDiff, maxDiff, preferNewPeriod)) { + retPeriod = stream->prevPeriod; + } else { + retPeriod = period; + } + stream->prevMinDiff = minDiff; + stream->prevPeriod = period; + return retPeriod; +} + +/* Overlap two sound segments, ramp the volume of one down, while ramping the + other one from zero up, and add them, storing the result at the output. */ +static void overlapAdd(int numSamples, int numChannels, short* out, + short* rampDown, short* rampUp) { + short* o; + short* u; + short* d; + int i, t; + + for (i = 0; i < numChannels; i++) { + o = out + i; + u = rampUp + i; + d = rampDown + i; + for (t = 0; t < numSamples; t++) { +#ifdef SONIC_USE_SIN + float ratio = sin(t * M_PI / (2 * numSamples)); + *o = *d * (1.0f - ratio) + *u * ratio; +#else + *o = (*d * (numSamples - t) + *u * t) / numSamples; +#endif + o += numChannels; + d += numChannels; + u += numChannels; + } + } +} + +/* Overlap two sound segments, ramp the volume of one down, while ramping the + other one from zero up, and add them, storing the result at the output. */ +static void overlapAddWithSeparation(int numSamples, int numChannels, + int separation, short* out, + short* rampDown, short* rampUp) { + short *o, *u, *d; + int i, t; + + for (i = 0; i < numChannels; i++) { + o = out + i; + u = rampUp + i; + d = rampDown + i; + for (t = 0; t < numSamples + separation; t++) { + if (t < separation) { + *o = *d * (numSamples - t) / numSamples; + d += numChannels; + } else if (t < numSamples) { + *o = (*d * (numSamples - t) + *u * (t - separation)) / numSamples; + d += numChannels; + u += numChannels; + } else { + *o = *u * (t - separation) / numSamples; + u += numChannels; + } + o += numChannels; + } + } +} + +/* Just move the new samples in the output buffer to the pitch buffer */ +static int moveNewSamplesToPitchBuffer(sonicStream stream, + int originalNumOutputSamples) { + int numSamples = stream->numOutputSamples - originalNumOutputSamples; + int numChannels = stream->numChannels; + + if (stream->numPitchSamples + numSamples > stream->pitchBufferSize) { + stream->pitchBufferSize += (stream->pitchBufferSize >> 1) + numSamples; + stream->pitchBuffer = + (short*)realloc(stream->pitchBuffer, + stream->pitchBufferSize * sizeof(short) * numChannels); + if (stream->pitchBuffer == NULL) { + return 0; + } + } + memcpy(stream->pitchBuffer + stream->numPitchSamples * numChannels, + stream->outputBuffer + originalNumOutputSamples * numChannels, + numSamples * sizeof(short) * numChannels); + stream->numOutputSamples = originalNumOutputSamples; + stream->numPitchSamples += numSamples; + return 1; +} + +/* Remove processed samples from the pitch buffer. */ +static void removePitchSamples(sonicStream stream, int numSamples) { + int numChannels = stream->numChannels; + short* source = stream->pitchBuffer + numSamples * numChannels; + + if (numSamples == 0) { + return; + } + if (numSamples != stream->numPitchSamples) { + memmove( + stream->pitchBuffer, source, + (stream->numPitchSamples - numSamples) * sizeof(short) * numChannels); + } + stream->numPitchSamples -= numSamples; +} + +/* Change the pitch. The latency this introduces could be reduced by looking at + past samples to determine pitch, rather than future. */ +static int adjustPitch(sonicStream stream, int originalNumOutputSamples) { + float pitch = stream->pitch; + int numChannels = stream->numChannels; + int period, newPeriod, separation; + int position = 0; + short* out; + short* rampDown; + short* rampUp; + + if (stream->numOutputSamples == originalNumOutputSamples) { + return 1; + } + if (!moveNewSamplesToPitchBuffer(stream, originalNumOutputSamples)) { + return 0; + } + while (stream->numPitchSamples - position >= stream->maxRequired) { + period = findPitchPeriod(stream, + stream->pitchBuffer + position * numChannels, 0); + newPeriod = period / pitch; + if (!enlargeOutputBufferIfNeeded(stream, newPeriod)) { + return 0; + } + out = stream->outputBuffer + stream->numOutputSamples * numChannels; + if (pitch >= 1.0f) { + rampDown = stream->pitchBuffer + position * numChannels; + rampUp = + stream->pitchBuffer + (position + period - newPeriod) * numChannels; + overlapAdd(newPeriod, numChannels, out, rampDown, rampUp); + } else { + rampDown = stream->pitchBuffer + position * numChannels; + rampUp = stream->pitchBuffer + position * numChannels; + separation = newPeriod - period; + overlapAddWithSeparation(period, numChannels, separation, out, rampDown, + rampUp); + } + stream->numOutputSamples += newPeriod; + position += period; + } + removePitchSamples(stream, position); + return 1; +} + +/* Aproximate the sinc function times a Hann window from the sinc table. */ +static int findSincCoefficient(int i, int ratio, int width) { + int lobePoints = (SINC_TABLE_SIZE - 1) / SINC_FILTER_POINTS; + int left = i * lobePoints + (ratio * lobePoints) / width; + int right = left + 1; + int position = i * lobePoints * width + ratio * lobePoints - left * width; + int leftVal = sincTable[left]; + int rightVal = sincTable[right]; + + return ((leftVal * (width - position) + rightVal * position) << 1) / width; +} + +/* Return 1 if value >= 0, else -1. This represents the sign of value. */ +static int getSign(int value) { return value >= 0 ? 1 : -1; } + +/* Interpolate the new output sample. */ +static short interpolate(sonicStream stream, short* in, int oldSampleRate, + int newSampleRate) { + /* Compute N-point sinc FIR-filter here. Clip rather than overflow. */ + int i; + int total = 0; + int position = stream->newRatePosition * oldSampleRate; + int leftPosition = stream->oldRatePosition * newSampleRate; + int rightPosition = (stream->oldRatePosition + 1) * newSampleRate; + int ratio = rightPosition - position - 1; + int width = rightPosition - leftPosition; + int weight, value; + int oldSign; + int overflowCount = 0; + + for (i = 0; i < SINC_FILTER_POINTS; i++) { + weight = findSincCoefficient(i, ratio, width); + /* printf("%u %f\n", i, weight); */ + value = in[i * stream->numChannels] * weight; + oldSign = getSign(total); + total += value; + if (oldSign != getSign(total) && getSign(value) == oldSign) { + /* We must have overflowed. This can happen with a sinc filter. */ + overflowCount += oldSign; + } + } + /* It is better to clip than to wrap if there was a overflow. */ + if (overflowCount > 0) { + return SHRT_MAX; + } else if (overflowCount < 0) { + return SHRT_MIN; + } + return total >> 16; +} + +/* Change the rate. Interpolate with a sinc FIR filter using a Hann window. */ +static int adjustRate(sonicStream stream, float rate, + int originalNumOutputSamples) { + int newSampleRate = stream->sampleRate / rate; + int oldSampleRate = stream->sampleRate; + int numChannels = stream->numChannels; + int position = 0; + short *in, *out; + int i; + int N = SINC_FILTER_POINTS; + + /* Set these values to help with the integer math */ + while (newSampleRate > (1 << 14) || oldSampleRate > (1 << 14)) { + newSampleRate >>= 1; + oldSampleRate >>= 1; + } + if (stream->numOutputSamples == originalNumOutputSamples) { + return 1; + } + if (!moveNewSamplesToPitchBuffer(stream, originalNumOutputSamples)) { + return 0; + } + /* Leave at least N pitch sample in the buffer */ + for (position = 0; position < stream->numPitchSamples - N; position++) { + while ((stream->oldRatePosition + 1) * newSampleRate > + stream->newRatePosition * oldSampleRate) { + if (!enlargeOutputBufferIfNeeded(stream, 1)) { + return 0; + } + out = stream->outputBuffer + stream->numOutputSamples * numChannels; + in = stream->pitchBuffer + position * numChannels; + for (i = 0; i < numChannels; i++) { + *out++ = interpolate(stream, in, oldSampleRate, newSampleRate); + in++; + } + stream->newRatePosition++; + stream->numOutputSamples++; + } + stream->oldRatePosition++; + if (stream->oldRatePosition == oldSampleRate) { + stream->oldRatePosition = 0; + if (stream->newRatePosition != newSampleRate) { + fprintf(stderr, + "Assertion failed: stream->newRatePosition != newSampleRate\n"); + exit(1); + } + stream->newRatePosition = 0; + } + } + removePitchSamples(stream, position); + return 1; +} + +/* Skip over a pitch period, and copy period/speed samples to the output */ +static int skipPitchPeriod(sonicStream stream, short* samples, float speed, + int period) { + int newSamples; + int numChannels = stream->numChannels; + + if (speed >= 2.0f) { + newSamples = period / (speed - 1.0f); + } else { + newSamples = period; + stream->remainingInputToCopy = period * (2.0f - speed) / (speed - 1.0f); + } + if (!enlargeOutputBufferIfNeeded(stream, newSamples)) { + return 0; + } + overlapAdd(newSamples, numChannels, + stream->outputBuffer + stream->numOutputSamples * numChannels, + samples, samples + period * numChannels); + stream->numOutputSamples += newSamples; + return newSamples; +} + +/* Insert a pitch period, and determine how much input to copy directly. */ +static int insertPitchPeriod(sonicStream stream, short* samples, float speed, + int period) { + int newSamples; + short* out; + int numChannels = stream->numChannels; + + if (speed < 0.5f) { + newSamples = period * speed / (1.0f - speed); + } else { + newSamples = period; + stream->remainingInputToCopy = + period * (2.0f * speed - 1.0f) / (1.0f - speed); + } + if (!enlargeOutputBufferIfNeeded(stream, period + newSamples)) { + return 0; + } + out = stream->outputBuffer + stream->numOutputSamples * numChannels; + memcpy(out, samples, period * sizeof(short) * numChannels); + out = + stream->outputBuffer + (stream->numOutputSamples + period) * numChannels; + overlapAdd(newSamples, numChannels, out, samples + period * numChannels, + samples); + stream->numOutputSamples += period + newSamples; + return newSamples; +} + +/* Resample as many pitch periods as we have buffered on the input. Return 0 if + we fail to resize an input or output buffer. */ +static int changeSpeed(sonicStream stream, float speed) { + short* samples; + int numSamples = stream->numInputSamples; + int position = 0, period, newSamples; + int maxRequired = stream->maxRequired; + + /* printf("Changing speed to %f\n", speed); */ + if (stream->numInputSamples < maxRequired) { + return 1; + } + do { + if (stream->remainingInputToCopy > 0) { + newSamples = copyInputToOutput(stream, position); + position += newSamples; + } else { + samples = stream->inputBuffer + position * stream->numChannels; + period = findPitchPeriod(stream, samples, 1); +#ifdef SONIC_SPECTROGRAM + if (stream->spectrogram != NULL) { + sonicAddPitchPeriodToSpectrogram(stream->spectrogram, samples, period, + stream->numChannels); + newSamples = period; + position += period; + } else +#endif /* SONIC_SPECTROGRAM */ + if (speed > 1.0) { + newSamples = skipPitchPeriod(stream, samples, speed, period); + position += period + newSamples; + } else { + newSamples = insertPitchPeriod(stream, samples, speed, period); + position += newSamples; + } + } + if (newSamples == 0) { + return 0; /* Failed to resize output buffer */ + } + } while (position + maxRequired <= numSamples); + removeInputSamples(stream, position); + return 1; +} + +/* Resample as many pitch periods as we have buffered on the input. Return 0 if + we fail to resize an input or output buffer. Also scale the output by the + volume. */ +static int processStreamInput(sonicStream stream) { + int originalNumOutputSamples = stream->numOutputSamples; + float speed = stream->speed / stream->pitch; + float rate = stream->rate; + + if (!stream->useChordPitch) { + rate *= stream->pitch; + } + if (speed > 1.00001 || speed < 0.99999) { + changeSpeed(stream, speed); + } else { + if (!copyToOutput(stream, stream->inputBuffer, stream->numInputSamples)) { + return 0; + } + stream->numInputSamples = 0; + } + if (stream->useChordPitch) { + if (stream->pitch != 1.0f) { + if (!adjustPitch(stream, originalNumOutputSamples)) { + return 0; + } + } + } else if (rate != 1.0f) { + if (!adjustRate(stream, rate, originalNumOutputSamples)) { + return 0; + } + } + if (stream->volume != 1.0f) { + /* Adjust output volume. */ + scaleSamples( + stream->outputBuffer + originalNumOutputSamples * stream->numChannels, + (stream->numOutputSamples - originalNumOutputSamples) * + stream->numChannels, + stream->volume); + } + return 1; +} + +/* Write floating point data to the input buffer and process it. */ +int sonicWriteFloatToStream(sonicStream stream, float* samples, + int numSamples) { + if (!addFloatSamplesToInputBuffer(stream, samples, numSamples)) { + return 0; + } + return processStreamInput(stream); +} + +/* Simple wrapper around sonicWriteFloatToStream that does the short to float + conversion for you. */ +int sonicWriteShortToStream(sonicStream stream, short* samples, + int numSamples) { + if (!addShortSamplesToInputBuffer(stream, samples, numSamples)) { + return 0; + } + return processStreamInput(stream); +} + +/* Simple wrapper around sonicWriteFloatToStream that does the unsigned char to + float conversion for you. */ +int sonicWriteUnsignedCharToStream(sonicStream stream, unsigned char* samples, + int numSamples) { + if (!addUnsignedCharSamplesToInputBuffer(stream, samples, numSamples)) { + return 0; + } + return processStreamInput(stream); +} + +/* This is a non-stream oriented interface to just change the speed of a sound + * sample */ +int sonicChangeFloatSpeed(float* samples, int numSamples, float speed, + float pitch, float rate, float volume, + int useChordPitch, int sampleRate, int numChannels) { + sonicStream stream = sonicCreateStream(sampleRate, numChannels); + + sonicSetSpeed(stream, speed); + sonicSetPitch(stream, pitch); + sonicSetRate(stream, rate); + sonicSetVolume(stream, volume); + sonicSetChordPitch(stream, useChordPitch); + sonicWriteFloatToStream(stream, samples, numSamples); + sonicFlushStream(stream); + numSamples = sonicSamplesAvailable(stream); + sonicReadFloatFromStream(stream, samples, numSamples); + sonicDestroyStream(stream); + return numSamples; +} + +/* This is a non-stream oriented interface to just change the speed of a sound + * sample */ +int sonicChangeShortSpeed(short* samples, int numSamples, float speed, + float pitch, float rate, float volume, + int useChordPitch, int sampleRate, int numChannels) { + sonicStream stream = sonicCreateStream(sampleRate, numChannels); + + sonicSetSpeed(stream, speed); + sonicSetPitch(stream, pitch); + sonicSetRate(stream, rate); + sonicSetVolume(stream, volume); + sonicSetChordPitch(stream, useChordPitch); + sonicWriteShortToStream(stream, samples, numSamples); + sonicFlushStream(stream); + numSamples = sonicSamplesAvailable(stream); + sonicReadShortFromStream(stream, samples, numSamples); + sonicDestroyStream(stream); + return numSamples; +} diff --git a/SGPlayer/Classes/Core/Vendor/sonic/sonic.h b/SGPlayer/Classes/Core/Vendor/sonic/sonic.h new file mode 100644 index 00000000..334c13a3 --- /dev/null +++ b/SGPlayer/Classes/Core/Vendor/sonic/sonic.h @@ -0,0 +1,229 @@ +/* Sonic library + Copyright 2010 + Bill Cox + This file is part of the Sonic Library. + + This file is licensed under the Apache 2.0 license. +*/ + +/* +The Sonic Library implements a new algorithm invented by Bill Cox for the +specific purpose of speeding up speech by high factors at high quality. It +generates smooth speech at speed up factors as high as 6X, possibly more. It is +also capable of slowing down speech, and generates high quality results +regardless of the speed up or slow down factor. For speeding up speech by 2X or +more, the following equation is used: + + newSamples = period/(speed - 1.0) + scale = 1.0/newSamples; + +where period is the current pitch period, determined using AMDF or any other +pitch estimator, and speed is the speedup factor. If the current position in +the input stream is pointed to by "samples", and the current output stream +position is pointed to by "out", then newSamples number of samples can be +generated with: + + out[t] = (samples[t]*(newSamples - t) + samples[t + period]*t)/newSamples; + +where t = 0 to newSamples - 1. + +For speed factors < 2X, the PICOLA algorithm is used. The above +algorithm is first used to double the speed of one pitch period. Then, enough +input is directly copied from the input to the output to achieve the desired +speed up factor, where 1.0 < speed < 2.0. The amount of data copied is derived: + + speed = (2*period + length)/(period + length) + speed*length + speed*period = 2*period + length + length(speed - 1) = 2*period - speed*period + length = period*(2 - speed)/(speed - 1) + +For slowing down speech where 0.5 < speed < 1.0, a pitch period is inserted into +the output twice, and length of input is copied from the input to the output +until the output desired speed is reached. The length of data copied is: + + length = period*(speed - 0.5)/(1 - speed) + +For slow down factors below 0.5, no data is copied, and an algorithm +similar to high speed factors is used. +*/ + +/* Uncomment this to use sin-wav based overlap add which in theory can improve + sound quality slightly, at the expense of lots of floating point math. */ +/* #define SONIC_USE_SIN */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This specifies the range of voice pitches we try to match. + Note that if we go lower than 65, we could overflow in findPitchInRange */ +#define SONIC_MIN_PITCH 65 +#define SONIC_MAX_PITCH 400 + +/* These are used to down-sample some inputs to improve speed */ +#define SONIC_AMDF_FREQ 4000 + +struct sonicStreamStruct; +typedef struct sonicStreamStruct* sonicStream; + +/* For all of the following functions, numChannels is multiplied by numSamples + to determine the actual number of values read or returned. */ + +/* Create a sonic stream. Return NULL only if we are out of memory and cannot + allocate the stream. Set numChannels to 1 for mono, and 2 for stereo. */ +sonicStream sonicCreateStream(int sampleRate, int numChannels); +/* Destroy the sonic stream. */ +void sonicDestroyStream(sonicStream stream); +/* Use this to write floating point data to be speed up or down into the stream. + Values must be between -1 and 1. Return 0 if memory realloc failed, + otherwise 1 */ +int sonicWriteFloatToStream(sonicStream stream, float* samples, int numSamples); +/* Use this to write 16-bit data to be speed up or down into the stream. + Return 0 if memory realloc failed, otherwise 1 */ +int sonicWriteShortToStream(sonicStream stream, short* samples, int numSamples); +/* Use this to write 8-bit unsigned data to be speed up or down into the stream. + Return 0 if memory realloc failed, otherwise 1 */ +int sonicWriteUnsignedCharToStream(sonicStream stream, unsigned char* samples, + int numSamples); +/* Use this to read floating point data out of the stream. Sometimes no data + will be available, and zero is returned, which is not an error condition. */ +int sonicReadFloatFromStream(sonicStream stream, float* samples, + int maxSamples); +/* Use this to read 16-bit data out of the stream. Sometimes no data will + be available, and zero is returned, which is not an error condition. */ +int sonicReadShortFromStream(sonicStream stream, short* samples, + int maxSamples); +/* Use this to read 8-bit unsigned data out of the stream. Sometimes no data + will be available, and zero is returned, which is not an error condition. */ +int sonicReadUnsignedCharFromStream(sonicStream stream, unsigned char* samples, + int maxSamples); +/* Force the sonic stream to generate output using whatever data it currently + has. No extra delay will be added to the output, but flushing in the middle + of words could introduce distortion. */ +int sonicFlushStream(sonicStream stream); +/* Return the number of samples in the input buffer */ +int sonicSamplesInput(sonicStream stream); +/* Return the number of samples in the output buffer */ +int sonicSamplesAvailable(sonicStream stream); +/* Get the speed of the stream. */ +float sonicGetSpeed(sonicStream stream); +/* Set the speed of the stream. */ +void sonicSetSpeed(sonicStream stream, float speed); +/* Get the pitch of the stream. */ +float sonicGetPitch(sonicStream stream); +/* Set the pitch of the stream. */ +void sonicSetPitch(sonicStream stream, float pitch); +/* Get the rate of the stream. */ +float sonicGetRate(sonicStream stream); +/* Set the rate of the stream. */ +void sonicSetRate(sonicStream stream, float rate); +/* Get the scaling factor of the stream. */ +float sonicGetVolume(sonicStream stream); +/* Set the scaling factor of the stream. */ +void sonicSetVolume(sonicStream stream, float volume); +/* Get the chord pitch setting. */ +int sonicGetChordPitch(sonicStream stream); +/* Set chord pitch mode on or off. Default is off. See the documentation + page for a description of this feature. */ +void sonicSetChordPitch(sonicStream stream, int useChordPitch); +/* Get the quality setting. */ +int sonicGetQuality(sonicStream stream); +/* Set the "quality". Default 0 is virtually as good as 1, but very much + * faster. */ +void sonicSetQuality(sonicStream stream, int quality); +/* Get the sample rate of the stream. */ +int sonicGetSampleRate(sonicStream stream); +/* Set the sample rate of the stream. This will drop any samples that have not + * been read. */ +void sonicSetSampleRate(sonicStream stream, int sampleRate); +/* Get the number of channels. */ +int sonicGetNumChannels(sonicStream stream); +/* Set the number of channels. This will drop any samples that have not been + * read. */ +void sonicSetNumChannels(sonicStream stream, int numChannels); +/* This is a non-stream oriented interface to just change the speed of a sound + sample. It works in-place on the sample array, so there must be at least + speed*numSamples available space in the array. Returns the new number of + samples. */ +int sonicChangeFloatSpeed(float* samples, int numSamples, float speed, + float pitch, float rate, float volume, + int useChordPitch, int sampleRate, int numChannels); +/* This is a non-stream oriented interface to just change the speed of a sound + sample. It works in-place on the sample array, so there must be at least + speed*numSamples available space in the array. Returns the new number of + samples. */ +int sonicChangeShortSpeed(short* samples, int numSamples, float speed, + float pitch, float rate, float volume, + int useChordPitch, int sampleRate, int numChannels); + +#ifdef SONIC_SPECTROGRAM +/* +This code generates high quality spectrograms from sound samples, using +Time-Aliased-FFTs as described at: + + https://github.com/waywardgeek/spectrogram + +Basically, two adjacent pitch periods are overlap-added to create a sound +sample that accurately represents the speech sound at that moment in time. +This set of samples is converted to a spetral line using an FFT, and the result +is saved as a single spectral line at that moment in time. The resulting +spectral lines vary in resolution (it is equal to the number of samples in the +pitch period), and the spacing of spectral lines also varies (proportional to +the numver of samples in the pitch period). + +To generate a bitmap, linear interpolation is used to render the grayscale +value at any particular point in time and frequency. +*/ + +#define SONIC_MAX_SPECTRUM_FREQ 5000 + +struct sonicSpectrogramStruct; +struct sonicBitmapStruct; +typedef struct sonicSpectrogramStruct* sonicSpectrogram; +typedef struct sonicBitmapStruct* sonicBitmap; + +/* sonicBitmap objects represent spectrograms as grayscale bitmaps where each + pixel is from 0 (black) to 255 (white). Bitmaps are rows*cols in size. + Rows are indexed top to bottom and columns are indexed left to right */ +struct sonicBitmapStruct { + unsigned char* data; + int numRows; + int numCols; +}; + +typedef struct sonicBitmapStruct* sonicBitmap; + +/* Enable coomputation of a spectrogram on the fly. */ +void sonicComputeSpectrogram(sonicStream stream); + +/* Get the spectrogram. */ +sonicSpectrogram sonicGetSpectrogram(sonicStream stream); + +/* Create an empty spectrogram. Called automatically if sonicComputeSpectrogram + has been called. */ +sonicSpectrogram sonicCreateSpectrogram(int sampleRate); + +/* Destroy the spectrotram. This is called automatically when calling + sonicDestroyStream. */ +void sonicDestroySpectrogram(sonicSpectrogram spectrogram); + +/* Convert the spectrogram to a bitmap. Caller must destroy bitmap when done. */ +sonicBitmap sonicConvertSpectrogramToBitmap(sonicSpectrogram spectrogram, + int numRows, int numCols); + +/* Destroy a bitmap returned by sonicConvertSpectrogramToBitmap. */ +void sonicDestroyBitmap(sonicBitmap bitmap); + +int sonicWritePGM(sonicBitmap bitmap, char* fileName); + +/* Add two pitch periods worth of samples to the spectrogram. There must be + 2*period samples. Time should advance one pitch period for each call to + this function. */ +void sonicAddPitchPeriodToSpectrogram(sonicSpectrogram spectrogram, + short* samples, int period, + int numChannels); +#endif /* SONIC_SPECTROGRAM */ + +#ifdef __cplusplus +} +#endif diff --git a/SGPlayer/Classes/SGPlayer.h b/SGPlayer/Classes/SGPlayer.h new file mode 100644 index 00000000..2b35003b --- /dev/null +++ b/SGPlayer/Classes/SGPlayer.h @@ -0,0 +1,176 @@ +// +// SGPlayer.h +// SGPlayer +// +// Created by Single on 03/01/2017. +// Copyright © 2017 single. All rights reserved. +// + +#import "SGPlayerHeader.h" + +#pragma mark - SGPlayer + +@interface SGPlayer : NSObject + +/** + * + */ +@property (nonatomic, strong) SGOptions *options; + +/** + * + */ +- (BOOL)stateInfo:(SGStateInfo *)stateInfo timeInfo:(SGTimeInfo *)timeInfo error:(NSError **)error; + +@end + +#pragma mark - Item + +@interface SGPlayer () + +/** + * + */ +- (SGPlayerItem *)currentItem; + +/** + * + */ +@property (nonatomic, copy) SGHandler readyHandler; + +/** + * + */ +- (BOOL)replaceWithURL:(NSURL *)URL; + +/** + * + */ +- (BOOL)replaceWithAsset:(SGAsset *)asset; + +/** + * + */ +- (BOOL)replaceWithPlayerItem:(SGPlayerItem *)item; + +@end + +#pragma mark - Playback + +@interface SGPlayer () + +/** + * + */ +@property (nonatomic) Float64 rate; + +/** + * + */ +@property (nonatomic, readonly) BOOL wantsToPlay; + +/** + * + */ +#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV +@property (nonatomic) BOOL pausesWhenInterrupted; +#endif + +/** + * + */ +- (BOOL)play; + +/** + * + */ +- (BOOL)pause; + +/** + * + */ +- (BOOL)seekable; + +/** + * + */ +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result; + +@end + +#pragma mark - Renderer + +@interface SGPlayer () + +/** + * + */ +- (SGClock *)clock; + +/** + * + */ +- (SGAudioRenderer *)audioRenderer; + +/** + * + */ +- (SGVideoRenderer *)videoRenderer; + +@end + +#pragma mark - Notification + +/** + * + */ +SGPLAYER_EXTERN NSNotificationName const SGPlayerDidChangeInfosNotification; + +/** + * + */ +SGPLAYER_EXTERN NSString * const SGPlayerTimeInfoUserInfoKey; + +/** + * + */ +SGPLAYER_EXTERN NSString * const SGPlayerStateInfoUserInfoKey; + +/** + * + */ +SGPLAYER_EXTERN NSString * const SGPlayerInfoActionUserInfoKey; + +@interface SGPlayer () + +/** + * + */ ++ (SGTimeInfo)timeInfoFromUserInfo:(NSDictionary *)userInfo; + +/** + * + */ ++ (SGStateInfo)stateInfoFromUserInfo:(NSDictionary *)userInfo; + +/** + * + */ ++ (SGInfoAction)infoActionFromUserInfo:(NSDictionary *)userInfo; + +/** + * + */ +@property (nonatomic) SGInfoAction actionMask; + +/** + * + */ +@property (nonatomic) NSTimeInterval minimumTimeInfoInterval; + +/** + * + */ +@property (nonatomic, strong) NSOperationQueue *notificationQueue; + +@end diff --git a/SGPlayer/Classes/SGPlayer.m b/SGPlayer/Classes/SGPlayer.m new file mode 100644 index 00000000..a1b7d991 --- /dev/null +++ b/SGPlayer/Classes/SGPlayer.m @@ -0,0 +1,652 @@ +// +// SGPlayer.m +// SGPlayer +// +// Created by Single on 03/01/2017. +// Copyright © 2017 single. All rights reserved. +// + +#import "SGPlayer.h" +#import +#import "SGPlayerItem+Internal.h" +#import "SGRenderer+Internal.h" +#import "SGActivity.h" +#import "SGMacro.h" +#import "SGLock.h" + +NSString * const SGPlayerTimeInfoUserInfoKey = @"SGPlayerTimeInfoUserInfoKey"; +NSString * const SGPlayerStateInfoUserInfoKey = @"SGPlayerStateInfoUserInfoKey"; +NSString * const SGPlayerInfoActionUserInfoKey = @"SGPlayerInfoActionUserInfoKey"; +NSNotificationName const SGPlayerDidChangeInfosNotification = @"SGPlayerDidChangeInfosNotification"; + +@interface SGPlayer () + +{ + struct { + BOOL playing; + BOOL audioFinished; + BOOL videoFinished; + BOOL audioAvailable; + BOOL videoAvailable; + NSError *error; + NSUInteger seekingIndex; + SGTimeInfo timeInfo; + SGStateInfo stateInfo; + SGInfoAction additionalAction; + NSTimeInterval lastNotificationTime; + } _flags; +} + +@property (nonatomic, strong, readonly) NSLock *lock; +@property (nonatomic, strong, readonly) SGClock *clock; +@property (nonatomic, strong, readonly) SGPlayerItem *currentItem; +@property (nonatomic, strong, readonly) SGAudioRenderer *audioRenderer; +@property (nonatomic, strong, readonly) SGVideoRenderer *videoRenderer; + +@end + +@implementation SGPlayer + +@synthesize rate = _rate; +@synthesize clock = _clock; +@synthesize currentItem = _currentItem; +@synthesize audioRenderer = _audioRenderer; +@synthesize videoRenderer = _videoRenderer; + +- (instancetype)init +{ + if (self = [super init]) { + [self stop]; + self->_options = [SGOptions sharedOptions].copy; + self->_rate = 1.0; + self->_lock = [[NSLock alloc] init]; + self->_clock = [[SGClock alloc] init]; + self->_clock.delegate = self; + self->_audioRenderer = [[SGAudioRenderer alloc] initWithClock:self->_clock]; + self->_audioRenderer.delegate = self; + self->_videoRenderer = [[SGVideoRenderer alloc] initWithClock:self->_clock]; + self->_videoRenderer.delegate = self; + self->_actionMask = SGInfoActionNone; + self->_minimumTimeInfoInterval = 1.0; + self->_notificationQueue = [NSOperationQueue mainQueue]; +#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV + self->_pausesWhenInterrupted = YES; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interruptionHandler:) name:AVAudioSessionInterruptionNotification object:nil]; +#endif + } + return self; +} + +- (void)dealloc +{ +#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV + [[NSNotificationCenter defaultCenter] removeObserver:self]; +#endif + [SGActivity removeTarget:self]; + [self->_currentItem close]; + [self->_clock close]; + [self->_audioRenderer close]; + [self->_videoRenderer close]; +} + +#pragma mark - Info + +- (SGBlock)setPlayerState:(SGPlayerState)state action:(SGInfoAction *)action +{ + if (self->_flags.stateInfo.player == state) { + return ^{}; + } + *action |= SGInfoActionStatePlayer; + self->_flags.stateInfo.player = state; + return ^{ + if (state == SGPlayerStateReady) { + if (self->_readyHandler) { + self->_readyHandler(self); + } + if (self->_wantsToPlay) { + [self play]; + } + } + }; +} + +- (SGBlock)setPlaybackState:(SGInfoAction *)action +{ + SGPlaybackState state = 0; + if (self->_flags.playing) { + state |= SGPlaybackStatePlaying; + } + if (self->_flags.seekingIndex > 0) { + state |= SGPlaybackStateSeeking; + } + if (self->_flags.stateInfo.player == SGPlayerStateReady && + (!self->_flags.audioAvailable || self->_flags.audioFinished) && + (!self->_flags.videoAvailable || self->_flags.videoFinished)) { + state |= SGPlaybackStateFinished; + } + if (self->_flags.stateInfo.playback == state) { + return ^{}; + } + *action |= SGInfoActionStatePlayback; + self->_flags.stateInfo.playback = state; + SGBlock b1 = ^{}; + if (state & SGPlaybackStateFinished) { + [self setCachedDuration:kCMTimeZero action:action]; + [self setPlaybackTime:self->_flags.timeInfo.duration action:action]; + } + if (state & SGPlaybackStateFinished) { + b1 = ^{ + [self->_clock pause]; + [self->_audioRenderer finish]; + [self->_videoRenderer finish]; + }; + } else if (state & SGPlaybackStatePlaying) { + b1 = ^{ + [self->_clock resume]; + [self->_audioRenderer resume]; + [self->_videoRenderer resume]; + }; + } else { + b1 = ^{ + [self->_clock pause]; + [self->_audioRenderer pause]; + [self->_videoRenderer pause]; + }; + } + return b1; +} + +- (SGBlock)setLoadingState:(SGLoadingState)state action:(SGInfoAction *)action +{ + if (self->_flags.stateInfo.loading == state) { + return ^{}; + } + *action |= SGInfoActionStateLoading; + self->_flags.stateInfo.loading = state; + return ^{}; +} + +- (void)setPlaybackTime:(CMTime)time action:(SGInfoAction *)action +{ + if (CMTimeCompare(self->_flags.timeInfo.playback, time) == 0) { + return; + } + *action |= SGInfoActionTimePlayback; + self->_flags.timeInfo.playback = time; +} + +- (void)setDuration:(CMTime)duration action:(SGInfoAction *)action +{ + if (CMTimeCompare(self->_flags.timeInfo.duration, duration) == 0) { + return; + } + *action |= SGInfoActionTimeDuration; + self->_flags.timeInfo.duration = duration; +} + +- (void)setCachedDuration:(CMTime)duration action:(SGInfoAction *)action +{ + if (CMTimeCompare(self->_flags.timeInfo.cached, duration) == 0) { + return; + } + *action |= SGInfoActionTimeCached; + self->_flags.timeInfo.cached = duration; +} + +#pragma mark - Setter & Getter + +- (BOOL)stateInfo:(SGStateInfo *)stateInfo timeInfo:(SGTimeInfo *)timeInfo error:(NSError **)error +{ + __block NSError *err = nil; + SGLockEXE00(self->_lock, ^{ + if (stateInfo) { + *stateInfo = self->_flags.stateInfo; + } + if (timeInfo) { + *timeInfo = self->_flags.timeInfo; + } + err = self->_flags.error; + }); + if (error) { + *error = err; + } + return YES; +} + +- (SGPlayerItem *)currentItem +{ + __block SGPlayerItem *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = self->_currentItem; + }); + return ret; +} + +- (void)setRate:(Float64)rate +{ + SGLockCondEXE11(self->_lock, ^BOOL { + return self->_rate != rate; + }, ^SGBlock { + self->_rate = rate; + return nil; + }, ^BOOL(SGBlock block) { + self->_clock.rate = rate; + self->_audioRenderer.rate = rate; + self->_videoRenderer.rate = rate; + return YES; + }); +} + +- (Float64)rate +{ + __block Float64 ret = 1.0; + SGLockEXE00(self->_lock, ^{ + ret = self->_rate; + }); + return ret; +} + +- (SGClock *)clock +{ + __block SGClock *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = self->_clock; + }); + return ret; +} + +- (SGAudioRenderer *)audioRenderer +{ + __block SGAudioRenderer *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = self->_audioRenderer; + }); + return ret; +} + +- (SGVideoRenderer *)videoRenderer +{ + __block SGVideoRenderer *ret = nil; + SGLockEXE00(self->_lock, ^{ + ret = self->_videoRenderer; + }); + return ret; +} + +#pragma mark - Item + +- (BOOL)replaceWithURL:(NSURL *)URL +{ + return [self replaceWithAsset:URL ? [[SGURLAsset alloc] initWithURL:URL] : nil]; +} + +- (BOOL)replaceWithAsset:(SGAsset *)asset +{ + return [self replaceWithPlayerItem:asset ? [[SGPlayerItem alloc] initWithAsset:asset] : nil]; +} + +- (BOOL)replaceWithPlayerItem:(SGPlayerItem *)item +{ + [self stop]; + if (!item) { + return NO; + } + return SGLockEXE11(self->_lock, ^SGBlock { + self->_currentItem = item; + self->_currentItem.delegate = self; + self->_currentItem.demuxerOptions = self->_options.demuxer; + self->_currentItem.decoderOptions = self->_options.decoder; + self->_currentItem.processorOptions = self->_options.processor; + self->_currentItem.audioDescriptor = self->_audioRenderer.descriptor; + self->_audioRenderer.options = self->_options.renderer; + self->_videoRenderer.options = self->_options.renderer; + return nil; + }, ^BOOL(SGBlock block) { + return [item open]; + }); +} + +- (BOOL)stop +{ + [SGActivity removeTarget:self]; + return SGLockEXE10(self->_lock, ^SGBlock { + SGPlayerItem *currentItem = self->_currentItem; + self->_currentItem = nil; + self->_flags.error = nil; + self->_flags.playing = NO; + self->_flags.seekingIndex = 0; + self->_flags.audioFinished = NO; + self->_flags.videoFinished = NO; + self->_flags.audioAvailable = NO; + self->_flags.videoAvailable = NO; + self->_flags.additionalAction = SGInfoActionNone; + self->_flags.lastNotificationTime = 0.0; + self->_flags.timeInfo.cached = kCMTimeInvalid; + self->_flags.timeInfo.playback = kCMTimeInvalid; + self->_flags.timeInfo.duration = kCMTimeInvalid; + self->_flags.stateInfo.player = SGPlayerStateNone; + self->_flags.stateInfo.loading = SGLoadingStateNone; + self->_flags.stateInfo.playback = SGPlaybackStateNone; + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = [self setPlayerState:SGPlayerStateNone action:&action]; + SGBlock b2 = [self setPlaybackState:&action]; + SGBlock b3 = [self setLoadingState:SGLoadingStateNone action:&action]; + SGBlock b4 = [self infoCallback:action]; + return ^{ + [currentItem close]; + [self->_clock close]; + [self->_audioRenderer close]; + [self->_videoRenderer close]; + b1(); b2(); b3(); b4(); + }; + }); +} + +#pragma mark - Playback + +- (BOOL)play +{ + self->_wantsToPlay = YES; + [SGActivity addTarget:self]; + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.stateInfo.player == SGPlayerStateReady; + }, ^SGBlock { + self->_flags.playing = YES; + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = [self setPlaybackState:&action]; + SGBlock b2 = [self infoCallback:action]; + return ^{b1(); b2();}; + }); +} + +- (BOOL)pause +{ + self->_wantsToPlay = NO; + [SGActivity removeTarget:self]; + return SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.stateInfo.player == SGPlayerStateReady; + }, ^SGBlock { + self->_flags.playing = NO; + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = [self setPlaybackState:&action]; + SGBlock b2 = [self infoCallback:action]; + return ^{b1(); b2();}; + }); +} + +- (BOOL)seekable +{ + SGPlayerItem *currentItem = [self currentItem]; + return [currentItem seekable]; +} + +- (BOOL)seekToTime:(CMTime)time result:(SGSeekResult)result +{ + __block NSUInteger seekingCount = 0; + __block SGPlayerItem *currentItem = nil; + BOOL ret = SGLockCondEXE10(self->_lock, ^BOOL { + return self->_flags.stateInfo.player == SGPlayerStateReady; + }, ^SGBlock { + self->_flags.seekingIndex += 1; + currentItem = self->_currentItem; + seekingCount = self->_flags.seekingIndex; + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = [self setPlaybackState:&action]; + SGBlock b2 = [self infoCallback:action]; + return ^{b1(); b2();}; + }); + if (!ret) { + return NO; + } + SGWeakify(self) + return [currentItem seekToTime:time result:^(CMTime time, NSError *error) { + SGStrongify(self) + SGLockCondEXE11(self->_lock, ^BOOL { + return seekingCount == self->_flags.seekingIndex; + }, ^SGBlock { + SGBlock b1 = ^{}; + self->_flags.seekingIndex = 0; + if (!error) { + self->_flags.audioFinished = NO; + self->_flags.videoFinished = NO; + self->_flags.lastNotificationTime = 0.0; + b1 = ^{ + [self->_clock flush]; + [self->_audioRenderer flush]; + [self->_videoRenderer flush]; + }; + } + SGInfoAction action = SGInfoActionNone; + SGBlock b2 = [self setPlaybackState:&action]; + SGBlock b3 = [self infoCallback:action]; + return ^{b1(); b2(); b3();}; + }, ^BOOL(SGBlock block) { + block(); + if (result) { + [self callback:^{ + result(time, error); + }]; + } + return YES; + }); + }]; +} + +#pragma mark - SGClockDelegate + +- (void)clock:(SGClock *)clock didChcnageCurrentTime:(CMTime)currentTime +{ + SGLockEXE10(self->_lock, ^SGBlock { + SGInfoAction action = SGInfoActionNone; + [self setPlaybackTime:currentTime action:&action]; + return [self infoCallback:action]; + }); +} + +#pragma mark - SGRenderableDelegate + +- (void)renderable:(id)renderable didChangeState:(SGRenderableState)state +{ + NSAssert(state != SGRenderableStateFailed, @"Invaild renderer, %@", renderable); +} + +- (void)renderable:(id)renderable didChangeCapacity:(SGCapacity)capacity +{ + if (SGCapacityIsEmpty(capacity)) { + SGLockEXE10(self->_lock, ^SGBlock { + if (SGCapacityIsEmpty(self->_audioRenderer.capacity) && [self->_currentItem isFinished:SGMediaTypeAudio]) { + self->_flags.audioFinished = YES; + } + if (SGCapacityIsEmpty(self->_videoRenderer.capacity) && [self->_currentItem isFinished:SGMediaTypeVideo]) { + self->_flags.videoFinished = YES; + } + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = [self setPlaybackState:&action]; + SGBlock b2 = [self infoCallback:action]; + return ^{b1(); b2();}; + }); + } +} + +- (__kindof SGFrame *)renderable:(id)renderable fetchFrame:(SGTimeReader)timeReader +{ + SGPlayerItem *currentItem = self.currentItem; + if (renderable == self->_audioRenderer) { + return [currentItem copyAudioFrame:timeReader]; + } else if (renderable == self->_videoRenderer) { + return [currentItem copyVideoFrame:timeReader]; + } + return nil; +} + +#pragma mark - SGPlayerItemDelegate + +- (void)playerItem:(SGPlayerItem *)playerItem didChangeState:(SGPlayerItemState)state +{ + SGLockEXE10(self->_lock, ^SGBlock { + SGInfoAction action = SGInfoActionNone; + SGBlock b1 = ^{}, b2 = ^{}, b3 = ^{}, b4 = ^{}; + switch (state) { + case SGPlayerItemStateOpening: { + b1 = [self setPlayerState:SGPlayerStatePreparing action:&action]; + } + break; + case SGPlayerItemStateOpened: { + CMTime duration = self->_currentItem.duration; + [self setDuration:duration action:&action]; + [self setPlaybackTime:kCMTimeZero action:&action]; + [self setCachedDuration:kCMTimeZero action:&action]; + b1 = ^{ + [self->_clock open]; + if ([playerItem isAvailable:SGMediaTypeAudio]) { + self->_flags.audioAvailable = YES; + [self->_audioRenderer open]; + } + if ([playerItem isAvailable:SGMediaTypeVideo]) { + self->_flags.videoAvailable = YES; + [self->_videoRenderer open]; + } + }; + b2 = [self setPlayerState:SGPlayerStateReady action:&action]; + b3 = [self setLoadingState:SGLoadingStateStalled action:&action]; + b4 = ^{ + [playerItem start]; + }; + } + break; + case SGPlayerItemStateReading: { + b1 = [self setPlaybackState:&action]; + } + break; + case SGPlayerItemStateFinished: { + b1 = [self setLoadingState:SGLoadingStateFinished action:&action]; + if (SGCapacityIsEmpty(self->_audioRenderer.capacity)) { + self->_flags.audioFinished = YES; + } + if (SGCapacityIsEmpty(self->_videoRenderer.capacity)) { + self->_flags.videoFinished = YES; + } + b2 = [self setPlaybackState:&action]; + } + break; + case SGPlayerItemStateFailed: { + self->_flags.error = [playerItem.error copy]; + b1 = [self setPlayerState:SGPlayerStateFailed action:&action]; + } + break; + default: + break; + } + SGBlock b5 = [self infoCallback:action]; + return ^{b1(); b2(); b3(); b4(); b5();}; + }); +} + +- (void)playerItem:(SGPlayerItem *)playerItem didChangeCapacity:(SGCapacity)capacity type:(SGMediaType)type +{ + BOOL should = NO; + if (type == SGMediaTypeAudio && + ![playerItem isFinished:SGMediaTypeAudio]) { + should = YES; + } else if (type == SGMediaTypeVideo && + ![playerItem isFinished:SGMediaTypeVideo] && + (![playerItem isAvailable:SGMediaTypeAudio] || [playerItem isFinished:SGMediaTypeAudio])) { + should = YES; + } + if (should) { + SGLockEXE10(self->_lock, ^SGBlock { + SGInfoAction action = SGInfoActionNone; + CMTime duration = capacity.duration; + SGLoadingState loadingState = (SGCapacityIsEmpty(capacity) || self->_flags.stateInfo.loading == SGLoadingStateFinished) ? SGLoadingStateStalled : SGLoadingStatePlaybale; + [self setCachedDuration:duration action:&action]; + SGBlock b1 = [self setLoadingState:loadingState action:&action]; + SGBlock b2 = [self infoCallback:action]; + return ^{b1(); b2();}; + }); + } +} + +#pragma mark - Notification + +- (SGBlock)infoCallback:(SGInfoAction)action +{ + action &= ~self->_actionMask; + BOOL needed = NO; + if (action & SGInfoActionState) { + needed = YES; + } else if (action & SGInfoActionTime) { + NSTimeInterval currentTime = CACurrentMediaTime(); + NSTimeInterval interval = currentTime - self->_flags.lastNotificationTime; + if (interval >= self->_minimumTimeInfoInterval) { + needed = YES; + self->_flags.lastNotificationTime = currentTime; + } else { + self->_flags.additionalAction |= (action & SGInfoActionTime); + } + } + if (!needed) { + return ^{}; + } + action |= self->_flags.additionalAction; + self->_flags.additionalAction = SGInfoActionNone; + NSValue *timeInfo = [NSValue value:&self->_flags.timeInfo withObjCType:@encode(SGTimeInfo)]; + NSValue *stateInfo = [NSValue value:&self->_flags.stateInfo withObjCType:@encode(SGStateInfo)]; + id userInfo = @{SGPlayerTimeInfoUserInfoKey : timeInfo, + SGPlayerStateInfoUserInfoKey : stateInfo, + SGPlayerInfoActionUserInfoKey : @(action)}; + return ^{ + [self callback:^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SGPlayerDidChangeInfosNotification + object:self + userInfo:userInfo]; + }]; + }; +} + +- (void)callback:(void (^)(void))block +{ + if (!block) { + return; + } + if (self->_notificationQueue) { + [self->_notificationQueue addOperation:[NSBlockOperation blockOperationWithBlock:block]]; + } else { + block(); + } +} + ++ (SGTimeInfo)timeInfoFromUserInfo:(NSDictionary *)userInfo +{ + SGTimeInfo info; + NSValue *value = userInfo[SGPlayerTimeInfoUserInfoKey]; + [value getValue:&info]; + return info; +} + ++ (SGStateInfo)stateInfoFromUserInfo:(NSDictionary *)userInfo +{ + SGStateInfo info; + NSValue *value = userInfo[SGPlayerStateInfoUserInfoKey]; + [value getValue:&info]; + return info; +} + ++ (SGInfoAction)infoActionFromUserInfo:(NSDictionary *)userInfo +{ + return [userInfo[SGPlayerInfoActionUserInfoKey] unsignedIntegerValue]; +} + +#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV +- (void)interruptionHandler:(NSNotification *)notification +{ + if (self->_pausesWhenInterrupted == NO) { + return; + } + AVAudioSessionInterruptionType type = [notification.userInfo[AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + if (type == AVAudioSessionInterruptionTypeBegan) { + [self pause]; + } +} +#endif + +@end diff --git a/SGPlayer/Classes/SGPlayerAction.h b/SGPlayer/Classes/SGPlayerAction.h deleted file mode 100644 index 604ff433..00000000 --- a/SGPlayer/Classes/SGPlayerAction.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// SGPlayerAction.h -// SGPlayer -// -// Created by Single on 2017/2/13. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGPlayerImp.h" - -@class SGState; -@class SGProgress; -@class SGPlayable; -@class SGError; - -NS_ASSUME_NONNULL_BEGIN - -// extern -#if defined(__cplusplus) -#define SGPLAYER_EXTERN extern "C" -#else -#define SGPLAYER_EXTERN extern -#endif - -// notification name -SGPLAYER_EXTERN NSString * const SGPlayerErrorNotificationName; // player error -SGPLAYER_EXTERN NSString * const SGPlayerStateChangeNotificationName; // player state change -SGPLAYER_EXTERN NSString * const SGPlayerProgressChangeNotificationName; // player play progress change -SGPLAYER_EXTERN NSString * const SGPlayerPlayableChangeNotificationName; // player playable progress change - -// notification userinfo key -SGPLAYER_EXTERN NSString * const SGPlayerErrorKey; // error - -SGPLAYER_EXTERN NSString * const SGPlayerStatePreviousKey; // state -SGPLAYER_EXTERN NSString * const SGPlayerStateCurrentKey; // state - -SGPLAYER_EXTERN NSString * const SGPlayerProgressPercentKey; // progress -SGPLAYER_EXTERN NSString * const SGPlayerProgressCurrentKey; // progress -SGPLAYER_EXTERN NSString * const SGPlayerProgressTotalKey; // progress - -SGPLAYER_EXTERN NSString * const SGPlayerPlayablePercentKey; // playable -SGPLAYER_EXTERN NSString * const SGPlayerPlayableCurrentKey; // playable -SGPLAYER_EXTERN NSString * const SGPlayerPlayableTotalKey; // playable - - -#pragma mark - SGPlayer Action Category - -@interface SGPlayer (SGPlayerAction) - -- (void)registerPlayerNotificationTarget:(id)target - stateAction:(nullable SEL)stateAction - progressAction:(nullable SEL)progressAction - playableAction:(nullable SEL)playableAction; // object's class is NSNotification - -- (void)registerPlayerNotificationTarget:(id)target - stateAction:(nullable SEL)stateAction - progressAction:(nullable SEL)progressAction - playableAction:(nullable SEL)playableAction - errorAction:(nullable SEL)errorAction; - -- (void)removePlayerNotificationTarget:(id)target; - -@end - - -#pragma mark - SGPlayer Action Models - -@interface SGModel : NSObject - -+ (SGState *)stateFromUserInfo:(NSDictionary *)userInfo; -+ (SGProgress *)progressFromUserInfo:(NSDictionary *)userInfo; -+ (SGPlayable *)playableFromUserInfo:(NSDictionary *)userInfo; -+ (SGError *)errorFromUserInfo:(NSDictionary *)userInfo; - -@end - -@interface SGState : SGModel -@property (nonatomic, assign) SGPlayerState previous; -@property (nonatomic, assign) SGPlayerState current; -@end - -@interface SGProgress : SGModel -@property (nonatomic, assign) CGFloat percent; -@property (nonatomic, assign) CGFloat current; -@property (nonatomic, assign) CGFloat total; -@end - -@interface SGPlayable : SGModel -@property (nonatomic, assign) CGFloat percent; -@property (nonatomic, assign) CGFloat current; -@property (nonatomic, assign) CGFloat total; -@end - -@interface SGErrorEvent : SGModel -@property (nonatomic, copy, nullable) NSDate * date; -@property (nonatomic, copy, nullable) NSString * URI; -@property (nonatomic, copy, nullable) NSString * serverAddress; -@property (nonatomic, copy, nullable) NSString * playbackSessionID; -@property (nonatomic, assign) NSInteger errorStatusCode; -@property (nonatomic, copy) NSString * errorDomain; -@property (nonatomic, copy, nullable) NSString * errorComment; -@end - -@interface SGError : SGModel -@property (nonatomic, copy) NSError * error; -@property (nonatomic, copy, nullable) NSData * extendedLogData; -@property (nonatomic, assign) NSStringEncoding extendedLogDataStringEncoding; -@property (nonatomic, copy, nullable) NSArray * errorEvents; -@end - -NS_ASSUME_NONNULL_END diff --git a/SGPlayer/Classes/SGPlayerAction.m b/SGPlayer/Classes/SGPlayerAction.m deleted file mode 100644 index ae1b38f1..00000000 --- a/SGPlayer/Classes/SGPlayerAction.m +++ /dev/null @@ -1,143 +0,0 @@ -// -// SGPlayerAction.m -// SGPlayer -// -// Created by Single on 2017/2/13. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGPlayerAction.h" - -// notification name -NSString * const SGPlayerErrorNotificationName = @"SGPlayerErrorNotificationName"; // player error -NSString * const SGPlayerStateChangeNotificationName = @"SGPlayerStateChangeNotificationName"; // player state change -NSString * const SGPlayerProgressChangeNotificationName = @"SGPlayerProgressChangeNotificationName"; // player play progress change -NSString * const SGPlayerPlayableChangeNotificationName = @"SGPlayerPlayableChangeNotificationName"; // player playable progress change - -// notification userinfo key -NSString * const SGPlayerErrorKey = @"error"; // error - -NSString * const SGPlayerStatePreviousKey = @"previous"; // state -NSString * const SGPlayerStateCurrentKey = @"current"; // state - -NSString * const SGPlayerProgressPercentKey = @"percent"; // progress -NSString * const SGPlayerProgressCurrentKey = @"current"; // progress -NSString * const SGPlayerProgressTotalKey = @"total"; // progress - -NSString * const SGPlayerPlayablePercentKey = @"percent"; // playable -NSString * const SGPlayerPlayableCurrentKey = @"current"; // playable -NSString * const SGPlayerPlayableTotalKey = @"total"; // playable - - -#pragma mark - SGPlayer Action Category - -@implementation SGPlayer (SGPlayerAction) - -- (void)registerPlayerNotificationTarget:(id)target - stateAction:(nullable SEL)stateAction - progressAction:(nullable SEL)progressAction - playableAction:(nullable SEL)playableAction -{ - [self registerPlayerNotificationTarget:target - stateAction:stateAction - progressAction:progressAction - playableAction:playableAction - errorAction:nil]; -} - -- (void)registerPlayerNotificationTarget:(id)target - stateAction:(nullable SEL)stateAction - progressAction:(nullable SEL)progressAction - playableAction:(nullable SEL)playableAction - errorAction:(nullable SEL)errorAction -{ - if (!target) return; - [self removePlayerNotificationTarget:target]; - - if (stateAction) { - [[NSNotificationCenter defaultCenter] addObserver:target selector:stateAction name:SGPlayerStateChangeNotificationName object:self]; - } - if (progressAction) { - [[NSNotificationCenter defaultCenter] addObserver:target selector:progressAction name:SGPlayerProgressChangeNotificationName object:self]; - } - if (playableAction) { - [[NSNotificationCenter defaultCenter] addObserver:target selector:playableAction name:SGPlayerPlayableChangeNotificationName object:self]; - } - if (errorAction) { - [[NSNotificationCenter defaultCenter] addObserver:target selector:errorAction name:SGPlayerErrorNotificationName object:self]; - } -} - -- (void)removePlayerNotificationTarget:(id)target -{ - [[NSNotificationCenter defaultCenter] removeObserver:target name:SGPlayerStateChangeNotificationName object:self]; - [[NSNotificationCenter defaultCenter] removeObserver:target name:SGPlayerProgressChangeNotificationName object:self]; - [[NSNotificationCenter defaultCenter] removeObserver:target name:SGPlayerPlayableChangeNotificationName object:self]; - [[NSNotificationCenter defaultCenter] removeObserver:target name:SGPlayerErrorNotificationName object:self]; -} - -@end - - -#pragma mark - SGPlayer Action Models - -@implementation SGModel - -+ (SGState *)stateFromUserInfo:(NSDictionary *)userInfo -{ - SGState * state = [[SGState alloc] init]; - state.previous = [[userInfo objectForKey:SGPlayerStatePreviousKey] integerValue]; - state.current = [[userInfo objectForKey:SGPlayerStateCurrentKey] integerValue]; - return state; -} - -+ (SGProgress *)progressFromUserInfo:(NSDictionary *)userInfo -{ - SGProgress * progress = [[SGProgress alloc] init]; - progress.percent = [[userInfo objectForKey:SGPlayerProgressPercentKey] doubleValue]; - progress.current = [[userInfo objectForKey:SGPlayerProgressCurrentKey] doubleValue]; - progress.total = [[userInfo objectForKey:SGPlayerProgressTotalKey] doubleValue]; - return progress; -} - -+ (SGPlayable *)playableFromUserInfo:(NSDictionary *)userInfo -{ - SGPlayable * playable = [[SGPlayable alloc] init]; - playable.percent = [[userInfo objectForKey:SGPlayerPlayablePercentKey] doubleValue]; - playable.current = [[userInfo objectForKey:SGPlayerPlayableCurrentKey] doubleValue]; - playable.total = [[userInfo objectForKey:SGPlayerPlayableTotalKey] doubleValue]; - return playable; -} - -+ (SGError *)errorFromUserInfo:(NSDictionary *)userInfo -{ - SGError * error = [userInfo objectForKey:SGPlayerErrorKey]; - if ([error isKindOfClass:[SGError class]]) { - return error; - } else if ([error isKindOfClass:[NSError class]]) { - SGError * obj = [[SGError alloc] init]; - obj.error = (NSError *)error; - return obj; - } else { - SGError * obj = [[SGError alloc] init]; - obj.error = [NSError errorWithDomain:@"SGPlayer error" code:-1 userInfo:nil]; - return obj; - } -} - -@end - -@implementation SGState -@end - -@implementation SGProgress -@end - -@implementation SGPlayable -@end - -@implementation SGErrorEvent -@end - -@implementation SGError -@end diff --git a/SGPlayer/Classes/SGPlayerDecoder.h b/SGPlayer/Classes/SGPlayerDecoder.h deleted file mode 100644 index 4a0fae91..00000000 --- a/SGPlayer/Classes/SGPlayerDecoder.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// SGPlayerDecoder.h -// SGPlayer -// -// Created by Single on 03/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import - -// decode type -typedef NS_ENUM(NSUInteger, SGDecoderType) { - SGDecoderTypeError, - SGDecoderTypeAVPlayer, - SGDecoderTypeFFmpeg, -}; - -// media format -typedef NS_ENUM(NSUInteger, SGMediaFormat) { - SGMediaFormatError, - SGMediaFormatUnknown, - SGMediaFormatMP3, - SGMediaFormatMPEG4, - SGMediaFormatMOV, - SGMediaFormatFLV, - SGMediaFormatM3U8, - SGMediaFormatRTMP, - SGMediaFormatRTSP, -}; - -@interface SGPlayerDecoder : NSObject - -+ (instancetype)decoderByDefault; -+ (instancetype)decoderByAVPlayer; -+ (instancetype)decoderByFFmpeg; - -@property (nonatomic, assign) BOOL hardwareAccelerateEnableForFFmpeg; // default is YES - -@property (nonatomic, assign) SGDecoderType decodeTypeForUnknown; // default is SGDecodeTypeFFmpeg -@property (nonatomic, assign) SGDecoderType decodeTypeForMP3; // default is SGDecodeTypeAVPlayer -@property (nonatomic, assign) SGDecoderType decodeTypeForMPEG4; // default is SGDecodeTypeAVPlayer -@property (nonatomic, assign) SGDecoderType decodeTypeForMOV; // default is SGDecodeTypeAVPlayer -@property (nonatomic, assign) SGDecoderType decodeTypeForFLV; // default is SGDecodeTypeFFmpeg -@property (nonatomic, assign) SGDecoderType decodeTypeForM3U8; // default is SGDecodeTypeAVPlayer -@property (nonatomic, assign) SGDecoderType decodeTypeForRTMP; // default is SGDecodeTypeFFmpeg -@property (nonatomic, assign) SGDecoderType decodeTypeForRTSP; // default is SGDecodeTypeFFmpeg - -- (SGMediaFormat)mediaFormatForContentURL:(NSURL *)contentURL; -- (SGDecoderType)decoderTypeForContentURL:(NSURL *)contentURL; - - -#pragma mark - FFmpeg optioins - -- (NSDictionary *)FFmpegFormatContextOptions; -- (void)setFFmpegFormatContextOptionIntValue:(int64_t)value forKey:(NSString *)key; -- (void)setFFmpegFormatContextOptionStringValue:(NSString *)value forKey:(NSString *)key; -- (void)removeFFmpegFormatContextOptionForKey:(NSString *)key; - -- (NSDictionary *)FFmpegCodecContextOptions; -- (void)setFFmpegCodecContextOptionIntValue:(int64_t)value forKey:(NSString *)key; -- (void)setFFmpegCodecContextOptionStringValue:(NSString *)value forKey:(NSString *)key; -- (void)removeFFmpegCodecContextOptionForKey:(NSString *)key; - -@end diff --git a/SGPlayer/Classes/SGPlayerDecoder.m b/SGPlayer/Classes/SGPlayerDecoder.m deleted file mode 100644 index 5a3e4421..00000000 --- a/SGPlayer/Classes/SGPlayerDecoder.m +++ /dev/null @@ -1,192 +0,0 @@ -// -// SGPlayerDecoder.m -// SGPlayer -// -// Created by Single on 03/01/2017. -// Copyright © 2017 single. All rights reserved. -// - -#import "SGPlayerDecoder.h" - -@interface SGPlayerDecoder () - -@property (nonatomic, strong) NSMutableDictionary * formatContextOptions; -@property (nonatomic, strong) NSMutableDictionary * codecContextOptions; - -@end - -@implementation SGPlayerDecoder - -+ (instancetype)decoderByDefault -{ - SGPlayerDecoder * decoder = [[self alloc] init]; - decoder.decodeTypeForUnknown = SGDecoderTypeFFmpeg; - decoder.decodeTypeForMP3 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForMPEG4 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForMOV = SGDecoderTypeAVPlayer; - decoder.decodeTypeForFLV = SGDecoderTypeFFmpeg; - decoder.decodeTypeForM3U8 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForRTMP = SGDecoderTypeFFmpeg; - decoder.decodeTypeForRTSP = SGDecoderTypeFFmpeg; - return decoder; -} - -+ (instancetype)decoderByAVPlayer -{ - SGPlayerDecoder * decoder = [[self alloc] init]; - decoder.decodeTypeForUnknown = SGDecoderTypeAVPlayer; - decoder.decodeTypeForMP3 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForMPEG4 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForMOV = SGDecoderTypeAVPlayer; - decoder.decodeTypeForFLV = SGDecoderTypeAVPlayer; - decoder.decodeTypeForM3U8 = SGDecoderTypeAVPlayer; - decoder.decodeTypeForRTMP = SGDecoderTypeAVPlayer; - decoder.decodeTypeForRTSP = SGDecoderTypeAVPlayer; - return decoder; -} - -+ (instancetype)decoderByFFmpeg -{ - SGPlayerDecoder * decoder = [[self alloc] init]; - decoder.decodeTypeForUnknown = SGDecoderTypeFFmpeg; - decoder.decodeTypeForMP3 = SGDecoderTypeFFmpeg; - decoder.decodeTypeForMPEG4 = SGDecoderTypeFFmpeg; - decoder.decodeTypeForMOV = SGDecoderTypeFFmpeg; - decoder.decodeTypeForFLV = SGDecoderTypeFFmpeg; - decoder.decodeTypeForM3U8 = SGDecoderTypeFFmpeg; - decoder.decodeTypeForRTMP = SGDecoderTypeFFmpeg; - decoder.decodeTypeForRTSP = SGDecoderTypeFFmpeg; - return decoder; -} - -- (instancetype)init -{ - if (self = [super init]) { - self.hardwareAccelerateEnableForFFmpeg = YES; - [self configFFmpegOptions]; - } - return self; -} - -- (SGMediaFormat)mediaFormatForContentURL:(NSURL *)contentURL -{ - if (!contentURL) return SGMediaFormatError; - - NSString * path; - if (contentURL.isFileURL) { - path = contentURL.path; - } else { - path = contentURL.absoluteString; - } - path = [path lowercaseString]; - - if ([path hasPrefix:@"rtmp:"]) - { - return SGMediaFormatRTMP; - } - else if ([path hasPrefix:@"rtsp:"]) - { - return SGMediaFormatRTSP; - } - else if ([path containsString:@".flv"]) - { - return SGMediaFormatFLV; - } - else if ([path containsString:@".mp4"]) - { - return SGMediaFormatMPEG4; - } - else if ([path containsString:@".mp3"]) - { - return SGMediaFormatMP3; - } - else if ([path containsString:@".m3u8"]) - { - return SGMediaFormatM3U8; - } - else if ([path containsString:@".mov"]) - { - return SGMediaFormatMOV; - } - return SGMediaFormatUnknown; -} - -- (SGDecoderType)decoderTypeForContentURL:(NSURL *)contentURL -{ - SGMediaFormat mediaFormat = [self mediaFormatForContentURL:contentURL]; - switch (mediaFormat) { - case SGMediaFormatError: - return SGDecoderTypeError; - case SGMediaFormatUnknown: - return self.decodeTypeForUnknown; - case SGMediaFormatMP3: - return self.decodeTypeForMP3; - case SGMediaFormatMPEG4: - return self.decodeTypeForMPEG4; - case SGMediaFormatMOV: - return self.decodeTypeForMOV; - case SGMediaFormatFLV: - return self.decodeTypeForFLV; - case SGMediaFormatM3U8: - return self.decodeTypeForM3U8; - case SGMediaFormatRTMP: - return self.decodeTypeForRTMP; - case SGMediaFormatRTSP: - return self.decodeTypeForRTSP; - } -} - - -#pragma mark - ffmpeg opstions - -- (void)configFFmpegOptions -{ - self.formatContextOptions = [NSMutableDictionary dictionary]; - self.codecContextOptions = [NSMutableDictionary dictionary]; - - [self setFFmpegFormatContextOptionStringValue:@"SGPlayer" forKey:@"user-agent"]; - [self setFFmpegFormatContextOptionIntValue:20 * 1000 * 1000 forKey:@"timeout"]; - [self setFFmpegFormatContextOptionIntValue:1 forKey:@"reconnect"]; -} - -- (NSDictionary *)FFmpegFormatContextOptions -{ - return [self.formatContextOptions copy]; -} - -- (void)setFFmpegFormatContextOptionIntValue:(int64_t)value forKey:(NSString *)key -{ - [self.formatContextOptions setValue:@(value) forKey:key]; -} - -- (void)setFFmpegFormatContextOptionStringValue:(NSString *)value forKey:(NSString *)key -{ - [self.formatContextOptions setValue:value forKey:key]; -} - -- (void)removeFFmpegFormatContextOptionForKey:(NSString *)key -{ - [self.formatContextOptions removeObjectForKey:key]; -} - -- (NSDictionary *)FFmpegCodecContextOptions -{ - return [self.codecContextOptions copy]; -} - -- (void)setFFmpegCodecContextOptionIntValue:(int64_t)value forKey:(NSString *)key -{ - [self.codecContextOptions setValue:@(value) forKey:key]; -} - -- (void)setFFmpegCodecContextOptionStringValue:(NSString *)value forKey:(NSString *)key -{ - [self.codecContextOptions setValue:value forKey:key]; -} - -- (void)removeFFmpegCodecContextOptionForKey:(NSString *)key -{ - [self.codecContextOptions removeObjectForKey:key]; -} - -@end diff --git a/SGPlayer/Classes/SGPlayerHeader.h b/SGPlayer/Classes/SGPlayerHeader.h new file mode 100644 index 00000000..76081fcc --- /dev/null +++ b/SGPlayer/Classes/SGPlayerHeader.h @@ -0,0 +1,142 @@ +// +// SGPlayerHeader.h +// SGPlayer +// +// Created by Single on 2019/8/14. +// Copyright © 2019 single. All rights reserved. +// + +#ifndef SGPlayerHeader_h +#define SGPlayerHeader_h + +#import + +#if __has_include() + +FOUNDATION_EXPORT double SGPlayerVersionNumber; +FOUNDATION_EXPORT const unsigned char SGPlayerVersionString[]; + +#import +#import +#import + +#import +#import +#import +#import +#import + +#import +#import + +#import +#import +#import + +#import +#import +#import + +#import +#import +#import + +#import +#import + +#import +#import +#import + +#import +#import +#import +#import + +#import +#import +#import +#import +#import + +#import +#import +#import + +#import +#import +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#import + +#else + +#import "SGTime.h" +#import "SGError.h" +#import "SGDefines.h" + +#import "SGOptions.h" +#import "SGDemuxerOptions.h" +#import "SGDecoderOptions.h" +#import "SGRendererOptions.h" +#import "SGProcessorOptions.h" + +#import "SGAudioDescriptor.h" +#import "SGVideoDescriptor.h" + +#import "SGAsset.h" +#import "SGURLAsset.h" +#import "SGMutableAsset.h" + +#import "SGTrack.h" +#import "SGMutableTrack.h" +#import "SGTrackSelection.h" + +#import "SGSegment.h" +#import "SGURLSegment.h" +#import "SGPaddingSegment.h" + +#import "SGPlayerItem.h" +#import "SGFrameOutput.h" +#import "SGPacketOutput.h" + +#import "SGClock.h" +#import "SGVRViewport.h" +#import "SGAudioRenderer.h" +#import "SGVideoRenderer.h" + +#import "SGData.h" +#import "SGFrame.h" +#import "SGCapacity.h" +#import "SGAudioFrame.h" +#import "SGVideoFrame.h" + +#import "SGProcessor.h" +#import "SGAudioProcessor.h" +#import "SGVideoProcessor.h" + +#import "SGSonic.h" +#import "SGSWScale.h" +#import "SGSWResample.h" +#import "SGAudioMixer.h" +#import "SGAudioMixerUnit.h" +#import "SGAudioFormatter.h" + +#import "SGPLFView.h" +#import "SGPLFImage.h" +#import "SGPLFColor.h" +#import "SGPLFObject.h" +#import "SGPLFScreen.h" +#import "SGPLFTargets.h" + +#endif + +#endif /* SGPlayerHeader_h */ diff --git a/SGPlayer/Classes/SGPlayerImp.h b/SGPlayer/Classes/SGPlayerImp.h deleted file mode 100644 index 6ce3fd7f..00000000 --- a/SGPlayer/Classes/SGPlayerImp.h +++ /dev/null @@ -1,136 +0,0 @@ -// -// SGPlayer.h -// SGPlayer -// -// Created by Single on 16/6/28. -// Copyright © 2016年 single. All rights reserved. -// - -#import -#import "SGPlayerTrack.h" -#import "SGPlayerDecoder.h" - -// video type -typedef NS_ENUM(NSUInteger, SGVideoType) { - SGVideoTypeNormal, // normal - SGVideoTypeVR, // virtual reality -}; - -// player state -typedef NS_ENUM(NSUInteger, SGPlayerState) { - SGPlayerStateNone = 0, // none - SGPlayerStateBuffering = 1, // buffering - SGPlayerStateReadyToPlay = 2, // ready to play - SGPlayerStatePlaying = 3, // playing - SGPlayerStateSuspend = 4, // pause - SGPlayerStateFinished = 5, // finished - SGPlayerStateFailed = 6, // failed -}; - -// display mode -typedef NS_ENUM(NSUInteger, SGDisplayMode) { - SGDisplayModeNormal, // default - SGDisplayModeBox, -}; - -// video content mode -typedef NS_ENUM(NSUInteger, SGGravityMode) { - SGGravityModeResize, - SGGravityModeResizeAspect, - SGGravityModeResizeAspectFill, -}; - -// background mode -typedef NS_ENUM(NSUInteger, SGPlayerBackgroundMode) { - SGPlayerBackgroundModeNothing, - SGPlayerBackgroundModeAutoPlayAndPause, // default - SGPlayerBackgroundModeContinue, -}; - - -#pragma mark - SGPlayer - -@class SGError; - -NS_ASSUME_NONNULL_BEGIN - -@interface SGPlayer : NSObject - -+ (instancetype)new NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -+ (instancetype)player; - -@property (nonatomic, strong) SGPlayerDecoder * decoder; // default is [SGPlayerDecoder defaultDecoder] - -@property (nonatomic, copy, readonly) NSURL * contentURL; -@property (nonatomic, assign, readonly) SGVideoType videoType; - -@property (nonatomic, strong, readonly, nullable) SGError * error; - -- (void)replaceVideoWithURL:(nullable NSURL *)contentURL; -- (void)replaceVideoWithURL:(nullable NSURL *)contentURL videoType:(SGVideoType)videoType; - -// preview -@property (nonatomic, assign) SGDisplayMode displayMode; -@property (nonatomic, strong, readonly) SGPLFView * view; // graphics view -@property (nonatomic, assign) BOOL viewAnimationHidden; // default is YES; -@property (nonatomic, assign) SGGravityMode viewGravityMode; // default is SGGravityModeResizeAspect; -@property (nonatomic, copy) void (^viewTapAction)(SGPlayer * player, SGPLFView * view); -- (SGPLFImage *)snapshot; - -// control -@property (nonatomic, assign, readonly) SGPlayerState state; -@property (nonatomic, assign, readonly) CGSize presentationSize; -@property (nonatomic, assign, readonly) NSTimeInterval bitrate; -@property (nonatomic, assign, readonly) NSTimeInterval progress; -@property (nonatomic, assign, readonly) NSTimeInterval duration; -@property (nonatomic, assign, readonly) NSTimeInterval playableTime; - -@property (nonatomic, assign) SGPlayerBackgroundMode backgroundMode; // background mode -@property (nonatomic, assign) NSTimeInterval playableBufferInterval; // default is 2s -@property (nonatomic, assign) CGFloat volume; // default is 1 - -- (void)play; -- (void)pause; -- (void)stop; - -@property (nonatomic, assign, readonly) BOOL seekEnable; -@property (nonatomic, assign, readonly) BOOL seeking; -- (void)seekToTime:(NSTimeInterval)time; -- (void)seekToTime:(NSTimeInterval)time completeHandler:(nullable void(^)(BOOL finished))completeHandler; - -@end - - -#pragma mark - Tracks Category - -@interface SGPlayer (Tracks) - -@property (nonatomic, assign, readonly) BOOL videoEnable; -@property (nonatomic, assign, readonly) BOOL audioEnable; - -@property (nonatomic, strong, readonly) SGPlayerTrack * videoTrack; -@property (nonatomic, strong, readonly) SGPlayerTrack * audioTrack; - -@property (nonatomic, strong, readonly) NSArray * videoTracks; -@property (nonatomic, strong, readonly) NSArray * audioTracks; - -- (void)selectAudioTrack:(SGPlayerTrack *)audioTrack; -- (void)selectAudioTrackIndex:(int)audioTrackIndex; - -@end - - -#pragma mark - Thread Category - -@interface SGPlayer (Thread) - -@property (nonatomic, assign, readonly) BOOL videoDecodeOnMainThread; -@property (nonatomic, assign, readonly) BOOL audioDecodeOnMainThread; - -@end - -NS_ASSUME_NONNULL_END - -#import "SGPlayerAction.h" diff --git a/SGPlayer/Classes/SGPlayerImp.m b/SGPlayer/Classes/SGPlayerImp.m deleted file mode 100644 index 47dabb65..00000000 --- a/SGPlayer/Classes/SGPlayerImp.m +++ /dev/null @@ -1,596 +0,0 @@ -// -// SGPlayer.m -// SGPlayer -// -// Created by Single on 16/6/28. -// Copyright © 2016年 single. All rights reserved. -// - -#import "SGPlayerImp.h" -#import "SGPlayerMacro.h" -#import "SGPlayerNotification.h" -#import "SGDisplayView.h" -#import "SGAVPlayer.h" - -#import "SGPlayerBuildConfig.h" -#if SGPlayerBuildConfig_FFmpeg_Enable -#import "SGFFPlayer.h" -#else -#import "SGFFPlayerShell.h" -#endif - -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV -#import "SGAudioManager.h" -#endif - -@interface SGPlayer () - -@property (nonatomic, copy) NSURL * contentURL; -@property (nonatomic, assign) SGVideoType videoType; - -@property (nonatomic, strong) SGDisplayView * displayView; -@property (nonatomic, assign) SGDecoderType decoderType; -@property (nonatomic, strong) SGAVPlayer * avPlayer; - -#if SGPlayerBuildConfig_FFmpeg_Enable -@property (nonatomic, strong) SGFFPlayer * ffPlayer; -#else -@property (nonatomic, strong) SGFFPlayerShell * ffPlayer; -#endif - -@property (nonatomic, assign) BOOL needAutoPlay; -@property (nonatomic, assign) NSTimeInterval lastForegroundTimeInterval; - -@end - -@implementation SGPlayer - -+ (instancetype)player -{ - return [[self alloc] init]; -} - -- (instancetype)init -{ - if (self = [super init]) { -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [self setupNotification]; -#endif - self.decoder = [SGPlayerDecoder decoderByDefault]; - self.contentURL = nil; - self.videoType = SGVideoTypeNormal; - self.backgroundMode = SGPlayerBackgroundModeAutoPlayAndPause; - self.displayMode = SGDisplayModeNormal; - self.viewGravityMode = SGGravityModeResizeAspect; - self.playableBufferInterval = 2.f; - self.viewAnimationHidden = YES; - self.volume = 1; - self.displayView = [SGDisplayView displayViewWithAbstractPlayer:self]; - } - return self; -} - -- (void)replaceVideoWithURL:(nullable NSURL *)contentURL -{ - [self replaceVideoWithURL:contentURL videoType:SGVideoTypeNormal]; -} - -- (void)replaceVideoWithURL:(nullable NSURL *)contentURL videoType:(SGVideoType)videoType -{ - self.error = nil; - self.contentURL = contentURL; - self.decoderType = [self.decoder decoderTypeForContentURL:self.contentURL]; - self.videoType = videoType; - switch (self.videoType) - { - case SGVideoTypeNormal: - case SGVideoTypeVR: - break; - default: - self.videoType = SGVideoTypeNormal; - break; - } - - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - { - [self.ffPlayer stop]; - - if (!self.avPlayer) { - self.avPlayer =[SGAVPlayer playerWithAbstractPlayer:self]; - } - [self.avPlayer replaceVideo]; - } - break; - case SGDecoderTypeFFmpeg: - { - [self.avPlayer stop]; - - if (!self.ffPlayer) { -#if SGPlayerBuildConfig_FFmpeg_Enable - self.ffPlayer = [SGFFPlayer playerWithAbstractPlayer:self]; -#endif - } - [self.ffPlayer replaceVideo]; - } - break; - case SGDecoderTypeError: - { - [self.avPlayer stop]; - [self.ffPlayer stop]; - } - break; - } -} - -- (void)play -{ -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [UIApplication sharedApplication].idleTimerDisabled = YES; -#endif - - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - [self.avPlayer play]; - break; - case SGDecoderTypeFFmpeg: - [self.ffPlayer play]; - break; - case SGDecoderTypeError: - break; - } -} - -- (void)pause -{ -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [UIApplication sharedApplication].idleTimerDisabled = NO; -#endif - - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - [self.avPlayer pause]; - break; - case SGDecoderTypeFFmpeg: - [self.ffPlayer pause]; - break; - case SGDecoderTypeError: - break; - } -} - -- (void)stop -{ -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [UIApplication sharedApplication].idleTimerDisabled = NO; -#endif - - [self replaceVideoWithURL:nil]; -} - -- (BOOL)seekEnable -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.seekEnable; - break; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.seekEnable; - case SGDecoderTypeError: - return NO; - } -} - -- (BOOL)seeking -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.seeking; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.seeking; - case SGDecoderTypeError: - return NO; - } -} - -- (void)seekToTime:(NSTimeInterval)time -{ - [self seekToTime:time completeHandler:nil]; -} - -- (void)seekToTime:(NSTimeInterval)time completeHandler:(nullable void (^)(BOOL))completeHandler -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - [self.avPlayer seekToTime:time completeHandler:completeHandler]; - break; - case SGDecoderTypeFFmpeg: - [self.ffPlayer seekToTime:time completeHandler:completeHandler]; - break; - case SGDecoderTypeError: - break; - } -} - -- (void)setVolume:(CGFloat)volume -{ - _volume = volume; - [self.avPlayer reloadVolume]; - [self.ffPlayer reloadVolume]; -} - -- (void)setPlayableBufferInterval:(NSTimeInterval)playableBufferInterval -{ - _playableBufferInterval = playableBufferInterval; - [self.ffPlayer reloadPlayableBufferInterval]; -} - -- (void)setViewGravityMode:(SGGravityMode)viewGravityMode -{ - _viewGravityMode = viewGravityMode; - [self.displayView reloadGravityMode]; -} - -- (SGPlayerState)state -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.state; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.state; - case SGDecoderTypeError: - return SGPlayerStateNone; - } -} - -- (CGSize)presentationSize -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.presentationSize; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.presentationSize; - case SGDecoderTypeError: - return CGSizeZero; - } -} - -- (NSTimeInterval)bitrate -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.bitrate; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.bitrate; - case SGDecoderTypeError: - return 0; - } -} - -- (NSTimeInterval)progress -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.progress; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.progress; - case SGDecoderTypeError: - return 0; - } -} - -- (NSTimeInterval)duration -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.duration; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.duration; - case SGDecoderTypeError: - return 0; - } -} - -- (NSTimeInterval)playableTime -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.playableTime; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.playableTime; - case SGDecoderTypeError: - return 0; - } -} - -- (SGPLFImage *)snapshot -{ - return self.displayView.snapshot; -} - -- (SGPLFView *)view -{ - return self.displayView; -} - -- (void)setError:(SGError * _Nullable)error -{ - if (self.error != error) { - self->_error = error; - } -} - -- (void)cleanPlayer -{ - [self.avPlayer stop]; - self.avPlayer = nil; - - [self.ffPlayer stop]; - self.ffPlayer = nil; - - [self cleanPlayerView]; - -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [UIApplication sharedApplication].idleTimerDisabled = NO; -#endif - - self.needAutoPlay = NO; - self.error = nil; -} - -- (void)cleanPlayerView -{ - [self.view.subviews enumerateObjectsUsingBlock:^(__kindof SGPLFView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - [obj removeFromSuperview]; - }]; -} - -- (void)dealloc -{ - SGPlayerLog(@"SGPlayer release"); - [self cleanPlayer]; - -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [[SGAudioManager manager] removeHandlerTarget:self]; -#endif -} - -#pragma mark - background mode - -#if SGPLATFORM_TARGET_OS_IPHONE_OR_TV -- (void)setupNotification -{ - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; - - SGWeakSelf - SGAudioManager * manager = [SGAudioManager manager]; - [manager setHandlerTarget:self interruption:^(id handlerTarget, SGAudioManager *audioManager, SGAudioManagerInterruptionType type, SGAudioManagerInterruptionOption option) { - SGStrongSelf - if (type == SGAudioManagerInterruptionTypeBegin) { - switch (strongSelf.state) { - case SGPlayerStatePlaying: - case SGPlayerStateBuffering: - { - // fix : maybe receive interruption notification when enter foreground. - NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970]; - if (timeInterval - strongSelf.lastForegroundTimeInterval > 1.5) { - [strongSelf pause]; - } - } - break; - default: - break; - } - } - } routeChange:^(id handlerTarget, SGAudioManager *audioManager, SGAudioManagerRouteChangeReason reason) { - SGStrongSelf - if (reason == SGAudioManagerRouteChangeReasonOldDeviceUnavailable) { - switch (strongSelf.state) { - case SGPlayerStatePlaying: - case SGPlayerStateBuffering: - { - [strongSelf pause]; - } - break; - default: - break; - } - } - }]; -} - -- (void)applicationDidEnterBackground:(NSNotification *)notification -{ - switch (self.backgroundMode) { - case SGPlayerBackgroundModeNothing: - case SGPlayerBackgroundModeContinue: - break; - case SGPlayerBackgroundModeAutoPlayAndPause: - { - switch (self.state) { - case SGPlayerStatePlaying: - case SGPlayerStateBuffering: - { - self.needAutoPlay = YES; - [self pause]; - } - break; - default: - break; - } - } - break; - } -} - -- (void)applicationWillEnterForeground:(NSNotification *)notification -{ - switch (self.backgroundMode) { - case SGPlayerBackgroundModeNothing: - case SGPlayerBackgroundModeContinue: - break; - case SGPlayerBackgroundModeAutoPlayAndPause: - { - switch (self.state) { - case SGPlayerStateSuspend: - { - if (self.needAutoPlay) { - self.needAutoPlay = NO; - [self play]; - self.lastForegroundTimeInterval = [NSDate date].timeIntervalSince1970; - } - } - break; - default: - break; - } - } - break; - } -} -#endif - -@end - - -#pragma mark - Tracks Category - -@implementation SGPlayer (Tracks) - -- (BOOL)videoEnable -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.videoEnable; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.videoEnable; - case SGDecoderTypeError: - return NO; - } -} - -- (BOOL)audioEnable -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.audioEnable; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.audioEnable; - case SGDecoderTypeError: - return NO; - } -} - -- (SGPlayerTrack *)videoTrack -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.videoTrack; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.videoTrack; - case SGDecoderTypeError: - return nil; - } -} - -- (SGPlayerTrack *)audioTrack -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.audioTrack; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.audioTrack; - case SGDecoderTypeError: - return nil; - } -} - -- (NSArray *)videoTracks -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.videoTracks; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.videoTracks; - case SGDecoderTypeError: - return nil; - } -} - -- (NSArray *)audioTracks -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return self.avPlayer.audioTracks; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.audioTracks; - case SGDecoderTypeError: - return nil; - } -} - -- (void)selectAudioTrack:(SGPlayerTrack *)audioTrack -{ - [self selectAudioTrackIndex:audioTrack.index]; -} - -- (void)selectAudioTrackIndex:(int)audioTrackIndex -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - [self.avPlayer selectAudioTrackIndex:audioTrackIndex]; - case SGDecoderTypeFFmpeg: - [self.ffPlayer selectAudioTrackIndex:audioTrackIndex]; - break; - case SGDecoderTypeError: - break; - } -} - -@end - - -#pragma mark - Thread Category - -@implementation SGPlayer (Thread) - -- (BOOL)videoDecodeOnMainThread -{ - switch (self.decoderType) - { - case SGDecoderTypeAVPlayer: - return NO; - case SGDecoderTypeFFmpeg: - return self.ffPlayer.videoDecodeOnMainThread; - case SGDecoderTypeError: - return NO; - } -} - -- (BOOL)audioDecodeOnMainThread -{ - return NO; -} - -@end diff --git a/SGPlayer/Classes/SGPlayerTrack.h b/SGPlayer/Classes/SGPlayerTrack.h deleted file mode 100644 index 5bcd5bfe..00000000 --- a/SGPlayer/Classes/SGPlayerTrack.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SGPlayerTrack.h -// SGPlayer -// -// Created by Single on 2017/3/7. -// Copyright © 2017年 single. All rights reserved. -// - -#import - -@interface SGPlayerTrack : NSObject - -@property (nonatomic, assign) int index; -@property (nonatomic, copy) NSString * name; - -@end diff --git a/SGPlayer/Classes/SGPlayerTrack.m b/SGPlayer/Classes/SGPlayerTrack.m deleted file mode 100644 index 17b25d8e..00000000 --- a/SGPlayer/Classes/SGPlayerTrack.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// SGPlayerTrack.m -// SGPlayer -// -// Created by Single on 2017/3/7. -// Copyright © 2017年 single. All rights reserved. -// - -#import "SGPlayerTrack.h" - -@implementation SGPlayerTrack - -@end diff --git a/SGPlayer/Info.plist b/SGPlayer/Info.plist index dd9e5da7..8d920076 100644 --- a/SGPlayer/Info.plist +++ b/SGPlayer/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0.1 + 2.0.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright diff --git a/SGPlayer/SGPlayer.h b/SGPlayer/SGPlayer.h deleted file mode 100644 index 24f9be92..00000000 --- a/SGPlayer/SGPlayer.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// SGPlayer.h -// SGPlayer -// -// Created by Single on 2017/3/9. -// Copyright © 2017年 single. All rights reserved. -// - -#import - -FOUNDATION_EXPORT double SGPlayerVersionNumber; -FOUNDATION_EXPORT const unsigned char SGPlayerVersionString[]; - - -// Platform -#import - - -// SGPlayer -#import -#import -#import -#import diff --git a/SGPlayer/module.modulemap b/SGPlayer/module.modulemap new file mode 100755 index 00000000..24561bc6 --- /dev/null +++ b/SGPlayer/module.modulemap @@ -0,0 +1,5 @@ +framework module SGPlayer { + umbrella header "SGPlayer.h" + export * + module * { export * } +} diff --git a/Vendors/SGPlatform b/Vendors/SGPlatform deleted file mode 160000 index 924f5ba5..00000000 --- a/Vendors/SGPlatform +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 924f5ba5d6db1ed32862300d5f1ddaeb26261a39 diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..6b7ccfcc --- /dev/null +++ b/build.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +PLATFORM=$1 +ACTION=$2 + +FFMPEG_VERSION=n4.2 +OPENSSL_VERSION=OpenSSL_1_0_2s + +if [ "$ACTION" = "build" ]; then + sh scripts/init-openssl.sh $PLATFORM $OPENSSL_VERSION + sh scripts/init-ffmpeg.sh $PLATFORM $FFMPEG_VERSION + sh scripts/compile-openssl.sh $PLATFORM "build" + sh scripts/compile-ffmpeg.sh $PLATFORM "build" +elif [ "$ACTION" = "clean" ]; then + sh scripts/compile-openssl.sh $PLATFORM "clean" + sh scripts/compile-ffmpeg.sh $PLATFORM "clean" +else + echo "Usage:" + echo " build.sh iOS build" + echo " build.sh iOS clean" + echo " ---" + echo " build.sh tvOS build" + echo " build.sh tvOS clean" + echo " ---" + echo " build.sh macOS build" + echo " build.sh macOS clean" + exit 1 +fi diff --git a/compile-build.sh b/compile-build.sh deleted file mode 100644 index b1e92c89..00000000 --- a/compile-build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -ARGV1=$1 - -ROOT_PATH=`pwd` -LIB_FFMPEG_DOWNLOAD_URL="" -LIB_FFMPEG_FILE_NAME="" -LIB_FFMPEG_FILE_NAME_IOS="lib-iOS" -LIB_FFMPEG_FILE_NAME_MACOS="lib-macOS" -LIB_FFMPEG_FILE_NAME_TVOS="lib-tvOS" - -do_lib_ffmpeg () { - if [ -d $ROOT_PATH/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/$LIB_FFMPEG_FILE_NAME ]; then - echo "lib ffmpeg exist." - else - LIB_FFMPEG_DOWNLOAD_URL="http://libobjc-libs.oss-cn-beijing.aliyuncs.com/FFmpeg/$LIB_FFMPEG_FILE_NAME.zip" - echo "download lib ffmpeg..." - curl -o $ROOT_PATH/$LIB_FFMPEG_FILE_NAME.zip $LIB_FFMPEG_DOWNLOAD_URL - echo "unzip lib ffmpeg..." - unzip $ROOT_PATH/$LIB_FFMPEG_FILE_NAME.zip -d $ROOT_PATH/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/ - echo "clean temp file..." - rm -rf $ROOT_PATH/$LIB_FFMPEG_FILE_NAME.zip - echo "download lib ffmpeg done." - fi -} - -do_framework_SGPlatform () { - echo "check SGPlatform..." - if [ -d ".git" ]; then - git submodule update --init --recursive - else - echo "no git repository." - fi - if [ ! -d "Vendors/SGPlatform/SGPlatform.xcodeproj" ]; then - echo "clone SGPlatform from GitHub..." - git clone https://github.com/libobjc/SGPlatform.git Vendors/SGPlatform - echo "SGPlatform done." - else - echo "SGPlatform done." - fi -} - -if [ "$ARGV1" == "iOS" ]; then - echo "build for iOS." - LIB_FFMPEG_FILE_NAME=$LIB_FFMPEG_FILE_NAME_IOS - do_framework_SGPlatform - do_lib_ffmpeg - echo "build iOS done." -elif [ "$ARGV1" == "macOS" ]; then - echo "build for macOS." - LIB_FFMPEG_FILE_NAME=$LIB_FFMPEG_FILE_NAME_MACOS - do_framework_SGPlatform - do_lib_ffmpeg - echo "build macOS done." -elif [ "$ARGV1" == "tvOS" ]; then - echo "build for tvOS." - LIB_FFMPEG_FILE_NAME=$LIB_FFMPEG_FILE_NAME_TVOS - do_framework_SGPlatform - do_lib_ffmpeg - echo "build tvOS done." -else - echo echo "Usage:" - echo " build.sh iOS" - echo " build.sh macOS" - echo " build.sh tvOS" - exit 1 -fi diff --git a/compile-clean.sh b/compile-clean.sh deleted file mode 100644 index 0f15b58b..00000000 --- a/compile-clean.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -do_clean_framework_SGPlatform () { - echo "clean SGPlatform..." - if [ -d ".git" ]; then - echo "remove SGPlatform from git submodule." - git submodule deinit --all - fi - - if [ -d "Vendors/SGPlatform/SGPlatform.xcodeproj" ]; then - echo "remove SGPlatform files." - rm -rf Vendors/SGPlatform - fi - echo "clean SGPlatform done." -} - -do_clean_lib_ffmpeg () { - echo "clean lib ffmpeg..." - if [ -d "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS" ]; then - echo "remove lib ffmpeg for iOS" - rm -rf SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS - fi - if [ -d "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS" ]; then - echo "remove lib ffmpeg for macOS" - rm -rf SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS - fi - if [ -d "SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS" ]; then - echo "remove lib ffmpeg for tvOS" - rm -rf SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS - fi - echo "clean lib ffmpeg done." -} - -do_clean_framework_SGPlatform -do_clean_lib_ffmpeg diff --git a/compile-rebuild.sh b/compile-rebuild.sh deleted file mode 100644 index 289f11f4..00000000 --- a/compile-rebuild.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sh compile-clean.sh -sh compile-build.sh $1 diff --git a/demo/demo-common/SGVideoItem.h b/demo/demo-common/SGVideoItem.h new file mode 100644 index 00000000..0e82fe03 --- /dev/null +++ b/demo/demo-common/SGVideoItem.h @@ -0,0 +1,20 @@ +// +// SGVideoItem.h +// demo-common +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import + +@interface SGVideoItem : NSObject + +@property (nonatomic, copy) NSString *name; +@property (nonatomic, copy) SGAsset *asset; +@property (nonatomic) SGDisplayMode displayMode; + ++ (NSArray *)videoItems; + +@end + diff --git a/demo/demo-common/SGVideoItem.m b/demo/demo-common/SGVideoItem.m new file mode 100644 index 00000000..44795d54 --- /dev/null +++ b/demo/demo-common/SGVideoItem.m @@ -0,0 +1,150 @@ +// +// SGVideoItem.m +// demo-common +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGVideoItem.h" + +@implementation SGVideoItem + ++ (NSArray *)videoItems +{ + NSURL *i_see_fire = [[NSBundle mainBundle] URLForResource:@"i-see-fire" withExtension:@"mp4"]; + NSURL *google_help_vr = [[NSBundle mainBundle] URLForResource:@"google-help-vr" withExtension:@"mp4"]; + + NSMutableArray *items = [NSMutableArray array]; + { + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire"; + item.asset = [[SGURLAsset alloc] initWithURL:i_see_fire]; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + SGMutableTrack *track = [asset addTrack:SGMediaTypeVideo]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:0]; + [track appendSegment:segment]; + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire, Video Track"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + SGMutableTrack *track = [asset addTrack:SGMediaTypeAudio]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:1]; + [track appendSegment:segment]; + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire, Audio Track"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + CMTime scale = kCMTimeInvalid; + CMTimeRange timeRange = CMTimeRangeMake(CMTimeMake(30, 1), CMTimeMake(10, 1)); + + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeAudio]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:1 timeRange:timeRange scale:scale]; + [track appendSegment:segment]; + } + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeVideo]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:0 timeRange:timeRange scale:scale]; + [track appendSegment:segment]; + } + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire, Range: 30s-40s"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + CMTime scale = CMTimeMake(1, 2); + CMTimeRange timeRange = CMTimeRangeMake(CMTimeMake(30, 1), CMTimeMake(20, 1)); + + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeAudio]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:1 timeRange:timeRange scale:scale]; + [track appendSegment:segment]; + } + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeVideo]; + SGSegment *segment = [[SGURLSegment alloc] initWithURL:i_see_fire index:0 timeRange:timeRange scale:scale]; + [track appendSegment:segment]; + } + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire, Range: 30s-50s, Scale: 0.5"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeAudio]; + SGSegment *segment1 = [[SGURLSegment alloc] initWithURL:i_see_fire index:1]; + SGSegment *segment2 = [[SGURLSegment alloc] initWithURL:google_help_vr index:1]; + [track appendSegment:segment1]; + [track appendSegment:segment2]; + } + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeVideo]; + SGSegment *segment1 = [[SGURLSegment alloc] initWithURL:i_see_fire index:0]; + SGSegment *segment2 = [[SGURLSegment alloc] initWithURL:google_help_vr index:0]; + [track appendSegment:segment1]; + [track appendSegment:segment2]; + } + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"I See Fire + Google Help"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + SGMutableAsset *asset = [[SGMutableAsset alloc] init]; + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeAudio]; + SGSegment *segment1 = [[SGPaddingSegment alloc] initWithDuration:CMTimeMake(5, 1)]; + SGSegment *segment2 = [[SGURLSegment alloc] initWithURL:i_see_fire index:1]; + [track appendSegment:segment1]; + [track appendSegment:segment2]; + } + { + SGMutableTrack *track = [asset addTrack:SGMediaTypeVideo]; + SGSegment *segment1 = [[SGPaddingSegment alloc] initWithDuration:CMTimeMake(5, 1)]; + SGSegment *segment2 = [[SGURLSegment alloc] initWithURL:i_see_fire index:0]; + [track appendSegment:segment1]; + [track appendSegment:segment2]; + } + + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"5s Padding + I See Fire"; + item.asset = asset; + item.displayMode = SGDisplayModePlane; + [items addObject:item]; + } + { + SGVideoItem *item = [[SGVideoItem alloc] init]; + item.name = @"Google Help VR"; + item.asset = [[SGURLAsset alloc] initWithURL:google_help_vr]; + item.displayMode = SGDisplayModeVR; + [items addObject:item]; + } + return items; +} + +@end diff --git a/demo/demo-ios/demo-ios.xcodeproj/project.pbxproj b/demo/demo-ios/demo-ios.xcodeproj/project.pbxproj index 4939d958..75796e7c 100644 --- a/demo/demo-ios/demo-ios.xcodeproj/project.pbxproj +++ b/demo/demo-ios/demo-ios.xcodeproj/project.pbxproj @@ -7,43 +7,48 @@ objects = { /* Begin PBXBuildFile section */ - 9C02F6511E79293A00932489 /* PlayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C02F64F1E79293A00932489 /* PlayerViewController.m */; }; - 9C02F6521E79293A00932489 /* PlayerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9C02F6501E79293A00932489 /* PlayerViewController.xib */; }; + 9C02F6521E79293A00932489 /* SGPlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9C02F6501E79293A00932489 /* SGPlayViewController.xib */; }; + 9C03E5F3212E732B001F0E1B /* SGPlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C03E5F2212E732B001F0E1B /* SGPlayViewController.m */; }; 9C36DD461E79538500959FDA /* google-help-vr.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9C36DD441E79538500959FDA /* google-help-vr.mp4 */; }; 9C36DD471E79538500959FDA /* i-see-fire.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9C36DD451E79538500959FDA /* i-see-fire.mp4 */; }; - 9C3DD16C1E8FBD420003B17A /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD16B1E8FBD420003B17A /* VideoToolbox.framework */; }; - 9C3DD16E1E8FBD4A0003B17A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD16D1E8FBD4A0003B17A /* AudioToolbox.framework */; }; - 9C3DD1701E8FBD4F0003B17A /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD16F1E8FBD4F0003B17A /* CoreMedia.framework */; }; + 9C49E5F32304F77B00C5FB1F /* SGVideoItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C49E5F12304F77B00C5FB1F /* SGVideoItem.m */; }; 9C886B981E78EC9F00F2CFD1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C886B971E78EC9F00F2CFD1 /* main.m */; }; 9C886B9B1E78EC9F00F2CFD1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C886B9A1E78EC9F00F2CFD1 /* AppDelegate.m */; }; - 9C886B9E1E78EC9F00F2CFD1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C886B9D1E78EC9F00F2CFD1 /* ViewController.m */; }; + 9C886B9E1E78EC9F00F2CFD1 /* SGListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C886B9D1E78EC9F00F2CFD1 /* SGListViewController.m */; }; 9C886BA11E78EC9F00F2CFD1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C886B9F1E78EC9F00F2CFD1 /* Main.storyboard */; }; 9C886BA31E78EC9F00F2CFD1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C886BA21E78EC9F00F2CFD1 /* Assets.xcassets */; }; 9C886BA61E78EC9F00F2CFD1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C886BA41E78EC9F00F2CFD1 /* LaunchScreen.storyboard */; }; 9C886BBA1E78F13E00F2CFD1 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C886BB91E78F13E00F2CFD1 /* libiconv.tbd */; }; 9C886BBC1E78F14300F2CFD1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C886BBB1E78F14300F2CFD1 /* libz.tbd */; }; 9C886BBE1E78F14700F2CFD1 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C886BBD1E78F14700F2CFD1 /* libbz2.tbd */; }; - 9CD96CCF21BA1EFA007971D7 /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C9824A41FAB073B00142215 /* SGPlayer.framework */; }; - 9CD96CD121BA1F06007971D7 /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CD96CD021BA1F06007971D7 /* SGPlatform.framework */; }; + 9C8A0E342190A687006F7AE8 /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C9824A41FAB073B00142215 /* SGPlayer.framework */; }; + 9CA1B18C22C5F7CE009E2863 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = 9CA1B18B22C5F7CE009E2863 /* default.metallib */; }; + 9CD90232230BDF1900A358AA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CD90231230BDF1900A358AA /* AVFoundation.framework */; }; + 9CD90233230BDF2200A358AA /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD16B1E8FBD420003B17A /* VideoToolbox.framework */; }; + 9CD90234230BDF2C00A358AA /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD16D1E8FBD4A0003B17A /* AudioToolbox.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 9C02F64E1E79293A00932489 /* PlayerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerViewController.h; sourceTree = ""; }; - 9C02F64F1E79293A00932489 /* PlayerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayerViewController.m; sourceTree = ""; }; - 9C02F6501E79293A00932489 /* PlayerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlayerViewController.xib; sourceTree = ""; }; + 9C02F64E1E79293A00932489 /* SGPlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayViewController.h; sourceTree = ""; }; + 9C02F6501E79293A00932489 /* SGPlayViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SGPlayViewController.xib; sourceTree = ""; }; + 9C03E5F2212E732B001F0E1B /* SGPlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayViewController.m; sourceTree = ""; }; 9C2167151E7F81B800272348 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-eihmyibiajxgvzgpltouukszknss/Build/Products/Debug-iphoneos/SGPlatform.framework"; sourceTree = ""; }; + 9C329AA52005DF4A00252B10 /* SGAVPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGAVPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C329AA72005E11500252B10 /* SGAVPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGAVPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9C36DD441E79538500959FDA /* google-help-vr.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = "google-help-vr.mp4"; path = "../../demo-assset/google-help-vr.mp4"; sourceTree = ""; }; 9C36DD451E79538500959FDA /* i-see-fire.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = "i-see-fire.mp4"; path = "../../demo-assset/i-see-fire.mp4"; sourceTree = ""; }; 9C3DD16B1E8FBD420003B17A /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; 9C3DD16D1E8FBD4A0003B17A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 9C3DD16F1E8FBD4F0003B17A /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 9C4032C41FAB1188005AEB36 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C49E5F12304F77B00C5FB1F /* SGVideoItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGVideoItem.m; sourceTree = ""; }; + 9C49E5F22304F77B00C5FB1F /* SGVideoItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGVideoItem.h; sourceTree = ""; }; 9C886B931E78EC9F00F2CFD1 /* SGPlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SGPlayer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9C886B971E78EC9F00F2CFD1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 9C886B991E78EC9F00F2CFD1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 9C886B9A1E78EC9F00F2CFD1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 9C886B9C1E78EC9F00F2CFD1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 9C886B9D1E78EC9F00F2CFD1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 9C886B9C1E78EC9F00F2CFD1 /* SGListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGListViewController.h; sourceTree = ""; }; + 9C886B9D1E78EC9F00F2CFD1 /* SGListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGListViewController.m; sourceTree = ""; }; 9C886BA01E78EC9F00F2CFD1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 9C886BA21E78EC9F00F2CFD1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 9C886BA51E78EC9F00F2CFD1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -55,9 +60,11 @@ 9C886BBD1E78F14700F2CFD1 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; 9C9824A41FAB073B00142215 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9C9824AE1FAB10B100142215 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CA1B18B22C5F7CE009E2863 /* default.metallib */ = {isa = PBXFileReference; lastKnownFileType = "archive.metal-library"; path = default.metallib; sourceTree = ""; }; 9CA86E851E87575000E4A8B1 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-cxkylxbwkfilbmgwetaiuwiojpbb/Build/Products/Debug-iphonesimulator/SGPlatform.framework"; sourceTree = ""; }; 9CA86E891E8757B500E4A8B1 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../Vendors/SGPlatform/build/Debug-iphoneos/SGPlatform.framework"; sourceTree = ""; }; - 9CD96CD021BA1F06007971D7 /* SGPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CB695132190680E00196E54 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CD90231230BDF1900A358AA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,23 +72,33 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9CD96CD121BA1F06007971D7 /* SGPlatform.framework in Frameworks */, - 9CD96CCF21BA1EFA007971D7 /* SGPlayer.framework in Frameworks */, - 9C3DD1701E8FBD4F0003B17A /* CoreMedia.framework in Frameworks */, - 9C3DD16E1E8FBD4A0003B17A /* AudioToolbox.framework in Frameworks */, - 9C3DD16C1E8FBD420003B17A /* VideoToolbox.framework in Frameworks */, + 9C8A0E342190A687006F7AE8 /* SGPlayer.framework in Frameworks */, + 9CD90232230BDF1900A358AA /* AVFoundation.framework in Frameworks */, + 9CD90234230BDF2C00A358AA /* AudioToolbox.framework in Frameworks */, + 9CD90233230BDF2200A358AA /* VideoToolbox.framework in Frameworks */, + 9C886BBA1E78F13E00F2CFD1 /* libiconv.tbd in Frameworks */, 9C886BBE1E78F14700F2CFD1 /* libbz2.tbd in Frameworks */, 9C886BBC1E78F14300F2CFD1 /* libz.tbd in Frameworks */, - 9C886BBA1E78F13E00F2CFD1 /* libiconv.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 9C49E5F02304F77B00C5FB1F /* demo-common */ = { + isa = PBXGroup; + children = ( + 9C49E5F22304F77B00C5FB1F /* SGVideoItem.h */, + 9C49E5F12304F77B00C5FB1F /* SGVideoItem.m */, + ); + name = "demo-common"; + path = "../demo-common"; + sourceTree = ""; + }; 9C886B8A1E78EC9F00F2CFD1 = { isa = PBXGroup; children = ( + 9C49E5F02304F77B00C5FB1F /* demo-common */, 9C886B951E78EC9F00F2CFD1 /* demo-ios */, 9C886B941E78EC9F00F2CFD1 /* Products */, 9C886BAE1E78ECE500F2CFD1 /* Frameworks */, @@ -101,15 +118,12 @@ children = ( 9C886B991E78EC9F00F2CFD1 /* AppDelegate.h */, 9C886B9A1E78EC9F00F2CFD1 /* AppDelegate.m */, - 9C886B9C1E78EC9F00F2CFD1 /* ViewController.h */, - 9C886B9D1E78EC9F00F2CFD1 /* ViewController.m */, - 9C02F64E1E79293A00932489 /* PlayerViewController.h */, - 9C02F64F1E79293A00932489 /* PlayerViewController.m */, - 9C02F6501E79293A00932489 /* PlayerViewController.xib */, + 9C886B9C1E78EC9F00F2CFD1 /* SGListViewController.h */, + 9C886B9D1E78EC9F00F2CFD1 /* SGListViewController.m */, + 9C02F64E1E79293A00932489 /* SGPlayViewController.h */, + 9C03E5F2212E732B001F0E1B /* SGPlayViewController.m */, + 9C02F6501E79293A00932489 /* SGPlayViewController.xib */, 9C886B9F1E78EC9F00F2CFD1 /* Main.storyboard */, - 9C886BA21E78EC9F00F2CFD1 /* Assets.xcassets */, - 9C886BA41E78EC9F00F2CFD1 /* LaunchScreen.storyboard */, - 9C886BA71E78EC9F00F2CFD1 /* Info.plist */, 9C886B961E78EC9F00F2CFD1 /* Supporting Files */, ); path = "demo-ios"; @@ -118,8 +132,12 @@ 9C886B961E78EC9F00F2CFD1 /* Supporting Files */ = { isa = PBXGroup; children = ( + 9C886BA21E78EC9F00F2CFD1 /* Assets.xcassets */, + 9CA1B18B22C5F7CE009E2863 /* default.metallib */, 9C36DD441E79538500959FDA /* google-help-vr.mp4 */, 9C36DD451E79538500959FDA /* i-see-fire.mp4 */, + 9C886BA71E78EC9F00F2CFD1 /* Info.plist */, + 9C886BA41E78EC9F00F2CFD1 /* LaunchScreen.storyboard */, 9C886B971E78EC9F00F2CFD1 /* main.m */, ); name = "Supporting Files"; @@ -128,7 +146,10 @@ 9C886BAE1E78ECE500F2CFD1 /* Frameworks */ = { isa = PBXGroup; children = ( - 9CD96CD021BA1F06007971D7 /* SGPlatform.framework */, + 9CD90231230BDF1900A358AA /* AVFoundation.framework */, + 9CB695132190680E00196E54 /* SGPlayer.framework */, + 9C329AA72005E11500252B10 /* SGAVPlayer.framework */, + 9C329AA52005DF4A00252B10 /* SGAVPlayer.framework */, 9C4032C41FAB1188005AEB36 /* SGPlayer.framework */, 9C9824AE1FAB10B100142215 /* SGPlayer.framework */, 9C9824A41FAB073B00142215 /* SGPlayer.framework */, @@ -173,12 +194,12 @@ 9C886B8B1E78EC9F00F2CFD1 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = single; TargetAttributes = { 9C886B921E78EC9F00F2CFD1 = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = 2EN49MUBLA; + DevelopmentTeam = KAGR32AB25; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.BackgroundModes = { @@ -214,8 +235,9 @@ 9C886BA61E78EC9F00F2CFD1 /* LaunchScreen.storyboard in Resources */, 9C886BA31E78EC9F00F2CFD1 /* Assets.xcassets in Resources */, 9C36DD461E79538500959FDA /* google-help-vr.mp4 in Resources */, + 9CA1B18C22C5F7CE009E2863 /* default.metallib in Resources */, 9C886BA11E78EC9F00F2CFD1 /* Main.storyboard in Resources */, - 9C02F6521E79293A00932489 /* PlayerViewController.xib in Resources */, + 9C02F6521E79293A00932489 /* SGPlayViewController.xib in Resources */, 9C36DD471E79538500959FDA /* i-see-fire.mp4 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -227,8 +249,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C886B9E1E78EC9F00F2CFD1 /* ViewController.m in Sources */, - 9C02F6511E79293A00932489 /* PlayerViewController.m in Sources */, + 9C886B9E1E78EC9F00F2CFD1 /* SGListViewController.m in Sources */, + 9C03E5F3212E732B001F0E1B /* SGPlayViewController.m in Sources */, + 9C49E5F32304F77B00C5FB1F /* SGVideoItem.m in Sources */, 9C886B9B1E78EC9F00F2CFD1 /* AppDelegate.m in Sources */, 9C886B981E78EC9F00F2CFD1 /* main.m in Sources */, ); @@ -269,6 +292,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -276,6 +300,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -322,6 +347,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -329,6 +355,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -360,12 +387,19 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 2EN49MUBLA; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-ios/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-ios"; + OTHER_LDFLAGS = ( + "-all_load", + "-Objc", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-ios"; PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Debug; }; @@ -373,12 +407,19 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 2EN49MUBLA; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-ios/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-ios"; + OTHER_LDFLAGS = ( + "-all_load", + "-Objc", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-ios"; PRODUCT_NAME = SGPlayer; + PROVISIONING_PROFILE_SPECIFIER = ""; }; name = Release; }; diff --git a/demo/demo-ios/demo-ios.xcodeproj/xcshareddata/xcschemes/demo-ios.xcscheme b/demo/demo-ios/demo-ios.xcodeproj/xcshareddata/xcschemes/demo-ios.xcscheme index 09683654..021a9f5d 100644 --- a/demo/demo-ios/demo-ios.xcodeproj/xcshareddata/xcschemes/demo-ios.xcscheme +++ b/demo/demo-ios/demo-ios.xcodeproj/xcshareddata/xcschemes/demo-ios.xcscheme @@ -1,6 +1,6 @@ diff --git a/demo/demo-ios/demo-ios/AppDelegate.h b/demo/demo-ios/demo-ios/AppDelegate.h index 184543fa..772bd4b1 100644 --- a/demo/demo-ios/demo-ios/AppDelegate.h +++ b/demo/demo-ios/demo-ios/AppDelegate.h @@ -12,6 +12,5 @@ @property (strong, nonatomic) UIWindow *window; - @end diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Contents.json index 8f98d3f7..e2750f25 100644 --- a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,13 +1,15 @@ { "images" : [ { - "idiom" : "iphone", "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-Notification@2x.png", "scale" : "2x" }, { - "idiom" : "iphone", "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-Notification@3x.png", "scale" : "3x" }, { @@ -47,8 +49,9 @@ "scale" : "3x" }, { - "idiom" : "ios-marketing", "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "logo.png", "scale" : "1x" } ], diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png index 330810cb..0485f127 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png index 36f32f3c..6e275ef4 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png new file mode 100644 index 00000000..e254b434 Binary files /dev/null and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png new file mode 100644 index 00000000..bcf9c715 Binary files /dev/null and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png index 8faee504..fc5dd3eb 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png index 330810cb..0485f127 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png index 36ea26ff..5273d746 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png index 0179d634..79761327 100644 Binary files a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png differ diff --git a/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/logo.png b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/logo.png new file mode 100644 index 00000000..ce519f7b Binary files /dev/null and b/demo/demo-ios/demo-ios/Assets.xcassets/AppIcon.appiconset/logo.png differ diff --git a/demo/demo-ios/demo-ios/Base.lproj/Main.storyboard b/demo/demo-ios/demo-ios/Base.lproj/Main.storyboard index 42889a24..2cbc71f6 100644 --- a/demo/demo-ios/demo-ios/Base.lproj/Main.storyboard +++ b/demo/demo-ios/demo-ios/Base.lproj/Main.storyboard @@ -1,18 +1,18 @@ - + - + - + @@ -22,7 +22,7 @@ - + @@ -43,7 +43,7 @@ - + diff --git a/demo/demo-ios/demo-ios/PlayerViewController.h b/demo/demo-ios/demo-ios/PlayerViewController.h deleted file mode 100644 index 3891b8c5..00000000 --- a/demo/demo-ios/demo-ios/PlayerViewController.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// PlayerViewController.h -// demo-ios -// -// Created by Single on 2017/3/15. -// Copyright © 2017年 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, DemoType) { - DemoType_AVPlayer_Normal = 0, - DemoType_AVPlayer_VR, - DemoType_AVPlayer_VR_Box, - DemoType_FFmpeg_Normal, - DemoType_FFmpeg_Normal_Hardware, - DemoType_FFmpeg_VR, - DemoType_FFmpeg_VR_Hardware, - DemoType_FFmpeg_VR_Box, - DemoType_FFmpeg_VR_Box_Hardware, -}; - -@interface PlayerViewController : UIViewController - -@property (nonatomic, assign) DemoType demoType; - -+ (NSString *)displayNameForDemoType:(DemoType)demoType; - -@end diff --git a/demo/demo-ios/demo-ios/PlayerViewController.m b/demo/demo-ios/demo-ios/PlayerViewController.m deleted file mode 100644 index 415a4934..00000000 --- a/demo/demo-ios/demo-ios/PlayerViewController.m +++ /dev/null @@ -1,210 +0,0 @@ -// -// PlayerViewController.m -// demo-ios -// -// Created by Single on 2017/3/15. -// Copyright © 2017年 single. All rights reserved. -// - -#import "PlayerViewController.h" -#import - -@interface PlayerViewController () - -@property (nonatomic, strong) SGPlayer * player; - -@property (weak, nonatomic) IBOutlet UILabel *stateLabel; -@property (weak, nonatomic) IBOutlet UISlider *progressSilder; -@property (weak, nonatomic) IBOutlet UILabel *currentTimeLabel; -@property (weak, nonatomic) IBOutlet UILabel *totalTimeLabel; - -@property (nonatomic, assign) BOOL progressSilderTouching; - -@end - -@implementation PlayerViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - self.view.backgroundColor = [UIColor blackColor]; - - self.player = [SGPlayer player]; - [self.player registerPlayerNotificationTarget:self - stateAction:@selector(stateAction:) - progressAction:@selector(progressAction:) - playableAction:@selector(playableAction:) - errorAction:@selector(errorAction:)]; - [self.player setViewTapAction:^(SGPlayer * _Nonnull player, SGPLFView * _Nonnull view) { - NSLog(@"player display view did click!"); - }]; - [self.view insertSubview:self.player.view atIndex:0]; - - static NSURL * normalVideo = nil; - static NSURL * vrVideo = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - normalVideo = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"i-see-fire" ofType:@"mp4"]]; - vrVideo = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"google-help-vr" ofType:@"mp4"]]; - }); - switch (self.demoType) - { - case DemoType_AVPlayer_Normal: - [self.player replaceVideoWithURL:normalVideo]; - break; - case DemoType_AVPlayer_VR: - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_AVPlayer_VR_Box: - self.player.displayMode = SGDisplayModeBox; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_FFmpeg_Normal: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - self.player.decoder.hardwareAccelerateEnableForFFmpeg = NO; - [self.player replaceVideoWithURL:normalVideo]; - break; - case DemoType_FFmpeg_Normal_Hardware: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - [self.player replaceVideoWithURL:normalVideo]; - break; - case DemoType_FFmpeg_VR: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - self.player.decoder.hardwareAccelerateEnableForFFmpeg = NO; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_FFmpeg_VR_Hardware: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_FFmpeg_VR_Box: - self.player.displayMode = SGDisplayModeBox; - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - self.player.decoder.hardwareAccelerateEnableForFFmpeg = NO; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_FFmpeg_VR_Box_Hardware: - self.player.displayMode = SGDisplayModeBox; - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - } -} - -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - self.player.view.frame = self.view.bounds; -} - -+ (NSString *)displayNameForDemoType:(DemoType)demoType -{ - static NSArray * displayNames = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - displayNames = @[@"i see fire, AVPlayer", - @"google help, AVPlayer, VR", - @"google help, AVPlayer, VR, Box", - @"i see fire, FFmpeg", - @"i see fire, FFmpeg, Hardware Acceleration", - @"google help, FFmpeg, VR", - @"google help, FFmpeg, VR, Hardware Acceleration", - @"google help, FFmpeg, VR, Box", - @"google help, FFmpeg, VR, Box, Hardware Acceleration"]; - }); - if (demoType < displayNames.count) { - return [displayNames objectAtIndex:demoType]; - } - return nil; -} -- (IBAction)back:(id)sender -{ - [self.navigationController popViewControllerAnimated:YES]; -} - -- (IBAction)play:(id)sender -{ - [self.player play]; -} - -- (IBAction)pause:(id)sender -{ - [self.player pause]; -} - -- (IBAction)progressTouchDown:(id)sender -{ - self.progressSilderTouching = YES; -} - -- (IBAction)progressTouchUp:(id)sender -{ - self.progressSilderTouching = NO; - [self.player seekToTime:self.player.duration * self.progressSilder.value]; -} - -- (void)stateAction:(NSNotification *)notification -{ - SGState * state = [SGState stateFromUserInfo:notification.userInfo]; - - NSString * text; - switch (state.current) { - case SGPlayerStateNone: - text = @"None"; - break; - case SGPlayerStateBuffering: - text = @"Buffering..."; - break; - case SGPlayerStateReadyToPlay: - text = @"Prepare"; - self.totalTimeLabel.text = [self timeStringFromSeconds:self.player.duration]; - [self.player play]; - break; - case SGPlayerStatePlaying: - text = @"Playing"; - break; - case SGPlayerStateSuspend: - text = @"Suspend"; - break; - case SGPlayerStateFinished: - text = @"Finished"; - break; - case SGPlayerStateFailed: - text = @"Error"; - break; - } - self.stateLabel.text = text; -} - -- (void)progressAction:(NSNotification *)notification -{ - SGProgress * progress = [SGProgress progressFromUserInfo:notification.userInfo]; - if (!self.progressSilderTouching) { - self.progressSilder.value = progress.percent; - } - self.currentTimeLabel.text = [self timeStringFromSeconds:progress.current]; -} - -- (void)playableAction:(NSNotification *)notification -{ - SGPlayable * playable = [SGPlayable playableFromUserInfo:notification.userInfo]; - NSLog(@"playable time : %f", playable.current); -} - -- (void)errorAction:(NSNotification *)notification -{ - SGError * error = [SGError errorFromUserInfo:notification.userInfo]; - NSLog(@"player did error : %@", error.error); -} - -- (NSString *)timeStringFromSeconds:(CGFloat)seconds -{ - return [NSString stringWithFormat:@"%ld:%.2ld", (long)seconds / 60, (long)seconds % 60]; -} - -- (void)dealloc -{ - [self.player removePlayerNotificationTarget:self]; -} - -@end diff --git a/demo/demo-ios/demo-ios/ViewController.h b/demo/demo-ios/demo-ios/SGListViewController.h similarity index 63% rename from demo/demo-ios/demo-ios/ViewController.h rename to demo/demo-ios/demo-ios/SGListViewController.h index 13a3216e..2c022928 100644 --- a/demo/demo-ios/demo-ios/ViewController.h +++ b/demo/demo-ios/demo-ios/SGListViewController.h @@ -1,5 +1,5 @@ // -// ViewController.h +// SGListViewController.h // demo-ios // // Created by Single on 2017/3/15. @@ -8,7 +8,7 @@ #import -@interface ViewController : UITableViewController +@interface SGListViewController : UITableViewController @end diff --git a/demo/demo-ios/demo-ios/ViewController.m b/demo/demo-ios/demo-ios/SGListViewController.m similarity index 58% rename from demo/demo-ios/demo-ios/ViewController.m rename to demo/demo-ios/demo-ios/SGListViewController.m index b8491738..d06a119b 100644 --- a/demo/demo-ios/demo-ios/ViewController.m +++ b/demo/demo-ios/demo-ios/SGListViewController.m @@ -1,15 +1,40 @@ // -// ViewController.m +// SGListViewController.m // demo-ios // // Created by Single on 2017/3/15. // Copyright © 2017年 single. All rights reserved. // -#import "ViewController.h" -#import "PlayerViewController.h" +#import "SGListViewController.h" +#import "SGPlayViewController.h" +#import "SGVideoItem.h" -@implementation ViewController +@interface SGListViewController () + +@property (nonatomic, strong) NSArray *videoItems; + +@end + +@implementation SGListViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + self.videoItems = [SGVideoItem videoItems]; +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + [self.navigationController setNavigationBarHidden:YES animated:YES]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -18,33 +43,21 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 9; + return self.videoItems.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; - cell.textLabel.text = [PlayerViewController displayNameForDemoType:indexPath.row]; + cell.textLabel.text = self.videoItems[indexPath.row].name; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - PlayerViewController * obj = [[PlayerViewController alloc] init]; - obj.demoType = indexPath.row; - [self.navigationController pushViewController:obj animated:YES]; -} - -- (void)viewWillDisappear:(BOOL)animated -{ - [super viewWillDisappear:animated]; - [self.navigationController setNavigationBarHidden:YES animated:YES]; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - [self.navigationController setNavigationBarHidden:NO animated:YES]; + SGPlayViewController *vc = [[SGPlayViewController alloc] init]; + vc.videoItem = self.videoItems[indexPath.row]; + [self.navigationController pushViewController:vc animated:YES]; } @end diff --git a/demo/demo-ios/demo-ios/SGPlayViewController.h b/demo/demo-ios/demo-ios/SGPlayViewController.h new file mode 100644 index 00000000..80148082 --- /dev/null +++ b/demo/demo-ios/demo-ios/SGPlayViewController.h @@ -0,0 +1,16 @@ +// +// SGPlayViewController.h +// demo-ios +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import +#import "SGVideoItem.h" + +@interface SGPlayViewController : UIViewController + +@property (nonatomic, strong) SGVideoItem *videoItem; + +@end diff --git a/demo/demo-ios/demo-ios/SGPlayViewController.m b/demo/demo-ios/demo-ios/SGPlayViewController.m new file mode 100644 index 00000000..c98af966 --- /dev/null +++ b/demo/demo-ios/demo-ios/SGPlayViewController.m @@ -0,0 +1,112 @@ +// +// SGPlayViewController.m +// demo-ios +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPlayViewController.h" + +@interface SGPlayViewController () + +@property (nonatomic, assign) BOOL seeking; +@property (nonatomic, strong) SGPlayer *player; + +@property (weak, nonatomic) IBOutlet UILabel *stateLabel; +@property (weak, nonatomic) IBOutlet UILabel *durationLabel; +@property (weak, nonatomic) IBOutlet UILabel *currentTimeLabel; +@property (weak, nonatomic) IBOutlet UISlider *progressSilder; + +@end + +@implementation SGPlayViewController + +- (instancetype)init +{ + if (self = [super init]) { + self.player = [[SGPlayer alloc] init]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(infoChanged:) name:SGPlayerDidChangeInfosNotification object:self.player]; + } + return self; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.player.videoRenderer.view = self.view; + self.player.videoRenderer.displayMode = self.videoItem.displayMode; + [self.player replaceWithAsset:self.videoItem.asset]; + [self.player play]; +} + +#pragma mark - SGPlayer Notifications + +- (void)infoChanged:(NSNotification *)notification +{ + SGTimeInfo time = [SGPlayer timeInfoFromUserInfo:notification.userInfo]; + SGStateInfo state = [SGPlayer stateInfoFromUserInfo:notification.userInfo]; + SGInfoAction action = [SGPlayer infoActionFromUserInfo:notification.userInfo]; + if (action & SGInfoActionTime) { + if (action & SGInfoActionTimePlayback && !(state.playback & SGPlaybackStateSeeking) && !self.seeking && !self.progressSilder.isTracking) { + self.progressSilder.value = CMTimeGetSeconds(time.playback) / CMTimeGetSeconds(time.duration); + self.currentTimeLabel.text = [self timeStringFromSeconds:CMTimeGetSeconds(time.playback)]; + } + if (action & SGInfoActionTimeDuration) { + self.durationLabel.text = [self timeStringFromSeconds:CMTimeGetSeconds(time.duration)]; + } + } + if (action & SGInfoActionState) { + if (state.playback & SGPlaybackStateFinished) { + self.stateLabel.text = @"Finished"; + } else if (state.playback & SGPlaybackStatePlaying) { + self.stateLabel.text = @"Playing"; + } else { + self.stateLabel.text = @"Paused"; + } + } +} + +#pragma mark - Actions + +- (IBAction)back:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +- (IBAction)play:(id)sender +{ + [self.player play]; +} + +- (IBAction)pause:(id)sender +{ + [self.player pause]; +} + +- (IBAction)progressTouchUp:(id)sender +{ + CMTime time = CMTimeMultiplyByFloat64(self.player.currentItem.duration, self.progressSilder.value); + if (!CMTIME_IS_NUMERIC(time)) { + time = kCMTimeZero; + } + self.seeking = YES; + [self.player seekToTime:time result:^(CMTime time, NSError *error) { + self.seeking = NO; + }]; +} + +#pragma mark - Tools + +- (NSString *)timeStringFromSeconds:(CGFloat)seconds +{ + return [NSString stringWithFormat:@"%ld:%.2ld", (long)seconds / 60, (long)seconds % 60]; +} + +@end diff --git a/demo/demo-ios/demo-ios/PlayerViewController.xib b/demo/demo-ios/demo-ios/SGPlayViewController.xib similarity index 88% rename from demo/demo-ios/demo-ios/PlayerViewController.xib rename to demo/demo-ios/demo-ios/SGPlayViewController.xib index b2995896..994629cf 100644 --- a/demo/demo-ios/demo-ios/PlayerViewController.xib +++ b/demo/demo-ios/demo-ios/SGPlayViewController.xib @@ -1,20 +1,21 @@ - + - + + - + + - @@ -30,14 +31,13 @@ - - + - - + @@ -121,11 +120,13 @@ + - + + diff --git a/demo/demo-ios/demo-ios/default.metallib b/demo/demo-ios/demo-ios/default.metallib new file mode 100644 index 00000000..c31a11ea Binary files /dev/null and b/demo/demo-ios/demo-ios/default.metallib differ diff --git a/demo/demo-macos/demo-macos.xcodeproj/project.pbxproj b/demo/demo-macos/demo-macos.xcodeproj/project.pbxproj index 2e42ad54..e71ea562 100644 --- a/demo/demo-macos/demo-macos.xcodeproj/project.pbxproj +++ b/demo/demo-macos/demo-macos.xcodeproj/project.pbxproj @@ -10,43 +10,49 @@ 9C36DD421E79537500959FDA /* google-help-vr.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9C36DD401E79537500959FDA /* google-help-vr.mp4 */; }; 9C36DD431E79537500959FDA /* i-see-fire.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9C36DD411E79537500959FDA /* i-see-fire.mp4 */; }; 9C3DD1661E8FBD090003B17A /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB9253E1E79478C00DE6721 /* VideoToolbox.framework */; }; - 9C3DD1681E8FBD100003B17A /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD1671E8FBD100003B17A /* CoreMedia.framework */; }; 9C3DD16A1E8FBD150003B17A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C3DD1691E8FBD150003B17A /* AudioToolbox.framework */; }; + 9C49E5FF23053DBD00C5FB1F /* SGVideoItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C49E5FD23053DBD00C5FB1F /* SGVideoItem.m */; }; + 9CA1B18A22C5F7AA009E2863 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = 9CA1B18922C5F7AA009E2863 /* default.metallib */; }; + 9CB6951821906D2F00196E54 /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB6951721906D2F00196E54 /* SGPlayer.framework */; }; 9CB925191E7942AC00DE6721 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB925181E7942AC00DE6721 /* AppDelegate.m */; }; 9CB9251C1E7942AC00DE6721 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB9251B1E7942AC00DE6721 /* main.m */; }; - 9CB9251F1E7942AC00DE6721 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB9251E1E7942AC00DE6721 /* ViewController.m */; }; + 9CB9251F1E7942AC00DE6721 /* SGListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB9251E1E7942AC00DE6721 /* SGListViewController.m */; }; 9CB925211E7942AC00DE6721 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9CB925201E7942AC00DE6721 /* Assets.xcassets */; }; 9CB925241E7942AC00DE6721 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CB925221E7942AC00DE6721 /* Main.storyboard */; }; - 9CB925311E79469A00DE6721 /* PlayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB9252F1E79469A00DE6721 /* PlayerViewController.m */; }; + 9CB925311E79469A00DE6721 /* SGPlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB9252F1E79469A00DE6721 /* SGPlayViewController.m */; }; 9CB925371E79476E00DE6721 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB925361E79476E00DE6721 /* libiconv.tbd */; }; 9CB925391E79477200DE6721 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB925381E79477200DE6721 /* libz.tbd */; }; 9CB9253B1E79477600DE6721 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB9253A1E79477600DE6721 /* libbz2.tbd */; }; - 9CB925411E79479500DE6721 /* VideoDecodeAcceleration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB925401E79479500DE6721 /* VideoDecodeAcceleration.framework */; }; - 9CB925451E7947B000DE6721 /* liblzma.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB925441E7947B000DE6721 /* liblzma.tbd */; }; - 9CE7BA0721BA21550087B5F8 /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CE7BA0621BA21550087B5F8 /* SGPlatform.framework */; }; - 9CE7BA0921BA21590087B5F8 /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CE7BA0821BA21590087B5F8 /* SGPlayer.framework */; }; + 9CD90236230BDF5F00A358AA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CD90235230BDF5F00A358AA /* AVFoundation.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 9C0D004E200C784D0079D609 /* SGAVPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGAVPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C0EABCA21905574004D5604 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9C2167171E7F81E900272348 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-eihmyibiajxgvzgpltouukszknss/Build/Products/Debug-iphoneos/SGPlatform.framework"; sourceTree = ""; }; 9C36DD401E79537500959FDA /* google-help-vr.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = "google-help-vr.mp4"; path = "../../demo-assset/google-help-vr.mp4"; sourceTree = ""; }; 9C36DD411E79537500959FDA /* i-see-fire.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = "i-see-fire.mp4"; path = "../../demo-assset/i-see-fire.mp4"; sourceTree = ""; }; 9C3DD1671E8FBD100003B17A /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 9C3DD1691E8FBD150003B17A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 9C49E5FD23053DBD00C5FB1F /* SGVideoItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGVideoItem.m; sourceTree = ""; }; + 9C49E5FE23053DBD00C5FB1F /* SGVideoItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGVideoItem.h; sourceTree = ""; }; + 9CA1B18922C5F7AA009E2863 /* default.metallib */ = {isa = PBXFileReference; lastKnownFileType = "archive.metal-library"; path = default.metallib; sourceTree = ""; }; 9CA86E811E8756E700E4A8B1 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-cxkylxbwkfilbmgwetaiuwiojpbb/Build/Products/Debug/SGPlatform.framework"; sourceTree = ""; }; 9CA86E831E87571800E4A8B1 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = ../../Vendors/SGPlatform/build/Debug/SGPlatform.framework; sourceTree = ""; }; 9CA86E871E8757A700E4A8B1 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = ../../Vendors/SGPlatform/build/Debug/SGPlatform.framework; sourceTree = ""; }; + 9CB694E42190599300196E54 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; + 9CB6951721906D2F00196E54 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9CB925141E7942AC00DE6721 /* SGPlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SGPlayer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9CB925171E7942AC00DE6721 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 9CB925181E7942AC00DE6721 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9CB9251B1E7942AC00DE6721 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 9CB9251D1E7942AC00DE6721 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 9CB9251E1E7942AC00DE6721 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 9CB9251D1E7942AC00DE6721 /* SGListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SGListViewController.h; sourceTree = ""; }; + 9CB9251E1E7942AC00DE6721 /* SGListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SGListViewController.m; sourceTree = ""; }; 9CB925201E7942AC00DE6721 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 9CB925231E7942AC00DE6721 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 9CB925251E7942AC00DE6721 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9CB9252E1E79469A00DE6721 /* PlayerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerViewController.h; sourceTree = ""; }; - 9CB9252F1E79469A00DE6721 /* PlayerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayerViewController.m; sourceTree = ""; }; + 9CB9252E1E79469A00DE6721 /* SGPlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPlayViewController.h; sourceTree = ""; }; + 9CB9252F1E79469A00DE6721 /* SGPlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPlayViewController.m; sourceTree = ""; }; 9CB925341E79475C00DE6721 /* SGPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlayer.framework; path = ../../build/Debug/SGPlayer.framework; sourceTree = ""; }; 9CB925361E79476E00DE6721 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; 9CB925381E79477200DE6721 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; @@ -56,8 +62,7 @@ 9CB925401E79479500DE6721 /* VideoDecodeAcceleration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoDecodeAcceleration.framework; path = System/Library/Frameworks/VideoDecodeAcceleration.framework; sourceTree = SDKROOT; }; 9CB925421E7947A900DE6721 /* liblzma.5.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = liblzma.5.tbd; path = usr/lib/liblzma.5.tbd; sourceTree = SDKROOT; }; 9CB925441E7947B000DE6721 /* liblzma.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = liblzma.tbd; path = usr/lib/liblzma.tbd; sourceTree = SDKROOT; }; - 9CE7BA0621BA21550087B5F8 /* SGPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9CE7BA0821BA21590087B5F8 /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CD90235230BDF5F00A358AA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,25 +70,33 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9CE7BA0921BA21590087B5F8 /* SGPlayer.framework in Frameworks */, - 9CE7BA0721BA21550087B5F8 /* SGPlatform.framework in Frameworks */, - 9C3DD1681E8FBD100003B17A /* CoreMedia.framework in Frameworks */, + 9CB6951821906D2F00196E54 /* SGPlayer.framework in Frameworks */, + 9CD90236230BDF5F00A358AA /* AVFoundation.framework in Frameworks */, 9C3DD16A1E8FBD150003B17A /* AudioToolbox.framework in Frameworks */, 9C3DD1661E8FBD090003B17A /* VideoToolbox.framework in Frameworks */, - 9CB925411E79479500DE6721 /* VideoDecodeAcceleration.framework in Frameworks */, + 9CB925371E79476E00DE6721 /* libiconv.tbd in Frameworks */, 9CB9253B1E79477600DE6721 /* libbz2.tbd in Frameworks */, 9CB925391E79477200DE6721 /* libz.tbd in Frameworks */, - 9CB925371E79476E00DE6721 /* libiconv.tbd in Frameworks */, - 9CB925451E7947B000DE6721 /* liblzma.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 9C49E5FC23053DBD00C5FB1F /* demo-common */ = { + isa = PBXGroup; + children = ( + 9C49E5FE23053DBD00C5FB1F /* SGVideoItem.h */, + 9C49E5FD23053DBD00C5FB1F /* SGVideoItem.m */, + ); + name = "demo-common"; + path = "../demo-common"; + sourceTree = ""; + }; 9CB9250B1E7942AC00DE6721 = { isa = PBXGroup; children = ( + 9C49E5FC23053DBD00C5FB1F /* demo-common */, 9CB925161E7942AC00DE6721 /* demo-macos */, 9CB925151E7942AC00DE6721 /* Products */, 9CB925331E79475B00DE6721 /* Frameworks */, @@ -103,13 +116,11 @@ children = ( 9CB925171E7942AC00DE6721 /* AppDelegate.h */, 9CB925181E7942AC00DE6721 /* AppDelegate.m */, - 9CB9251D1E7942AC00DE6721 /* ViewController.h */, - 9CB9251E1E7942AC00DE6721 /* ViewController.m */, - 9CB9252E1E79469A00DE6721 /* PlayerViewController.h */, - 9CB9252F1E79469A00DE6721 /* PlayerViewController.m */, - 9CB925201E7942AC00DE6721 /* Assets.xcassets */, + 9CB9251D1E7942AC00DE6721 /* SGListViewController.h */, + 9CB9251E1E7942AC00DE6721 /* SGListViewController.m */, + 9CB9252E1E79469A00DE6721 /* SGPlayViewController.h */, + 9CB9252F1E79469A00DE6721 /* SGPlayViewController.m */, 9CB925221E7942AC00DE6721 /* Main.storyboard */, - 9CB925251E7942AC00DE6721 /* Info.plist */, 9CB9251A1E7942AC00DE6721 /* Supporting Files */, ); path = "demo-macos"; @@ -118,8 +129,11 @@ 9CB9251A1E7942AC00DE6721 /* Supporting Files */ = { isa = PBXGroup; children = ( + 9CB925201E7942AC00DE6721 /* Assets.xcassets */, + 9CA1B18922C5F7AA009E2863 /* default.metallib */, 9C36DD401E79537500959FDA /* google-help-vr.mp4 */, 9C36DD411E79537500959FDA /* i-see-fire.mp4 */, + 9CB925251E7942AC00DE6721 /* Info.plist */, 9CB9251B1E7942AC00DE6721 /* main.m */, ); name = "Supporting Files"; @@ -128,8 +142,11 @@ 9CB925331E79475B00DE6721 /* Frameworks */ = { isa = PBXGroup; children = ( - 9CE7BA0821BA21590087B5F8 /* SGPlayer.framework */, - 9CE7BA0621BA21550087B5F8 /* SGPlatform.framework */, + 9CD90235230BDF5F00A358AA /* AVFoundation.framework */, + 9CB6951721906D2F00196E54 /* SGPlayer.framework */, + 9CB694E42190599300196E54 /* AudioUnit.framework */, + 9C0EABCA21905574004D5604 /* SGPlayer.framework */, + 9C0D004E200C784D0079D609 /* SGAVPlayer.framework */, 9C3DD1691E8FBD150003B17A /* AudioToolbox.framework */, 9C3DD1671E8FBD100003B17A /* CoreMedia.framework */, 9CA86E871E8757A700E4A8B1 /* SGPlatform.framework */, @@ -175,12 +192,12 @@ 9CB9250C1E7942AC00DE6721 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = single; TargetAttributes = { 9CB925131E7942AC00DE6721 = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = SWXNKT9754; + DevelopmentTeam = KAGR32AB25; ProvisioningStyle = Automatic; }; }; @@ -208,6 +225,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9CA1B18A22C5F7AA009E2863 /* default.metallib in Resources */, 9CB925211E7942AC00DE6721 /* Assets.xcassets in Resources */, 9C36DD421E79537500959FDA /* google-help-vr.mp4 in Resources */, 9CB925241E7942AC00DE6721 /* Main.storyboard in Resources */, @@ -222,8 +240,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9CB9251F1E7942AC00DE6721 /* ViewController.m in Sources */, - 9CB925311E79469A00DE6721 /* PlayerViewController.m in Sources */, + 9CB9251F1E7942AC00DE6721 /* SGListViewController.m in Sources */, + 9CB925311E79469A00DE6721 /* SGPlayViewController.m in Sources */, + 9C49E5FF23053DBD00C5FB1F /* SGVideoItem.m in Sources */, 9CB9251C1E7942AC00DE6721 /* main.m in Sources */, 9CB925191E7942AC00DE6721 /* AppDelegate.m in Sources */, ); @@ -256,6 +275,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -263,6 +283,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -309,6 +330,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -316,6 +338,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -347,11 +370,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = SWXNKT9754; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-macos/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.12; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-macos"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-macos"; PRODUCT_NAME = SGPlayer; }; name = Debug; @@ -361,11 +384,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = SWXNKT9754; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-macos/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.12; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-macos"; + MACOSX_DEPLOYMENT_TARGET = 10.11; + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-macos"; PRODUCT_NAME = SGPlayer; }; name = Release; diff --git a/demo/demo-macos/demo-macos.xcodeproj/xcshareddata/xcschemes/demo-macos.xcscheme b/demo/demo-macos/demo-macos.xcodeproj/xcshareddata/xcschemes/demo-macos.xcscheme index 44e7bdca..b6fe9c0a 100644 --- a/demo/demo-macos/demo-macos.xcodeproj/xcshareddata/xcschemes/demo-macos.xcscheme +++ b/demo/demo-macos/demo-macos.xcodeproj/xcshareddata/xcschemes/demo-macos.xcscheme @@ -1,6 +1,6 @@ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png index 1dce1491..563764d4 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png index bf360aa1..3cabdbf7 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png index e62f4a20..1d4a9494 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png index 7b669238..d9287f6b 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png index bf360aa1..3cabdbf7 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png index d49e460a..3d9a0ac4 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png index 7b669238..d9287f6b 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png index 2ef712ab..42048ae5 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png index d49e460a..3d9a0ac4 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png index 52e0562c..abb1c5cb 100644 Binary files a/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png and b/demo/demo-macos/demo-macos/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/demo/demo-macos/demo-macos/Base.lproj/Main.storyboard b/demo/demo-macos/demo-macos/Base.lproj/Main.storyboard index 5dc0bf75..e33ba373 100644 --- a/demo/demo-macos/demo-macos/Base.lproj/Main.storyboard +++ b/demo/demo-macos/demo-macos/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -664,11 +664,14 @@ - + + + + @@ -678,10 +681,10 @@ - + - + @@ -689,14 +692,12 @@ - + - - - + @@ -716,7 +717,7 @@ - + @@ -727,12 +728,15 @@ - + + + + @@ -742,10 +746,10 @@ - + - + @@ -753,7 +757,7 @@ - + @@ -761,7 +765,7 @@ - + @@ -779,6 +783,9 @@ + + + - + @@ -844,11 +851,11 @@ + - diff --git a/demo/demo-macos/demo-macos/PlayerViewController.h b/demo/demo-macos/demo-macos/PlayerViewController.h deleted file mode 100644 index b3ca8b16..00000000 --- a/demo/demo-macos/demo-macos/PlayerViewController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// PlayerViewController.h -// demo-macos -// -// Created by Single on 2017/3/15. -// Copyright © 2017年 single. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, DemoType) { - DemoType_AVPlayer_Normal = 0, - DemoType_AVPlayer_VR, - DemoType_FFmpeg_Normal, - DemoType_FFmpeg_VR, -}; - -@interface PlayerViewController : NSViewController - -@property (nonatomic, assign) DemoType demoType; - -- (void)setup; - -@end diff --git a/demo/demo-macos/demo-macos/PlayerViewController.m b/demo/demo-macos/demo-macos/PlayerViewController.m deleted file mode 100644 index 7392a0da..00000000 --- a/demo/demo-macos/demo-macos/PlayerViewController.m +++ /dev/null @@ -1,153 +0,0 @@ -// -// PlayerViewController.m -// demo-macos -// -// Created by Single on 2017/3/15. -// Copyright © 2017年 single. All rights reserved. -// - -#import "PlayerViewController.h" -#import - -@interface PlayerViewController () - -@property (nonatomic, strong) SGPlayer * player; -@property (weak) IBOutlet NSTextField *totalTimeLabel; -@property (weak) IBOutlet NSTextField *currentTimeLabel; -@property (weak) IBOutlet NSSlider *progressSilder; -@property (weak) IBOutlet NSButton *playButton; -@property (weak) IBOutlet NSButton *pauseButton; -@property (weak) IBOutlet NSTextField *stateLabel; -@property (weak) IBOutlet NSView *controlView; - -@end - -@implementation PlayerViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.view.wantsLayer = YES; - self.view.layer.backgroundColor = [NSColor blackColor].CGColor; - self.controlView.wantsLayer = YES; - self.controlView.layer.backgroundColor = [NSColor colorWithWhite:0 alpha:0.5].CGColor; - self.progressSilder.trackFillColor = [NSColor yellowColor]; -} - -- (void)setup -{ - self.player = [SGPlayer player]; - [self.player registerPlayerNotificationTarget:self - stateAction:@selector(stateAction:) - progressAction:@selector(progressAction:) - playableAction:@selector(playableAction:) - errorAction:@selector(errorAction:)]; - [self.view addSubview:self.player.view positioned:NSWindowBelow relativeTo:nil]; - - static NSURL * normalVideo = nil; - static NSURL * vrVideo = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - normalVideo = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"i-see-fire" ofType:@"mp4"]]; - vrVideo = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"google-help-vr" ofType:@"mp4"]]; - }); - switch (self.demoType) - { - case DemoType_AVPlayer_Normal: - [self.player replaceVideoWithURL:normalVideo]; - break; - case DemoType_AVPlayer_VR: - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - case DemoType_FFmpeg_Normal: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - self.player.decoder.hardwareAccelerateEnableForFFmpeg = NO; - [self.player replaceVideoWithURL:normalVideo]; - break; - case DemoType_FFmpeg_VR: - self.player.decoder = [SGPlayerDecoder decoderByFFmpeg]; - self.player.decoder.hardwareAccelerateEnableForFFmpeg = NO; - [self.player replaceVideoWithURL:vrVideo videoType:SGVideoTypeVR]; - break; - } -} - -- (void)viewDidLayout -{ - self.player.view.frame = self.view.bounds; -} - -- (IBAction)play:(id)sender -{ - [self.player play]; -} - -- (IBAction)pause:(id)sender -{ - [self.player pause]; -} - -- (void)stateAction:(NSNotification *)notification -{ - SGState * state = [SGState stateFromUserInfo:notification.userInfo]; - - NSString * text; - switch (state.current) { - case SGPlayerStateNone: - text = @"None"; - break; - case SGPlayerStateBuffering: - text = @"Buffering..."; - break; - case SGPlayerStateReadyToPlay: - text = @"Prepare"; - self.totalTimeLabel.stringValue = [self timeStringFromSeconds:self.player.duration]; - [self.player play]; - break; - case SGPlayerStatePlaying: - text = @"Playing"; - break; - case SGPlayerStateSuspend: - text = @"Suspend"; - break; - case SGPlayerStateFinished: - text = @"Finished"; - break; - case SGPlayerStateFailed: - text = @"Error"; - break; - } - self.stateLabel.stringValue = text; -} - -- (void)progressAction:(NSNotification *)notification -{ - SGProgress * progress = [SGProgress progressFromUserInfo:notification.userInfo]; - self.progressSilder.doubleValue = progress.percent; - self.currentTimeLabel.stringValue = [self timeStringFromSeconds:progress.current]; -} - -- (void)playableAction:(NSNotification *)notification -{ - SGPlayable * playable = [SGPlayable playableFromUserInfo:notification.userInfo]; - NSLog(@"playable time : %f", playable.current); -} - -- (void)errorAction:(NSNotification *)notification -{ - SGError * error = [SGError errorFromUserInfo:notification.userInfo]; - NSLog(@"player did error : %@", error.error); -} - -- (NSString *)timeStringFromSeconds:(CGFloat)seconds -{ - return [NSString stringWithFormat:@"%ld:%.2ld", (long)seconds / 60, (long)seconds % 60]; -} - -- (void)dealloc -{ - [self.player removePlayerNotificationTarget:self]; -} - -@end diff --git a/demo/demo-macos/demo-macos/ViewController.h b/demo/demo-macos/demo-macos/SGListViewController.h similarity index 65% rename from demo/demo-macos/demo-macos/ViewController.h rename to demo/demo-macos/demo-macos/SGListViewController.h index 1b124a25..a898709f 100644 --- a/demo/demo-macos/demo-macos/ViewController.h +++ b/demo/demo-macos/demo-macos/SGListViewController.h @@ -1,5 +1,5 @@ // -// ViewController.h +// SGListViewController.h // demo-macos // // Created by Single on 2017/3/15. @@ -8,7 +8,7 @@ #import -@interface ViewController : NSViewController +@interface SGListViewController : NSViewController @end diff --git a/demo/demo-macos/demo-macos/SGListViewController.m b/demo/demo-macos/demo-macos/SGListViewController.m new file mode 100644 index 00000000..e474c078 --- /dev/null +++ b/demo/demo-macos/demo-macos/SGListViewController.m @@ -0,0 +1,39 @@ +// +// SGListViewController.m +// demo-macos +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGListViewController.h" +#import "SGPlayViewController.h" +#import "SGVideoItem.h" + +@interface SGListViewController () + +@property (weak) IBOutlet NSPopUpButton *popUpButton; +@property (nonatomic, strong) NSArray *videoItems; + +@end + +@implementation SGListViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + [self.popUpButton removeAllItems]; + self.videoItems = [SGVideoItem videoItems]; + for (NSUInteger i = 0; i < self.videoItems.count; i++) { + [self.popUpButton addItemWithTitle:self.videoItems[i].name]; + } +} + +- (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender +{ + SGPlayViewController *vc = (id)[segue.destinationController contentViewController]; + vc.videoItem = self.videoItems[self.popUpButton.indexOfSelectedItem]; + [vc run]; +} + +@end diff --git a/demo/demo-macos/demo-macos/SGPlayViewController.h b/demo/demo-macos/demo-macos/SGPlayViewController.h new file mode 100644 index 00000000..b075cc35 --- /dev/null +++ b/demo/demo-macos/demo-macos/SGPlayViewController.h @@ -0,0 +1,18 @@ +// +// SGPlayViewController.h +// demo-macos +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import +#import "SGVideoItem.h" + +@interface SGPlayViewController : NSViewController + +@property (nonatomic, strong) SGVideoItem *videoItem; + +- (void)run; + +@end diff --git a/demo/demo-macos/demo-macos/SGPlayViewController.m b/demo/demo-macos/demo-macos/SGPlayViewController.m new file mode 100644 index 00000000..0d9e71c0 --- /dev/null +++ b/demo/demo-macos/demo-macos/SGPlayViewController.m @@ -0,0 +1,117 @@ +// +// SGPlayViewController.m +// demo-macos +// +// Created by Single on 2017/3/15. +// Copyright © 2017年 single. All rights reserved. +// + +#import "SGPlayViewController.h" + +@interface SGPlayViewController () + +@property (nonatomic, assign) BOOL seeking; +@property (nonatomic, strong) SGPlayer *player; + +@property (weak) IBOutlet NSView *controlView; +@property (weak) IBOutlet NSButton *playButton; +@property (weak) IBOutlet NSButton *pauseButton; +@property (weak) IBOutlet NSSlider *progressSilder; +@property (weak) IBOutlet NSTextField *stateLabel; +@property (weak) IBOutlet NSTextField *durationLabel; +@property (weak) IBOutlet NSTextField *currentTimeLabel; + +@end + +@implementation SGPlayViewController + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + if (self = [super initWithCoder:coder]) { + self.player = [[SGPlayer alloc] init]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(infoChanged:) name:SGPlayerDidChangeInfosNotification object:self.player]; + } + return self; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.view.wantsLayer = YES; + self.view.layer.backgroundColor = [NSColor blackColor].CGColor; + self.controlView.wantsLayer = YES; + self.controlView.layer.backgroundColor = [NSColor colorWithWhite:0 alpha:0.5].CGColor; + self.progressSilder.trackFillColor = [NSColor yellowColor]; + +} + +- (void)run +{ + self.player.videoRenderer.view = self.view; + self.player.videoRenderer.displayMode = self.videoItem.displayMode; + [self.player replaceWithAsset:self.videoItem.asset]; + [self.player play]; +} + +#pragma mark - SGPlayer Notifications + +- (void)infoChanged:(NSNotification *)notification +{ + SGTimeInfo time = [SGPlayer timeInfoFromUserInfo:notification.userInfo]; + SGStateInfo state = [SGPlayer stateInfoFromUserInfo:notification.userInfo]; + SGInfoAction action = [SGPlayer infoActionFromUserInfo:notification.userInfo]; + if (action & SGInfoActionTime) { + if (action & SGInfoActionTimePlayback && !(state.playback & SGPlaybackStateSeeking) && !self.seeking && !self.progressSilder.isHighlighted) { + self.progressSilder.doubleValue = CMTimeGetSeconds(time.playback) / CMTimeGetSeconds(time.duration); + self.currentTimeLabel.stringValue = [self timeStringFromSeconds:CMTimeGetSeconds(time.playback)]; + } + if (action & SGInfoActionTimeDuration) { + self.durationLabel.stringValue = [self timeStringFromSeconds:CMTimeGetSeconds(time.duration)]; + } + } + if (action & SGInfoActionState) { + if (state.playback & SGPlaybackStateFinished) { + self.stateLabel.stringValue = @"Finished"; + } else if (state.playback & SGPlaybackStatePlaying) { + self.stateLabel.stringValue = @"Playing"; + } else { + self.stateLabel.stringValue = @"Paused"; + } + } +} + +#pragma mark - Actions + +- (IBAction)play:(id)sender +{ + [self.player play]; +} + +- (IBAction)pause:(id)sender +{ + [self.player pause]; +} + +- (IBAction)progressValueChanged:(id)sender +{ + CMTime time = CMTimeMultiplyByFloat64(self.player.currentItem.duration, self.progressSilder.doubleValue); + self.seeking = YES; + [self.player seekToTime:time result:^(CMTime time, NSError *error) { + self.seeking = NO; + }]; +} + +#pragma mark - Tools + +- (NSString *)timeStringFromSeconds:(CGFloat)seconds +{ + return [NSString stringWithFormat:@"%ld:%.2ld", (long)seconds / 60, (long)seconds % 60]; +} + +@end diff --git a/demo/demo-macos/demo-macos/ViewController.m b/demo/demo-macos/demo-macos/ViewController.m deleted file mode 100644 index 7f4497fd..00000000 --- a/demo/demo-macos/demo-macos/ViewController.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// ViewController.m -// demo-macos -// -// Created by Single on 2017/3/15. -// Copyright © 2017年 single. All rights reserved. -// - -#import "ViewController.h" -#import "PlayerViewController.h" - -@interface ViewController () - -@property (weak) IBOutlet NSPopUpButton *demoTypeButton; - -@end - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; -} - -- (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender -{ - if ([segue.identifier isEqualToString:@"gotoPlay"]) { - PlayerViewController * obj = (PlayerViewController *)[segue.destinationController contentViewController]; - obj.demoType = [self.demoTypeButton indexOfSelectedItem]; - [obj setup]; - } -} - -@end diff --git a/demo/demo-macos/demo-macos/default.metallib b/demo/demo-macos/demo-macos/default.metallib new file mode 100644 index 00000000..f1dc6b3f Binary files /dev/null and b/demo/demo-macos/demo-macos/default.metallib differ diff --git a/demo/demo-tvos/demo-tvos.xcodeproj/project.pbxproj b/demo/demo-tvos/demo-tvos.xcodeproj/project.pbxproj index 4102156c..5231d2e4 100644 --- a/demo/demo-tvos/demo-tvos.xcodeproj/project.pbxproj +++ b/demo/demo-tvos/demo-tvos.xcodeproj/project.pbxproj @@ -3,117 +3,130 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ - 9C2CF00E1F10D5F50099247F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2CF00D1F10D5F50099247F /* main.m */; }; - 9C2CF0111F10D5F50099247F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2CF0101F10D5F50099247F /* AppDelegate.m */; }; - 9C2CF0141F10D5F50099247F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C2CF0131F10D5F50099247F /* ViewController.m */; }; - 9C2CF0171F10D5F50099247F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C2CF0151F10D5F50099247F /* Main.storyboard */; }; - 9C2CF0191F10D5F50099247F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C2CF0181F10D5F50099247F /* Assets.xcassets */; }; - 9C69BC7A1F10D650008DC715 /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C69BC791F10D650008DC715 /* SGPlayer.framework */; }; - 9C69BC7C1F10D656008DC715 /* SGPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C69BC7B1F10D656008DC715 /* SGPlatform.framework */; }; - 9C69BC7E1F10D75F008DC715 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C69BC7D1F10D75F008DC715 /* libz.tbd */; }; - 9C69BC801F10D768008DC715 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C69BC7F1F10D768008DC715 /* libbz2.tbd */; }; - 9C69BC821F10D76F008DC715 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C69BC811F10D76F008DC715 /* libiconv.tbd */; }; + 9C6901F821901D3C00B546E3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6901F721901D3C00B546E3 /* AppDelegate.m */; }; + 9C6901FB21901D3C00B546E3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6901FA21901D3C00B546E3 /* ViewController.m */; }; + 9C6901FE21901D3C00B546E3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9C6901FC21901D3C00B546E3 /* Main.storyboard */; }; + 9C69020021901D3D00B546E3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9C6901FF21901D3D00B546E3 /* Assets.xcassets */; }; + 9C69020321901D3D00B546E3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C69020221901D3D00B546E3 /* main.m */; }; + 9C86356A21902E5000D730EC /* SGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C86356921902E5000D730EC /* SGPlayer.framework */; }; + 9C8637E72190479F00D730EC /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C8637E62190479F00D730EC /* AudioToolbox.framework */; }; + 9C8637E9219047A400D730EC /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C8637E8219047A400D730EC /* VideoToolbox.framework */; }; + 9C8637EB219047A900D730EC /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C8637EA219047A900D730EC /* libbz2.tbd */; }; + 9C8637ED219047AE00D730EC /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C8637EC219047AE00D730EC /* libz.tbd */; }; + 9C8637EF219047B400D730EC /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C8637EE219047B400D730EC /* libiconv.tbd */; }; + 9CA1B18F22C624F4009E2863 /* default.metallib in Resources */ = {isa = PBXBuildFile; fileRef = 9CA1B18E22C624F3009E2863 /* default.metallib */; }; + 9CD90238230BE08E00A358AA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CD90237230BE08E00A358AA /* AVFoundation.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 9C2CF0091F10D5F50099247F /* demo-tvos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "demo-tvos.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9C2CF00D1F10D5F50099247F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 9C2CF00F1F10D5F50099247F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 9C2CF0101F10D5F50099247F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 9C2CF0121F10D5F50099247F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 9C2CF0131F10D5F50099247F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 9C2CF0161F10D5F50099247F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 9C2CF0181F10D5F50099247F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 9C2CF01A1F10D5F50099247F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9C69BC791F10D650008DC715 /* SGPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlayer.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-cxkylxbwkfilbmgwetaiuwiojpbb/Build/Products/Debug-appletvsimulator/SGPlayer.framework"; sourceTree = ""; }; - 9C69BC7B1F10D656008DC715 /* SGPlatform.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SGPlatform.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/demo-cxkylxbwkfilbmgwetaiuwiojpbb/Build/Products/Debug-appletvsimulator/SGPlatform.framework"; sourceTree = ""; }; - 9C69BC7D1F10D75F008DC715 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; - 9C69BC7F1F10D768008DC715 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; - 9C69BC811F10D76F008DC715 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; + 9C6901F321901D3C00B546E3 /* SGPlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SGPlayer.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C6901F621901D3C00B546E3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 9C6901F721901D3C00B546E3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9C6901F921901D3C00B546E3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 9C6901FA21901D3C00B546E3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 9C6901FD21901D3C00B546E3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9C6901FF21901D3D00B546E3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9C69020121901D3D00B546E3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9C69020221901D3D00B546E3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 9C86356921902E5000D730EC /* SGPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SGPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C8637E42190479A00D730EC /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 9C8637E62190479F00D730EC /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 9C8637E8219047A400D730EC /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; + 9C8637EA219047A900D730EC /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; + 9C8637EC219047AE00D730EC /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 9C8637EE219047B400D730EC /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; + 9CA1B18E22C624F3009E2863 /* default.metallib */ = {isa = PBXFileReference; lastKnownFileType = "archive.metal-library"; path = default.metallib; sourceTree = ""; }; + 9CD90237230BE08E00A358AA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 9C2CF0061F10D5F50099247F /* Frameworks */ = { + 9C6901F021901D3C00B546E3 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9C69BC821F10D76F008DC715 /* libiconv.tbd in Frameworks */, - 9C69BC801F10D768008DC715 /* libbz2.tbd in Frameworks */, - 9C69BC7E1F10D75F008DC715 /* libz.tbd in Frameworks */, - 9C69BC7C1F10D656008DC715 /* SGPlatform.framework in Frameworks */, - 9C69BC7A1F10D650008DC715 /* SGPlayer.framework in Frameworks */, + 9C86356A21902E5000D730EC /* SGPlayer.framework in Frameworks */, + 9CD90238230BE08E00A358AA /* AVFoundation.framework in Frameworks */, + 9C8637E72190479F00D730EC /* AudioToolbox.framework in Frameworks */, + 9C8637E9219047A400D730EC /* VideoToolbox.framework in Frameworks */, + 9C8637EF219047B400D730EC /* libiconv.tbd in Frameworks */, + 9C8637EB219047A900D730EC /* libbz2.tbd in Frameworks */, + 9C8637ED219047AE00D730EC /* libz.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 9C2CF0001F10D5F50099247F = { + 9C6901EA21901D3C00B546E3 = { isa = PBXGroup; children = ( - 9C2CF00B1F10D5F50099247F /* demo-tvos */, - 9C2CF00A1F10D5F50099247F /* Products */, - 9C69BC781F10D650008DC715 /* Frameworks */, + 9C6901F521901D3C00B546E3 /* demo-tvos */, + 9C6901F421901D3C00B546E3 /* Products */, + 9C86356821902E5000D730EC /* Frameworks */, ); sourceTree = ""; }; - 9C2CF00A1F10D5F50099247F /* Products */ = { + 9C6901F421901D3C00B546E3 /* Products */ = { isa = PBXGroup; children = ( - 9C2CF0091F10D5F50099247F /* demo-tvos.app */, + 9C6901F321901D3C00B546E3 /* SGPlayer.app */, ); name = Products; sourceTree = ""; }; - 9C2CF00B1F10D5F50099247F /* demo-tvos */ = { + 9C6901F521901D3C00B546E3 /* demo-tvos */ = { isa = PBXGroup; children = ( - 9C2CF00F1F10D5F50099247F /* AppDelegate.h */, - 9C2CF0101F10D5F50099247F /* AppDelegate.m */, - 9C2CF0121F10D5F50099247F /* ViewController.h */, - 9C2CF0131F10D5F50099247F /* ViewController.m */, - 9C2CF0151F10D5F50099247F /* Main.storyboard */, - 9C2CF0181F10D5F50099247F /* Assets.xcassets */, - 9C2CF01A1F10D5F50099247F /* Info.plist */, - 9C2CF00C1F10D5F50099247F /* Supporting Files */, + 9C6901F621901D3C00B546E3 /* AppDelegate.h */, + 9C6901F721901D3C00B546E3 /* AppDelegate.m */, + 9C6901F921901D3C00B546E3 /* ViewController.h */, + 9C6901FA21901D3C00B546E3 /* ViewController.m */, + 9C6901FC21901D3C00B546E3 /* Main.storyboard */, + 9CA1B18D22C6241C009E2863 /* Supporting Files */, ); path = "demo-tvos"; sourceTree = ""; }; - 9C2CF00C1F10D5F50099247F /* Supporting Files */ = { + 9C86356821902E5000D730EC /* Frameworks */ = { isa = PBXGroup; children = ( - 9C2CF00D1F10D5F50099247F /* main.m */, + 9CD90237230BE08E00A358AA /* AVFoundation.framework */, + 9C8637EE219047B400D730EC /* libiconv.tbd */, + 9C8637EC219047AE00D730EC /* libz.tbd */, + 9C8637EA219047A900D730EC /* libbz2.tbd */, + 9C8637E8219047A400D730EC /* VideoToolbox.framework */, + 9C8637E62190479F00D730EC /* AudioToolbox.framework */, + 9C8637E42190479A00D730EC /* CoreMedia.framework */, + 9C86356921902E5000D730EC /* SGPlayer.framework */, ); - name = "Supporting Files"; + name = Frameworks; sourceTree = ""; }; - 9C69BC781F10D650008DC715 /* Frameworks */ = { + 9CA1B18D22C6241C009E2863 /* Supporting Files */ = { isa = PBXGroup; children = ( - 9C69BC811F10D76F008DC715 /* libiconv.tbd */, - 9C69BC7F1F10D768008DC715 /* libbz2.tbd */, - 9C69BC7D1F10D75F008DC715 /* libz.tbd */, - 9C69BC7B1F10D656008DC715 /* SGPlatform.framework */, - 9C69BC791F10D650008DC715 /* SGPlayer.framework */, + 9C6901FF21901D3D00B546E3 /* Assets.xcassets */, + 9CA1B18E22C624F3009E2863 /* default.metallib */, + 9C69020121901D3D00B546E3 /* Info.plist */, + 9C69020221901D3D00B546E3 /* main.m */, ); - name = Frameworks; + name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 9C2CF0081F10D5F50099247F /* demo-tvos */ = { + 9C6901F221901D3C00B546E3 /* demo-tvos */ = { isa = PBXNativeTarget; - buildConfigurationList = 9C2CF01D1F10D5F50099247F /* Build configuration list for PBXNativeTarget "demo-tvos" */; + buildConfigurationList = 9C69020621901D3D00B546E3 /* Build configuration list for PBXNativeTarget "demo-tvos" */; buildPhases = ( - 9C2CF0051F10D5F50099247F /* Sources */, - 9C2CF0061F10D5F50099247F /* Frameworks */, - 9C2CF0071F10D5F50099247F /* Resources */, + 9C6901EF21901D3C00B546E3 /* Sources */, + 9C6901F021901D3C00B546E3 /* Frameworks */, + 9C6901F121901D3C00B546E3 /* Resources */, ); buildRules = ( ); @@ -121,73 +134,72 @@ ); name = "demo-tvos"; productName = "demo-tvos"; - productReference = 9C2CF0091F10D5F50099247F /* demo-tvos.app */; + productReference = 9C6901F321901D3C00B546E3 /* SGPlayer.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 9C2CF0011F10D5F50099247F /* Project object */ = { + 9C6901EB21901D3C00B546E3 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1000; ORGANIZATIONNAME = Single; TargetAttributes = { - 9C2CF0081F10D5F50099247F = { - CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = SWXNKT9754; - ProvisioningStyle = Automatic; + 9C6901F221901D3C00B546E3 = { + CreatedOnToolsVersion = 10.0; }; }; }; - buildConfigurationList = 9C2CF0041F10D5F50099247F /* Build configuration list for PBXProject "demo-tvos" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + buildConfigurationList = 9C6901EE21901D3C00B546E3 /* Build configuration list for PBXProject "demo-tvos" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); - mainGroup = 9C2CF0001F10D5F50099247F; - productRefGroup = 9C2CF00A1F10D5F50099247F /* Products */; + mainGroup = 9C6901EA21901D3C00B546E3; + productRefGroup = 9C6901F421901D3C00B546E3 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 9C2CF0081F10D5F50099247F /* demo-tvos */, + 9C6901F221901D3C00B546E3 /* demo-tvos */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 9C2CF0071F10D5F50099247F /* Resources */ = { + 9C6901F121901D3C00B546E3 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C2CF0191F10D5F50099247F /* Assets.xcassets in Resources */, - 9C2CF0171F10D5F50099247F /* Main.storyboard in Resources */, + 9CA1B18F22C624F4009E2863 /* default.metallib in Resources */, + 9C69020021901D3D00B546E3 /* Assets.xcassets in Resources */, + 9C6901FE21901D3C00B546E3 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 9C2CF0051F10D5F50099247F /* Sources */ = { + 9C6901EF21901D3C00B546E3 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9C2CF0141F10D5F50099247F /* ViewController.m in Sources */, - 9C2CF0111F10D5F50099247F /* AppDelegate.m in Sources */, - 9C2CF00E1F10D5F50099247F /* main.m in Sources */, + 9C6901FB21901D3C00B546E3 /* ViewController.m in Sources */, + 9C69020321901D3D00B546E3 /* main.m in Sources */, + 9C6901F821901D3C00B546E3 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - 9C2CF0151F10D5F50099247F /* Main.storyboard */ = { + 9C6901FC21901D3C00B546E3 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 9C2CF0161F10D5F50099247F /* Base */, + 9C6901FD21901D3C00B546E3 /* Base */, ); name = Main.storyboard; sourceTree = ""; @@ -195,16 +207,17 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 9C2CF01B1F10D5F50099247F /* Debug */ = { + 9C69020421901D3D00B546E3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -223,13 +236,14 @@ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -243,24 +257,25 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 10.2; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; - 9C2CF01C1F10D5F50099247F /* Release */ = { + 9C69020521901D3D00B546E3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -279,13 +294,14 @@ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -294,61 +310,71 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 10.2; + TVOS_DEPLOYMENT_TARGET = 12.0; VALIDATE_PRODUCT = YES; }; name = Release; }; - 9C2CF01E1F10D5F50099247F /* Debug */ = { + 9C69020721901D3D00B546E3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = SWXNKT9754; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-tvos/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-tvos"; - PRODUCT_NAME = "$(TARGET_NAME)"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-tvos"; + PRODUCT_NAME = SGPlayer; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.2; }; name = Debug; }; - 9C2CF01F1F10D5F50099247F /* Release */ = { + 9C69020821901D3D00B546E3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = SWXNKT9754; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = KAGR32AB25; INFOPLIST_FILE = "demo-tvos/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer-demo-tvos"; - PRODUCT_NAME = "$(TARGET_NAME)"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.libobjc.SGPlayer.demo-tvos"; + PRODUCT_NAME = SGPlayer; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 10.2; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 9C2CF0041F10D5F50099247F /* Build configuration list for PBXProject "demo-tvos" */ = { + 9C6901EE21901D3C00B546E3 /* Build configuration list for PBXProject "demo-tvos" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9C2CF01B1F10D5F50099247F /* Debug */, - 9C2CF01C1F10D5F50099247F /* Release */, + 9C69020421901D3D00B546E3 /* Debug */, + 9C69020521901D3D00B546E3 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9C2CF01D1F10D5F50099247F /* Build configuration list for PBXNativeTarget "demo-tvos" */ = { + 9C69020621901D3D00B546E3 /* Build configuration list for PBXNativeTarget "demo-tvos" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9C2CF01E1F10D5F50099247F /* Debug */, - 9C2CF01F1F10D5F50099247F /* Release */, + 9C69020721901D3D00B546E3 /* Debug */, + 9C69020821901D3D00B546E3 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 9C2CF0011F10D5F50099247F /* Project object */; + rootObject = 9C6901EB21901D3C00B546E3 /* Project object */; } diff --git a/demo/demo-tvos/demo-tvos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/demo/demo-tvos/demo-tvos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/demo/demo-tvos/demo-tvos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/demo/demo-tvos/demo-tvos.xcodeproj/xcshareddata/xcschemes/demo-tvos.xcscheme b/demo/demo-tvos/demo-tvos.xcodeproj/xcshareddata/xcschemes/demo-tvos.xcscheme index 7473c796..088f0420 100644 --- a/demo/demo-tvos/demo-tvos.xcodeproj/xcshareddata/xcschemes/demo-tvos.xcscheme +++ b/demo/demo-tvos/demo-tvos.xcodeproj/xcshareddata/xcschemes/demo-tvos.xcscheme @@ -1,6 +1,6 @@ @@ -32,8 +32,8 @@ @@ -50,13 +50,15 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUFrameCaptureMode = "3" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> @@ -74,8 +76,8 @@ runnableDebuggingMode = "0"> diff --git a/demo/demo-tvos/demo-tvos/AppDelegate.h b/demo/demo-tvos/demo-tvos/AppDelegate.h index f5aee299..e9fb3fcb 100644 --- a/demo/demo-tvos/demo-tvos/AppDelegate.h +++ b/demo/demo-tvos/demo-tvos/AppDelegate.h @@ -2,16 +2,15 @@ // AppDelegate.h // demo-tvos // -// Created by Single on 2017/7/8. -// Copyright © 2017年 Single. All rights reserved. +// Created by Single on 2018/11/5. +// Copyright © 2018 Single. All rights reserved. // #import @interface AppDelegate : UIResponder -@property (strong, nonatomic) UIWindow *window; - +@property (strong, nonatomic) UIWindow * window; @end diff --git a/demo/demo-tvos/demo-tvos/AppDelegate.m b/demo/demo-tvos/demo-tvos/AppDelegate.m index 6cab83d7..52fd1b8f 100644 --- a/demo/demo-tvos/demo-tvos/AppDelegate.m +++ b/demo/demo-tvos/demo-tvos/AppDelegate.m @@ -2,8 +2,8 @@ // AppDelegate.m // demo-tvos // -// Created by Single on 2017/7/8. -// Copyright © 2017年 Single. All rights reserved. +// Created by Single on 2018/11/5. +// Copyright © 2018 Single. All rights reserved. // #import "AppDelegate.h" @@ -14,38 +14,9 @@ @interface AppDelegate () @implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ return YES; } - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. -} - - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - - @end diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json similarity index 68% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index 0564959f..48ecb4fa 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -1,8 +1,7 @@ { "images" : [ { - "idiom" : "tv", - "scale" : "1x" + "idiom" : "tv" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json similarity index 99% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json index 8bf75d9f..d29f024e 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json @@ -14,4 +14,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..48ecb4fa --- /dev/null +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 00000000..48ecb4fa --- /dev/null +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,11 @@ +{ + "images" : [ + { + "idiom" : "tv" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 0564959f..00000000 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json deleted file mode 100644 index 0564959f..00000000 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "tv", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json similarity index 70% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index 0564959f..16a370df 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -3,6 +3,10 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json similarity index 99% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json index 8bf75d9f..d29f024e 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json @@ -14,4 +14,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json similarity index 70% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index 0564959f..16a370df 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -3,6 +3,10 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json similarity index 70% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json index 0564959f..16a370df 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -3,6 +3,10 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json similarity index 100% rename from demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json rename to demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json index 6d596bc7..db288f36 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -3,13 +3,13 @@ { "size" : "1280x768", "idiom" : "tv", - "filename" : "App Icon - Large.imagestack", + "filename" : "App Icon - App Store.imagestack", "role" : "primary-app-icon" }, { "size" : "400x240", "idiom" : "tv", - "filename" : "App Icon - Small.imagestack", + "filename" : "App Icon.imagestack", "role" : "primary-app-icon" }, { @@ -29,4 +29,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json index 0564959f..7dc95020 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -3,6 +3,18 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json index 0564959f..7dc95020 100644 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +++ b/demo/demo-tvos/demo-tvos/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -3,6 +3,18 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + }, + { + "idiom" : "tv-marketing", + "scale" : "1x" + }, + { + "idiom" : "tv-marketing", + "scale" : "2x" } ], "info" : { diff --git a/demo/demo-tvos/demo-tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo/demo-tvos/demo-tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 29d94c78..00000000 --- a/demo/demo-tvos/demo-tvos/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "orientation" : "landscape", - "idiom" : "tv", - "extent" : "full-screen", - "minimum-system-version" : "9.0", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/demo-tvos/demo-tvos/Base.lproj/Main.storyboard b/demo/demo-tvos/demo-tvos/Base.lproj/Main.storyboard index a89ecf5c..a5c40f19 100644 --- a/demo/demo-tvos/demo-tvos/Base.lproj/Main.storyboard +++ b/demo/demo-tvos/demo-tvos/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - - + + - + + @@ -17,6 +18,7 @@ + diff --git a/demo/demo-tvos/demo-tvos/Info.plist b/demo/demo-tvos/demo-tvos/Info.plist index dfd605c7..5f512a2b 100644 --- a/demo/demo-tvos/demo-tvos/Info.plist +++ b/demo/demo-tvos/demo-tvos/Info.plist @@ -3,7 +3,9 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + SGPlayer CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/demo/demo-tvos/demo-tvos/ViewController.h b/demo/demo-tvos/demo-tvos/ViewController.h index 20d0f67a..430690e0 100644 --- a/demo/demo-tvos/demo-tvos/ViewController.h +++ b/demo/demo-tvos/demo-tvos/ViewController.h @@ -2,14 +2,13 @@ // ViewController.h // demo-tvos // -// Created by Single on 2017/7/8. -// Copyright © 2017年 Single. All rights reserved. +// Created by Single on 2018/11/5. +// Copyright © 2018 Single. All rights reserved. // #import @interface ViewController : UIViewController - @end diff --git a/demo/demo-tvos/demo-tvos/ViewController.m b/demo/demo-tvos/demo-tvos/ViewController.m index 017413bd..2799b766 100644 --- a/demo/demo-tvos/demo-tvos/ViewController.m +++ b/demo/demo-tvos/demo-tvos/ViewController.m @@ -2,8 +2,8 @@ // ViewController.m // demo-tvos // -// Created by Single on 2017/7/8. -// Copyright © 2017年 Single. All rights reserved. +// Created by Single on 2018/11/5. +// Copyright © 2018 Single. All rights reserved. // #import "ViewController.h" @@ -11,17 +11,59 @@ @interface ViewController () -@property (nonatomic, strong) SGPlayer * player; +@property (nonatomic, assign) BOOL seeking; +@property (nonatomic, strong) SGPlayer *player; @end @implementation ViewController +- (instancetype)init +{ + if (self = [super init]) { + self.player = [[SGPlayer alloc] init]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(infoChanged:) name:SGPlayerDidChangeInfosNotification object:self.player]; + } + return self; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + - (void)viewDidLoad { [super viewDidLoad]; - self.player = [SGPlayer player]; + NSURL *URL = [[NSBundle mainBundle] URLForResource:@"i-see-fire" withExtension:@"mp4"]; + SGAsset *asset = [[SGURLAsset alloc] initWithURL:URL]; + + self.player.videoRenderer.view = self.view; + [self.player replaceWithAsset:asset]; + [self.player play]; +} + +#pragma mark - SGPlayer Notifications + +- (void)infoChanged:(NSNotification *)notification +{ + SGTimeInfo time = [SGPlayer timeInfoFromUserInfo:notification.userInfo]; + SGStateInfo state = [SGPlayer stateInfoFromUserInfo:notification.userInfo]; + SGInfoAction action = [SGPlayer infoActionFromUserInfo:notification.userInfo]; + if (action & SGInfoActionTime) { + NSLog(@"playback: %f, duration: %f, cached: %f", + CMTimeGetSeconds(time.playback), + CMTimeGetSeconds(time.duration), + CMTimeGetSeconds(time.cached)); + } + if (action & SGInfoActionState) { + NSLog(@"player: %d, loading: %d, playback: %d, playing: %d, seeking: %d, finished: %d", + (int)state.player, (int)state.loading, (int)state.playback, + (int)(state.playback & SGPlaybackStatePlaying), + (int)(state.playback & SGPlaybackStateSeeking), + (int)(state.playback & SGPlaybackStateFinished)); + } } @end diff --git a/demo/demo-tvos/demo-tvos/default.metallib b/demo/demo-tvos/demo-tvos/default.metallib new file mode 100644 index 00000000..ab585c92 Binary files /dev/null and b/demo/demo-tvos/demo-tvos/default.metallib differ diff --git a/demo/demo-tvos/demo-tvos/main.m b/demo/demo-tvos/demo-tvos/main.m index c995e63c..293c2640 100644 --- a/demo/demo-tvos/demo-tvos/main.m +++ b/demo/demo-tvos/demo-tvos/main.m @@ -2,8 +2,8 @@ // main.m // demo-tvos // -// Created by Single on 2017/7/8. -// Copyright © 2017年 Single. All rights reserved. +// Created by Single on 2018/11/5. +// Copyright © 2018 Single. All rights reserved. // #import diff --git a/documents/Principle-chs.md b/documents/Principle-chs.md deleted file mode 100644 index 79009531..00000000 --- a/documents/Principle-chs.md +++ /dev/null @@ -1,152 +0,0 @@ -# SGPlayer 原理详解 - -SGPlayer 是一款基于 AVPlayer、FFmpeg 的媒体资源播放器框架。支持全景视频,RTMP、RTSP 等直播流;同时支持 iOS、macOS、tvOS 三个平台。本文将采用图解+说明的方式把关键模块的实现原理介绍给大家。 - -## 发起原因 - -关于视频播放,苹果提供的 AVPlayer 在性能上有着十分出色的表现,在无特需求且资源可控的时,首选一定是它。但随着 VR 和直播的兴起,仅使用 AVPlayer 很多时候已经无法满足需求。出于性能考虑,又不能完全抛弃 AVPlayer,毕竟在点播时有着明显的优势。而在现有的开源项目中,普遍定位比较单一,并不能兼顾 AVPlayer、直播、VR。这样一来,需同时使用3款播放器才能满足需求,即点播使用 AVPlayer,直播使用一个独立的播放器,VR 使用一个独立的播放器。这样处理3套不同的接口和回调事件,着实很让人崩溃!SGPlayer 的出现大大简化了这一过程。 - - -## 组成结构 和 播放流程 - -![SGPlayer](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/SGFFPlayer-playback.jpeg) - -上图展示了 SGPlayer 的播放流程和主要组件,下面简单介绍图中各组件的分工 - -### SGPlayer - -SGPlayer是一个抽象的播放器外壳,它本身并不具备播放功能。仅作为和外界交互的载体。真正的播放由内部的 SGAVPlayer 和 SGFFPlayer 完成。而画面绘制由内部的 SGDisplayView 完成。 - -### SGPlayerDecoder - -SGPlayerDecoder 是播放内核的选择器,根据资源类型动态选择使用 SGAVPlayer 或 SGFFPlayer 进行播放,可通过更改其配置参数,来自定义播放内核的选择策略。 - -### SGAVPlayer - -SGAVPlayer 是基于 AVPlayer 封装而成,视频画面输出至 SGDsiplayView,并根据视频类型(全景或平面)进行展示。音频由系统处理无需额外操作。 - -### SGFFPlayer - -SGFFPlayer 是基于 FFmpeg 封装而成,支持近所有的主流视频格式。视频画面同样输出至 SGDsiplayView。音频则输出至 SGAudioManager,再由 SGAudioManager 使用 Audio Unit 进行播放。 - -### SGDisplayView - -SGDisplayView 负责视频画面的绘制。它本身不会绘制视频画面,仅作为绘制层的父视图使用,真正的绘制由内部的 AVPlayerLayer 和 SGGLViewController 完成,选择规则如下表所示。 - -|| 平面 | 全景 ----|---|--- -SGAVPlayer | AVPlayerLayer | SGGLViewController -SGFFPlayer | SGGLViewController | SGGLViewController - -### SGAudioManager - -SGAudioManager 负责声音的播放和音频事件的处理。内部使用 AUGraph 做了一层混音,通过混音可以设置声音的输出音量大小等操作。 - -### 小结 - -了解了各组件的功能,重新梳理一下完整的播放过程 - -- SGPlayer 收到播放请求。 -- 由 SGPlayerDecoder 根据资源类型分发给 SGAVPlayer 或 SGFFPlayer 进行播放。 -- 如果使用 SGAVPlayer 播放,根据视频类型将画面输出给 SGDisplayView 中的 AVPlayerLayer 或 SGGLViewController。 -- 如果使用 SGFFPlayer 播放,将视频画面输出给 SGDisplayView,音频输出至 SGAudioManager。 - -通过抽象的 SGPlayer 将真正负责播放的 SGAVPlayer 和 SGFFPlayer 屏蔽起来,这样可以保证无论资源是何种类型,对外仅暴露一套统一的接口和回调,将播放内核间的差异内部消化,尽可能降低使用成本。 - - -## 全景图像原理 - -全景图像与平面图像本质都是一张 2D 图片,区别在于展示时的载体。对于平面图而言,用于展示的模型是一个矩形,仅需将图像上的像素一一对应在矩形上即可;而全景图像展示的模型是一个球,需要将图像上的每一个像素都对应到球面相应位置上。在绘制流程上二者的差别并不大,仅在贴图规则和呈现方式上略有区别。 - -### 贴图规则 - -![image](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/vr-texture.jpeg) - -把平面图片贴到球面上的过程和地球仪很相似。以上图为例,左侧图片中的每一个像素,都可以在右侧球面上找到对应的位置。下面列举一个关键的对应关系。 - -- 直线AB 上所有的点都与 点J 对应,同理 直线CD 上所有的点都与 点K 对应。 -- 直线MN 上的点与 赤道 上的点一一对应。 -- 直线AC/BD 上的点与绿 色经线前半面 上的点一一对应。 -- 直线EF 上的点与 绿色经线后半面 上的点一一对应。 - -### 呈现方式 - -![ball](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/vr-ball.jpeg) - -上图展示了全景图像的呈现方式,不同于平面,全景图像需将观景点放在球心,站在球心观看球面上的图像。最终将 曲面ABCD 在 平面ABCD 上的投影显示到屏幕上。 - -### 小结 - -这部分内容在实现上涉及到很多 OpenGL 的内容,需要具备一些 OpenGL 的基础。在双眼模式下还需要做 畸变校正 和 色散校正 来保证画面被真实的还原。具体实现可以查看 SGGLViewController。 - - -## SGFFPlayer 运作流程 - -![SGFFPlayer](http://oxl6mxy2t.bkt.clouddn.com/SGPlayer/SGFFPlayer-thread.jpeg) - -上图展示了 SGFFPlayer 的协作流程图,下面简单介绍图中各组件 - -### 线程模型 - -SGFFPlayer 中共有4个线程。与图中4个蓝色圆圈对应。 - -- 数据读取 - Read Packet Loop -- 视频解码 - Video Decode Loop -- 视频绘制 - Video Display Loop -- 音频播放 - Audio Playback Loop - -图中隐藏掉了线程的控制条件。在4个线程的协作下完成整个播放过程。 - -### SGVideoDecoder - -SGVideoDecoder 是视频解码器,初始化时可配置同步、异步解码,以及是否开启硬解。上图中采用的是异步解码,默认的解码线程对应关系如下表所示。 - -|| 平面 | 全景 ----|---|--- -软件解码 | 异步 | 同步 -硬件解码 | 异步 | 异步 - -- 同步解码在收到视频包后立即解码,并存入视频帧队列。 -- 异步解码在收到视频包后仅存入音频包队列,当独立的解码线程取出音频包并完成解码后,再存入视频帧队列。 - -### SGAudioDecoder - -SGAudioDecoder 是音频解码器,采用同步解码,收到音频包后立即解码,并存入音频帧队列。 - -### 数据队列 SGFFPacketQueue、SGFFFrameQueue - -- SGFFPacketQueue 是包队列,用于管理解码前的数据包(AVPacket)。 -- SGFFFrameQueue 是帧队列,用于管理解码后的帧(SGFFVideoFrame 或 SGFFAudioFrame)。 - -它们都支持数据的同步获取和异步获取,同步获取是通过条件变量(NSCondition)实现。当队列中没有足够数据时,会阻塞当前线程,直到向队列中添加新元素时,线程才会被唤醒。 - -### 帧复用池 SGFFFramePool - -该部分并没有在上图中体现,但能避免一些不必要的性能开销。由于音频帧和视频帧的数量很大,1分钟的视频就包含几千帧的数据。如果每一帧都新创建的话会造成不必要的资源浪费。通过 SGFFFramePool 创建的 SGFFFrame 在使用完成后不会立即释放,而是被复用池回收,以供下次使用,达到仅创建最小数量的帧对象的目的。 - -### 音视频同步 - -常用的同步当时有3种 - -1. 音频时钟 -1. 视频时钟 -1. 自制时钟 - -在 SGFFPlayer 中,优先使用音频时钟,当视频中没有音轨时,会使用视频时钟进行同步。 - -### 小结 - -了解了各组件的功能,以视频异步解码为例,重新梳理一下整个流程 - -- 数据读取线程读取到数据包,根据数据包类型分发给音频解码器或视频解码器。 -- 如果为音频包,音频解码器收到音频包的同时进行解码,并将解码后的音频帧存入音频帧队列。 -- 如果为视频包,由于视频解码器是异步解码,仅将视频包放入视频包队列,等待视频解码线程来队列中取视频包。 -- 视频解码线程循环从视频包队列中取出视频包,同时解码,并将解码后的视频帧存入视频帧队列。 -- 音频播放线程循环在音频帧队列中取出音频帧并播放。 -- 视频展示线程循环在视频帧队列中取出视频帧并绘制。 - -到这里SGFFPlayer的运作流程已经很清晰了,只需在各个环节中加入对应的条件控制,就可以完成播放功能了。 - -## 总结 - -关于 SGPlayer 的原理就阐述到这里,由于本文以理论为主,所以并没有贴代码。感兴趣的同学可以在 [GitHub](https://github.com/libobjc/SGPlayer) 上找到全部的代码实现。希望对大家能有所帮助。 diff --git a/documents/README-chs.md b/documents/README-chs.md deleted file mode 100644 index 549c1a94..00000000 --- a/documents/README-chs.md +++ /dev/null @@ -1,194 +0,0 @@ -![(banner)](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/banner-small.png) - -![Build Status](https://img.shields.io/badge/build-%20passing%20-brightgreen.svg) -![Platform](https://img.shields.io/badge/Platform-%20iOS%20macOS%20tvOS%20-blue.svg) -![Support](https://img.shields.io/badge/support-%20VR%20360%C2%B0%20-orange.svg) - -[English README](https://github.com/libobjc/SGPlayer/blob/master/README.md) | [原理详解](https://github.com/libobjc/SGPlayer/blob/master/documents/Principle-chs.md) | [视频下载](https://github.com/libobjc/SGDownload) - -# SGPlayer - -- SGPlayer 是一款基于 AVPlayer、FFmpeg 的媒体资源播放器框架。支持360°全景视频,VR视频,RTMP、RTSP 等直播流;同时支持 iOS、macOS、tvOS 三个平台。 - -## 功能特点 - -- 支持播放360°全景视频。 -- 支持手势、传感器操控360°全景视频。 -- 支持双眼模式,具有畸变校正、色散校正。 -- 支持 iOS、macOS、tvOS。 -- 支持 H.264 硬件解码(VideoToolBox)。 -- 支持 RTMP、RTSP 等直播流。 -- 支持后台播放。 -- 支持选择音频轨道。 -- 支持控制音频输出音量。 -- 支持无损视频截图。 -- 支持近所有常用媒体格式。 -- 支持 Bitcode。 -- 极简的事件通知机制。 - -## 编译方式(2选1即可) - -### 1.脚本编译 - -```obj-c - -// iOS -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -sh compile-build.sh iOS - -// macOS -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -sh compile-build.sh macOS - -// tvOS -git clone https://github.com/libobjc/SGPlayer.git -cd SGPlayer -sh compile-build.sh tvOS - -``` - -### 2.手动编译 - -- 步骤1 - 克隆项目并安装子模块 - -``` -git clone git@github.com:libobjc/SGPlayer.git -cd SGPlayer -git submodule update --init --recursive - -``` - -- 步骤2 - 手动编译 FFmpeg 并放在指定目录下 - -```obj-c - -// 将FFmpeg编译出的.a静态库分别放在对应目录 -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-iOS // iOS -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-macOS // macOS -/SGPlayer/Classes/Core/SGFFPlayer/ffmpeg/lib-tvOS // tvOS - -``` - -### 编译完成效果(仅目标平台的静态库存在即可) - -![ffmpeg-libs](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/ffmpeg-libs.jpg) - - -## 使用示例 - -- 详细使用示例参见 demo - -#### iOS依赖 - -- SGPlayer.framework -- SGPlatform.framework Optional -- CoreMedia.framework -- AudioToolBox.framework -- VideoToolBox.framework -- libiconv.tbd -- libbz2.tbd -- libz.tbd - -#### macOS依赖 - -- SGPlayer.framework -- SGPlatform.framework Optional -- CoreMedia.framework -- AudioToolBox.framework -- VideoToolBox.framework -- VideoDecodeAcceleration.framework -- libiconv.tbd -- libbz2.tbd -- libz.tbd -- libizma.tbd - -### 基础视屏播放 - -```obj-c - -self.player = [SGPlayer player]; - -// 注册事件通知 -[self.player registerPlayerNotificationTarget:self stateAction:@selector(stateAction:) progressAction:@selector(progressAction:) playableAction:@selector(playableAction:) errorAction:@selector(errorAction:)]; - -// 视频画面点击事件 -[self.player setViewTapAction:^(SGPlayer * _Nonnull player, SGPLFView * _Nonnull view) { - NSLog(@"player display view did click!"); -}]; - -// 播放普通视频 (2种方式2选1即可) -[self.player replaceVideoWithURL:contentURL]; // 方式1 -[self.player replaceVideoWithURL:contentURL videoType:SGVideoTypeNormal]; // 方式2 - -// 播放360度全景视频、VR视频 -[self.player replaceVideoWithURL:contentURL videoType:SGVideoTypeVR]; - -// 播放 -[self.player play]; - -``` - -### 高级设置 - - -```obj-c - -// 三种预设播放内核选择策略 -self.player.decoder = [SGPlayerDecoder defaultDecoder];     // 默认配置,混合使用 AVPlayer和FFmpeg,根据容器格式动态选择播放内核 -self.player.decoder = [SGPlayerDecoder AVPlayerDecoder]; // 仅使用 AVPlayer -self.player.decoder = [SGPlayerDecoder FFmpegDecoder]; // 仅使用 FFmpeg - -// 单个容器格式单独配置示例 -self.player.decoder.decodeTypeForMPEG4 = SGDecoderTypeFFmpeg; // 使用 FFmpeg 播放 mp4 文件 - -// 开启 FFmpeg 硬解 -self.player.decoder.hardwareAccelerateEnableForFFmpeg = YES; - -// 进入 VR眼镜 模式 -self.player.displayMode = SGDisplayModeBox; - -// 设置后台播放模式 -// 如果需要后台播放,需将项目的 Background Modes 打开并勾选 Audio 选项, 并将 AVAudioSession 的 Category 设为AVAudioSessionCategoryPlayback -self.player.backgroundMode = SGPlayerBackgroundModeAutoPlayAndPause; // 自动暂停及恢复 -self.player.backgroundMode = SGPlayerBackgroundModeContinue; // 继续播放 - -``` - - -## 效果演示 - -### iOS - -- 普通视频 - -![ios-i-see-fire](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/ios-i-see-fire.gif) - -- 360度全景视频 - -![ios-google-vr](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/ios-google-vr.gif) - -- 360度全景视频双眼模式 - -![ios-google-vr-box](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/ios-google-vr-box.gif) - - -### macOS - -- 普通视频 - -![mac-i-see-fire](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/mac-google-vr.gif) - -- VR全景视频 - -![mac-google-vr](https://coding.net/u/0x010101/p/resource-public/git/raw/master/SGPlayer/mac-google-vr.gif) - - - -## 联系方式 - -- Email : libobjc@gmail.com -- Twitter : CoderSingle -- Weibo : 程序员Single -- QQ Group : 616349536 diff --git a/documents/banner.jpg b/documents/banner.jpg new file mode 100644 index 00000000..1f5d4f5f Binary files /dev/null and b/documents/banner.jpg differ diff --git a/documents/flow-chart.jpg b/documents/flow-chart.jpg new file mode 100644 index 00000000..54b36e25 Binary files /dev/null and b/documents/flow-chart.jpg differ diff --git a/scripts/avconfig.h b/scripts/avconfig.h new file mode 100644 index 00000000..c851904e --- /dev/null +++ b/scripts/avconfig.h @@ -0,0 +1,46 @@ +/* + * avconfig.h + * + * Copyright (c) 2013 Bilibili + * Copyright (c) 2013 Zhang Rui + * + * This file is part of ijkPlayer. + * + * ijkPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * ijkPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with ijkPlayer; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if defined(__aarch64__) +# include "arm64/avconfig.h" +#elif defined(__x86_64__) +# include "x86_64/avconfig.h" +#elif defined(__arm__) + +# if defined(__ARM_ARCH_7S__) +# include "armv7s/avconfig.h" +# elif defined(__ARM_ARCH) +# if __ARM_ARCH == 7 +# include "armv7/avconfig.h" +# else +# error Unsupport ARM architecture +# endif +# else +# error Unsupport ARM architecture +# endif + +#elif defined(__i386__) +# include "i386/avconfig.h" +#else +# error Unsupport architecture +#endif diff --git a/scripts/compile-ffmpeg.sh b/scripts/compile-ffmpeg.sh new file mode 100755 index 00000000..3d781330 --- /dev/null +++ b/scripts/compile-ffmpeg.sh @@ -0,0 +1,170 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2014 Bilibili +# Copyright (C) 2013-2014 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---------- +# modify for your build tool + +set -e + +FF_ALL_ARCHS= +FF_ALL_ARCHS_IOS="armv7 arm64 i386 x86_64" +FF_ALL_ARCHS_TVOS="arm64 x86_64" +FF_ALL_ARCHS_MACOS="x86_64" + +FF_PLATFORM=$1 +FF_ACTION=$2 + +#---------- +UNI_BUILD_ROOT=`pwd`/build +UNI_TMP="$UNI_BUILD_ROOT/build/tmp" +UNI_TMP_LLVM_VER_FILE="$UNI_TMP/llvm.ver.txt" + +#---------- +SSL_LIBS="libcrypto libssl" +FF_LIBS="libavcodec libavfilter libavformat libavutil libswscale libswresample" + +#---------- +echo_archs() { + echo "====================" + echo "[*] check xcode version" + echo "====================" + echo "FF_PLATFORM = $FF_PLATFORM" + echo "FF_ALL_ARCHS = $FF_ALL_ARCHS" +} + +do_lipo_ffmpeg () { + LIB_FILE=$1 + LIPO_FLAGS= + for ARCH in $FF_ALL_ARCHS + do + ARCH_LIB_FILE="$UNI_BUILD_ROOT/build/$FF_PLATFORM/ffmpeg-$ARCH/output/lib/$LIB_FILE" + if [ -f "$ARCH_LIB_FILE" ]; then + LIPO_FLAGS="$LIPO_FLAGS $ARCH_LIB_FILE" + else + echo "skip $LIB_FILE of $ARCH"; + fi + done + + xcrun lipo -create $LIPO_FLAGS -output $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE + xcrun lipo -info $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE +} + +do_lipo_ssl () { + LIB_FILE=$1 + LIPO_FLAGS= + for ARCH in $FF_ALL_ARCHS + do + ARCH_LIB_FILE="$UNI_BUILD_ROOT/build/$FF_PLATFORM/openssl-$ARCH/output/lib/$LIB_FILE" + if [ -f "$ARCH_LIB_FILE" ]; then + LIPO_FLAGS="$LIPO_FLAGS $ARCH_LIB_FILE" + else + echo "skip $LIB_FILE of $ARCH"; + fi + done + + if [ "$LIPO_FLAGS" != "" ]; then + xcrun lipo -create $LIPO_FLAGS -output $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE + xcrun lipo -info $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE + fi +} + +do_lipo_all () { + mkdir -p $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib + echo "lipo archs: $FF_ALL_ARCHS" + for FF_LIB in $FF_LIBS + do + do_lipo_ffmpeg "$FF_LIB.a"; + done + + ANY_ARCH= + for ARCH in $FF_ALL_ARCHS + do + ARCH_INC_DIR="$UNI_BUILD_ROOT/build/$FF_PLATFORM/ffmpeg-$ARCH/output/include" + if [ -d "$ARCH_INC_DIR" ]; then + if [ -z "$ANY_ARCH" ]; then + ANY_ARCH=$ARCH + cp -R "$ARCH_INC_DIR" "$UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/" + fi + + UNI_INC_DIR="$UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/include" + + mkdir -p "$UNI_INC_DIR/libavutil/$ARCH" + cp -f "$ARCH_INC_DIR/libavutil/avconfig.h" "$UNI_INC_DIR/libavutil/$ARCH/avconfig.h" + cp -f scripts/avconfig.h "$UNI_INC_DIR/libavutil/avconfig.h" + cp -f "$ARCH_INC_DIR/libavutil/ffversion.h" "$UNI_INC_DIR/libavutil/$ARCH/ffversion.h" + cp -f scripts/ffversion.h "$UNI_INC_DIR/libavutil/ffversion.h" + mkdir -p "$UNI_INC_DIR/libffmpeg/$ARCH" + cp -f "$ARCH_INC_DIR/libffmpeg/config.h" "$UNI_INC_DIR/libffmpeg/$ARCH/config.h" + cp -f scripts/config.h "$UNI_INC_DIR/libffmpeg/config.h" + fi + done + + for SSL_LIB in $SSL_LIBS + do + do_lipo_ssl "$SSL_LIB.a"; + done +} + +#---------- +if [ "$FF_PLATFORM" = "iOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_IOS +elif [ "$FF_PLATFORM" = "tvOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_TVOS +elif [ "$FF_PLATFORM" = "macOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_MACOS +else + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +if [ "$FF_ACTION" = "build" ]; then + echo_archs + for ARCH in $FF_ALL_ARCHS + do + sh scripts/do-compile-ffmpeg.sh $FF_PLATFORM $ARCH + done + do_lipo_all +elif [ "$FF_ACTION" = "clean" ]; then + echo_archs + echo "==================" + for ARCH in $FF_ALL_ARCHS + do + echo "clean ffmpeg-$ARCH" + echo "==================" + cd $UNI_BUILD_ROOT/source/$FF_PLATFORM/ffmpeg-$ARCH && git clean -xdf && cd - + done + echo "clean build cache" + echo "=================" + rm -rf $UNI_BUILD_ROOT/build/$FF_PLATFORM/ffmpeg-* + rm -rf $UNI_BUILD_ROOT/build/$FF_PLATFORM/openssl-* + rm -rf $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/include + rm -rf $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib + echo "clean success" +else + echo "Usage:" + echo " compile-ffmpeg.sh iOS build" + echo " compile-ffmpeg.sh iOS clean" + echo " ---" + echo " compile-ffmpeg.sh tvOS build" + echo " compile-ffmpeg.sh tvOS clean" + echo " ---" + echo " compile-ffmpeg.sh macOS build" + echo " compile-ffmpeg.sh macOS clean" + exit 1 +fi + diff --git a/scripts/compile-openssl.sh b/scripts/compile-openssl.sh new file mode 100755 index 00000000..27c443e7 --- /dev/null +++ b/scripts/compile-openssl.sh @@ -0,0 +1,108 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2014 Bilibili +# Copyright (C) 2013-2014 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#---------- +# modify for your build tool + +set -e + +FF_ALL_ARCHS= +FF_ALL_ARCHS_IOS="armv7 arm64 i386 x86_64" +FF_ALL_ARCHS_TVOS="arm64 x86_64" +FF_ALL_ARCHS_MACOS="x86_64" + +FF_PLATFORM=$1 +FF_ACTION=$2 + +#---------- +UNI_BUILD_ROOT=`pwd`/build +UNI_TMP="$UNI_BUILD_ROOT/build/tmp" +UNI_TMP_LLVM_VER_FILE="$UNI_TMP/llvm.ver.txt" + +#---------- +FF_LIBS="libssl libcrypto" + +#---------- +echo_archs() { + echo "====================" + echo "[*] check xcode version" + echo "====================" + echo "FF_PLATFORM = $FF_PLATFORM" + echo "FF_ALL_ARCHS = $FF_ALL_ARCHS" +} + +do_lipo () { + LIB_FILE=$1 + LIPO_FLAGS= + for ARCH in $FF_ALL_ARCHS + do + LIPO_FLAGS="$LIPO_FLAGS $UNI_BUILD_ROOT/build/$FF_PLATFORM/openssl-$ARCH/output/lib/$LIB_FILE" + done + + xcrun lipo -create $LIPO_FLAGS -output $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE + xcrun lipo -info $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib/$LIB_FILE +} + +do_lipo_all () { + mkdir -p $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/lib + echo "lipo archs: $FF_ALL_ARCHS" + for FF_LIB in $FF_LIBS + do + do_lipo "$FF_LIB.a"; + done + + cp -R $UNI_BUILD_ROOT/build/$FF_PLATFORM/openssl-x86_64/output/include $UNI_BUILD_ROOT/build/$FF_PLATFORM/universal/ +} + +#---------- +if [ "$FF_PLATFORM" = "iOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_IOS +elif [ "$FF_PLATFORM" = "tvOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_TVOS +elif [ "$FF_PLATFORM" = "macOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_MACOS +else + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +if [ "$FF_ACTION" = "build" ]; then + echo_archs + for ARCH in $FF_ALL_ARCHS + do + sh scripts/do-compile-openssl.sh $FF_PLATFORM $ARCH + done + do_lipo_all +elif [ "$FF_ACTION" = "clean" ]; then + echo_archs + for ARCH in $FF_ALL_ARCHS + do + cd $UNI_BUILD_ROOT/source/$FF_PLATFORM/openssl-$ARCH && git clean -xdf && cd - + done +else + echo "Usage:" + echo " compile-openssl.sh iOS build" + echo " compile-openssl.sh iOS clean" + echo " ---" + echo " compile-openssl.sh tvOS build" + echo " compile-openssl.sh tvOS clean" + echo " ---" + echo " compile-openssl.sh macOS build" + echo " compile-openssl.sh macOS clean" + exit 1 +fi diff --git a/scripts/config.h b/scripts/config.h new file mode 100644 index 00000000..de2d861b --- /dev/null +++ b/scripts/config.h @@ -0,0 +1,46 @@ +/* + * config.h + * + * Copyright (c) 2013 Bilibili + * Copyright (c) 2013 Zhang Rui + * + * This file is part of ijkPlayer. + * + * ijkPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * ijkPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with ijkPlayer; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if defined(__aarch64__) +# include "arm64/config.h" +#elif defined(__x86_64__) +# include "x86_64/config.h" +#elif defined(__arm__) + +# if defined(__ARM_ARCH_7S__) +# include "armv7s/config.h" +# elif defined(__ARM_ARCH) +# if __ARM_ARCH == 7 +# include "armv7/config.h" +# else +# error Unsupport ARM architecture +# endif +# else +# error Unsupport ARM architecture +# endif + +#elif defined(__i386__) +# include "i386/config.h" +#else +# error Unsupport architecture +#endif diff --git a/scripts/do-compile-ffmpeg.sh b/scripts/do-compile-ffmpeg.sh new file mode 100755 index 00000000..2a111b8e --- /dev/null +++ b/scripts/do-compile-ffmpeg.sh @@ -0,0 +1,283 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2014 Bilibili +# Copyright (C) 2013-2014 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is based on projects below +# https://github.com/kolyvan/kxmovie +# https://github.com/yixia/FFmpeg-Android +# http://git.videolan.org/?p=vlc-ports/android.git;a=summary +# https://github.com/kewlbear/FFmpeg-iOS-build-script/ + +#-------------------- +echo "====================" +echo "[*] check host" +echo "====================" +set -e + +#-------------------- +# include + + +#-------------------- +# common defines +FF_PLATFORM=$1 + if [ -z "$FF_PLATFORM" ]; then + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +FF_ARCH=$2 + if [ -z "$FF_ARCH" ]; then + echo "You must specific an architecture 'armv7, armv7s, arm64, i386, x86_64, ...'.\n" + exit 1 +fi + + +FF_BUILD_ROOT=`pwd`/build +FF_TAGET_OS="darwin" + + +# ffmpeg build params +export COMMON_FF_CFG_FLAGS= +source scripts/module.sh + +FFMPEG_CFG_FLAGS= +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $COMMON_FF_CFG_FLAGS" + +# Optimization options (experts only): +# FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-armv5te" +# FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-armv6" +# FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-armv6t2" + +# Advanced options (experts only): +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --enable-cross-compile" +# --disable-symver may indicate a bug +# FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-symver" + +# Developer options (useful when working on FFmpeg itself): +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-stripping" + +## +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --arch=$FF_ARCH" +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --target-os=$FF_TAGET_OS" +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --enable-static" +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --disable-shared" +FFMPEG_EXTRA_CFLAGS= + +# i386, x86_64 +FFMPEG_CFG_FLAGS_INTEL= +FFMPEG_CFG_FLAGS_INTEL="$FFMPEG_CFG_FLAGS_INTEL --disable-asm" +FFMPEG_CFG_FLAGS_INTEL="$FFMPEG_CFG_FLAGS_INTEL --disable-mmx" +FFMPEG_CFG_FLAGS_INTEL="$FFMPEG_CFG_FLAGS_INTEL --assert-level=2" + +# armv7, armv7s, arm64 +FFMPEG_CFG_FLAGS_ARM= +FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-pic" +FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-neon" +#case "$FF_BUILD_OPT" in +# debug) +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --disable-optimizations" +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-debug" +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --disable-small" +# ;; +# *) +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-optimizations" +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-debug" +# FFMPEG_CFG_FLAGS_ARM="$FFMPEG_CFG_FLAGS_ARM --enable-small" +# ;; +#esac + +echo "build_root: $FF_BUILD_ROOT" + +#-------------------- +echo "====================" +echo "[*] check gas-preprocessor" +echo "====================" +FF_TOOLS_ROOT="$FF_BUILD_ROOT/extra" +export PATH="$FF_TOOLS_ROOT/gas-preprocessor:$PATH" + +echo "gasp: $FF_TOOLS_ROOT/gas-preprocessor/gas-preprocessor.pl" + +#-------------------- +echo "====================" +echo "[*] config arch $FF_ARCH" +echo "====================" + +FF_BUILD_NAME="unknown" +FF_XCRUN_PLATFORM= +FF_XCRUN_OSVERSION= +FF_GASPP_EXPORT= +FF_DEP_OPENSSL_INC= +FF_DEP_OPENSSL_LIB= +FF_XCODE_BITCODE="-fembed-bitcode" + +if [ "$FF_PLATFORM" = "iOS" ]; then + if [ "$FF_ARCH" = "i386" ]; then + FF_BUILD_NAME="ffmpeg-i386" + FF_BUILD_NAME_OPENSSL=openssl-i386 + FF_XCRUN_PLATFORM="iPhoneSimulator" + FF_XCRUN_OSVERSION="-mios-simulator-version-min=8.0" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_INTEL" + elif [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="ffmpeg-x86_64" + FF_BUILD_NAME_OPENSSL=openssl-x86_64 + FF_XCRUN_PLATFORM="iPhoneSimulator" + FF_XCRUN_OSVERSION="-mios-simulator-version-min=8.0" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_INTEL" + elif [ "$FF_ARCH" = "armv7" ]; then + FF_BUILD_NAME="ffmpeg-armv7" + FF_BUILD_NAME_OPENSSL=openssl-armv7 + FF_XCRUN_PLATFORM="iPhoneOS" + FF_XCRUN_OSVERSION="-miphoneos-version-min=8.0" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_ARM" + elif [ "$FF_ARCH" = "arm64" ]; then + FF_BUILD_NAME="ffmpeg-arm64" + FF_BUILD_NAME_OPENSSL=openssl-arm64 + FF_XCRUN_PLATFORM="iPhoneOS" + FF_XCRUN_OSVERSION="-miphoneos-version-min=8.0" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_ARM" + FF_GASPP_EXPORT="GASPP_FIX_XCODE5=1" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +elif [ "$FF_PLATFORM" = "macOS" ]; then + if [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="ffmpeg-x86_64" + FF_BUILD_NAME_OPENSSL=openssl-x86_64 + FF_XCRUN_PLATFORM="MacOSX" + FF_XCRUN_OSVERSION="-mmacosx-version-min=10.11" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_INTEL" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +elif [ "$FF_PLATFORM" = "tvOS" ]; then + if [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="ffmpeg-x86_64" + FF_BUILD_NAME_OPENSSL=openssl-x86_64 + FF_XCRUN_PLATFORM="AppleTVSimulator" + FF_XCRUN_OSVERSION="-mtvos-simulator-version-min=10.2" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_INTEL" + elif [ "$FF_ARCH" = "arm64" ]; then + FF_BUILD_NAME="ffmpeg-arm64" + FF_BUILD_NAME_OPENSSL=openssl-arm64 + FF_XCRUN_PLATFORM="AppleTVOS" + FF_XCRUN_OSVERSION="-mtvos-version-min=10.2" + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_FLAGS_ARM" + FF_GASPP_EXPORT="GASPP_FIX_XCODE5=1" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +else + echo "unknown platform $FF_PLATFORM"; + exit 1 +fi + +echo "build_name: $FF_BUILD_NAME" +echo "platform: $FF_XCRUN_PLATFORM" +echo "osversion: $FF_XCRUN_OSVERSION" + +#-------------------- +echo "====================" +echo "[*] make ios toolchain $FF_BUILD_NAME" +echo "====================" + +FF_BUILD_SOURCE="$FF_BUILD_ROOT/source/$FF_PLATFORM/$FF_BUILD_NAME" +FF_BUILD_PREFIX="$FF_BUILD_ROOT/build/$FF_PLATFORM/$FF_BUILD_NAME/output" + +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --prefix=$FF_BUILD_PREFIX" + +mkdir -p $FF_BUILD_PREFIX + +echo "build_source: $FF_BUILD_SOURCE" +echo "build_prefix: $FF_BUILD_PREFIX" + +#-------------------- +echo "\n--------------------" +echo "[*] configurate ffmpeg" +echo "--------------------" +FF_XCRUN_SDK=`echo $FF_XCRUN_PLATFORM | tr '[:upper:]' '[:lower:]'` +FF_XCRUN_CC="xcrun -sdk $FF_XCRUN_SDK clang" + +FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $FFMPEG_CFG_CPU" + +FFMPEG_CFLAGS= +FFMPEG_CFLAGS="$FFMPEG_CFLAGS -arch $FF_ARCH" +FFMPEG_CFLAGS="$FFMPEG_CFLAGS $FF_XCRUN_OSVERSION" +FFMPEG_CFLAGS="$FFMPEG_CFLAGS $FFMPEG_EXTRA_CFLAGS" +FFMPEG_CFLAGS="$FFMPEG_CFLAGS $FF_XCODE_BITCODE" +FFMPEG_LDFLAGS="$FFMPEG_CFLAGS" +FFMPEG_DEP_LIBS= + +#-------------------- +echo "\n--------------------" +echo "[*] check OpenSSL" +echo "----------------------" +FFMPEG_DEP_OPENSSL_INC=$FF_BUILD_ROOT/build/$FF_PLATFORM/$FF_BUILD_NAME_OPENSSL/output/include +FFMPEG_DEP_OPENSSL_LIB=$FF_BUILD_ROOT/build/$FF_PLATFORM/$FF_BUILD_NAME_OPENSSL/output/lib +#-------------------- +# with openssl +if [ -f "${FFMPEG_DEP_OPENSSL_LIB}/libssl.a" ]; then + FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --enable-openssl" + + FFMPEG_CFLAGS="$FFMPEG_CFLAGS -I${FFMPEG_DEP_OPENSSL_INC}" + FFMPEG_DEP_LIBS="$FFMPEG_CFLAGS -L${FFMPEG_DEP_OPENSSL_LIB} -lssl -lcrypto" +fi + +#-------------------- +echo "\n--------------------" +echo "[*] configure" +echo "----------------------" + +if [ ! -d $FF_BUILD_SOURCE ]; then + echo "" + echo "!! ERROR" + echo "!! Can not find FFmpeg directory for $FF_BUILD_NAME" + echo "!! Run 'sh init-ffmpeg.sh' first" + echo "" + exit 1 +fi + +# xcode configuration +export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym + +cd $FF_BUILD_SOURCE +if [ -f "./config.h" ]; then + echo 'reuse configure' +else + echo "config: $FFMPEG_CFG_FLAGS $FF_XCRUN_CC" + ./configure \ + $FFMPEG_CFG_FLAGS \ + --cc="$FF_XCRUN_CC" \ + $FFMPEG_CFG_CPU \ + --extra-cflags="$FFMPEG_CFLAGS" \ + --extra-cxxflags="$FFMPEG_CFLAGS" \ + --extra-ldflags="$FFMPEG_LDFLAGS $FFMPEG_DEP_LIBS" + make clean +fi + +#-------------------- +echo "\n--------------------" +echo "[*] compile ffmpeg" +echo "--------------------" +cp config.* $FF_BUILD_PREFIX +make -j12 $FF_GASPP_EXPORT +make install +mkdir -p $FF_BUILD_PREFIX/include/libffmpeg +cp -f config.h $FF_BUILD_PREFIX/include/libffmpeg/config.h diff --git a/scripts/do-compile-openssl.sh b/scripts/do-compile-openssl.sh new file mode 100755 index 00000000..18ec83c7 --- /dev/null +++ b/scripts/do-compile-openssl.sh @@ -0,0 +1,205 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2014 Bilibili +# Copyright (C) 2013-2014 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is based on projects below +# https://github.com/x2on/OpenSSL-for-iPhone + +#-------------------- +echo "====================" +echo "[*] check host" +echo "====================" +set -e + + +FF_XCRUN_DEVELOPER=`xcode-select -print-path` +if [ ! -d "$FF_XCRUN_DEVELOPER" ]; then + echo "xcode path is not set correctly $FF_XCRUN_DEVELOPER does not exist (most likely because of xcode > 4.3)" + echo "run" + echo "sudo xcode-select -switch " + echo "for default installation:" + echo "sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer" + exit 1 +fi + +case $FF_XCRUN_DEVELOPER in + *\ * ) + echo "Your Xcode path contains whitespaces, which is not supported." + exit 1 + ;; +esac + + +#-------------------- +# include + + +#-------------------- +# common defines +FF_PLATFORM=$1 +if [ -z "$FF_PLATFORM" ]; then + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +FF_ARCH=$2 +if [ -z "$FF_ARCH" ]; then + echo "You must specific an architecture 'armv7, armv7s, arm64, i386, x86_64, ...'.\n" + exit 1 +fi + + +FF_BUILD_ROOT=`pwd`/build +FF_TAGET_OS="darwin" + + +# openssl build params +export COMMON_FF_CFG_FLAGS= + +OPENSSL_CFG_FLAGS= +OPENSSL_EXTRA_CFLAGS= +OPENSSL_CFG_CPU= + +echo "build_root: $FF_BUILD_ROOT" + +#-------------------- +echo "====================" +echo "[*] config arch $FF_ARCH" +echo "====================" + +FF_BUILD_NAME="unknown" +FF_XCRUN_PLATFORM= +FF_XCRUN_OSVERSION= +FF_GASPP_EXPORT= +FF_XCODE_BITCODE="-fembed-bitcode" + +if [ "$FF_PLATFORM" = "iOS" ]; then + if [ "$FF_ARCH" = "i386" ]; then + FF_BUILD_NAME="openssl-i386" + FF_XCRUN_PLATFORM="iPhoneSimulator" + FF_XCRUN_OSVERSION="-mios-simulator-version-min=8.0" + OPENSSL_CFG_FLAGS="darwin-i386-cc no-asm $OPENSSL_CFG_FLAGS" + elif [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="openssl-x86_64" + FF_XCRUN_PLATFORM="iPhoneSimulator" + FF_XCRUN_OSVERSION="-mios-simulator-version-min=8.0" + OPENSSL_CFG_FLAGS="darwin64-x86_64-cc no-asm $OPENSSL_CFG_FLAGS" + elif [ "$FF_ARCH" = "armv7" ]; then + FF_BUILD_NAME="openssl-armv7" + FF_XCRUN_PLATFORM="iPhoneOS" + FF_XCRUN_OSVERSION="-miphoneos-version-min=8.0" + OPENSSL_CFG_FLAGS="iphoneos-cross $OPENSSL_CFG_FLAGS" + elif [ "$FF_ARCH" = "arm64" ]; then + FF_BUILD_NAME="openssl-arm64" + FF_XCRUN_PLATFORM="iPhoneOS" + FF_XCRUN_OSVERSION="-miphoneos-version-min=8.0" + OPENSSL_CFG_FLAGS="iphoneos-cross $OPENSSL_CFG_FLAGS" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +elif [ "$FF_PLATFORM" = "macOS" ]; then + if [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="openssl-x86_64" + FF_XCRUN_PLATFORM="MacOSX" + FF_XCRUN_OSVERSION="-DHAVE_FORK=0 -mmacosx-version-min=10.11" + OPENSSL_CFG_FLAGS="darwin64-x86_64-cc $OPENSSL_CFG_FLAGS" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +elif [ "$FF_PLATFORM" = "tvOS" ]; then + if [ "$FF_ARCH" = "x86_64" ]; then + FF_BUILD_NAME="openssl-x86_64" + FF_XCRUN_PLATFORM="AppleTVSimulator" + FF_XCRUN_OSVERSION="-DHAVE_FORK=0 -mtvos-simulator-version-min=10.2" + OPENSSL_CFG_FLAGS="darwin64-x86_64-cc $OPENSSL_CFG_FLAGS" + elif [ "$FF_ARCH" = "arm64" ]; then + FF_BUILD_NAME="openssl-arm64" + FF_XCRUN_PLATFORM="AppleTVOS" + FF_XCRUN_OSVERSION="-DHAVE_FORK=0 -mtvos-version-min=10.2" + OPENSSL_CFG_FLAGS="iphoneos-cross $OPENSSL_CFG_FLAGS" + else + echo "unknown architecture $FF_PLATFORM, $FF_ARCH"; + exit 1 + fi +else + echo "unknown platform $FF_PLATFORM"; + exit 1 +fi + +echo "build_name: $FF_BUILD_NAME" +echo "platform: $FF_XCRUN_PLATFORM" +echo "osversion: $FF_XCRUN_OSVERSION" + +#-------------------- +echo "====================" +echo "[*] make ios toolchain $FF_BUILD_NAME" +echo "====================" + + +FF_BUILD_SOURCE="$FF_BUILD_ROOT/source/$FF_PLATFORM/$FF_BUILD_NAME" +FF_BUILD_PREFIX="$FF_BUILD_ROOT/build/$FF_PLATFORM/$FF_BUILD_NAME/output" + +mkdir -p $FF_BUILD_PREFIX + + +FF_XCRUN_SDK=`echo $FF_XCRUN_PLATFORM | tr '[:upper:]' '[:lower:]'` +FF_XCRUN_SDK_PLATFORM_PATH=`xcrun -sdk $FF_XCRUN_SDK --show-sdk-platform-path` +FF_XCRUN_SDK_PATH=`xcrun -sdk $FF_XCRUN_SDK --show-sdk-path` +FF_XCRUN_CC="xcrun -sdk $FF_XCRUN_SDK clang" + +export CROSS_TOP="$FF_XCRUN_SDK_PLATFORM_PATH/Developer" +export CROSS_SDK=`echo ${FF_XCRUN_SDK_PATH/#$CROSS_TOP\/SDKs\//}` +export BUILD_TOOL="$FF_XCRUN_DEVELOPER" +export CC="$FF_XCRUN_CC -arch $FF_ARCH $FF_XCRUN_OSVERSION" + +echo "build_source: $FF_BUILD_SOURCE" +echo "build_prefix: $FF_BUILD_PREFIX" +echo "CROSS_TOP: $CROSS_TOP" +echo "CROSS_SDK: $CROSS_SDK" +echo "BUILD_TOOL: $BUILD_TOOL" +echo "CC: $CC" + +#-------------------- +echo "\n--------------------" +echo "[*] configurate openssl" +echo "--------------------" + +OPENSSL_CFG_FLAGS="$OPENSSL_CFG_FLAGS $FF_XCODE_BITCODE" +OPENSSL_CFG_FLAGS="$OPENSSL_CFG_FLAGS --openssldir=$FF_BUILD_PREFIX" + +# xcode configuration +export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym + +cd $FF_BUILD_SOURCE +if [ -f "./Makefile" ]; then + echo 'reuse configure' +else + echo "config: $OPENSSL_CFG_FLAGS" + ./Configure \ + $OPENSSL_CFG_FLAGS + make clean +fi + +#-------------------- +echo "\n--------------------" +echo "[*] compile openssl" +echo "--------------------" +set +e +make -j12 +make install_sw diff --git a/scripts/ffversion.h b/scripts/ffversion.h new file mode 100644 index 00000000..01b6f7bb --- /dev/null +++ b/scripts/ffversion.h @@ -0,0 +1,42 @@ +/* + * ffversion.h + * + * Copyright (c) 2013 Bilibili + * Copyright (c) 2013 Zhang Rui + * + * This file is part of ijkPlayer. + * + * ijkPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * ijkPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with ijkPlayer; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if defined(__aarch64__) +# include "arm64/ffversion.h" +#elif defined(__x86_64__) +# include "x86_64/ffversion.h" +#elif defined(__arm__) + +# if defined(__ARM_ARCH_7S__) +# include "armv7s/ffversion.h" +# elif defined(__ARM_ARCH_7__) +# include "armv7/ffversion.h" +# else +# error Unsupport ARM architecture +# endif + +#elif defined(__i386__) +# include "i386/ffversion.h" +#else +# error Unsupport architecture +#endif diff --git a/scripts/init-ffmpeg.sh b/scripts/init-ffmpeg.sh new file mode 100755 index 00000000..f7148623 --- /dev/null +++ b/scripts/init-ffmpeg.sh @@ -0,0 +1,73 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2015 Bilibili +# Copyright (C) 2013-2015 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +IJK_FFMPEG_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +IJK_FFMPEG_FORK=https://github.com/FFmpeg/FFmpeg.git +IJK_FFMPEG_COMMIT=$2 +IJK_FFMPEG_LOCAL_REPO=build/extra/ffmpeg + +IJK_GASP_UPSTREAM=https://github.com/libav/gas-preprocessor.git +IJK_GASP_LOCAL_REPO=build/extra/gas-preprocessor + +set -e + +FF_ALL_ARCHS= +FF_ALL_ARCHS_IOS="armv7 arm64 i386 x86_64" +FF_ALL_ARCHS_TVOS="arm64 x86_64" +FF_ALL_ARCHS_MACOS="x86_64" + +FF_PLATFORM=$1 + +function pull_common() { + echo "== pull gas-preprocessor base ==" + sh scripts/pull-repo-base.sh $IJK_GASP_UPSTREAM $IJK_GASP_LOCAL_REPO + + echo "== pull ffmpeg base ==" + sh scripts/pull-repo-base.sh $IJK_FFMPEG_UPSTREAM $IJK_FFMPEG_LOCAL_REPO +} + +function pull_fork() { + echo "== pull ffmpeg fork $1 ==" + sh scripts/pull-repo-ref.sh $IJK_FFMPEG_FORK build/source/$FF_PLATFORM/ffmpeg-$1 ${IJK_FFMPEG_LOCAL_REPO} + cd build/source/$FF_PLATFORM/ffmpeg-$1 + git checkout ${IJK_FFMPEG_COMMIT} -B SGPlayer + cd - +} + +function pull_fork_all() { + for ARCH in $FF_ALL_ARCHS + do + pull_fork $ARCH + done +} + +#---------- +if [ "$FF_PLATFORM" = "iOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_IOS +elif [ "$FF_PLATFORM" = "tvOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_TVOS +elif [ "$FF_PLATFORM" = "macOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_MACOS +else + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +pull_common +pull_fork_all + diff --git a/scripts/init-openssl.sh b/scripts/init-openssl.sh new file mode 100755 index 00000000..b0563ce1 --- /dev/null +++ b/scripts/init-openssl.sh @@ -0,0 +1,67 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2013-2015 Bilibili +# Copyright (C) 2013-2015 Zhang Rui +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +IJK_OPENSSL_UPSTREAM=https://github.com/openssl/openssl.git +IJK_OPENSSL_FORK=https://github.com/openssl/openssl.git +IJK_OPENSSL_COMMIT=$2 +IJK_OPENSSL_LOCAL_REPO=build/extra/openssl + +set -e + +FF_ALL_ARCHS= +FF_ALL_ARCHS_IOS="armv7 arm64 i386 x86_64" +FF_ALL_ARCHS_TVOS="arm64 x86_64" +FF_ALL_ARCHS_MACOS="x86_64" + +FF_PLATFORM=$1 + +function pull_common() { + echo "== pull openssl base ==" + sh scripts/pull-repo-base.sh $IJK_OPENSSL_UPSTREAM $IJK_OPENSSL_LOCAL_REPO +} + +function pull_fork() { + echo "== pull openssl fork $1 ==" + sh scripts/pull-repo-ref.sh $IJK_OPENSSL_FORK build/source/$FF_PLATFORM/openssl-$1 ${IJK_OPENSSL_LOCAL_REPO} + cd build/source/$FF_PLATFORM/openssl-$1 + git checkout ${IJK_OPENSSL_COMMIT} -B SGPlayer + cd - +} + +function pull_fork_all() { + for ARCH in $FF_ALL_ARCHS + do + pull_fork $ARCH + done +} + +#---------- +if [ "$FF_PLATFORM" = "iOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_IOS +elif [ "$FF_PLATFORM" = "tvOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_TVOS +elif [ "$FF_PLATFORM" = "macOS" ]; then + FF_ALL_ARCHS=$FF_ALL_ARCHS_MACOS +else + echo "You must specific an platform 'iOS, tvOS, macOS'.\n" + exit 1 +fi + +pull_common +pull_fork_all + diff --git a/scripts/module.sh b/scripts/module.sh new file mode 100755 index 00000000..d87535d1 --- /dev/null +++ b/scripts/module.sh @@ -0,0 +1,257 @@ +#! /usr/bin/env bash + +#-------------------- +# Standard options: +export COMMON_FF_CFG_FLAGS= +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --prefix=PREFIX" + +# Licensing options: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-gpl" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-version3" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-nonfree" + +# Configuration options: +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-static" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-shared" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-small" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-runtime-cpudetect" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-gray" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-swscale-alpha" + +# Program options: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-programs" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-ffmpeg" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-ffplay" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-ffprobe" + +# Documentation options: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-doc" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-htmlpages" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-manpages" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-podpages" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-txtpages" + +# Component options: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avdevice" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avcodec" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avformat" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avutil" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-pthreads" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-w32threads" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-os2threads" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-network" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-dct" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-dwt" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-lsp" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-lzo" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mdct" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-rdft" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-fft" + +# Hardware accelerators: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-d3d11va" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-dxva2" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-vaapi" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-vdpau" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-videotoolbox" + +# Individual component options: +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-everything" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-encoders" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-encoder=png" + +# ./configure --list-decoders +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-decoders" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=aac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=aac_latm" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=flv" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=h264" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=mp3*" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=vp6f" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=flac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=hevc" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=vp8" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=vp9" + +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-hwaccels" + +# ./configure --list-muxers +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-muxers" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mp4" + +# ./configure --list-demuxers +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-demuxers" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=aac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=concat" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=data" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=flv" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=hls" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=live_flv" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mov" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mp3" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpegps" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpegts" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpegvideo" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=flac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=hevc" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=webm_dash_manifest" + +# ./configure --list-parsers +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-parsers" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=aac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=aac_latm" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=h264" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=flac" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=hevc" + +# ./configure --list-bsf +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-bsfs" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=chomp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dca_core" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dump_extradata" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=hevc_mp4toannexb" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=imx_dump_header" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpeg2jpeg" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpega_dump_header" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mov2textsub" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mp3_header_decompress" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mpeg4_unpack_bframes" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=noise" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=remove_extradata" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=text2movsub" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=vp9_superframe" + +# ./configure --list-protocols +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocols" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=async" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=bluray" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=concat" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=crypto" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=ffrtmpcrypt" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=ffrtmphttp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=gopher" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=icecast" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=librtmp*" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=libssh" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=md5" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=mmsh" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=mmst" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=rtmp*" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtmp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtmpt" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=rtp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=sctp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=srtp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=subfile" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=unix" + +# +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-devices" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-filters" + +# External library support: +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-iconv" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-audiotoolbox" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-videotoolbox" + +# ... + +# Advanced options (experts only): +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --cross-prefix=${FF_CROSS_PREFIX}-" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-cross-compile" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --sysroot=PATH" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --sysinclude=PATH" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --target-os=TAGET_OS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --target-exec=CMD" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --target-path=DIR" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --toolchain=NAME" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --nm=NM" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --ar=AR" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --as=AS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --yasmexe=EXE" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --cc=CC" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --cxx=CXX" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --dep-cc=DEPCC" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --ld=LD" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-cc=HOSTCC" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-cflags=HCFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-cppflags=HCPPFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-ld=HOSTLD" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-ldflags=HLDFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-libs=HLIBS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --host-os=OS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --extra-cflags=ECFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --extra-cxxflags=ECFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --extra-ldflags=ELDFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --extra-libs=ELIBS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --extra-version=STRING" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --optflags=OPTFLAGS" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --build-suffix=SUFFIX" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --malloc-prefix=PREFIX" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --progs-suffix=SUFFIX" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --arch=ARCH" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --cpu=CPU" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-pic" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-sram" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-thumb" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-symver" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-hardcoded-tables" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-safe-bitstream-reader" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-memalign-hack" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-lto" + +# Optimization options (experts only): +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-asm" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-altivec" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-amd3dnow" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-amd3dnowext" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mmx" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mmxext" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-sse" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-sse2" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-sse3" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-ssse3" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-sse4" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-sse42" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avx" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-fma4" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-armv5te" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-armv6" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-armv6t2" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-vfp" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-neon" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-vis" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-inline-asm" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-yasm" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mips32r2" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mipsdspr1" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mipsdspr2" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-mipsfpu" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-fast-unaligned" + +# Developer options (useful when working on FFmpeg itself): +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-coverage" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-debug" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-debug=LEVEL" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-optimizations" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-extra-warnings" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-stripping" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --assert-level=level" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-memory-poisoning" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --valgrind=VALGRIND" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-ftrapv" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --samples=PATH" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-xmm-clobber-test" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-random" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-random" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-random=LIST" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-random=LIST" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --random-seed=VALUE" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib" + diff --git a/scripts/pull-repo-base.sh b/scripts/pull-repo-base.sh new file mode 100644 index 00000000..59fb5c7f --- /dev/null +++ b/scripts/pull-repo-base.sh @@ -0,0 +1,15 @@ +#! /usr/bin/env bash + +REMOTE_REPO=$1 +LOCAL_WORKSPACE=$2 + + +if [ -z $REMOTE_REPO -o -z $LOCAL_WORKSPACE ]; then + echo "invalid call pull-repo.sh '$REMOTE_REPO' '$LOCAL_WORKSPACE'" +elif [ ! -d $LOCAL_WORKSPACE ]; then + git clone $REMOTE_REPO $LOCAL_WORKSPACE +else + cd $LOCAL_WORKSPACE + git fetch --all --tags + cd - +fi diff --git a/scripts/pull-repo-ref.sh b/scripts/pull-repo-ref.sh new file mode 100644 index 00000000..d2247ed7 --- /dev/null +++ b/scripts/pull-repo-ref.sh @@ -0,0 +1,17 @@ +#! /usr/bin/env bash + +REMOTE_REPO=$1 +LOCAL_WORKSPACE=$2 +REF_REPO=$3 + +if [ -z $1 -o -z $2 -o -z $3 ]; then + echo "invalid call pull-repo.sh '$1' '$2' '$3'" +elif [ ! -d $LOCAL_WORKSPACE ]; then + git clone --reference $REF_REPO $REMOTE_REPO $LOCAL_WORKSPACE + cd $LOCAL_WORKSPACE + git repack -a +else + cd $LOCAL_WORKSPACE + git fetch --all --tags + cd - +fi