├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── build.yml ├── CMakeLists.txt ├── Changelog.md ├── README.Android.md ├── README.Linux.md ├── README.WinRT.md ├── README.Windows.md ├── README.iOS.md ├── README.macOS.md ├── README.md ├── README.rpi.md ├── README.sunxi.md ├── ci-after-build.sh ├── ci-before-build.sh ├── mdk.podspec ├── mksdk.sh ├── mksrc.sh ├── nuget ├── MDK.targets ├── README.md └── mdk.nuspec └── upload.mk /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | custom: ['https://www.paypal.me/ibingow'] 3 | # ko_fi: 4 | # issuehunt: 5 | # liberapay: 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Environment:** 20 | - OS: 21 | - GPU: optional 22 | 23 | **Log** 24 | Add any other context about the problem here. 25 | ```cpp 26 | setLogHandler([&log_file](LogLevel level, const char* msg){ 27 | //write_msg_to_a_file(msg); // it's better to add system time. example: https://github.com/wang-bin/mdk-examples/blob/master/GLFW/prettylog.h 28 | }); 29 | ``` 30 | 31 | **Crash** 32 | use lldb, gdb, visual studio to show the call stack. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | # TODO: nuget, vcpkg on macOS, $(brew --prefix llvm)/bin/clang (llvm11), llvm12 is default 3 | # https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry 4 | on: 5 | push: 6 | schedule: 7 | - cron: '0 12 * * 0' 8 | repository_dispatch: 9 | 10 | env: 11 | FF_VER: ${{ vars.FF_VER }} 12 | LLVM_VER: ${{ vars.LLVM_VER }} 13 | VC_LTL_VER: ${{ vars.VC_LTL_VER }} 14 | NINJA_STATUS: '[%f/%t %e %r]' 15 | SF_PW: ${{ secrets.SF_PW }} 16 | SF_USER: ${{ secrets.SF_USER }} 17 | SF_UPLOAD: ${{ github.event_name != 'repository_dispatch' || github.event.client_payload.ref == 'master' }} 18 | NVJP2K_SDK_PW: ${{ secrets.NVJP2K_SDK_PW }} 19 | CUDA_SDK_PW: ${{ secrets.CUDA_SDK_PW }} 20 | 21 | jobs: 22 | macOS: 23 | # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix 24 | runs-on: macos-15 # 15. 1 xcode per image 25 | env: 26 | TARGET_OS: 'macOS' 27 | TARGET_ARCH: ${{ matrix.arch }} 28 | #LTO_SUFFIX: -lto # lto on master branch crashes in avio_open2 if open 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | config: [MinSizeRel] 33 | arch: [x86_64, arm64] # different minos 34 | steps: 35 | - uses: actions/checkout@v4 36 | - name: Checkout source 37 | uses: actions/checkout@v4 38 | with: 39 | repository: ${{ github.repository_owner }}/mdk 40 | path: mdk 41 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} # https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_dispatch 42 | fetch-depth: 1 43 | token: ${{ secrets.CLONE_PAT }} 44 | submodules: 'recursive' 45 | - name: Setup Xcode 46 | run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app 47 | - name: 'Restore External Dep cache' 48 | id: external-dep-cache 49 | uses: actions/cache@v4 50 | with: 51 | path: | 52 | ./mdk/external 53 | !./mdk/external/lib/macOS/libvulkan.tbd 54 | !./mdk/external/lib/libdav1d.tbd 55 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 56 | # why may failed to cache/restore /usr/local/bin/sshpass? 57 | # no build cache because build dir content changes but key should not, then no cache save. 58 | - name: Create Build Environment 59 | shell: bash 60 | env: 61 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 62 | working-directory: mdk 63 | run: ../ci-before-build.sh 64 | 65 | - name: Configure CMake 66 | if: ${{ matrix.arch == 'x86_64' }} 67 | # Use a bash shell so we can use the same syntax for environment variable 68 | # access regardless of the host operating system 69 | shell: bash 70 | working-directory: mdk # TODO: remove 71 | run: | 72 | pwd 73 | cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_X11=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk 74 | - name: Configure CMake 75 | if: ${{ startsWith(matrix.arch, 'arm64') }} # arm64, arm64e 76 | shell: bash 77 | working-directory: mdk 78 | run: | 79 | cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_X11=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk 80 | - name: Build 81 | shell: bash 82 | working-directory: mdk 83 | run: cmake --build build/${TARGET_OS} --parallel 84 | - name: Make SDK 85 | shell: bash 86 | working-directory: mdk 87 | run: | 88 | ../ci-after-build.sh 89 | mv mdk-sdk*.tar.xz ../mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch }}.tar.xz 90 | - name: Archieve SDK 91 | uses: actions/upload-artifact@v4 92 | with: 93 | name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}-${{ matrix.config }} 94 | path: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}.tar.xz 95 | - name: Upload to SourceForge 96 | if: ${{ matrix.config == 'RelWithDebInfo' && matrix.arch == 'x86_64' && env.SF_UPLOAD == 'true' }} 97 | shell: bash 98 | run: | 99 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-${{ matrix.arch }}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 100 | 101 | iOS: 102 | runs-on: macos-15 103 | env: 104 | TARGET_OS: ${{ matrix.os }}${{ matrix.simulator }} 105 | #LTO_SUFFIX: -lto # lto on master branch crashes in avio_open2 if open 106 | strategy: 107 | fail-fast: false 108 | matrix: 109 | os: [iOS, tvOS, visionOS, macCatalyst] 110 | config: [MinSizeRel] 111 | simulator: ['', Simulator] 112 | exclude: 113 | - os: macCatalyst 114 | simulator: Simulator 115 | steps: 116 | - uses: actions/checkout@v4 117 | - name: Checkout source 118 | uses: actions/checkout@v4 119 | with: 120 | repository: ${{ github.repository_owner }}/mdk 121 | path: mdk 122 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 123 | fetch-depth: 1 124 | token: ${{ secrets.CLONE_PAT }} 125 | submodules: 'recursive' 126 | - name: Setup Xcode 127 | run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app 128 | - name: 'Restore External Dep cache' 129 | id: external-dep-cache 130 | uses: actions/cache@v4 131 | with: 132 | path: | 133 | ./mdk/external 134 | !./mdk/external/lib/macOS/libvulkan.tbd 135 | !./mdk/external/lib/libdav1d.tbd 136 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 137 | # why may failed to cache/restore /usr/local/bin/sshpass? 138 | # no build cache because build dir content changes but key should not, then no cache save. 139 | - name: Create Build Environment 140 | shell: bash 141 | env: 142 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 143 | working-directory: mdk 144 | run: ../ci-before-build.sh 145 | - name: Configure CMake 146 | if: ${{ matrix.os != 'macCatalyst' }} 147 | shell: bash 148 | working-directory: mdk 149 | run: | 150 | minver=8.0 151 | [[ "$TARGET_OS" == "tv"* ]] && minver=10.2 # VT: 10.2+ 152 | [[ "$TARGET_OS" == "vision"* ]] && minver=1.0 153 | archs=arm64 154 | [[ "$TARGET_OS" == *"Simulator" ]] && { 155 | archs="arm64;x86_64" 156 | sdk=$TARGET_OS 157 | sdk=${sdk/iOSS/iphones} 158 | sdk=${sdk/tvOSS/appletvs} 159 | sdk=${sdk/visionOSS/xrs} 160 | sdk=${sdk/xrOSS/xrs} 161 | EXTRA_OPTS="-DCMAKE_OSX_SYSROOT=${sdk}" 162 | } 163 | [ ${{ matrix.os }} == visionOS ] && archs=arm64 164 | cmake -GNinja -DFFMPEG_EMBED=1 -DMIN_SIZE=1 -DUSE_LTO=1 -DWITH_DEB_INFO=1 -DCMAKE_SYSTEM_NAME=${{ matrix.os }} $EXTRA_OPTS -DCMAKE_OSX_DEPLOYMENT_TARGET=$minver -DCMAKE_OSX_ARCHITECTURES="$archs" -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_IOS_INSTALL_COMBINED=YES -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib 165 | - name: Configure CMake 166 | if: ${{ matrix.os == 'macCatalyst' }} 167 | shell: bash 168 | working-directory: mdk 169 | run: cmake -GNinja -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/macCatalyst.cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk 170 | - name: Build 171 | shell: bash 172 | working-directory: mdk 173 | run: cmake --build build/${TARGET_OS} --parallel 174 | - name: Make SDK 175 | shell: bash 176 | working-directory: mdk 177 | run: | 178 | ../ci-after-build.sh 179 | mv mdk-sdk*.tar.xz .. 180 | - name: Archieve SDK 181 | uses: actions/upload-artifact@v4 182 | with: 183 | name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }} 184 | path: mdk-sdk-${{ env.TARGET_OS }}.tar.xz 185 | - name: Upload to SourceForge 186 | if: ${{ env.SF_UPLOAD == 'true' }} 187 | shell: bash 188 | run: sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 189 | 190 | Apple: 191 | runs-on: macos-15 192 | needs: [macOS, iOS] 193 | steps: 194 | - name: Setup Xcode 195 | run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE }}.app 196 | - uses: actions/checkout@v4 197 | - name: Download macOS x64 sdk 198 | uses: actions/download-artifact@v4 199 | with: 200 | name: mdk-sdk-macOS-x86_64-MinSizeRel 201 | - name: Download macOS arm64 sdk 202 | uses: actions/download-artifact@v4 203 | with: 204 | name: mdk-sdk-macOS-arm64-MinSizeRel 205 | - name: Download iOS sdk 206 | uses: actions/download-artifact@v4 207 | with: 208 | name: mdk-sdk-iOS-MinSizeRel 209 | - name: Download iOSSimulator sdk 210 | uses: actions/download-artifact@v4 211 | with: 212 | name: mdk-sdk-iOSSimulator-MinSizeRel 213 | - name: Download tvOS sdk 214 | uses: actions/download-artifact@v4 215 | with: 216 | name: mdk-sdk-tvOS-MinSizeRel 217 | - name: Download tvOSSimulator sdk 218 | uses: actions/download-artifact@v4 219 | with: 220 | name: mdk-sdk-tvOSSimulator-MinSizeRel 221 | - name: Download visionOS sdk 222 | uses: actions/download-artifact@v4 223 | with: 224 | name: mdk-sdk-visionOS-MinSizeRel 225 | - name: Download visionOSSimulator sdk 226 | uses: actions/download-artifact@v4 227 | with: 228 | name: mdk-sdk-visionOSSimulator-MinSizeRel 229 | - name: Download macCatalyst sdk 230 | uses: actions/download-artifact@v4 231 | with: 232 | name: mdk-sdk-macCatalyst-MinSizeRel 233 | - name: Install tools 234 | shell: bash 235 | run: brew install sshpass 236 | - name: make XCFramework and SDK 237 | shell: bash 238 | run: | 239 | export XZ_OPT="-9e -T0" 240 | mkdir -p macOS iOS iOSSimulator tvOS tvOSSimulator visionOS visionOSSimulator macCatalyst mdk-sdk/{Frameworks,include,lib} macOS-arm64 macOS-x86_64 241 | tar Jxf mdk-sdk-macOS-x86_64.tar.xz -C macOS-x86_64 242 | tar Jxf mdk-sdk-macOS-arm64.tar.xz -C macOS-arm64 243 | tar Jxf mdk-sdk-iOS.tar.xz -C iOS 244 | tar Jxf mdk-sdk-iOSSimulator.tar.xz -C iOSSimulator 245 | tar Jxf mdk-sdk-tvOS.tar.xz -C tvOS 246 | tar Jxf mdk-sdk-tvOSSimulator.tar.xz -C tvOSSimulator 247 | tar Jxf mdk-sdk-visionOS.tar.xz -C visionOS 248 | tar Jxf mdk-sdk-visionOSSimulator.tar.xz -C visionOSSimulator 249 | tar Jxf mdk-sdk-macCatalyst.tar.xz -C macCatalyst 250 | find . 251 | cp -af macOS-$(uname -m)/mdk-sdk macOS/ # libffmpeg is already fat 252 | lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/mdk -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/mdk 253 | lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework.dSYM/Contents/Resources/DWARF/mdk -output macOS/mdk-sdk/lib/mdk.framework.dSYM/Contents/Resources/DWARF/mdk 254 | if [ -f macOS-arm64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib -a -f macOS-x86_64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib ]; then 255 | lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-braw.dylib 256 | fi 257 | if [ -f macOS-arm64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib -a -f macOS-x86_64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib ]; then 258 | lipo -create macOS-{arm,x86_}64/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib -output macOS/mdk-sdk/lib/mdk.framework/Versions/Current/libmdk-r3d.dylib 259 | fi 260 | for b in `ls macOS-arm64/mdk-sdk/bin`; do # exes exist in both archs 261 | if [ -f macOS-x86_64/mdk-sdk/bin/$b ]; then 262 | lipo -create macOS-{arm,x86_}64/mdk-sdk/bin/$b -output macOS/mdk-sdk/bin/$b 263 | fi 264 | done 265 | codesign --force --sign - --deep --timestamp macOS/mdk-sdk/lib/mdk.framework 266 | 267 | libffmpeg=$(find macCatalyst/mdk-sdk/lib/mdk.framework -name "libffmpeg*.dylib") 268 | # xcrun bitcode_strip -r $libffmpeg -o $libffmpeg 269 | # xcrun bitcode_strip -r macCatalyst/mdk-sdk/lib/mdk.framework/mdk -o macCatalyst/mdk-sdk/lib/mdk.framework/Versions/Current/mdk 270 | 271 | cp -af macOS/mdk-sdk/{bin,doc,*.sh} mdk-sdk 272 | cp -af macOS/mdk-sdk/README.md mdk-sdk/README-macOS.md 273 | cp -af macOS/mdk-sdk/lib/cmake mdk-sdk/lib/ 274 | cp -af iOS/mdk-sdk/README.md mdk-sdk/README-iOS.md 275 | # https://developer.apple.com/forums/thread/655768 (error: the path does not point to a valid debug symbols file: macOS/mdk-sdk/lib/mdk.framework.dSYM) 276 | xcodebuild -create-xcframework -framework macOS/mdk-sdk/lib/mdk.framework -debug-symbols $PWD/macOS/mdk-sdk/lib/mdk.framework.dSYM -framework iOS/mdk-sdk/lib/mdk.framework -debug-symbols $PWD/iOS/mdk-sdk/lib/mdk.framework.dSYM -framework iOSSimulator/mdk-sdk/lib/mdk.framework -framework tvOS/mdk-sdk/lib/mdk.framework -framework tvOSSimulator/mdk-sdk/lib/mdk.framework -framework visionOS/mdk-sdk/lib/mdk.framework -framework visionOSSimulator/mdk-sdk/lib/mdk.framework -framework macCatalyst/mdk-sdk/lib/mdk.framework -output mdk-sdk/lib/mdk.xcframework 277 | mdkfw=`find mdk-sdk/lib/mdk.xcframework -name "macos-*" -depth 1` 278 | # ensure bin/* can Find mdk and ffmpeg 279 | ln -sf ${mdkfw/mdk-sdk/..}/mdk.framework mdk-sdk/Frameworks 280 | ln -sf ../Frameworks/mdk.framework/Headers mdk-sdk/include/mdk 281 | codesign --force --sign - --deep --timestamp mdk-sdk/lib/mdk.xcframework 282 | # pod requires a file in tarball 283 | gtar Jcvf mdk-sdk-apple.tar.xz mdk-sdk README.md 284 | gtar Jcvf mdk-sdk-macOS.tar.xz -C macOS . 285 | 7z a mdk-sdk-apple.zip mdk-sdk 286 | swift package compute-checksum mdk-sdk-apple.zip 287 | - name: Archieve XCFramework SDK 288 | uses: actions/upload-artifact@v4 289 | with: 290 | name: mdk-sdk-apple 291 | path: mdk-sdk-apple.tar.xz 292 | - name: Archieve XCFramework SDK 293 | uses: actions/upload-artifact@v4 294 | with: 295 | name: mdk-sdk-apple-zip 296 | path: mdk-sdk-apple.zip 297 | - name: Archieve macOS SDK 298 | uses: actions/upload-artifact@v4 299 | with: 300 | name: mdk-sdk-macOS 301 | path: mdk-sdk-macOS.tar.xz 302 | - name: Upload to SourceForge 303 | if: ${{ env.SF_UPLOAD == 'true' }} 304 | shell: bash 305 | run: | 306 | make -f upload.mk 307 | 308 | 309 | Windows: 310 | runs-on: windows-latest 311 | env: 312 | TARGET_OS: windows-desktop 313 | strategy: 314 | fail-fast: false 315 | matrix: 316 | config: [RelWithDebInfo] 317 | steps: 318 | - uses: actions/checkout@v4 319 | - name: Checkout source 320 | uses: actions/checkout@v4 321 | with: 322 | repository: ${{ github.repository_owner }}/mdk 323 | path: mdk 324 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 325 | fetch-depth: 1 326 | token: ${{ secrets.CLONE_PAT }} 327 | submodules: 'recursive' 328 | - name: 'Restore External Dep cache' 329 | id: external-dep-cache 330 | uses: actions/cache@v4 331 | with: 332 | path: ./mdk/external 333 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 334 | - name: Create Build Environment 335 | shell: bash 336 | env: 337 | SYSROOT_CACHE_HIT: true 338 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 339 | working-directory: mdk 340 | run: ../ci-before-build.sh 341 | - uses: seanmiddleditch/gha-setup-ninja@master 342 | - uses: ilammy/msvc-dev-cmd@v1 343 | with: 344 | arch: amd64_arm64 345 | - name: Configure for win arm64 346 | env: 347 | ARCH: arm64 348 | working-directory: mdk 349 | run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 350 | - name: Build for win arm64 351 | working-directory: mdk 352 | run: cmake --build build/${{ env.TARGET_OS }}-arm64 353 | - uses: ilammy/msvc-dev-cmd@v1 354 | with: 355 | arch: amd64_x86 356 | - name: Configure for win x86 357 | env: 358 | ARCH: x86 359 | R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK 360 | working-directory: mdk 361 | run: cmake -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 362 | - name: Build for win x86 363 | working-directory: mdk 364 | run: cmake --build build/${{ env.TARGET_OS }}-x86 365 | - uses: ilammy/msvc-dev-cmd@v1 366 | with: 367 | arch: x64 368 | - name: Get nvJPEG2000 SDK 369 | shell: bash 370 | run: | 371 | curl -kL -o nvjpeg2000.zip https://github.com/user-attachments/files/17663661/nvjpeg2000.zip 372 | 7z x -y -p${{ env.NVJP2K_SDK_PW }} nvjpeg2000.zip 373 | curl -kL -o cuda.zip https://github.com/user-attachments/files/17663668/cuda.zip 374 | 7z x -y -p${{ env.CUDA_SDK_PW }} cuda.zip 375 | - name: Configure for win x64 376 | env: 377 | ARCH: x64 378 | R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK 379 | working-directory: mdk 380 | run: cmake -DR3DSDK=${{ env.R3DSDK }} -DNVJP2K=1 -DCUDA_SDK_DIR=${{ github.workspace }}/cuda -DNVJPEG2K_PATH=${{ github.workspace }}/nvjpeg2000 -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 381 | - name: Build for win x64 382 | working-directory: mdk 383 | run: cmake --build build/${{ env.TARGET_OS }}-x64 384 | - name: Make SDK 385 | shell: bash 386 | working-directory: mdk 387 | run: | 388 | ../ci-after-build.sh 389 | mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z 390 | rm -rf mdk-sdk/bin/{x86,arm*} 391 | 7z a -ssc -m0=lzma2 -mx=9 -ms=on -mf=off ../mdk-sdk-${{ env.TARGET_OS }}-vs2022-x64.7z mdk-sdk 392 | - name: Archieve SDK 393 | uses: actions/upload-artifact@v4 394 | with: 395 | name: mdk-sdk-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }} 396 | path: mdk-sdk-${{ env.TARGET_OS }}-vs2022*.7z 397 | # - name: Upload to SourceForge 398 | # if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }} 399 | # uses: garygrossgarten/github-action-scp@release 400 | # with: 401 | # host: 'frs.sourceforge.net' 402 | # username: ${{ secrets.SF_USER }} 403 | # password: ${{ secrets.SF_PW }} 404 | # local: mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z 405 | # remote: '/home/frs/project/mdk-sdk/nightly/' 406 | 407 | 408 | Win64_SRC: 409 | if: false 410 | runs-on: windows-latest 411 | env: 412 | TARGET_OS: windows-desktop 413 | ARCH: x64 414 | strategy: 415 | fail-fast: false 416 | matrix: 417 | config: [Debug] 418 | steps: 419 | - uses: actions/checkout@v4 420 | - name: Checkout source 421 | uses: actions/checkout@v4 422 | with: 423 | repository: ${{ github.repository_owner }}/mdk 424 | path: mdk 425 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 426 | fetch-depth: 1 427 | token: ${{ secrets.CLONE_PAT }} 428 | submodules: 'recursive' 429 | - name: 'Restore External Dep cache' 430 | id: external-dep-cache 431 | uses: actions/cache@v4 432 | with: 433 | path: ./mdk/external 434 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 435 | - name: Create Build Environment 436 | shell: bash 437 | env: 438 | SYSROOT_CACHE_HIT: true 439 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 440 | working-directory: mdk 441 | run: ../ci-before-build.sh 442 | - uses: seanmiddleditch/gha-setup-ninja@master 443 | - uses: ilammy/msvc-dev-cmd@v1 444 | with: 445 | arch: x64 446 | - name: Configure for win x64 447 | env: 448 | R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK 449 | working-directory: mdk 450 | run: cmake -DSOURCE_MODULES=core -DR3DSDK=${{ env.R3DSDK }} -DUSE_LTO=0 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 451 | - name: Build for win x64 452 | working-directory: mdk 453 | run: cmake --build build/${{ env.TARGET_OS }}-x64 454 | - name: Install for win x64 455 | working-directory: mdk 456 | run: cmake --install build/${{ env.TARGET_OS }}-x64 457 | - name: Make SRC SDK 458 | shell: bash 459 | working-directory: mdk 460 | run: | 461 | chmod +x ../mksrc.sh 462 | ../mksrc.sh $PWD mdk-sdk-${{ env.ARCH }} 463 | cp -avf ../CMakeLists.txt mdk-sdk-${{ env.ARCH }} 464 | if [[ ${{ matrix.config }} == Debug ]]; then 465 | CRT_SUFFIX=d 466 | fi 467 | cp -avf external/lib/windows/${{ env.ARCH }}/MD$CRT_SUFFIX/{vpl,snappy}.lib mdk-sdk-${{ env.ARCH }}/lib 468 | date +%m%d 469 | 7z a -p${{ secrets.SRC_USER }}`date +%m%d` -mhe ../mdk-src-${{ env.TARGET_OS }}-vs2022.7z mdk-sdk-${{ env.ARCH }} 470 | - name: Archieve SDK 471 | uses: actions/upload-artifact@v4 472 | with: 473 | name: mdk-src-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }} 474 | path: mdk-src-${{ env.TARGET_OS }}-vs2022.7z 475 | 476 | 477 | Windows_LTL: 478 | runs-on: windows-latest 479 | env: 480 | TARGET_OS: windows-desktop 481 | CRT_EXTRA: LTL 482 | strategy: 483 | fail-fast: false 484 | matrix: 485 | config: [RelWithDebInfo] 486 | steps: 487 | - uses: actions/checkout@v4 488 | - name: Checkout source 489 | uses: actions/checkout@v4 490 | with: 491 | repository: ${{ github.repository_owner }}/mdk 492 | path: mdk 493 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 494 | fetch-depth: 1 495 | token: ${{ secrets.CLONE_PAT }} 496 | submodules: 'recursive' 497 | - name: 'Restore External Dep cache' 498 | id: external-dep-cache 499 | uses: actions/cache@v4 500 | with: 501 | path: ./mdk/external 502 | key: external-dep-${{ env.TARGET_OS }}-${{ env.CRT_EXTRA }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 503 | - name: 'Restore VC-LTL cache' 504 | id: ltl-cache 505 | uses: actions/cache@v4 506 | with: 507 | path: ./mdk/cmake/VC-LTL 508 | key: ltl-${{ vars.VC_LTL_VER }} 509 | - if: ${{ steps.ltl-cache.outputs.cache-hit != 'true' }} 510 | name: Get VC-LTL 511 | shell: bash 512 | working-directory: mdk/cmake 513 | run: | 514 | curl -kL -o ltl.7z https://github.com/Chuyu-Team/VC-LTL5/releases/download/v${VC_LTL_VER}/VC-LTL-${VC_LTL_VER}-Binary.7z 515 | 7z x ltl.7z -oVC-LTL 516 | - name: Create Build Environment 517 | shell: bash 518 | env: 519 | SYSROOT_CACHE_HIT: true 520 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 521 | working-directory: mdk 522 | run: ../ci-before-build.sh 523 | - uses: seanmiddleditch/gha-setup-ninja@master 524 | - uses: ilammy/msvc-dev-cmd@v1 525 | with: 526 | arch: amd64_x86 527 | - name: Configure for win x86 528 | env: 529 | ARCH: x86 530 | R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK 531 | working-directory: mdk 532 | run: cmake -DVC_LTL=1 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 533 | - name: Build for win x86 534 | working-directory: mdk 535 | run: cmake --build build/${{ env.TARGET_OS }}-x86 536 | - uses: ilammy/msvc-dev-cmd@v1 537 | with: 538 | arch: x64 539 | - name: Configure for win x64 540 | env: 541 | ARCH: x64 542 | R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK 543 | working-directory: mdk 544 | run: cmake -DVC_LTL=1 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 545 | - name: Build for win x64 546 | working-directory: mdk 547 | run: cmake --build build/${{ env.TARGET_OS }}-x64 548 | - name: Make SDK 549 | shell: bash 550 | working-directory: mdk 551 | run: | 552 | ../ci-after-build.sh 553 | mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022-ltl.7z 554 | - name: Archieve SDK 555 | uses: actions/upload-artifact@v4 556 | with: 557 | name: mdk-sdk-vs2022-ltl-${{ env.TARGET_OS }}-${{ matrix.config }} 558 | path: mdk-sdk-${{ env.TARGET_OS }}-vs2022-ltl.7z 559 | 560 | 561 | UWP: 562 | runs-on: windows-latest 563 | env: 564 | TARGET_OS: uwp 565 | strategy: 566 | fail-fast: false 567 | matrix: 568 | config: [RelWithDebInfo] 569 | steps: 570 | - uses: actions/checkout@v4 571 | - name: Checkout source 572 | uses: actions/checkout@v4 573 | with: 574 | repository: ${{ github.repository_owner }}/mdk 575 | path: mdk 576 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 577 | fetch-depth: 1 578 | token: ${{ secrets.CLONE_PAT }} 579 | submodules: 'recursive' 580 | - name: 'Restore External Dep cache' 581 | id: external-dep-cache 582 | uses: actions/cache@v4 583 | with: 584 | path: ./mdk/external 585 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 586 | - name: Create Build Environment 587 | shell: bash 588 | env: 589 | SYSROOT_CACHE_HIT: true 590 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 591 | working-directory: mdk 592 | run: ../ci-before-build.sh 593 | - uses: seanmiddleditch/gha-setup-ninja@master 594 | - uses: ilammy/msvc-dev-cmd@v1 595 | with: 596 | arch: amd64_arm64 597 | uwp: true 598 | - name: Configure for uwp arm64 599 | env: 600 | ARCH: arm64 601 | working-directory: mdk 602 | run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 603 | - name: Build for win arm64 604 | working-directory: mdk 605 | run: cmake --build build/${{ env.TARGET_OS }}-arm64 606 | - uses: ilammy/msvc-dev-cmd@v1 607 | with: 608 | arch: x64 609 | uwp: true 610 | - name: Configure for uwp x64 611 | env: 612 | ARCH: x64 613 | working-directory: mdk 614 | run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 . 615 | - name: Build for win x64 616 | working-directory: mdk 617 | run: cmake --build build/${{ env.TARGET_OS }}-x64 618 | - name: Make SDK 619 | shell: bash 620 | working-directory: mdk 621 | run: | 622 | ../ci-after-build.sh 623 | mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z 624 | - name: Archieve SDK 625 | uses: actions/upload-artifact@v4 626 | with: 627 | name: mdk-sdk-vs2022-${{ env.TARGET_OS }}-${{ matrix.config }} 628 | path: mdk-sdk-${{ env.TARGET_OS }}-vs2022.7z 629 | 630 | 631 | ClangCL: 632 | runs-on: ubuntu-latest 633 | env: 634 | TARGET_OS: ${{ matrix.os }} 635 | VCDIR: '/tmp/winsysroot/msvcrt-dev' 636 | WINDOWSSDKDIR: '/tmp/winsysroot/winsdk' 637 | strategy: 638 | fail-fast: false 639 | matrix: 640 | os: [windows-desktop] 641 | config: [MinSizeRel] 642 | steps: 643 | - uses: actions/checkout@v4 644 | - name: Checkout source 645 | uses: actions/checkout@v4 646 | with: 647 | repository: ${{ github.repository_owner }}/mdk 648 | path: mdk 649 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 650 | fetch-depth: 1 651 | token: ${{ secrets.CLONE_PAT }} 652 | submodules: 'recursive' 653 | - name: 'Restore External Dep cache' 654 | id: external-dep-cache 655 | uses: actions/cache@v4 656 | with: 657 | path: ./mdk/external 658 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 659 | - name: 'Restore sysroot cache' 660 | id: sysroot-cache 661 | uses: actions/cache@v4 662 | with: 663 | path: /tmp/winsysroot 664 | key: sysroot-${{ env.TARGET_OS }}${{ vars.WINSDKVER }}-vc${{ vars.VCVER }} 665 | - name: Create Build Environment 666 | shell: bash 667 | env: 668 | SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }} 669 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 670 | working-directory: mdk 671 | run: ../ci-before-build.sh 672 | - name: Configure for win arm64 673 | env: 674 | ARCH: arm64 675 | working-directory: mdk 676 | run: | 677 | export WindowsSdkDir=${WINDOWSSDKDIR} 678 | export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version) 679 | cmake -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 680 | - name: Build for arm64 681 | working-directory: mdk 682 | run: cmake --build build/${TARGET_OS}-arm64 683 | - name: Configure for win x86 684 | env: 685 | ARCH: x86 686 | working-directory: mdk 687 | run: | 688 | export WindowsSdkDir=${WINDOWSSDKDIR} 689 | export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version) 690 | cmake -DUSE_QSV=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 691 | - name: Build for x86 692 | working-directory: mdk 693 | run: cmake --build build/${TARGET_OS}-x86 694 | - name: Configure for win x64 695 | env: 696 | ARCH: x64 697 | working-directory: mdk 698 | run: | 699 | export WindowsSdkDir=${WINDOWSSDKDIR} 700 | export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version) 701 | cmake -DUSE_QSV=0 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/windows.clang.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 702 | - name: Build for x64 703 | working-directory: mdk 704 | run: cmake --build build/${TARGET_OS}-x64 705 | - name: Make SDK 706 | working-directory: mdk 707 | run: | 708 | ../ci-after-build.sh 709 | if [ -f $VCDIR/bin/x64/vcruntime140_1.dll ]; then 710 | mkdir -p mdk-sdk/bin/x64 711 | cp $VCDIR/bin/x64/vcruntime140_1.dll mdk-sdk/bin/x64 712 | 7z a mdk-sdk-*.7z mdk-sdk/bin/x64/vcruntime140_1.dll 713 | fi 714 | mv mdk-sdk-*.7z ../mdk-sdk-${{ env.TARGET_OS }}-clang.7z 715 | - name: Archieve SDK 716 | uses: actions/upload-artifact@v4 717 | with: 718 | name: mdk-sdk-clang-${{ env.TARGET_OS }}-${{ matrix.config }} 719 | path: mdk-sdk-${{ env.TARGET_OS }}-clang.7z 720 | - name: Upload to SourceForge 721 | if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }} 722 | run: sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-clang.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 723 | 724 | NuGet: 725 | runs-on: macos-latest 726 | needs: [Windows, UWP, Windows_LTL] 727 | steps: 728 | - uses: actions/checkout@v4 729 | - name: Download win32 vs2022 sdk 730 | uses: actions/download-artifact@v4 731 | with: 732 | name: mdk-sdk-vs2022-windows-desktop-RelWithDebInfo 733 | - name: Download win32 vs2022 ltl sdk 734 | uses: actions/download-artifact@v4 735 | with: 736 | name: mdk-sdk-vs2022-ltl-windows-desktop-RelWithDebInfo 737 | - name: Download uwp vs2022 sdk 738 | uses: actions/download-artifact@v4 739 | with: 740 | name: mdk-sdk-vs2022-uwp-RelWithDebInfo 741 | - name: update build version 742 | shell: bash 743 | run: sed -i .bak "s,\(.*\.\)[0-9]*\(\),\1${GITHUB_RUN_NUMBER}\2," nuget/mdk.nuspec 744 | - name: install tools 745 | run: brew install sshpass nuget 7zip md5sha1sum 746 | - name: Make nupkg (VS2022) 747 | run: | 748 | rm -rf mdk-sdk uwp 749 | md5sum mdk-sdk-windows-desktop-vs2022.7z | cut -d ' ' -f1 > mdk-sdk-windows-desktop-vs2022.7z.md5 750 | md5sum mdk-sdk-windows-desktop-vs2022-x64.7z | cut -d ' ' -f1 > mdk-sdk-windows-desktop-vs2022-x64.7z.md5 751 | 7z x mdk-sdk-windows-desktop-vs2022.7z 752 | 7z x mdk-sdk-uwp-vs2022.7z -o"uwp" 753 | mkdir mdk-sdk/bin/UAP 754 | cp -af uwp/mdk-sdk/bin/* mdk-sdk/bin/UAP 755 | cp nuget/mdk.nuspec mdk-sdk 756 | cp -avf nuget/README.md mdk-sdk 757 | cd mdk-sdk 758 | nuget pack mdk.nuspec 759 | mv *.nupkg ../mdk-vs2022.nupkg 760 | - name: Archieve SDK 761 | uses: actions/upload-artifact@v4 762 | with: 763 | name: mdk-nuget 764 | path: 'mdk*.nupkg' 765 | - name: Upload to SourceForge 766 | if: ${{ env.SF_UPLOAD == 'true' }} 767 | shell: bash 768 | run: make -f upload.mk 769 | 770 | Linux: 771 | runs-on: ubuntu-latest 772 | env: 773 | TARGET_OS: linux 774 | LTO_SUFFIX: -lto 775 | strategy: 776 | fail-fast: false 777 | matrix: 778 | config: [MinSizeRel] 779 | steps: 780 | - uses: actions/checkout@v4 781 | - name: Checkout source 782 | uses: actions/checkout@v4 783 | with: 784 | repository: ${{ github.repository_owner }}/mdk 785 | path: mdk 786 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 787 | fetch-depth: 1 788 | token: ${{ secrets.CLONE_PAT }} 789 | submodules: 'recursive' 790 | - name: 'Restore External Dep cache' 791 | id: external-dep-cache 792 | uses: actions/cache@v4 793 | with: 794 | path: ./mdk/external 795 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 796 | - name: 'Restore sysroot cache' 797 | id: sysroot-cache 798 | uses: actions/cache@v4 799 | with: 800 | path: ./mdk/sysroot 801 | key: sysroot-${{ env.TARGET_OS }}-${{ vars.LINUX_SYSROOT_ID }} 802 | - name: Create Build Environment 803 | shell: bash 804 | env: 805 | SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }} 806 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 807 | working-directory: mdk 808 | run: | 809 | sudo apt remove -y libc++1-14 libc++abi1-14 libunwind-14 python3-lldb-14 # conflict with latest llvm 810 | ../ci-before-build.sh 811 | - name: Configure for x64 812 | env: 813 | ARCH: amd64 814 | shell: bash 815 | working-directory: mdk 816 | run: cmake -DR3DSDK=$PWD/external/R3DSDK -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 817 | - name: Build for x64 818 | shell: bash 819 | working-directory: mdk 820 | run: cmake --build build/${TARGET_OS}-amd64 821 | - name: Configure for aarch64 822 | env: 823 | ARCH: arm64 824 | shell: bash 825 | working-directory: mdk 826 | run: cmake -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 827 | - name: Build for aarch64 828 | shell: bash 829 | working-directory: mdk 830 | run: cmake --build build/${TARGET_OS}-arm64 831 | - name: Configure for armhf 832 | env: 833 | ARCH: armhf 834 | shell: bash 835 | working-directory: mdk 836 | run: cmake -DGLVA_STATIC_CXX=OFF -DUSE_LTO=1 -DUSE_LIBCXX=1 -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/${TARGET_OS/r*pi/rpi}.clang.cmake -DLINUX_SYSROOT=$PWD/sysroot -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 837 | - name: Build for armhf 838 | shell: bash 839 | working-directory: mdk 840 | run: cmake --build build/${TARGET_OS}-armhf 841 | - name: Make SDK 842 | shell: bash 843 | working-directory: mdk 844 | run: | 845 | ../ci-after-build.sh 846 | mv mdk-sdk*.tar.xz .. 847 | rm -rf mdk-sdk/{bin,lib}/arm* 848 | tar Jcvf ../mdk-sdk-${{ env.TARGET_OS }}-x64.tar.xz mdk-sdk 849 | - name: Archieve SDK 850 | uses: actions/upload-artifact@v4 851 | with: 852 | name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }} 853 | path: mdk-sdk-${{ env.TARGET_OS }}*.tar.xz 854 | - name: Upload to SourceForge 855 | if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }} 856 | shell: bash 857 | run: | 858 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 859 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-x64.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 860 | md5sum mdk-sdk-${TARGET_OS}.tar.xz | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}.tar.xz.md5 861 | md5sum mdk-sdk-${TARGET_OS}-x64.tar.xz | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}-x64.tar.xz.md5 862 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-*.md5 ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 863 | 864 | Android: 865 | runs-on: ubuntu-latest # ndk 25 removed 866 | env: 867 | #FF_VER: 6.1 # 7.0 and master is very slow in avformat_find_stream_info 868 | TARGET_OS: android 869 | LTO_SUFFIX: -lto 870 | MIN_API: 21 871 | NDK_32: r25c 872 | strategy: 873 | fail-fast: false 874 | matrix: 875 | config: [MinSizeRel] # https://github.com/android/ndk/issues/721 876 | steps: 877 | - uses: actions/checkout@v4 878 | - name: Checkout source 879 | uses: actions/checkout@v4 880 | with: 881 | repository: ${{ github.repository_owner }}/mdk 882 | path: mdk 883 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 884 | fetch-depth: 1 885 | token: ${{ secrets.CLONE_PAT }} 886 | submodules: 'recursive' 887 | - name: 'Restore External Dep cache' 888 | id: external-dep-cache 889 | uses: actions/cache@v4 890 | with: 891 | path: ./mdk/external 892 | key: external-dep-${{ env.TARGET_OS }}-ffmpeg-${{ env.FF_VER }}-${{ vars.FF_SDK_ID }} 893 | - name: Create Build Environment 894 | shell: bash 895 | env: 896 | # SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }} 897 | EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }} 898 | working-directory: mdk 899 | run: ../ci-before-build.sh 900 | - name: Configure for arm64-v8a 901 | env: 902 | ARCH: arm64-v8a 903 | shell: bash 904 | working-directory: mdk 905 | run: | 906 | ls ${ANDROID_HOME}/ndk 907 | MIN_API_64=21 908 | [ $MIN_API -gt 21 ] && MIN_API_64=$MIN_API 909 | cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API_64} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 910 | - name: Build for arm64-v8a 911 | shell: bash 912 | working-directory: mdk 913 | run: cmake --build build/${TARGET_OS}-arm64-v8a 914 | - name: Configure for x86_64 915 | env: 916 | ARCH: x86_64 917 | shell: bash 918 | working-directory: mdk 919 | run: | 920 | MIN_API_64=21 921 | [ $MIN_API -gt 21 ] && MIN_API_64=$MIN_API 922 | cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API_64} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 923 | - name: Build for x86_64 924 | shell: bash 925 | working-directory: mdk 926 | run: cmake --build build/${TARGET_OS}-x86_64 927 | # - uses: nttld/setup-ndk@v1 928 | # id: setup-ndk 929 | # with: 930 | # ndk-version: ${{ env.NDK_32 }} 931 | # local-cache: false 932 | # - name: 'Restore ndk cache' # setup-ndk not fully cached 933 | # id: ndk-cache 934 | # uses: actions/cache@v4 935 | # with: 936 | # path: ${{ runner.tool_cache }}/ndk/${{ env.NDK_32 }} # /opt/hostedtoolcache 937 | # key: ndk-cache-${{ runner.os }}-${{ env.NDK_32 }} 938 | - name: Configure for armeabi-v7a 939 | env: 940 | ARCH: armeabi-v7a 941 | MIN_API: 21 # 19: android 4.4. ndk25 942 | # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} 943 | shell: bash 944 | working-directory: mdk 945 | run: cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 946 | - name: Build for armeabi-v7a 947 | shell: bash 948 | working-directory: mdk 949 | run: cmake --build build/${TARGET_OS}-armeabi-v7a 950 | - name: Configure for x86 951 | env: 952 | ARCH: x86 953 | MIN_API: 21 # 19: android 4.4. ndk25 954 | # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} 955 | shell: bash 956 | working-directory: mdk 957 | run: cmake -DUSE_LTO=1 -DANDROID_LD=lld -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=android-${MIN_API} -DANDROID_TOOLCHAIN=clang -DANDROID_STL=c++_shared -DANDROID_PIE=ON -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -GNinja -H$PWD -B$PWD/build/${TARGET_OS}-${ARCH} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk-${ARCH} -DCMAKE_VERBOSE_MAKEFILE=1 958 | - name: Build for x86 959 | shell: bash 960 | working-directory: mdk 961 | run: cmake --build build/${TARGET_OS}-x86 962 | - name: Make SDK 963 | shell: bash 964 | working-directory: mdk 965 | run: | 966 | ../ci-after-build.sh 967 | mv mdk-sdk-*.7z .. 968 | - name: Archieve SDK 969 | uses: actions/upload-artifact@v4 970 | with: 971 | name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }} 972 | path: mdk-sdk-${{ env.TARGET_OS }}.7z 973 | - name: Upload to SourceForge 974 | if: ${{ matrix.config == 'MinSizeRel' && env.SF_UPLOAD == 'true' }} 975 | shell: bash 976 | run: | 977 | 7z d -ssc -m0=lzma2 -mx=9 -ms=on -mf=off mdk-sdk-${TARGET_OS}.7z mdk-sdk/lib/{x86,x86_64}/libmdk.so.dsym 978 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 979 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk/build/android-arm64-v8a/video/libqtav-mediacodec.so ${SF_USER}@frs.sourceforge.net:/home/frs/project/qtav/depends/mediacodec/arm64-v8a 980 | md5sum mdk-sdk-${TARGET_OS}.7z | cut -d ' ' -f1 > mdk-sdk-${TARGET_OS}.7z.md5 981 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-*.md5 ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 982 | 983 | abi: 984 | runs-on: ubuntu-latest 985 | steps: 986 | - uses: actions/checkout@v4 987 | - name: Checkout source 988 | uses: actions/checkout@v4 989 | with: 990 | repository: ${{ github.repository_owner }}/mdk 991 | path: mdk 992 | ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || 'master' }} 993 | fetch-depth: 1 994 | token: ${{ secrets.CLONE_PAT }} 995 | - name: Make SDK 996 | shell: bash 997 | run: | 998 | mkdir -p mdk-sdk/include/abi/mdk 999 | cp -avf mdk/include/mdk/{AudioFormat,AudioFrame,Buffer,ColorSpace,FrameReader,global,MediaInfo,Property,VideoBuffer,VideoFormat,VideoFrame,VideoDecoder,Packet,MediaIO}.h mdk-sdk/include/abi/mdk 1000 | - name: Archieve SDK 1001 | uses: actions/upload-artifact@v4 1002 | with: 1003 | name: mdk-abi-sdk 1004 | path: mdk-sdk/ 1005 | - run: sudo apt install -y sshpass p7zip-full 1006 | - name: Upload to SourceForge 1007 | shell: bash 1008 | run: | 1009 | 7z a mdk-abi-sdk.7z mdk-sdk 1010 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-abi-sdk.7z ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 1011 | cd mdk && git describe --always >.version 1012 | sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no .version ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 1013 | 1014 | - name: test 1015 | if: ${{ env.SF_UPLOAD == 'true' }} 1016 | run: echo bye 1017 | 1018 | # https://github.com/orgs/community/discussions/26323#discussioncomment-3251451 1019 | # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow 1020 | # https://github.blog/changelog/2022-09-08-github-actions-use-github_token-with-workflow_dispatch-and-repository_dispatch/ 1021 | Dispatch: 1022 | runs-on: ubuntu-latest 1023 | permissions: write-all 1024 | needs: [abi, NuGet, Apple, Linux, Android] 1025 | steps: 1026 | # - name: 'Trigger Workflow' 1027 | # uses: actions/github-script@v7 1028 | # with: 1029 | # script: | 1030 | # await github.rest.actions.createWorkflowDispatch({ 1031 | # owner: '${{ github.repository_owner }}', 1032 | # repo: 'mdk-examples', 1033 | # workflow_id: 'workflows/main.yaml', 1034 | # ref: 'master', 1035 | # inputs: { 1036 | # run_id: ${{ github.run_id }} 1037 | # } 1038 | # }); 1039 | - name: Dispatch 1040 | if: ${{ env.SF_UPLOAD == 'true' }} 1041 | run: | 1042 | gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-examples # -f run_id=${{ github.run_id }} 1043 | gh workflow run build.yml --repo ${{ github.repository_owner }}/SPV # -f run_id=${{ github.run_id }} 1044 | gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-braw -f run_id=${{ github.run_id }} 1045 | gh workflow run main.yml --repo ${{ github.repository_owner }}/mdk-nvjp2k -f run_id=${{ github.run_id }} 1046 | env: 1047 | GH_TOKEN: ${{ secrets.ACTION_PAT }} # GITHUB_TOKEN? 1048 | 1049 | Release: 1050 | runs-on: ubuntu-latest 1051 | if: startsWith(github.ref, 'refs/tags/') 1052 | needs: [Apple, NuGet, Linux, Android, ClangCL] 1053 | steps: 1054 | - name: Checkout 1055 | uses: actions/checkout@v4 1056 | - name: Download iOS sdk 1057 | uses: actions/download-artifact@v4 1058 | with: 1059 | name: mdk-sdk-iOS-MinSizeRel 1060 | - name: Download iOSSimulator sdk 1061 | uses: actions/download-artifact@v4 1062 | with: 1063 | name: mdk-sdk-iOSSimulator-MinSizeRel 1064 | - name: Download tvOS sdk 1065 | uses: actions/download-artifact@v4 1066 | with: 1067 | name: mdk-sdk-tvOS-MinSizeRel 1068 | - name: Download tvOSSimulator sdk 1069 | uses: actions/download-artifact@v4 1070 | with: 1071 | name: mdk-sdk-tvOSSimulator-MinSizeRel 1072 | - name: Download visionOS sdk 1073 | uses: actions/download-artifact@v4 1074 | with: 1075 | name: mdk-sdk-visionOS-MinSizeRel 1076 | - name: Download visionOSSimulator sdk 1077 | uses: actions/download-artifact@v4 1078 | with: 1079 | name: mdk-sdk-visionOSSimulator-MinSizeRel 1080 | - name: Download macCatalyst sdk 1081 | uses: actions/download-artifact@v4 1082 | with: 1083 | name: mdk-sdk-macCatalyst-MinSizeRel 1084 | - name: Download macOS sdk 1085 | uses: actions/download-artifact@v4 1086 | with: 1087 | name: mdk-sdk-macOS 1088 | - name: Download Apple sdk txz 1089 | uses: actions/download-artifact@v4 1090 | with: 1091 | name: mdk-sdk-apple 1092 | - name: Download Apple sdk zip 1093 | uses: actions/download-artifact@v4 1094 | with: 1095 | name: mdk-sdk-apple-zip 1096 | - name: Download win32 vs2022 sdk 1097 | uses: actions/download-artifact@v4 1098 | with: 1099 | name: mdk-sdk-vs2022-windows-desktop-RelWithDebInfo 1100 | - name: Download win32 vs2022 ltl sdk 1101 | uses: actions/download-artifact@v4 1102 | with: 1103 | name: mdk-sdk-vs2022-ltl-windows-desktop-RelWithDebInfo 1104 | - name: Download uwp vs2022 sdk 1105 | uses: actions/download-artifact@v4 1106 | with: 1107 | name: mdk-sdk-vs2022-uwp-RelWithDebInfo 1108 | - name: Download clang-cl sdk 1109 | uses: actions/download-artifact@v4 1110 | with: 1111 | name: mdk-sdk-clang-windows-desktop-MinSizeRel 1112 | - name: Download linux sdk 1113 | uses: actions/download-artifact@v4 1114 | with: 1115 | name: mdk-sdk-linux-MinSizeRel 1116 | - name: Download android sdk 1117 | uses: actions/download-artifact@v4 1118 | with: 1119 | name: mdk-sdk-android-MinSizeRel 1120 | - run: ls -lh 1121 | - name: Release 1122 | uses: softprops/action-gh-release@v2 1123 | with: 1124 | draft: true 1125 | body: "Changelog.md" 1126 | #body_path: Changelog.md 1127 | files: | 1128 | *.7z 1129 | *.xz 1130 | mdk-sdk-apple.zip 1131 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) # precompile headers 2 | if(NOT DEFINED PROJECT_NAME) 3 | set(PROJECT_NAME mdk) 4 | else() 5 | add_definitions(-DMDK_NS=${PROJECT_NAME}) 6 | endif() 7 | if(POLICY CMP0091) # CMAKE_MSVC_RUNTIME_LIBRARY. since 3.15 8 | cmake_policy(SET CMP0091 NEW) 9 | endif() 10 | 11 | project(${PROJECT_NAME} VERSION 0.20.0 DESCRIPTION "Multimedia Dev Kit ${GIT_COMMIT}" 12 | #LANGUAGES C CXX OBJC OBJCXX 13 | ) 14 | set(PROJECT_VERSION_TWEAK 0) 15 | set(TARGET_NAME ${PROJECT_NAME}) 16 | # https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ (global and specified target) 17 | set(CMAKE_CXX_STANDARD 20) 18 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 19 | #set(ENV{PKG_CONFIG_SYSROOT_DIR} "=") 20 | #set(CMAKE_CXX_EXTENSIONS OFF) 21 | message("CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}, CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}, CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}") 22 | message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}. CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}. LINUX: ${LINUX}") 23 | message("CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") 24 | message("CMAKE: ${CMAKE_VERSION}") 25 | 26 | 27 | include(CheckLibraryExists) 28 | 29 | set(SO_NAME ${TARGET_NAME}) 30 | 31 | if(MSVC) 32 | add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) 33 | endif() 34 | 35 | include_directories( 36 | include 37 | src/ 38 | src/base/cppcompat/include 39 | ) 40 | 41 | file(GLOB SRC "src/core/*.cpp") 42 | add_library(${TARGET_NAME} SHARED 43 | ${SRC} 44 | ) 45 | target_compile_definitions(${TARGET_NAME} PRIVATE -DBUILD_MDK_LIB) 46 | target_link_directories(${TARGET_NAME} PRIVATE lib) 47 | # vpl, snappy: download from artifacts of https://github.com/wang-bin/devpkgs/actions or https://sourceforge.net/projects/mdk-sdk/files/deps/dep.7z/download 48 | target_link_libraries(${TARGET_NAME} PRIVATE mdkObj avglue ugl ugs glva-static vpl snappy) 49 | set_target_properties(${TARGET_NAME} PROPERTIES 50 | MACOSX_RPATH ON 51 | FRAMEWORK ON 52 | MACOSX_FRAMEWORK_IDENTIFIER com.mediadevkit.${TARGET_NAME} 53 | MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION} 54 | MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} 55 | #MACOSX_FRAMEWORK_INFO_PLIST 56 | #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY 57 | FRAMEWORK_VERSION A # codesign assumes framework version is A 58 | VERSION ${PROJECT_VERSION} 59 | SOVERSION ${PROJECT_VERSION_MAJOR} 60 | OUTPUT_NAME ${SO_NAME} 61 | CLEAN_DIRECT_OUTPUT 1 62 | ) 63 | 64 | CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) 65 | if(HAVE_LIBDL) 66 | target_link_libraries(${TARGET_NAME} PRIVATE dl) 67 | endif() 68 | # only static libs are enough for reloc obj targets, otherwise static + shared 69 | target_link_libraries(${TARGET_NAME} PRIVATE ${EXTRA_LIBS}) 70 | if(POLICY CMP0072) 71 | cmake_policy(SET CMP0072 NEW) 72 | endif() 73 | set(OpenGL_GL_PREFERENCE GLVND) 74 | include(FindOpenGL) 75 | if(OPENGL_FOUND) 76 | list(APPEND EXTRA_DYLIBS OpenGL::GL) 77 | target_link_libraries(${TARGET_NAME} PRIVATE OpenGL::GL) 78 | endif() 79 | find_package(Threads) 80 | target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads) # link_libraries() affect targets ONLY add later 81 | 82 | if(WIN32) 83 | target_link_libraries(${TARGET_NAME} PRIVATE 84 | mfplat mfuuid version wmcodecdspuuid 85 | xaudio2 dsound ole32 d3d11 user32 Mf gdi32 86 | advapi32 87 | ) 88 | endif() 89 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | Change log: 2 | 3 | # 0.33.0 4 | 5 | - API: 6 | - Audio/VideoFrame is ref counted 7 | - Add `VideoFrame.get(DX11Resource*, ID3D11Device*)` to get underlying dx11 resource, or convert to dx11 textures if device is provided(cuda only) 8 | - Rockchip rkmpp decoder 10bit output can be directly imported by EGLImage w/o rga format conversion. Maybe it's the only player supports this feature. 9 | - MFT: 10 | - Support async and hardware mft via property `hardware=1` or `async=1`, hardware implies async. jpeg and vp8 can be async decoder 11 | - `hardware` property value can be a vendor name, e.g. `nvidia`, `intel`, `amd`, `qcom` 12 | - packed yuv format is not preferred 13 | - D3D11: 14 | - Render target D3D11RenderAPI.rtv can be an array texture. array index starts from 0, and increases if renderVideo() draws a new frame, i.e. returns a new timestamp 15 | - Expose [IDXSync](https://github.com/wang-bin/mdk-sdk/wiki/Render-API#idxsync) for user, which can be used to sync between contexts if render decoded dx11 resource from `VideoFrame.get(DX11Resource*)` or encode/process dx11 texture rendered by `renderVideo()`. It's also used internally. 16 | - Fix signal on a wrong fence 17 | - Improve cross device rendering w/o cpu wait 18 | - OpenGL: 19 | - Fix yuv sampler shader 20 | - Don't use GL_OES_EGL_image_external for ES3, fix error on some devices(e.g. rk3588 mali driver) 21 | - More EGL platform types, and platform extension is used when possible. 22 | - Metal: render target supports array texture 23 | - CUDA: 24 | - Add decoder property `array=N` or global option `cuda.array` for dx11 to use an array texture as output 25 | - Add decoder property `persistent` or global option `cuda.persistent` for gl and dx11 to map as cuda resource only once 26 | - Dolby vision: support profile 20, used by MV-HEVC 27 | - Use rgba format for GBM to fix no EGLConfig for rgb. env var `GBM_FORMAT` can force another format, the value is a GBM fourcc, e.g. `AR24` 28 | - record() without any decoder will remux the media. steps: `setMedia(..., {}) => record(file,...) => set(State::Playing) => waitFor(State::Stopped)` 29 | - Fix avfilter processed audio format 30 | - Fix bitmap subtitle display area 31 | - Fix some subtitle crash 32 | - Fix mirror for rotated video used by OpenGL FBO 33 | - build with libc++21 34 | - lto is disabled for apple platforms because of compiler bug. 35 | - FFmpeg: support 8.0 abi 36 | - Add global option `ffmpeg` and `libffmpeg` to reload all av modules, value can be libffmpeg path or handle 37 | 38 | 39 | # 0.32.0 40 | 41 | - API: 42 | - Add `AudioFrame` and `Player.onFrame()`. Example: [obs](https://github.com/wang-bin/obs-mdk/commit/b5027fffa08765626954af8e5ca0566416e50f38) 43 | - `VideoFrame.from()` can import CUDA and VAAPI resources 44 | - **NEW: VP8/9, HEVC with Alpha support.** Maybe it's the 1st player engine supports those standard alpha videos. 45 | - VP8/9, HEVC alpha layer decoding for all decoders. 46 | - alpha layer rendering in all renderers. Alpha and base layer can be from different decoders and have different strides, and sampler types can be different. 47 | - `alpha=0` can disable alpha layer decoding, e.g. `player.setProperty("video.decoder", "alpha=0")` 48 | - non-standard alpha videos whose alpha data is at bottom or right, enable via decoder property `alpha=right` or `alpha=bottom`. sw decoder or hw decoder copy mode only. 49 | - MFT: support HEVC base layer decoding if has multiple layers(alpha and MV-HEVC). By default such bitstream is rejected by MFT 50 | - D3D11: fix downloading from stage texture, previously may crash on amd, arm64 51 | - CUDA: 52 | - Only decode base layer of has multiple layers. By default it decodes all layers(alpha and MV-HEVC). 53 | - Add properties `device`, `stream`, `pbo` etc. see https://github.com/wang-bin/mdk-sdk/wiki/Decoders#cuda 54 | - Fix a crash when destroying the last frame 55 | - VT: `RequestedMVHEVCVideoLayerIDs` bug reported by me in 2024 is fixed in macOS 15.4, so remove workaroud for macOS 15.4+ 56 | - VAAPI: add "vpp" property, 1 to convert to rgb via vpp 57 | - EGL: 58 | - Prefer storage extension for desktop gl. external only formats support is vendor dependent. Works well on all gpus including raspberry pi. previously only OpenGL ES + external image can be used for extenal only formats. 59 | - Fix no hdr metadata warnings in system log on android 60 | - Support android platform display 61 | - Fix HDR display if no colorspace extension(regression in 0.31.0) 62 | - Fix crash if no client extension(regression in 0.31.0) 63 | - Add value "fit" to property "subtitle.size" to scale subtitle to renderer size and keep aspect ratio 64 | - CMake: add rpath-link for linux libc++ 65 | - Load libshaderc.so instead of libshaderc-shared.so on linux 66 | - global option videoout.hdr10_metadata=0 can disable hdr10 metadata passthru to display 67 | - Fix old subtitle rendered if track switched 68 | - Fix point map if render api changed(default opengl, to another) 69 | - Don't clear render target if failed to open a decoder 70 | - FFmpeg: 71 | - Add "format" option for sw decoder. used by hevc alpha, for example `format=yuva420p` 72 | - "sw_fallback" property applies for codecs w/o hwaccel 73 | 74 | 75 | # 0.31.0 76 | 77 | - API: 78 | - Add color space and dolby vision profile in MediaInfo 79 | - Add `VideoEffect::ScaleChannels` and `ShiftChannels` 80 | - Add `Player.subtitleText()` to get subtitle text(except bitmap subtitles) with ass style or not, even if subtitle rendering is disabled by `setProperty("subtitle", "0")`. see https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#stdstring-subtitletextdouble-time---1-int-style--0-const 81 | - EGL: 82 | - Support HDR color spaces. `player.set(ColorSpaceUnknown)` will switch between HDR and SDR color space depending on current rendering video frame. Tested on android, may work on linux 83 | - Enable HDR10 metadata pass through, can be disabled by env var `EGL_HDR_METADATA=0` 84 | - Prefer rgb10a2 to avoid recreating context when switching between SDR and HDR 85 | - Support KHR_no_config_context to avoid recreating context when switching between SDR and HDR 86 | - Subtitle: 87 | - Fix properties not applied if set before play 88 | - Support splitting ASS rendered rgba image into several smaller regions when possible to reduce total size and gpu bandwidth. controlled by player property `subtitle.ass.regions.max` or env `ASS_REGIONS_MAX`, value is int. use `subtitle.ass.regions.debug` or env `ASS_REGIONS_DEBUG` to visualize regions and show debug messages. 89 | - Keep colorspace the same as video, fix dark in bt2020 pq 90 | - Add player property `subtitle.scale` to scale all kind of subtitles. default is 1.0, i.e. no scale 91 | - Fix `subtitle.blur` is not applied because of a libass bug 92 | - Add player property `subtitle.size`, default value is `video` to render in video frame size, other values will render in video renderer resolution 93 | - Redraw subtitle if output resolution changed even if playback is paused, e.g. rendering in renderer resolution, and resize the renderer 94 | - Redraw subtitle for any subtitle property change even if playback is paused. 95 | - Render earlier 96 | - Fix dead lock 97 | - Fix unexpected null texture for some timestamp values and blinking 98 | - Set ass storage size 99 | - Dolby vision: Fix shader error if yuv sampler is used for MediaCodec decoder 100 | - GL: add `glFinish()` before context destroyed 101 | - D3D11: Improve UMA support check. UMA optimized texture download. can be disabled by env `GPU_OPTIMAL_DOWNLOAD=0` 102 | - DXGI: Use the 1st screen's HDR capability 103 | - Metal: Fix rendering mutiple overlayes 104 | - MFT: return error if output type is not supported 105 | - Fix wrong start time if `record()` multiple times. 106 | - Fix buffered packets out of range of the value set by `setBufferRange()` 107 | - Fix audio not decoded after seek if paused and result in a/v desync(apple only). 108 | - Fix seek(if not started) callback may be called twice. 109 | - Fix global subtitle options not applied, regression in 0.30.1 110 | - FFmpeg: 111 | - Support webvtt in mkv. Patch is from avbuild, not merged by upstream. 112 | - Workaround aac packets from rtsp have no keyframe if ffmpeg > 7.1 113 | 114 | 115 | # 0.30.1 116 | 117 | - Fix a crash in audio renderer if get delay 118 | - renderVideo() before the 1st frame will clear render target with background color. useful if render target content is undefined 119 | - Fix some global options not applied immediately 120 | - FFmpeg: prefer new avcodec_get_supported_config() 121 | 122 | 123 | # 0.30.0 124 | 125 | - API: 126 | - Add `Player.appendBuffer()` to play streams with user provided data, for example data is from [websocket](https://github.com/wang-bin/mdk-examples/blob/master/Native/stream.cpp). media protocol is `stream`, i.e. `player.setMedia("stream:empty_or_any_string")`. `setTimeout()` can abort current playback if timedout to read data from user. 127 | - Plain text subtitle(srt for example) style can be changed by user via [subtitle properties](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#subtitle-properties) 128 | - Multi channels audio rendering, no downmix to stereo 129 | - Support dolby vision in mpeg ts 130 | - PulseAudio is the default audio render for linux 131 | - Improve audio renderer delay and AV sync 132 | - VT: Fix hardware decoder disabled if hvcC has no PS NALUs 133 | - D3D11: 134 | - Fix UMA check if run x64 on arm64 and failed to create textures 135 | - Disable cross context 0-copy for AMD gpus to avoid corrupt result on many gpus 136 | - Set usage for swapchain, fix back buffer RTV create error on some win7 devices 137 | - VAAPI: 138 | - Map YUYV fourcc, fix jpeg yuv 422 rendering 139 | - Convert to RGB with VPP if DRM to EGLImage is not possible(desktop gl + external only formats) 140 | - DRM Prime: 141 | - Error if no OpenGL ES2/3 context for external only formats, then VAAPI can fallback to suboptimal rendering instead of blank 142 | - Map more formats 143 | - Player property "audio.tracks", "video.tracks" and "subtitle.tracks" is same as `setActiveTracks()`, value is a int list string, e.g. `"0,1"` 144 | - Reset more callbacks before deleting player object to simplify user code 145 | - Fix undefined symbol on wayland < 1.10, compatible with more linux distributions, e.g. ubuntu 14.04 146 | - More packed yuv formats 147 | - MFT: fix d3d9 not tried if d3d11 is not supported 148 | - Fix null callback invoked if reset by user 149 | - Will try to load Ass.framework on apple OS except macOS, to be compatible with media-kit's frameworks 150 | - FFmpeg: Fix wromg abi version if avfilter is disabled when swresample is loaded and crash, e.g. qt6's ffmpeg dlls 151 | - Add nvjpeg2000 plugin for windows x64, requires cudart64_12.dll and nvjpeg2k_0.dll 152 | - Compatible with libc++20 153 | 154 | 155 | # 0.29.1 156 | 157 | - Android 64bit is built with 16KB page size support 158 | - Supprt GL_EXT_EGL_image_storage for drm, via global option "eglimage.storage=1" 159 | - VAAPI: prefer x11 display to support both EGL and GLX 160 | - Add privacy manifest for apple platforms 161 | - Improve demuxer cache 162 | - Enable http reconnect 163 | - Fix OpenGL symbols not resolved on android 15 emulator 164 | - Fix snapshot in OpenGL renderers 165 | - Fix snapshot callback not invoked if failed 166 | - Fix muxer write after close 167 | - Fix a decoder crash when stopping playback 168 | - Fix waitFor(State::Stopped) 169 | - Stop demuxer immediately if io is aborted. 170 | - Apply ffmpeg muxer options 171 | - Prefer ffmpeg dynamic library even if statically linked. mainly used by iOS user provided FFmpeg.framework 172 | 173 | 174 | # 0.29.0 175 | 176 | - Support demuxer cache for http(s), can be enabled via `player.setProperty("demux.buffer.ranges", "8"/*or other positive int*/)`. `{count, "cache.ranges"}` event will be triggered when cached time ranges are created, dropped(via LRU cache) or merged. Other protocols can be enabled via player property `player.setProperty("demux.buffer.ranges", "http,https,proto1,proto2");`. 177 | - Add `Player.bufferedTimeRanges()` 178 | - Dolby vision: support reading metadata from av1 in all decoders, previously only supported by ffmpeg hwaccels and software decoder. 179 | - Support pause/resume rtsp stream in `Player.set(State)`. Enable via `player.setProperty("reader.pause", "1");`. 180 | - Record video from non-key frame if property "reader.starts_with_key" is "0" 181 | - Support [nvJPEG2000 as a plugin](https://github.com/wang-bin/mdk-nvjp2k/actions) 182 | - Support planar xyz format, produced by nvJPEG2000 183 | - Support p012, p212, p412, can be produced by VT decoder(can be tested with VT:fourcc=tv20) 184 | - OpenGL: 185 | - Detect(guess) invalid foreign context, usually in old OSes(ubuntu 20.04) and with `GLRenderAPI.getProcAddress` set by user. 186 | - Fix blank display if failed update textures 187 | - D3D11: fix crash if decoder and renderer adapters are different 188 | - Metal: 189 | - Set layer scale, fix low resolution 190 | - Build highest shader version 191 | - VT: support ProRes without fourcc 192 | - VAAPI: 193 | - Prefer drm display over x11, less errors, better performance 194 | - Fix upload unmapped host memory crash 195 | - Fix wrong channels in recorded pcm 196 | - Fix prepare callback not invoked if decoder changed 197 | - Fix rgb48be rendering 198 | - FFmpeg 199 | - Improve abi compatibility, found in x86 32bit ffmpeg 4.x 200 | - Fix flipped frame in avfilter 201 | - Compatible with msvcp 14.40+ 202 | 203 | 204 | # 0.28.0 205 | 206 | - Support [rendering in a foreign render pass](https://github.com/wang-bin/mdk-sdk/wiki/Render-API#render-in-a-foreign-render-pass) for all renderers. Previously only foreign opengl context are implemented. The performance should be better than rendering to texture. Now it's able to [render in a Qt RHI window](https://github.com/wang-bin/mdk-examples/tree/master/Qt/rhiwindow) 207 | - Support decoding A53 closed caption in all video decoders. Previously only supported by ffmpeg hwaccels and software decoder. Can be disabled by player property "cc=0". 208 | - Add new [player properties](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setpropertyconst-stdstring-key-const-stdstring-value): "buffer", "audio.decoders", "video.decoders". Convenient to control player in [flutter](https://pub.dev/packages/fvp). 209 | - Support video frames with negative stride, frames are vertically flipped 210 | - BRAW: support 4.0 SDK, compatible with 3.0 211 | - Improve NALU start code and EBP search 212 | - VT decoder: 213 | - fix hevc mpegts decode error after seek 214 | - max continuous session restart on error is 1 by default, controlled by property "error=1" 215 | - MFT: fix mf shutdown too early and crash when releasing a sample after stop 216 | - Fix CUDA decoder error after seek. It's a regression in the previous release. 217 | - OpenGL: Fix UBO error, requires glsl150(OpenGL 3.2, ES 3.0) 218 | - Fix alpha channel value of render target when blending subtitle, now output alpha >= background alpha 219 | - Fix multiple frames rendered if prepare() without play 220 | - Fix wrong position() value after prepare() without play 221 | - Fix buffering progress value 222 | - Fix play a new media if previously an individual audio track file/url is used 223 | - Fix endless wait when buffering on apple 224 | - Fix audio channels on apple 225 | - Fix no frame decoded if decoder changed when seeking 226 | - Vulkan: fix wsi extension check 227 | - Metal: fix layer colorspace and disable EDR for SDR 228 | - Fix wrong frame height if copy DX9/11 textures to host memory 229 | - Fix negative duration and start time for live streams, should be 0 230 | 231 | 232 | # 0.27.0 233 | 234 | - Dolby Vision profile 5 support: 235 | - Works for all renderers: OpenGL, D3D11/12, Metal, Vulkan 236 | - Support SDR and HDR10 display 237 | - Works for all decoders. For ffmpeg software decoder and hwaccels, dolby vision metadata are parsed by ffmpeg. For other decoders including ffmpeg external decoders and mdk hardware decoders, metadata is parsed in mdk 238 | - AMediaCodec system dolby vision decoder is disabled by default(previously was enabled). Can turn on via property "dv=1". 239 | - Improve gpu const buffer/uniform update for all renderers 240 | - OpenGL: Support UBO. Enabled for OpenGLES >= 3.0, OpenGL >= 3.1 or extension `GL_ARB_uniform_buffer_object` is supported. Can be disabled via global option "gl.ubo=0" or env var "GL_UBO=0" 241 | - Fix blank display when switching to some videos 242 | - Fix dx swapchain colorspace support check 243 | - Reset some callbacks when destroying player 244 | - Add option "reader.starts_with_key", "0" can decode from non-key. Can be used to reduce latency of network stream 245 | - C++ API: 246 | - Fix callbacks are not thread safe 247 | - Fix MediaStatus callback register only once 248 | - Fix seek, prepare, snapshot callbacks 249 | - Fix video with a single frame not decoded until EOS 250 | - Fix blank display if play another video with only different color primaries 251 | - Fix packet drop 252 | - Fix seek after EOS demuxed 253 | - Use display p3 if hdr10 metadata is invalid 254 | - Read duration from metadata if stream duration is unknown 255 | - Set android application context automatically for ffmpeg 7.0+ 256 | - Prefer AudioTrack over OpenSLES 257 | - FFmpeg: Add avformat.video/audio/subtitle_codec_id options 258 | 259 | 260 | # 0.26.0 261 | 262 | - Support WinUI3. `updateNativeSurface()` accepts `SwapChainPanel` as surface like [UWP](https://github.com/wang-bin/mdk-examples/blob/d6035e1450039962577ada748a9be37620c6e6c9/WindowsStore/XamlCx/OpenGLESPage.xaml.cpp#L54) 263 | - Enable UWP features for windows desktop 264 | - Support visionOS 265 | - Add metadata change event `MediaEvent{.category = "metadata"}`, new metadata can be read from `Player.mediaInfo().metadata`. Useful to get icy metadata for SHOUTcast. 266 | - D3D11: 267 | - Support sync via kmt, requires env var `D3D11_ZERO_COPY=0` and `D3D11_KMT=1` 268 | - Ignore RTV creation error for shader resource, e.g. textures produced by MFT software decoder via `d3d=11` 269 | - Vulkan: 270 | - Enable pipeline cache 271 | - Select the 1st physical device provided by vulkan by default, previously try to use a discrete device 272 | - Fix `Player.WaitFor()` may return wrong value 273 | - Fix YCgCo rendering 274 | - Add global option `plugins.dir` 275 | - Android: link to `libmediandk.so` for 64bit targets 276 | - macOS: fix audio data dropped when paused and results in wrong playback speed 277 | - BRAW, R3D: 278 | - Fix a crash when stopped 279 | - (R3D) Fix crash if seek a video without audio track if the previous media has a audio track 280 | - Build with R3DSDK 8.5.1 281 | - Support macOS appex, see the [QuickLook plugin](https://github.com/wang-bin/SPV). mdk now weak link to r3d and braw to work in sandbox 282 | - Fix failed to play a normal video after braw/r3d in the same player instance 283 | - braw sdk now can be loaded from a custom dir from global option `BRAWSDK_DIR` 284 | - (BRAW) Fix some memory leaks 285 | - FFmpeg: 286 | - Support FFmpeg 7.0, now supported runtime versions are 4.0~7.0. Default build version is 6.1, you can remove bundled ffmpeg and add 7.0 shared library|ies to try the new version. 287 | - Can use avio directly via global option `io.avio=1`, default is via a custom avio 288 | - [Swift](https://github.com/wang-bin/swift-mdk): support cocoapods and swit package manager 289 | 290 | 291 | # 0.25.0 292 | 293 | - D3D11: 294 | - Improve gpu and cpu 0-copy rendering. Some AMD gpus are disabled because the result is wrong. Can be disabled by environment var `D3D11_ZERO_COPY=0` 295 | - Improve sync if copy, decode, draw device contexts are different 296 | - Enable shader_resource in D3D11 decoder by default to support gpu 0-copy rendering, lower gpu load. 297 | - limit highest feature level to 12.1 to fix device create error 298 | - Support global device via SetGlobalOption("d3d11.device", devPtr) for both decoders and renderers, then gpu 0-copy will be enabled without issues found in cross device 0-copy, but performance may be lower than cross device 0-copy(tested 8k 60fps av1 hdr with RTX3050) 299 | - D3D12: sync between D3D12/MFT:d3d=12 decoder and renderer 300 | - MFT: `shader_resource` option default value is `1` for MFT:d3d=11 to support 0-copy rendering 301 | - VideoFrame can import an existing d3d11 or d3d9 resources 302 | - Support tvOS 303 | - VT decoder: enable av1, not tested 304 | - CUDA decoder: skip av1C header to fix parse error 305 | - OpenGL: Support GL_EXT_YUV_target, used by android hardware decoder rendering, can be enabled via env var `GL_YUV_SAMPLER=1` 306 | - Fix dead lock if output too many frames in 1 decode 307 | - Fix video size event not triggered for custom readers, e.g. braw and r3d 308 | - Improve overlay rendering 309 | - Wayland: support xdg-shell 310 | - Set subtitle fonts dir and default font file via global option "subtitle.fonts.dir" and "subtitle.fonts.file". Useful for android(lacks of many system fonts). Android subtitle font can be an asset, and then `SetGlobalOption("subtitle.fonts.file", "assets://sub_font_path.ttf")` 311 | - Android: add libass.so in sdk, and will be bundled into your app if use FindMDK.cmake. Remove libass.so from sdk if you don't need it 312 | - Linux: libc++18 compatible 313 | 314 | 315 | ## 0.24.0 - 2023-12-31 316 | 317 | - OpenGL: 318 | - GLRenderAPI.getProcAddress now works, can be provided by user. If not provided, will try to use standard GL library names 319 | - Support hardware decoder rendering in multiple renderers and multiple threads. 320 | - Vulkan: 321 | - Support hdr metadata if render context is created in the library via `updateNativeSurface` 322 | - Support scRGB swapchain 323 | - Fix invalid framebuffer after resetting render pass(resize error in qmlrhi example). 324 | - Ensure swapchain bufferfs are cleared after stop. Previously only clear once, may result in showing blank image and the last frame repeatly. 325 | - Improve audio/video track switch `Player.setActiveTracks()`, fast and accurate 326 | - Improve (mpegts) program switch `Player.setActiveTracks(MediaType::Unknown, )`, fast and accurate 327 | - If use `updateNativeSurface()`, vo_opaque must be the `surface` parameter. 328 | - VT: Support mpeg4 329 | - AMediaCodec/MediaCodec: 330 | - property "surface" and "window" to enable tunnel mode, the value is `Surface` jobject and `ANativeWindow*` value string(Previously "surface" value was `ANativeWindow*`). 331 | - Increase image queue size to reduce acquire errors. max images can be set via decoder property "images=N" or `player.setProperty("video.decoder", "N")`, where N > 1 332 | - Player.record will choose a suitable format if the format guessed from url does not support all codecs. Select correct format for rtmp and rtsp. 333 | - Recorded timestamp is continious and monotonicity by default, required by live streaming. Previous behavior can be enabled by `Player.setProperty("recorder.copyts", "1")` 334 | - Add `MediaEvent{track, "video", "size", {width, height}}` to indicate video track size change, `MediaInfo.video[track].width/height` also change changes 335 | - Improve decoder change event `MediaEvent{track, "decoder.video", decoderName, stream}`, decoderName of hardware decoders is the alias name(e.g. VAAPI), software decoder name is always "FFmpeg". Previously hardware decoderName may be FFmpeg 336 | - Improve packet drop 337 | - iOS: try to load ass.framework and dav1d.framework instead of .dylib 338 | - Subtitle: ignore invalid ass images to fix crash 339 | - Fix crash if audio channels > 8 340 | - Fix thread safe issues for callback setting apis. 341 | - Fix scRGB map in DX and apple 342 | - Fix mpeg4 mosaic after seek 343 | - Fix cmake3.28 xcframework error 344 | - FFmpeg: 345 | - Add `D3D12` decoder, alias of `FFmpeg:hwcontext=d3d12va` 346 | - `D3D12` decoder supports 0-copy rendering in a d3d12 renderer 347 | - Fix wrong audio time base of filter output 348 | - Fix a potential crash in hw decoder copy mode 349 | - New [.NET binding](https://github.com/axojhf/MDK.SDK.NET/tree/main) and [Avalonia example](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) 350 | 351 | 352 | ## 0.23.1 - 2023-11-30 353 | 354 | - HDR 355 | - Fix scRGB white level scale 356 | - Add ColorSpaceExtendedSRGB and ColorSpaceExtendedLinearSRGB. scRGB is used on windows, lumiance is scene referred, while ExtendedLinearSRGB(used on apple) is display referred 357 | - Vulkan: 358 | - Compress built-in spv via smol-v 359 | - Add spv for scRGB output 360 | - Support build shader via shaderc shared library(shaderc_shared.dll, libshaderc_shared.so{,.1}, libshaderc_shared{.1,}.dynamic) if no built-in spv found. 361 | - Add `VideoStreamInfo.image` as audio cover art image 362 | - Apply rotation in recorded video 363 | - Add `MediaEvent{track, "decoder.video", "size", {width, height}}` indicates video frame size changed, value in MediaInfo is also updated 364 | - Add player.setProperty("avcodec.opt_name", "opt_val") to apply AVCodecContext options. For video only codecs, you can also use player.setProperty("video.decoder", "opt_name=opt_val"); 365 | - Do not sync to audio if no audio decoded 366 | - AMediaCodec: add property "name" to force a codec name, e.g. `AMediaCodec:name=c2.android.hevc.decoder`. 367 | - MFT: fix d3d=11 driver bug (receive MF_E_TRANSFORM_STREAM_CHANGE endlessly) 368 | - Fix `setBufferRange()` dropping mode incorrectly drops audio packets 369 | - Fix some dead locks 370 | 371 | 372 | ## 0.23.0 - 2023-10-31 373 | 374 | - HDR 375 | - Support scRGB, via `player.set(ColorSpaceSCRGB)`, recommended for windows HDR screen, same experience as system player. You can try it in [QtQuick](https://github.com/wang-bin/mdk-examples/blob/master/Qt/qmlrhi/VideoTextureNodePriv.cpp#L66) app via env var `QSG_RHI_HDR=scrgb`, or in OBS Studio via [the plugin](https://github.com/wang-bin/obs-mdk) 376 | - Add global option "sdr.white", SDR white level. Default is 203. Can be a different value, e.g. Qt is 100. OBS Studio default is 300 and can be changed by user in settings dialog. 377 | - Add global option "hdr10.format", Metal only. Metal use rgba16f for HDR10 by default. This can [let QtQuick apps support perfect HDR playback on macOS](https://github.com/wang-bin/mdk-examples/blob/master/Qt/qmlrhi/VideoTextureNodePriv.cpp) 378 | - Add ColorSpaceSCRGB, ColorSpaceExtendedLinearDisplayP3 379 | - Fix linear target trc 380 | - Metal: use HLG metadata. use scRGB if requested hdr is not supported. 381 | - Raspberry pi: fix hevc 0-copy OpenGL renderer crash on debian 12. It's a driver bug. 382 | - Decoder options can be set via `player.set("video.decoder", "key1=val1:key2=val2")` 383 | - AMediaCodec: 384 | - Fix crash if image=1 on api level < 26 385 | - Do not acquire an image if releaseOutputBuffer error, fix long wait after seek/stop 386 | - Add SeekFlag::SeekFlag for KeyFrame seeking. This can fix EPERM error for some videos. 387 | - `Player.position()` is the last seek request target position when seeking. Previously if seeking is frequent may go back to a previous seek result position then the final position. 388 | - Improve seeking, fix seek request not processed, fix seek callback may be called multiple times 389 | - Fix onFrame() callback sometimes can't get an EOS frame when playback finished or stopped by some reason. 390 | - Fix gpu VideoFrame.to() not in host memory if target format, size is the same as input 391 | - Fix `Player.prepare()` from a position > 0 wrong result if the first decoder fails. 392 | - Fix `waitFor()` dead lock 393 | - Fix PGS subtitle frame duration 394 | - VAAPI: fix undefined symbol on old systems, e.g. ubuntu 16.04 395 | - FFmpeg: 396 | - Fix audio timestamp if a packet has no pts 397 | - BRAW: 398 | - Fix crash when destroying player if cuda 0-copy is used 399 | - Fix OpenCL pipeline, by AdrianEddy 400 | 401 | 402 | ## 0.22.1 - 2023-09-30 403 | 404 | - `VideoFrame.timestamp()` is alway readable. `TimestampEOS` indicates no more frames 405 | - Add global option `demuxer.max_errors` to continue on error if error count is less than this value 406 | - MFT: 407 | - Ignore h264 level by default 408 | - Fix adapter index if `vendor` property is set, e.g. `MFT:d3d=9:vendor=nv` 409 | - Add `mem` scheme to play from memory, url format is `mem://addr+size` 410 | - VDPAU: 411 | - Add `interop` property, can be `video`, `output` and `pixmap`. Detail: https://github.com/wang-bin/mdk-sdk/wiki/Decoders#vdpau 412 | - Use x11 display provided by user except `pixmap` interop 413 | - VAAPI: [document is updated](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#vaapi) 414 | - Support GLX/EGL texture from dri3 pixmap from drm prime, via option `interop=dri3`, or fallback from `interop=x11` failure. For some drivers(intel iHD driver) it's the only 0-copy solution in GLX context because libva-x11 is broken(vaPutSurface error). `VAEntrypointVideoProc` is requred. Recommend to install `intel-media-va-driver-non-free`, because i965 and free iHD driver may lack of `VAEntrypointVideoProc`. 415 | - Support `GL_TEXTURE_EXTERNAL_OES` for `dri3` and `x11` interop, via option `external=1` 416 | - DXGI: 417 | - Fix crash in vm, or no gpu driver 418 | - Always try rgba8 if fail to create a rgb10a2 swapchain, fix d3d11 feature level 9.3 create render context error 419 | - Try the next decoder if a decoder does not produce any frame. MFT jpeg decoder may produce nothing but no error. 420 | - Fix decode error if previous decoder in decoder list failed 421 | - Fix open a decoder multiple times before trying the next decoder 422 | - Fix pause at eof then stop dead lock if `keep_open` is set(music with cover art). 423 | - Fix incorrect seek request count 424 | - CUDA: fix crash for some unsupported streams, e.g. av1 12bit 425 | - FFmpeg: fix crash if a codec is not enabled 426 | - Add `mdk.pri` for qt qmake projects. All you need is including this file 427 | - Enable full lto to reduce binary size. Thin lto was used in previous versions. 428 | 429 | 430 | ## 0.22.0 - 2023-08-31 431 | 432 | - Add `Player.onMediaStatus(MediaStatus oldValue, MediaStatus newValue)` to simplify user code. `Player.onMediaStatusChanged` is deprecated. 433 | - Add player property `avformat.xxx`, `avio.xxx` as as ffmpeg demuxer/io options 434 | - C api module is opensource: https://github.com/wang-bin/libmdk-capi 435 | - If `keep_open` property is set, state changes to `State::Paused` when reach EOS. Also reduce cpu load 436 | - Android: 437 | - Fix x86 relocation 438 | - Fix planar formats in OpenSL 439 | - MFT: 440 | - Support DV video codec 441 | - Continue if no attributes 442 | - OpenGL: Fix crash if failed to create a context, found in flutter android example 443 | - VAAPI: Flush before seek, fix invalid surface id and crash 444 | - VDPAU: 445 | - Interop with output surface by default if not nvidia to workaround hevc crash on amd gpus. 446 | - Prefer interop2 extension 447 | - BRAW: 448 | - Support build with sdk version 2 and 3 449 | - Fix 0-copu glitch 450 | - Dead lock before unloaded 451 | - FFmpeg: 452 | - hw decoders do not fallback to sw decoder by default, so can correctly switch to the next decoders set in `setDecoders()`. property `sw_fallback=1` to use old behavior 453 | - Use single thread for hwdec when possible 454 | - Stop decoding ASAP if hwdec, fix multi-thread hwdec crash on unsupported GPUs, e.g. MX940 455 | - Fix 'file://' on windows 456 | - Fix frames drop in decoders 457 | - Fix loop does not work if audio duration is much smaller than video 458 | - Fix seek may fail if audio duration is much smaller than video 459 | - Fix seek callbacks not called 460 | - Fix `prepare()` fails if previous playback is not finished 461 | - Fix prepare callback is not called if demuxer open error 462 | - Fix seek error for a music with cover art 463 | - Fix crash if unsupported track type is read 464 | 465 | 466 | ## 0.21.1 - 2023-06-30 467 | 468 | - Fix loop fails in some ranges 469 | - Raspberry pi: enable eglimage reuse by default to improve 0-copy rendering performance 470 | - API: allow construct Player object from existing ptr 471 | - Android: support assets, via url scheme 'assets', for example `player.setMedia("assets://flutter_assets/assets/test.mp4")` 472 | - Improve av sync 473 | - Braw: 474 | - upgrade to version 3.1 475 | - Support iOS 476 | - Enable 0-copy for cuda 477 | - FFmpeg: 478 | - Add vulkan decoder `FFmpeg:hwcontext=vulkan:copy=1`, or select another device index `FFmpeg:hwcontext=vulkan:copy=1:hwdevice=1` 479 | - Fix hwaccel_flags is not correctly applied 480 | 481 | * New project: [fvp](https://pub.dev/packages/fvp) is a plugin for flutter [video_player](https://pub.dev/packages/video_player) to support all platforms via libmdk. Add `fvp` as a dependency, and add 2 lines of code, then you can benefit from the power of libmdk. You can try prebuilt example from [artifacts of github actions](https://github.com/wang-bin/fvp/actions) 482 | 483 | 484 | ## 0.21.0 - 2023-05-31 485 | 486 | - New D3D12 renderer via `D3D12RenderAPI`. Support all decoders. Performance is similar to D3D11. Optimal texture upload for iGPU, env var "GPU_OPTIMAL_UPLOAD=0" can disale optimal upload to compare performance. You can try [Qt6 QML example](https://github.com/wang-bin/mdk-examples/blob/master/Qt/qmlrhi/VideoTextureNodePub.cpp#L143) or `./glfwplay -d3d12 video_file`. 487 | - D3D11: 488 | - Texture upload optimize for iGPU on win10. env var "GPU_OPTIMAL_UPLOAD", significantly reduce vram usage, about 50~70%, and even more for compressed textures. Software decoders and built-in hap decoder will benifit from it. 489 | - Cache shader binaries 490 | - Fix crash on win7 if default swapchain format is not supported 491 | - DRM Prime: 492 | - Auto detect external texture requirements via modifiers 493 | - Fix fd leak in 0.20.0 494 | - Support reusing EGLImage to improve performance via global option `SetGlobalOption("eglimage.reuse", 1)`, or decoder option `reuse=1`. Known to work for raspberry pi. 495 | - Vulkan: 496 | - Fix `snapshot()` error, a regression in previous release 497 | - Fix a crash for Hap videos 498 | - Metal: 499 | - Fix BC3CoCgSY 500 | - Support BC formats for iOS 16.4+ 501 | - OpenGL: Fix deleting queries without a context, fix potential leaks 502 | - MFT: 503 | - Supports `d3d=12` option to enable d3d12 decoding. Currently 0-copy renderer is only D3D12, requires `copy=1` option to be used in other renderers. 504 | - `d3d=11` is default 505 | - Fallback to lower d3d version or software decoder if open error. So now using `MFT` without option as decoder name is enough. 506 | - Fix decode error on win7 507 | - VAAPI: 508 | - [Support windows](https://devblogs.microsoft.com/directx/video-acceleration-api-va-api-now-available-on-windows), backend is d3d12 decoder. Currently only supported by D3D12 renderer 0-copy rendering, or use `copy=1` option for other renderers. Requires dlls from https://www.nuget.org/packages/Microsoft.Direct3D.VideoAccelerationCompatibilityPack can be found by `LoadLibrary()` 509 | - Fix render error because of drm fd leak 510 | - Raspberry Pi 3/4: 511 | - Perfectly support h264, hevc hardware decoder and 0-copy rendering in Raspberry Pi OS via `Player.setDecoders(MediaType::Video, {"V4L2M2M","FFmpeg:hwcontext=drm"})`. System ffmpeg is required, MUST delete libffmpeg.so.* in mdk sdk package. May also work with https://github.com/jc-kynesim/rpi-ffmpeg . EGL + OpenGL ES2/3 is recommended by hevc. You can test with `./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm -gl test.mp4` 512 | - Android: 513 | - AMediaCodec video decoder enable `image=1` option by default, lower latency 514 | - Fix acquiring AImage when it's not ready 515 | - Fix jni env detach 516 | - Add `low_latency` option for AMediaCodec video decoder, default is 0. requires api level 30+ 517 | - Fix alpha value for opaque formats in all renderers 518 | - Enable `SeekFlag::InCache` for `Default` flag 519 | - Support programs, add `MediaInfo.program`. `setActiveTracks(MediaType::Unknown, {N})` will select Nth program and it's audio/video tracks will be active. Useful for mpegts programs 520 | - Add `SubtitleStreamInfo.metadata`, subtitle(and other streams) language is `metadata["language"]` 521 | - New pixel formats supported by dx, drm 522 | - Fix a/v sync if audio duration is a lot less than video 523 | - Fix BRAW seek 524 | - FFmpeg: 525 | - Improve abi compatibility, better support ffmpeg 4.x and 5.x 526 | 527 | 528 | 0.20.0 - 2023-02-28 529 | 530 | - Support R3D raw videos via R3D SDK. Document: https://github.com/wang-bin/mdk-sdk/wiki/Decoders#r3d 531 | - Support decoding closed caption for ffmpeg based decoders(FFmpeg, VideoToolbox, D3D11 etc.) and rendering. Add "cc" event when closed caption is detect 532 | - Add drm prime 0-copy rendering, support multi-layers, multi-planes object, support 2d and external texture. Will be used by ffmpeg rpi v4l2 decoder and rkmpp decoder. It should work but not tested. 533 | - Support QSV decoder via oneVPL 534 | - Add video decoder change event https://github.com/wang-bin/mdk-sdk/wiki/Types#class-mediaevent 535 | - FFmpeg: Support 6.0 abi. now the same binary is compatible with ffmpeg 4.4~6.0 runtime 536 | - Improve log 537 | - Reduce shader update for Vulkan and D3D11 renderer 538 | - Fix CUDA and NVDEC not fully enabled on linux 539 | - Fix incorrect `Player.position` if in paused state for videos with no audio track 540 | - Fix incorrect pixel aspect ratio for some videos, prefer the value from decoder(e.g. MFT) 541 | - Fix audio clock not paused if prepare() without play(Apple only). 542 | - BRAW: fix audio not paused if without play 543 | - iOS: fix rejected by app store 544 | - OpenGL: Fix bayer formats not rendered 545 | - VAAPI: 546 | - Fix derive image 547 | - Add property "x11", "drm"(or "device") to set x11 display and drm device path(global option "X11Display", "DRMDevice"). "display" option to use "x11" or "drm" display. 548 | - Improve surface sync 549 | - Support exporting to an drm prime object with a composed layer with multiple planes. decoder option "composed=1" 550 | - Add decoder "VADRM" to test exporting drm prime from vaapi 551 | - VT: Use semi-planar formats for macOS11+ & iOS14+ to fix unsupported default output formats 552 | - Add VC-LTL build for windows desktop 553 | - Support build plugins(braw, r3d) with sdk + abi headers. Add global options "plugins_dir" 554 | 555 | 556 | 557 | 0.19.0 - 2022-12-28 558 | 559 | - New: support subtitle rendering. Can be embedded or external text/bitmap subtitle tracks. The first embedded subtitle track is enabled by default. Use `setActiveTrack(MediaType::Subtitle, ...)` to switch embedded subtitle track. External subtitle must be explicitly enabled by user via `setMedia(file, MediaType::Subtitle)`, and must call it at some point after main video `setMedia(mainVideoFile)`. Text subtitle is rendered by libass, only windows desktop and macOS prebuilt libass is provided for now. Linux users can install system libass. Text subtitles must be UTF-8 encoded. 560 | - API: 561 | - add Player.enqueue(VideoFrame) to draw a frame provided by user 562 | - Change frame timestamp precision from millisecond to microsecond 563 | - Fix wrong display aspect ratio 564 | - Improve redraw for D3D11, Metal and Vulkan 565 | - Reduce frame queue in renderer to fix some decoders(MFT) may fail to output frames 566 | - VT: 567 | - add property "fourcc", "CVPixelFormat" to force an output format 568 | - more pixel formats 569 | - fix color range error 570 | - QSV: support d3d11. add `d3d` option, can be 11(default for ffmpeg5.0+) or 9. 571 | - FFmpeg: 572 | - log level for ffmpeg class, for example SetGlobalOption("ffmpeg.log", "trace=tcp") 573 | - Check opt availability before set, no more warnings 574 | - Fix unknown media type crash 575 | 576 | 577 | 0.18.0 - 2022-11-16 578 | 579 | - API: 580 | - Add Player.set(ColorSpace), supports auto HDR display, SDR to HDR or HDR to SDR tone mapping. [More details](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 581 | - Support HDR display for D3D11 and Metal. If a swapchain and metal layer is provided in RenderAPI, and Player.setColorSpace(ColorSpaceUnknown), then hdr display will be automatically enabled when possible. 582 | - AMediaCodec: 583 | - "surface" property can be ANativeWindow address to decode video into user profided surface from SurfaceView, SurfaceTexture etc. 584 | - Add "image" property to support AHardwareBuffer as output, default is "0", can be enabled by "1". Requires android 8.0+. 585 | - VT: 586 | - Fix frames sorting for some videos 587 | - Ignore reference missing error 588 | - Fix wrong playback rate on apple if replay after playback end 589 | - Fix audio timestamp is not monotonic for some streams and result in playback stuttering 590 | - Fix decoding image is slow 591 | - Fix global options are not correctly applied 592 | - Fix HLG is not correctly set on MFT decoded frames 593 | - Vulkan: fix crash on macOS with new drivers 594 | - BRAW: fix file path encoding 595 | - Fix some crashes 596 | - Increase frame queue size in renderer, drop frames less 597 | - Improve logging 598 | - Global options changes: 599 | - "log" == "logLevel", "ffmpeg.log" == "ffmpeg.logLevel" 600 | - Add "profiler.gpu", shows gpu time for a frame in log 601 | 602 | 603 | 0.17.0 - 2022-09-30 604 | 605 | - MFT: 606 | - Support vc1, wmv, opus, amr, wma, dolby audio 607 | - Fix mpeg4, enable mpeg2/4 608 | - Flac partially works, but disabled by property "blacklist=flac" 609 | - Add D3D11RenderAPI.vendor to choose gpu vendor, case insensitive. For example "nv" will select nvidia gpu 610 | - MediaInfo.bit_rate is updated in real time 611 | - Improve audio track switch when playing 612 | - MediaStatus is Invalid if no track found 613 | - D3D11: always flush after renderVideo 614 | - Fix position error if audio has a cover art 615 | - Fix ALSA dead lock if stopping player in paused state 616 | - Pause clock when buffering 617 | - Fix network stream frame update after buffering (apple) 618 | - FFmpeg: 619 | - Fix D3D11 vc1 decoding 620 | - Fix audio decode error when seeking ts 621 | - Fix probing dts audio in ts 622 | - Fix filter is initialized twice 623 | - Fix frame pts abi 624 | - Improve encoder 625 | - New [Flutter desktop example](https://pub.dev/packages/fvp) 626 | 627 | 628 | 0.16.0 - 2022-08-28 629 | 630 | - Blackmagic RAW playback support, decoder name is [`BRAW`](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#braw). [Plugin is opensource](https://github.com/wang-bin/mdk-braw) 631 | - Seek callback will always report the correct result position 632 | - Improve seek 633 | - Fix D3D/MFT decoder + WGL on windows may displays green image 634 | - Supports DNG 635 | - More pixel formats, bayer, float rgb etc. 636 | - Fix audio crash on win7 637 | - Fix snapshot crash if render with transform, fix incorrect transform if point map is set 638 | - VideoFrame.to() will copy to host memory first if necessary 639 | - Fix decoded video timestamp maybe not monotonic 640 | 641 | 642 | 0.15.0 - 2022-06-30 643 | 644 | - Add new decoder "hap" to decode Hap1, Hap5, HapY and HapM videos into compressed gpu textures(BC1~4). Only desktop platforms are enabled. It's preferred over "FFmpeg" if Player.setDecoders() is not called by user. See https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap 645 | - Support gpu accelerated Hap rendering via decoder name "hap". 646 | - Support backward seek by frame. `pos` in `seek(pos, SeekFlag::FromNow|SeekFlag::Frame)` can be negative, -1 means go back 1 frame. 647 | - Add SeekFlag::InCache to support seeking in cached data to improve online video seeking. Target position must be in range `(position(), position() + Player.buffered()]`. 648 | - VT Supports mpeg2video 649 | - `VideoFrame.save()` can save original data. Also select closest format if save as an image. 650 | - Improve rendering RGB with X/0(unused alpha channel) formats 651 | - Fix position() is not correctly when seeking by frame. 652 | - Fix playback may stop unexpected, and seeking is slow if seek near EOF 653 | - Fix wrong playback speed if resume from paused state on apple platforms 654 | - Fix empty png snapshot 655 | - Fix snapshot error on OpenGL ES2 656 | - Fix A-B loop may block if too many players 657 | - Fix wrong `Player.position()` and audio timestamp if `playbackRate()` != 1 658 | - Fix `prepare()` callback not called or called many times 659 | - Fix shader compiling affected by locale and may crash, e.g. LC_ALL == de_CH 660 | - FFmpeg: 661 | - Improve avdevice playback 662 | - Supports ffmpeg 5.1+ 663 | 664 | 665 | 0.14.2 - 2022-04-30 666 | 667 | - CUDA decoder: 668 | - support av1 8 and 10 bit 669 | - support gray format (mjpeg) 670 | - fix context error, which results in jpeg decode error 671 | - VT decoder: 672 | - support deinterlace and enabled by default 673 | - add "threads" property for software decoding 674 | - support 16bit yuv with alpha, e.g. ProRes with alpha 675 | - disable h264 422 10bit for macOS < 11.0. decoded image is corrupt(macOS bug?) 676 | - fix color info from decoder 677 | - Support dav1d 1.0 678 | - Improve playing live recording ts file near EOF 679 | - Fix record before running state 680 | - Fix recorded video may be malformed when using hardware decoders 681 | - Fix loop at end does not work if "continue_at_end" property is set 682 | 683 | 684 | 0.14.1 - 2022-03-18 685 | 686 | - Fix android undefined __emutls_get_address 687 | - Improve accurate seek and seek callback 688 | - D3D11: fix rendering MFT output w/o hw decoding 689 | - D3D11: Wait for fence in gpu 690 | - Support rendering float 16/32 textures 691 | - Fix packed yuv may not be correctly rendered 692 | - Fix mediaInfo() crash 693 | - Support exr image 694 | - VT: support more codecs, including ProRes Raw 695 | 696 | 697 | 0.14.0 - 2022-02-01 698 | 699 | - API: 700 | - Add `Player.setPointMap()` 701 | - Fix Player::foreignGLContextDestroyed() does nothing. Useful to realease gl resources if player is destroyed before context 702 | - Release GL resources ASAP. 703 | - Fix realtime streams frame drop 704 | - Fix rtp decode error 705 | - Fix a crash if recreate opengl context frequently 706 | - Fix macCatalyst build, fix macOS < 11 707 | - Fix ffmpeg av1 can not fallback to dav1d 708 | - Fix metal snapshot and resize renders a green frame 709 | - Fix seeking may output a frame with wrong timestamp 710 | 711 | 712 | 0.13.0 - 2021-12-26 713 | 714 | - API: 715 | - Add Player.setFrameRate(). Default is 25fps if no timestamp in stream. 716 | - MFT: 717 | - Fix crash on some new drivers 718 | - Add "activate" property to select mft plugin 719 | - Add "threads" property for software decoding 720 | - VT: 721 | - Support more 420, 422 16 bit semi-planar formats, use the closest format 722 | - Support HEVC with alpha 723 | - Support HEVC gray formats 724 | - AMediaCodec: 725 | - Support decoding dolby vision profile 5 726 | - Enable YUV with alpha for all renderers 727 | - Support semi-planar yuv with alpha: NV12A, P416A, 16bit gray format L016 728 | - GL, D3D11, Metal timestamp query 729 | - Fix fail to render hw frame mapped to host for all renderers 730 | - Fix wrong OpenGL blend state 731 | - Fix D3D11 renderer crash on device change 732 | - Use vulkan loader set by env var `QT_VULKAN_LIB` or `VULKAN_LIB` 733 | - Fix CUDA decoder crash 734 | - Fix subtitle endless decode loop at EOF 735 | - Compat with latest FFmpeg 5.0 abi 736 | 737 | 738 | 0.12.0 - 2021-06-26 739 | 740 | - API: 741 | - Add Player.setVolume(float value, int channel) to control channel volume 742 | - Deprecate setState(State), use set(State) 743 | - Add GetGlobalOption() 744 | - Fix uyvy422, yuvy422 rendering 745 | - Fix MediaInfo.start_time if < 0 746 | - Fix crash in decoder name is not supported 747 | - Fix a track may endless wait for loop end 748 | - Fix muti-tracks stream can not loop 749 | - Fix slow down near EOF in loop mode at high playback rate 750 | - Fix VAAPI not work in wayland 751 | - VT decoder: 752 | - Fix decoder stops when bad data error occurs 753 | - Fix frames are out of order from the 2nd loop 754 | - D3D11 prefers fence for synchronization. 755 | - FFmpeg: support 4.x and 5.x abi, prefer 5.x 756 | 757 | 758 | 0.11.1 - 2021-05-16 759 | 760 | - Deprecate Player.setState(State), use Player.set(State) 761 | - Add VideoFrame.save() to encode and save as a file 762 | - Buffer range for realtime streams(rtsp, rtp etc.) is unlimited by default 763 | - Unify pixel format channel map algorithm. Fix incorrect color for some formats(e.g. nv21) 764 | - Ignore incorrect hdr metadata 765 | - Allow renderVideo() in RenderCallback 766 | - VT decoder: 767 | - Support jpeg, more prores profiles 768 | - Support h264, hevc GBRP 8bit input pixel format 769 | - MFT: 770 | - Fix h264 profile check 771 | - Add property "blacklist", default is "mpeg4", mpeg4 is not well supported so disabled for now 772 | - FFmpeg: 773 | - continue to decode by default if error ocurrs. can stop decoding by setting property "error=0" 774 | - Use 4.4 instead of master because of abi break 775 | - Auto reset log handler to fix potential crash when exiting 776 | - Fix seek on pause may never be executed forever without resume playback 777 | - Fix endless wait if seek near EOF in loop mode 778 | - Fix license check, appid is utf8. License generator and validator is opensource now as [appke](https://github.com/wang-bin/appkey) 779 | - Fix crash if snapshot failed 780 | 781 | 782 | 0.11.0 - 2021-03-31 783 | 784 | - API changes: 785 | - Add [setActiveTracks()](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setactivetracksmediatype-type-const-stdsetint-tracks) 786 | - Deprecate `javaVM(JavaVM*)`, use `SetGlobalOption("jvm", void*)` instead. [See Wiki](https://github.com/wang-bin/mdk-sdk/wiki/Global-Options) 787 | - Deprecate `setLogLevel(LogLevel)`, use `SetGlobalOption("logLevel", name or LogLevel or int value)` instead. See Wiki](https://github.com/wang-bin/mdk-sdk/wiki/Global-Options) 788 | - Deprecate `Player.setVideoDecoders(...)` and `Player.setAudioDecoders(...)`, use `Player.setDecoders(MediaType, ...)` instead 789 | - Add VideoFrame.isValid() 790 | - Add ["dav1d"](https://github.com/wang-bin/mdk-dav1d) decoder. Default load libdav1d.5.dylib, libdav1d.so(android), libdav1d.so.5(linux), libdav1d.dll(windows), or set library name via environment var "DAV1D_LIB" 791 | - Support frame step forward via `seek(1, SeekFlag::FromNow|SeekFlag::Frame)`, also support N frame forward 792 | - `seek()` supports seeking to the last frame or the last key frame(has `SeekFlag::KeyFrame`) if target position > duration 793 | - Improve video decoder switch 794 | - setLogHandler(nullptr) once to log to std::clog, set again to disable log completely 795 | - Fix potential endless wait if stop playback in loop mode 796 | - Fix the first frame after seek is not the latest frame 797 | - Fix music cover image not rendered if prepare from pos > 0 798 | - Fix wrong position() and prepared callback invoked multiple times if play with an audio track file 799 | - Fix the first frame rendered after seek is not the lastest frame 800 | - FFmpeg: 801 | - Support avdevice via "avdevice://format:filename" 802 | - Support avformat options via url query, starts with "mdkopt=avformat", e.g. "some_url?mdkopt=avformat&fflags=nobuffer" 803 | 804 | 805 | 0.10.4 - 2021-02-17 806 | 807 | - Support macCatalyst 808 | - Support vulkan on apple silicon 809 | - VT decoder: 810 | - Support VP9 on macOS 11+. Profile 0 and 2 are confirmed 811 | - Support more(all) semi-planar formats, output a format with the same chroma subsample size as original format, e.g. 'p410' for hevc yuv444p10le. 812 | - Fix high depth channel formats output error on apple silicon. It's r10g10a10a2 for 10bit Y plane, but not support yet in renderer, so use p010('x420') 813 | - Add "hardware" property to enable/disable hardware acceleration 814 | - Add "width" and "height" property 815 | - Support HDR in mkv 816 | - Reduce compressed packet copy 817 | - VAAPI, VDPAU: fix not work since 0.10.2 818 | - MFT video decoder: fix h264 constrained baseline profile check 819 | - CUDA decoder: fix chroma format 820 | - FFmpeg: 821 | - Fix a crash if avio open error 822 | - Fix "drop" option does not work correctly 823 | - Improve decoder switch in paused state 824 | - Fix can't switch to a new decoder via setVideoDecoders() since 0.10.0 825 | - Fix a blank frame in gapless playback 826 | - Fix 2 crashes in player dtor, 1 race in setNextMedia(), 1 race/crash if faile to open a media 827 | - Examples: 828 | - Enable glfw for apple silicon 829 | 830 | 831 | 0.10.3 - 2020-12-31 832 | 833 | - Player.setMedia() will stop previous media 834 | - Default buffer range changes to 1000~2000ms 835 | - Deprecate `foreignGLContextDestroyed()`, does nothing now. Use `setVideoSurfaceSize(-1, -1)` instead 836 | - Support key-frame only decoding via env "KEY_FRAMES_ONLY=1" (per player option will be better) 837 | - Support play/seek dynamic duration streams, e.g. recording mpeg ts 838 | - Support 'x444'/p410 pixel format 839 | - OpenGL: 840 | - smart resources release, no leak even if no context destroyed 841 | - fix external image in essl3 may crash on android 842 | - VT decoder: 843 | - force nv12 for mpeg?video 844 | - support hevc yuv444p10le decoded format 'x444' 845 | - Change macOS framework struct to support codesign better 846 | - AMediaCodec decoder: use baseline as fallback of CBP(constrainted baseline) to fix decoder open error 847 | - Fix crash when destroying player if use native surface 848 | - Fix unable to seek if EOS is decoded 849 | - FindMDK.cmake: 850 | - support xcframework 851 | - support android studio 852 | - New swift binding: https://github.com/wang-bin/swiftMDK 853 | - New android java wrapper and example: https://github.com/wang-bin/mdk-android 854 | 855 | 856 | 0.10.2 - 2020-11-18 857 | 858 | - Support apple silicon(not tested on real device) 859 | - Support swift language 860 | - Support cocoapods for macOS via `pod 'mdk'` 861 | - Add xcframework, including both macOS and iOS frameworks 862 | - Add av1 support for CUDA decoder 863 | - check pixel format support for mmal to fix yuv444p error 864 | - mmal decoder: force copy if no 0-copy support 865 | - Add ACES HDR tone map, via env `GPU_TONE_MAP=aces` 866 | - Metal, d3d11, vulkan renderer support alpha blending if video has alpha channel 867 | - Metal: fix crash if frame is invalid 868 | - Fix a/v sync regression after seek since v0.10.1 869 | 870 | 871 | 0.10.1 - 2020-10-05 872 | 873 | - Vulkan: support Player.snapshot() 874 | - GLRenderAPI.egl/opengl/opengles combinations 875 | - Fix Player.setProperty("audio.avfilter") 876 | - D3D11 supports shared nt handle 0-copy rendering via decoder "D3D11:nthandle=1" 877 | - Simplify ffmpeg runtime loading 878 | - Fix some crashes and endless waits 879 | 880 | 881 | 0.10.0 - 2020-09-01 882 | 883 | - API: 884 | - Add VulkanRenderAPI 885 | - Support Vulkan: win32, macOS, android(buggy). Everything works except hardware decoder 0-copy rendering, only software decoders and hardware decoder with ":copy=1" are supported. 886 | - Correct HDR trc if obviously wrong from decoder(mediacodec vp9) 887 | - AMediaCodec: 888 | - Improve async mode 889 | - Fix blocks on some devices 890 | - No need to call setLogHandler(nullptr) manually 891 | - Remove redundant gpu color primaries convertion 892 | - Fix D3D11 hevc decoder wrong result because of ignoring profile/level 893 | - Fix D3D11 decoder + D3D11 0-copy rendering wrong result on RTX2060 894 | - Partialy upport mac catalyst build 895 | 896 | 897 | 0.9.2 - 2020-07-29 898 | 899 | - API: 900 | - Add version() 901 | - Add `Player.set(VideoEffect effect, const float& values, void* vo_opaque)` to set brightness, constrast, hue, saturation 902 | - Metal: Fix viewport resize if create from user provided view 903 | - D3D11/Metal: Fix stop playback does not clear background 904 | - Fix XAudio2 crash on win7, fix leak 905 | - HDR: 906 | - support HLG transfer function 907 | - use primaries from decoder(maybe wrong values) iff env "USE_METADATA_PRIMARIES" is 1 908 | - tone mapping improves 909 | - Add AV1 for android "AMediaCodec" decoder 910 | - Fix another A-B range loop endless waiting 911 | - Vulkan WIP: apple, swapchain, debug, queue, apis, clear background render pass etc. 912 | 913 | 914 | 0.9.1 - 2020-06-30 915 | 916 | - API: 917 | - D3D11RenderAPI.rtv can be a texture to reduce platform dependent user code, context is optional if rtv is set 918 | - Add GLRenderAPI.fbo, so no need to bind & restore fbo in user code 919 | - Add MDK_strdup(). Fix potential crashes if msvc build configuration(Debug) != SDK(Release) 920 | - HDR: 921 | - BT.2390 is the default tone map curve. Controlled by env GPU_TONE_MAP=2390/hable 922 | - All decoder and renderer combinations has almost the same result 923 | - MFT: 924 | - Read HDR metadata 925 | - Support AV1 decoder, need to install av1 extension from store: https://www.microsoft.com/en-us/p/av1-video-extension/9mvzqvxjbq9v 926 | - Clear background on stop can be disabled by SetGlobalOption("videoout.clear_on_stop", 0) 927 | - Default log level is Info. Must manually set to Debug to see more. playback progress log only appears in LogLevel::All 928 | - Seek: ensure the last request will be executed. Useful for timeline preview 929 | - Fix D3D11 backbuffer resize error 930 | - Fix A-B range loop endless waiting if stop playback by user 931 | - Fix change decoder error and wait forever near EOF 932 | - Fix D3D11/Metal renderer crash if change from GPU decoder to CPU decoder 933 | - Fix D3D11RenderAPI.feature_level 934 | - Fix mute crash (avfilter) 935 | - Fix crash if a chapter tile is empty 936 | - Fix failed to save snapshot as png 937 | - Fix win64 cmake search dir 938 | - Deploy: requires vcruntime140_1.dll by win64 939 | - WIP: vulkan 940 | 941 | 942 | 0.9.0 - 2020-05-28 943 | 944 | - API: Add GLRenderAPI and MetalRenderAPI 945 | - Support Metal on macOS and iOS. Lower CPU and GPU load. 946 | - Windows: 947 | - Fix com initialization may affect cef 948 | - D3D11 support decode in 1 gpu and render in another (poor performance). 949 | - D3D11 upport some 16bit pixel formats if R16 is not supported 950 | - Add D3D11 debug mode for MFT decoder("MFT:debug=1") and D3D11 renderer 951 | - Android: 952 | - Fix EGL load 953 | - Fix decoding EOS frame in sync and async mode 954 | - Apple 955 | - Add debug symbol 956 | - (macOS) weak link to standard ffmpeg dylibs so no need to dlopen by user. see https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime#macos 957 | - Support software decoder direct rendering, decode to CVPixelBuffer via decoder "FFmpeg:pool=CVPixelBuffer". Less memory use. 958 | - VT decoder supports ProRes, decode into P010 frames 959 | - FFmpeg: 960 | - Print ffmpeg logs in log mdk log handler. Fix multi-lines logs not print completely 961 | - Support reload via library handle 962 | - Custom frame pool 963 | - Add "sw_fallback" property 964 | - Examples: 965 | - Modified apple official metal example: https://github.com/wang-bin/HelloTriangle/tree/master 966 | - QtQuick RHI example. supports d3d11, metal and opengl: https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi 967 | 968 | 969 | 0.8.1 - 2020-04-30 970 | 971 | - API: 972 | - Player.onSync() default interval is 10 973 | - Add options for creating D3D11RenderAPI 974 | - CUDA: supports decoding yuv444 formats and 0-copy rendering 975 | - Support rendering gray formats 976 | - Fix MFT:d3d=11 texture leak 977 | - Fix Player.setMute() 978 | - Player.setState(State::Stopped) is much faster 979 | - Fix seek error after setPlaybackRate() if sync to audio 980 | - Apple: enable arc 981 | 982 | 983 | 0.8.0 - 2020-03-18 984 | 985 | - API: 986 | - Add Player.mapPoint() to map coordinates between video frame and viewport 987 | - Aspect ratio change: negative is scale and crop, positive is scale without crop 988 | - Add Player.onSync() to support sync to user provided clock. Currently only video can sync to it 989 | - D3D11 renderer: 990 | - Supports 16bit be formats 991 | - Convert to rgb by cpu if format is not supported 992 | - Linux multi arch cross build. Less platform specific code 993 | - Add V4L2M2M decoder 994 | - Improve EGL 995 | - Fix a crash on macOS when destroying player 996 | - `setBackgroundColor()`: always draw background if color is valid. Fix regression since 0.7.0. 997 | - Fix playback speed is too fast if resume after paused seek. Regression since v0.5.0 998 | - Fix video only stream clock sync if change playback rate 999 | - Fix wrong position when seeking (if media 1st pts > 0) 1000 | - GLX is not linked 1001 | - Use clang-8 for rpi to fix invalid armv6 so 1002 | - Fix undefined symbol for sunxi 1003 | - Enable cf guard for windows 1004 | 1005 | 1006 | 0.7.0 - 2020-02-17 1007 | 1008 | - API: 1009 | - add `Player.setProperty()` 1010 | - add `VideoFrame` class 1011 | - add `Player.onFrame()` to get decoded frame, can be used by custom filters 1012 | - support `MediaStatus::Seeking` 1013 | - add snapshot [MediaEvent](https://github.com/wang-bin/mdk-sdk/wiki/Types#class-mediaevent) 1014 | - `seek()` callback parameter is -2 if seek request is ignored 1015 | - ABI: no break 1016 | - `setBackgroundColor()`: if alpha is 0(default), you have to call `glClearColor`(or d3d11 api) manually. 1017 | - Add FindMDK.cmake in sdk lib/cmake dir, support multiple target architectures. 1018 | - Fix multiple D3D11 renderer crash 1019 | - Fix crash if audio device is not available 1020 | - Fix music with cover buffering progress error 1021 | - Fix last frames not rendered if prepare() from a position closed to end of stream. 1022 | - Player.setVideoSurfaceSize(-1, -1) can remove the renderer 1023 | - prepare() starts from 0 if requested start position > stream duration or duration is unknown 1024 | - Improve A-B loop if B is closed to or larger than end of file 1025 | - Fix block if A-B loop restarts when previous seeking is not finished 1026 | - Music with cover art: fix png not rendered. fix block if stop by user. 1027 | - Seek: 1028 | - Fix SeekFromNow 1029 | - Fix audio file read error after seek 1030 | - When end of stream decoded and in paused state 1031 | - Fix seek never work if previous seek failed 1032 | - position() never change after a seek error or a frequent seek request 1033 | - snapshot: fix msvc crash 1034 | - OpenGL: 1035 | - Save and restore blend states 1036 | - Skip loading EGL if context is not created by mdk 1037 | - FFmpeg: 1038 | - support avfilter complex filters via Player property ["video.avfilter" and "audio.avfilter"](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#void-setpropertyconst-stdstring-key-const-stdstring-value) 1039 | - Optimize audio filter if in/out parameters are the same 1040 | - Improve video encoder 1041 | - VT decoder: 1042 | - Fix the last frame not rendered 1043 | - Support AnnexB streams 1044 | - Reduce exported classes 1045 | - Fix crashes, memory leaks in stress tests. 1046 | - Metal renderer: WIP 1047 | - Audio encoder: WIP 1048 | 1049 | 1050 | 0.6.1 - 2020-01-05 1051 | 1052 | - Improve D3D11 renderer, more pixel formats 1053 | - Player.snapshot() supports saving to file 1054 | - Support QSV decoder via DXVA2, and 0-copy rendering 1055 | - Subtitle WIP. 1056 | - Encoder WIP. 1057 | - Fix endless wait in loop mode 1058 | - Environment var name change: GL_MMAL_FORMAT=>MMAL_GL_FORMAT, GL_VAAPI=>VAAPI_GL, GL_VDPAU=>VDPAU_GL 1059 | 1060 | 1061 | 0.6.0 - 2019-12-02 1062 | 1063 | - D3D11 Renderer: now has almost the same features as OpenGL renderer 1064 | - HDR tone mapping support 1065 | - Support UWP. `ICoreWindow` or `ISwapchainPanel` can be used as the surface of `Player.updateNativeSurface()` 1066 | - Zero copy rendering for hardware decoders, including d3d11, dxva2 and cuda based decoders. 1067 | - Add env vars "SWAPCHAIN_BUFFERS", "DXGI_ADAPTER_RENDER" and "GPU_DEBUG" to control swap chain buffers adapter index and debug layer 1068 | - Support feature level 9.1~12.1(default), controlled by env "D3D_FEATURE_LEVEL_RENDER" 1069 | - Save and restore pipeline states before and after rendering 1070 | - Support foreign context provided by user via `Player.setRenderAPI()`, `D3D11RenderAPI.context` and `D3D11RenderAPI.rtv` must be provided 1071 | - Remove restriction of calling `Player.setRenderAPI()` before any other apis have `vo_opaque` parameter. `updateNativeSurface()` still have to be called after `setRenderAPI()` 1072 | - Support more pixel formats, including nv12, p010 etc. Packed formats with 3 channels are not supported by d3d11 without cpu convertion, leaves them as unsupported. 1073 | - MFT: decoder device feature level can be set by property "feature_level" 1074 | - Reduce cpu load on pause 1075 | - Range loop: fix seek to A failure 1076 | - macOS: 1077 | - Fix ui apis called on non-ui thread when creating CGL context(crash on macOS 10.15+) 1078 | - Weak link to libffmpeg.4.dylib because macOS 10.15+ disallow dlopen. also can be replaced by user provided ffmpeg libraries(avutil, avcodec etc.) at runtime via `SetGlobalOption("avutil", (void*)handle)` 1079 | - FFmpeg: 1080 | - Set ffmpeg module handle via `SetGlobalOption("name", (void*)handle)`, where name is avutil, avcodec, avformat etc. 1081 | - Fix crash if custom ffmpeg libraries are not complete. Required modules are "avutil", "avformat", "avcodec" 1082 | - D3D11 decoder improve 1083 | - Fix VAAPI seek crash cause by wrong ref count 1084 | 1085 | 1086 | 0.5.0 - 2019-11-03 1087 | 1088 | - ABI Changes: 1089 | - PrepareCallback return type change in Player.prepare() 1090 | - Player.snapshot() callback return type change. Return a file path to save as file(not implemented yet) 1091 | - Add SeekFlag for prepare(), setNextMedia() and gaplessSwitch() 1092 | - APIs Changes: 1093 | - Add RenderAPI.h: provides necessary informations to use a graphics api other than OpenGL 1094 | - Add Player.setRenderAPI(): select platform graphics api for video rendering. Now OpenGL(default) and D3D11 are supported. 1095 | - Add version macros 1096 | - New Features: 1097 | - Experimental D3D11 rendering support. Now can render frames from software decoders. Color is not precise as OpenGL. Only the context created internally from a HWND via updateNativeSurface is tested. Foreign contexts may work, not tested. 1098 | - Improve seeking performance, fix unchanged display when seeking continuously. Now it's close to mpv, and should be better than most players like potplayer, vlc, mpc-hc etc. 1099 | - Fix seek position if media start time > 0 1100 | - Accurate seek is the default for the start position of prepare(), setNextMedia() and gaplessSwitch() 1101 | - OpenGL: Skip uploading video frame to gpu when redrawing 1102 | - setState(State::Stopped) now clears video renderer viewport and releases video renderer resources 1103 | - Fix stopping playback is not executed immediately 1104 | - setState(State::Stopped) now releases host and gpu resouces and clear background color. Normal playback end does not, and still keep the last frame displayed 1105 | - Fix setState() sometimes does not work 1106 | - MFT Decoder: 1107 | - Disable low latency by default only for hevc. Previous release turned off low latency mode for all codecs, then h264 decoding may be too slow 1108 | - Add property "ignore_profile" and "ignore_level" 1109 | - Add FFmpeg decoder property "drop" to control decoder frame dropping when seeking 1110 | - glfwplay example: 1111 | - new seek options: `-seek_step`, `-seek_any` 1112 | - support d3d11 rendering using `-d3d11 -gfxthread` 1113 | 1114 | 1115 | 0.4.1 - 2019-10-08 1116 | 1117 | - macOS: fix glx weak link 1118 | - support ubuntu >= 14.04 1119 | - load vaapi dynamically 1120 | - improve vaapi host map, control via env var VAIMAGE_DERIVE, VAIMAGE_FORMAT 1121 | - fix many playback loop bugs when more tracks are enabled 1122 | - fix too many packets buffered when decoding the 1st frame 1123 | - MFT: disable low latency to fix frames out of order 1124 | - subtitle support WIP. 1125 | - decode embedded subtitle tracks via avcodec 1126 | - decode loop and thread 1127 | - FFmpeg 1128 | - versioned dso is preferred 1129 | - reload ffmpeg symbols if dso is changed by SetGlobalOption() 1130 | - log level is controlled by SetGlobalOption("ffmpeg.loglevel", val), val can be "quiet", "panic", "fatal", "error", "warning", "info", "verbose", "debug", "trace" 1131 | 1132 | 1133 | 0.4.0 - 2019-09-04 1134 | 1135 | - API: 1136 | - add Player.setRange(a, b) 1137 | - add Player.setLoop(count), onLoop(callback) 1138 | - Reduce pixel format storage 1139 | - Fix onEvent() can not add multiple callbacks 1140 | - Support windows on arm64 1141 | - VA-API: support map to host 1142 | - GL: support creating ES context from WGL 1143 | - avglue plugin is now merged into main library 1144 | - FFmpeg code is no longer embedded into mdk by default. External ffmpeg4.0+ is loaded automatically. Distributing mdk sdk is easier especially on linux 1145 | 1146 | 1147 | 0.3.1 - 2019-08-15 1148 | 1149 | - fix user stop block 1150 | - fix some bugs at eof, e.g. unable to seek 1151 | - fix setLoop(0) can not disable looping 1152 | - support clang-cl 9.0 1153 | - c++ api: support g++ 4.9 1154 | - vaapi: sync surface after exporting drm handle 1155 | - improve ci. now nightly packages are uploaded automatically to https://sourceforge.net/projects/mdk-sdk/files/nightly 1156 | - now mdk can be installed via nuget in visual studio. https://www.nuget.org/packages/mdk 1157 | 1158 | 1159 | 0.3.0 - 2019-08-01 1160 | 1161 | - support A-B loop via setLoop() 1162 | - API: 1163 | - fix player.mediaInfo() crash 1164 | - add chapters description in MediaInfo 1165 | - add setLoop() 1166 | - GL: 1167 | - add hdr tone mapping. can be disabled by env var "GL_TONE_MAP=0" 1168 | - can create wgl context with specified version and profile 1169 | - improve glsl 1170 | - raspberry pi: 1171 | - fix legacy driver check. gl and mmal works correctly on all drivers 1172 | - load libwayland-egl.so.1 when needed 1173 | - mmal zero copy rendering supports yuv textures. not perfect. not the default. enabled by "GL_MMAL_FORMAT=yuv420p" 1174 | - MFT(windows media foundation): 1175 | - fix dolby decoder output format 1176 | - input/output type index can be specified by property, example: decoder name is "MFT:in_type=0:out_type=0" 1177 | - add missing metadata in MediaInfo 1178 | - improve EOS handling in demux thread 1179 | - remove terminal null in log 1180 | - videotoolbox: stop decoding if decoded frame is invalid 1181 | - stop annexb conversion if error occurs 1182 | - fix video output drop rate is not desired value 1183 | - fix crash if cuda is not available when using CUDA decoder 1184 | - fix xaudio2 crash 1185 | - fix iOS 32bit min version 1186 | 1187 | 1188 | 0.2.3 - 2019-07-01 1189 | 1190 | - muxer: skip unwanted stream packets 1191 | - GL: 1192 | - support gbrp formats 1193 | - improve yuv to rgb 1194 | - xyz gamma correction 1195 | - generic color space, trc, primaries support. done in renderer, demuxers and decoders(FFmpeg, VT, AMediaCodec, MFT) 1196 | - android AudioTrack: do not use deprecated 7.1 channel value, which may not work in new OSes 1197 | - FFmpeg: 1198 | - fix sw format after seek 1199 | - check hw pixfmt of decoded frame, fix sw fallback 1200 | - support avcodec options via property, e.g. FFmpeg:thread=2 1201 | - fix annexb check for CUDA, MFT, AMediaCodec decoder 1202 | - try next decoder set by user if failed to decode a frame 1203 | - AMediaCodec decoder: 1204 | - profile, level and capabilities check before using a codec 1205 | - fix nv12 plane line size in copy mode 1206 | - async mode support 1207 | - detect decode error 1208 | - VT decoder(VideoToolbox): add property "copy" 1209 | - MFT decoder: 1210 | - apply property "copy", "pool" on the fly 1211 | - fix annexb check 1212 | - raspberry pi: 1213 | - enable builtin mmal decoder. decoder name is "mmal", while FFmpeg's is "MMAL" 1214 | 1215 | 1216 | 0.2.2 - 2019-06-05 1217 | 1218 | - API changes: 1219 | - add Player.record() to record while playing 1220 | - add SetGlobalOption(), can be used to set ffmpeg runtime paths via key "avutil_lib", "avcodec_lib" etc. 1221 | - ABI break: no 1222 | - NEW: 1223 | - add NV24/42 1224 | - GL: support xyz12le/be 1225 | - MFT: support D3D11 for win7 1226 | - support color space, primaries, trc, range, hdr metadata for VideoFrame, MediaInfo, decoders(except android) etc. 1227 | - support HDR10 for windows GLES2/3(ANGLE) via environment var "D3D11_GL=eglpbuf" 1228 | - support muxing 1229 | - fix m3u check 1230 | - GL: scale high depth color depends on channel shift 1231 | - ci: add azure macOS + iOS build 1232 | - iOS: fix arm32 c++17 build(aligned allocate), disable private symbol texImageIOSurface 1233 | - free for gpl softwares 1234 | 1235 | 1236 | 0.2.1 - 2019-04-28 1237 | 1238 | - support win arm64 via clang, support llvm-rc 1239 | - AVGlue: 1240 | - support user specified FFmpeg runtime libraries instead of built-in ones via environment var: AVUTIL_LIB, AVCODEC_LIB, AVFORMAT_LIB, AVFILTER_LIB, SWRESAMPLE_LIB 1241 | - add FFmpeg decoder property "codec": glfwplay -c:v FFmpeg:codec=... 1242 | - Fix MFT p010 frame stride 1243 | - Fix cuda api 1244 | 1245 | 0.2.0 - 2019-04-01 1246 | 1247 | - API: 1248 | - add setBufferRange() 1249 | - add/removeListener()=>onEvent() 1250 | - add MediaInfo 1251 | - add snapshot() 1252 | - add setBackgroundColor() 1253 | - C ABI: should be stable 1254 | - New: 1255 | - support dropping outdated packets for realtime streams 1256 | - support fast accurate seek 1257 | - auto rotate 1258 | - switch decoder on the fly 1259 | - first frame rendered event 1260 | - Fix m3u8 demux 1261 | - Fix a/v sync if audio thread exits earlier 1262 | - Fix incorrect buffering progress 1263 | - Fix undefined ndkmedia symbols at runtime and crash 1264 | - rpi: add native mmal video decoder(disabled now) 1265 | - rpi: fix eglimage cache 1266 | - rpi: start to adding omx 1267 | - MFT: check h264 constraints 1268 | 1269 | 1270 | 0.1.0 - 2019-02-25 1271 | 1272 | - ABI and API change. Single C/C++ SDK is compatible with any C++11 compiler and runtime. Library APIs moves into abi namespace. 1273 | - Hide more unnecessary symbols 1274 | - Simplify udio channel map 1275 | - Do not render audio if no audio device. crash fix 1276 | - Fix buffered bytes 1277 | - Implement CUDA decoder. Should be better than FFmpeg's CUVID. 1278 | - Use exported symbol `void* GetCurrentNativeDisplay()` in main to support vaapi/vdpau+x11egl interop 1279 | 1280 | 1281 | 0.0.10 - 2019-01-28 1282 | 1283 | - Individual audio tracks support. 1284 | - MFT decoder improve 1285 | - crop visual area 1286 | - decoded frame copy mode option 1287 | - fix crashes 1288 | - d3d11 0-copy rendering jitter fix 1289 | - add audio decoders: aac, mp3 support 1290 | - minimize IMFMediaBuffer copy 1291 | - fix undefined MFCreateTrackedSample runtime error on win7 1292 | - P010, P016 rendering in OpenGL 1293 | - buffering event 1294 | - Apple: disable flat namespace 1295 | - unify decoder properties: "copy", "format" 1296 | - support win32 x86: api ptr type, float point compare 1297 | - MediaStatus changes 1298 | - fix android mediacodec arm64 lto link 1299 | - fix annexb packet filter(affects mediacodec) 1300 | - mediacodec: support yuv420p, support level 28 ndk apis and metadata, print decoder name 1301 | - vaapi: support info/error callback 1302 | - avcodec: fix lifetime of hwcontext(hwdec crash) 1303 | - gl: recreate texture before changing parameters to fix wrong display if hwdec=>swdec 1304 | 1305 | 0.0.9 - 2018-12-05 1306 | 1307 | - dynamic load vdpau in GLVA module 1308 | - P010 for d3d11 decoded frames 1309 | - enable thin-lto for all 1310 | - fix crash if no egl dll 1311 | - fix iOS link error 1312 | - pulseaudio wip 1313 | - Audio backend refactor: async push backend 1314 | - exit dsound thread via event 1315 | - Add missing onOpen, onClose, onFlush in video decoders 1316 | - Add VideoToolbox(name is "VT") for macOS/iOS, support async mode. h265 hvcC, h264 avcC stream are supported, nal is not yet. 1317 | Better performance than FFmpeg's videotoolbox. 1318 | propertyes: threads, format, realTime, async 1319 | - Decode EOS only once to fix MediaCodec block in the end. 1320 | - Add MFT based video decoder for Win32(Vista+) and UWP. Supports h264, hevc, vp8/9 etc. Supports software decoding, dxva/d3d11 gpu acceleration. 1321 | - Add threads property for FFmpeg based decoders. 1322 | - Android: support posting messages from native code. try to load stl. 1323 | - WinRT/UWP: support IStorageFile 1324 | 1325 | 1326 | 0.0.8 - 2018-10-07 1327 | 1328 | - GL: 1329 | - do not fill background color 1330 | - fix wrong color if video changes 1331 | - fix redraw in a new gl context 1332 | - restore viewport, bo, shader program after rendering to support embedding in other frameworks 1333 | - fix global vbo attributes changes 1334 | - multi-thread improve 1335 | - support NSWindow 1336 | - fix resizing on macOS10.14 1337 | - player 1338 | - Add volume, mute, playback rate, vide scale(including mirror) api 1339 | - add getVideoFrame() to retreive currently rendered frame 1340 | - surface type parameter for updateNativeWindow() 1341 | - default preload policy change 1342 | - render callback parameter to support multiple outputs 1343 | - fix gapless switch 1344 | - fix buffered duration 1345 | - apple: disable time pitch effect which results in inaccurate callback invoking time after AudioQueueReset 1346 | - playback rate is implemented in avfilter 1347 | - no sw fallback when opening hw decoder 1348 | - print build information 1349 | - fix old packet is enqueued after seek 1350 | - GLVA: 1351 | - vaapi: fallback to drm interop if drm2 is not implemented 1352 | - d3d11: always render mapped nv12 textures in rg format to fix es2 rendering(11 feature level 9.3) 1353 | - win32/winrt: observe surface size change via foreign window handle and less user code 1354 | - build: icf, clang-cl on windows, libc++ etc. 1355 | - test: add glfw, x11 example 1356 | 1357 | 1358 | 0.0.7 - 2018-07-31 1359 | 1360 | - support sunxi cedarv decoder and 0-copy rendering via UMP 1361 | - add mediacodec audio decoder 1362 | - unify mediacodec audio & video decoder 1363 | - improve mediacodec video decoder 1364 | - create decoder with options string 1365 | - buffering progress in duration 1366 | - drop frame less. control via env "VO_DROP" 1367 | - no MTA requirement for xaudio2 1368 | - player: support multiple renderers 1369 | - API: player.setAudioDecoders(...), tiled pixel format, seek flag 1370 | - build: improve linux cross build with lib++, support winrt via clang 1371 | - GLVA: 1372 | - use native video buffer template except apple 1373 | - vaapi + drm(prime) support 1374 | - fix mapped texture reuse for multi-renderers rendering(except d3d) 1375 | 1376 | 1377 | 0.0.6 - 2018-06-02 1378 | 1379 | - support clang-cl host build and cross build for windows 1380 | - support opensource gcc on macOS 1381 | - improve Packet.buffer 1382 | - support rendering frame whose vertical stride > height 1383 | - fix and improve VideoFrame ctor 1384 | - fix seek block because of long time sleep 1385 | - add MediaStatus::PreparedMedia, fix mediaStatus() bugs 1386 | - frame boost options for FrameReader and player prepared callback 1387 | - fix wrong frame displayed in gapless switch via frame boost option 1388 | - Android AudioTrack support 1389 | - Android MediaCodec video decoder support, via ndk api implemented in ndk or jni (JMI+AND project) 1390 | - GLVA: 1391 | - test D3D11 nv12 SR texture support 1392 | - map to host support: d3d9, d3d11, vdpau 1393 | - CUDA stream support and enabled by default 1394 | - fix android context change check 1395 | - fix MMAL pool is used for mesa vc4 environment 1396 | - AVGlue: 1397 | - use new api avcodec_get_hw_frames_parameters 1398 | - set texture flags via hwframesctx to enable d3d11va-eglstream 0-copy 1399 | - improve Buffer and AVBufferRef, support offset 1400 | - fix mkv packet decode error in ffmpeg4.0+ 1401 | - fix mediacodec because of ref leak 1402 | - use CUDA stream shared from glva native buffer pool 1403 | 1404 | 1405 | 0.0.5 - 2018-05-05 1406 | 1407 | - video decoder supports glva via wrapper 1408 | - fix mapped host frame stride and format 1409 | - qr code overlay and license check module 1410 | - OpenSL use system stream type and the sound is louder 1411 | - ALSA: fix reopen error 1412 | - Support direct sound 1413 | - Fix rendering audio with invalid padding data 1414 | - GL: grab rendered frame, user shader api 1415 | - player: no currentMediaChanged in dtor to ensure accessing player object is safe 1416 | - FrameReader: improve AOT frame boost(no api now), improve state update and no more unexpected dead blocks 1417 | - Gapless switch improvements(mostly in audio) 1418 | - log is default disabled, set null handler behavior change 1419 | - build: cmake 3.5+ is required, ubsan, fix header install 1420 | - GLVA 1421 | - api change: support multiple textures, no more map callback, frame size parameter 1422 | - NativeVideoBuffer wrapper for c api 1423 | - Fix texture reuse optimization(apple, d3d, mmal) 1424 | - add VA-API interop with X11 Pixmap, for both EGL and GLX 1425 | - add VDPAU interop with X11 Pixmap, and GLX extension, for both EGL and GLX 1426 | - D3D9 interop with WGL works now 1427 | - support D3D11 interop with WGL 1428 | - D3D11 interop with EGLStream works now and it becomes the default 1429 | - D3D11 supports texture as egl client buffer(requires ANGLE master) 1430 | - fix potential EGLSurface leak in CVPixelBuffer interop 1431 | - AVGlue 1432 | - improve linking static ffmpeg on windows 1433 | - support VA-API, VDPAU 1434 | - less deprecated apis 1435 | - fix AVFrame leak in filter, use smart ptrs for av types 1436 | - fix the case avpacket data is different from buf.data 1437 | 1438 | 1439 | 0.0.4 - 2018-04-07 1440 | 1441 | - requires cmake3, fix x64 1442 | - gnu stl is default for rpi 1443 | - works with vs2013 again(wgl only) 1444 | - frame drop api, no implementation 1445 | - support ALSA, it's default for linux 1446 | - improve audio renderer: flush, pause, delay, timestamp, unified, write 1447 | - remove audio renderer open/close apis. reopen internally when necessary 1448 | - improve a/v sync, support no active audio track 1449 | - opengl context local storage improvements: per object, custom creator and initializer etc. 1450 | - d3d11 interop with angle egl, for desktop and uwp 1451 | - fix teared content in d3d11 interop 1452 | - apple CVPixelBuffer interop with ANGLE EGL 1453 | - disable opengl shader cache sharing 1454 | - fix 16bit rendering in ES3 1455 | - videorenderer: fix 2d transform matrix(aspect ratio), optimize matrix uploading 1456 | - GLVA: refactor, unify and simplify context change handling 1457 | - support CUDA 1458 | - frame capture api without implementation 1459 | - avglue: new ffmpeg hwconfig apis, support nvdec, hw device ctx from us, hw copy decoder, mediacodec hwcontext 1460 | -------------------------------------------------------------------------------- /README.Android.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 16 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 17 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 18 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 19 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 20 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 21 | 22 | 23 | ## About SDK for Android 24 | SDK is built with 25 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/android/ffmpeg-master-android-clang-lite-lto.tar.xz/download 26 | - ndk 28 27 | - requires ndk r23 and later because of ndk abi break in r23 28 | 29 | SDK can be used by any C or C++11 compiler, e.g. g++, clang 30 | 31 | dsym files are debug symbols, not required to deploy your programe. 32 | 33 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 34 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 35 | - Vulkan 36 | 37 | ### OpenGL Context 38 | - Create by mdk: use SurfaceView's Surface to initialize rendering thread 39 | - Created by user: use GLSurfaceView, TextureView or whatever 40 | 41 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 42 | - FFmpeg 43 | - MediaCodec: FFmpeg mediacodec implementation 44 | - AMediaCodec: builtin mediacodec implementation, using libmediandk or java api 45 | 46 | MediaCodec/AMediaCodec decoder will not be destroyed if app go to background, and continues to work when resumed. 47 | 48 | ### Audio Renderers 49 | - OpenSLES 50 | - AudioTrack (default) 51 | 52 | ### Data Source 53 | - `content:` 54 | - `android.resource:` 55 | - `assets:` 56 | 57 | ### Use in CMake Projects 58 | ``` 59 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 60 | target_link_libraries(your_target PRIVATE mdk) 61 | ``` 62 | 63 | ### Qt qmake project 64 | ```qmake 65 | include($$MDK_SDK_DIR/mdk.pri) 66 | ``` 67 | 68 | 69 | ### Recommended settings 70 | ```cpp 71 | SetGlobalOption("JavaVM", JvmPtr); // REQUIRED 72 | player.setDecoders(MediaType::Video, {"AMediaCodec", "FFmpeg", "dav1d"}); 73 | ``` 74 | 75 | ## Source code: 76 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 77 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 78 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 79 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 80 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 81 | - [Android java wrapper and example](https://github.com/wang-bin/mdk-android) 82 | - [libmediandk and other java classes implemented in C++](https://github.com/wang-bin/AND) 83 | - [JNI Modern Interface](https://github.com/wang-bin/JMI) 84 | 85 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 86 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.Linux.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 16 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 17 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 18 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 19 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 20 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 21 | 22 | 23 | ## About SDK for Linux 24 | SDK is built by clang 21 with 25 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-master-linux-clang-lite-lto.tar.xz/download 26 | - libc++ 20. You can use delete libc++.so from sdk and use system libc++ 27 | 28 | SDK can be used by any C or C++11 compiler, e.g. g++, clang 29 | 30 | dsym files are debug symbols, not required to deploy your programe. 31 | 32 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#linux-desktop-raspberry-pi-64bit) 33 | 34 | ubuntu>=14.04(maybe 12.04) 35 | 36 | - glibc >= 2.14 37 | - libc++1, libc++abi1: not using gnu stl because libc++ has better compatibility. previous sdks depend on glibc++ 3.4.22(g++6) 38 | - libva version 2 or 1: libva2, libva-x11-2, libva-drm2 or libva1, libva-x11-1, libva-drm1. Running `apt install vainfo` will install these 39 | - libasound2, libpulse0 40 | - libwayland-client0 41 | - libgbm1 42 | - libgl1-mesa-glx 43 | 44 | Optional: 45 | - libegl1-mesa: egl context 46 | - libvdpau1: vdpau rendering. (required by ffmpeg decoder) 47 | - libwayland-egl1: wayland surface and egl context support 48 | - libass5~9 to support subtitle 49 | - libopenal1 50 | - libsdl2: sdlplay example 51 | 52 | ### Environment Vars: 53 | - GL_EGL: 0 = use glx context, 1 = use egl context (if created by mdk) 54 | - GL_ES: 0 = use opengl, 1 = use opengl es (if created by mdk) 55 | - VDPAU_GL: video = interop with video surface, output = interop with output surface, pixmap = interop with x11 pixmap(required by egl from x11) 56 | - VAAPI_GL: x11 = interop with glx/egl(via x11 pixmap), drm = interop with drm prime, drm2 = interop with drm prime2 57 | - CUDA_STREAM: 0/1 58 | - CUDA_PBO: 0/1 59 | - CUDA_HOST: 0/1 60 | - CUDA_DEVICE: number 61 | 62 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 63 | - OpenGL 64 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via EGL, GLX, ANGLE or others. the default if EGL is available. 65 | - Vulkan: broken now 66 | 67 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 68 | - FFmpeg, VDPAU, VAAPI, CUDA, QSV(not tested), NVDEC 69 | - command line: -c:v decodername 70 | 71 | ### DRM Prime 72 | RaspberryPi OS system ffmpeg provides hevc and v4l2m2m drm_prime frame output, you can use system ffmpeg(delete libffmpeg.so.* in sdk package) with OpenGLES(desktop GL does not support hevc) contexts created from EGL to get maximum performance. glfwplay option to test: 73 | - x11: `./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -gl test.mp4` 74 | - wayland: `./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -es test.mp4`, you have to install glfw `sudo apt install libglfw3-wayland` 75 | 76 | RaspberryPi OS rendering performance is poor, you may have to disable log, log to file or minimize terminal to get higher fps, otherwise rendering log may slow down video rendering. wayland environment has better performance 77 | 78 | ### Examples 79 | GL Context 80 | - Created by MDK: glfwplay -gl:opengl=1, glfwplay -gl:opengl=1:egl=1, glfwplay -gl, mdkplay, x11win 81 | - Foreign Context: glfwplay, multiplayers, multiwindows (via glfw), sdlplay(via sdl) 82 | 83 | Gapless Playback for Any Media: 84 | - mdkplay(or glfwplay/window/sdlplay) file file2 ... 85 | 86 | N players for 1 video: multiplayers -share -win N url 87 | 88 | N videos and N players: multiplayers -share url1 url2 ... urlN 89 | 90 | N videos renderers for 1 player: multiwidnows url 91 | 92 | ### Use in CMake Projects 93 | ``` 94 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 95 | target_link_libraries(your_target PRIVATE mdk) 96 | ``` 97 | 98 | ### Qt qmake project 99 | ```qmake 100 | include($$MDK_SDK_DIR/mdk.pri) 101 | ``` 102 | 103 | 104 | ### Recommended settings 105 | - Linux: 106 | ```cpp 107 | // XInitThreads(); // If using x11. before any x11 api call. some gui toolkits already call this, e.g. qt, glfw 108 | SetGlobalOption("X11Display", DisplayPtr); // If using x11. Requred by VAAPI, VDPAU 109 | player.setDecoders(MediaType::Video, {"VAAPI", "VDPAU", "CUDA", "hap", "FFmpeg", "dav1d"}); 110 | ``` 111 | - Raspberry Pi: use [mdk-sdk-linux.tar.xz](https://sourceforge.net/projects/mdk-sdk/files/nightly/mdk-sdk-linux.tar.xz/download), delete libffmpeg.so.* to use system ffmpeg to support h264, hevc hardware decoder and 0-copy rendering 112 | ```cpp 113 | player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg"}); 114 | ``` 115 | 116 | ## Source code: 117 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 118 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 119 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 120 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 121 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 122 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 123 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 124 | 125 | 126 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 127 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.WinRT.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 16 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 17 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 18 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 19 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 20 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 21 | 22 | 23 | ## About SDK for Windows Desktop & UWP 24 | SDK is built by 25 | - latest VS2022 with [FFmpeg win32](https://sourceforge.net/projects/avbuild/files/windows-desktop/ffmpeg-master-windows-desktop-vs2022-lite.7z/download) and [FFmpeg UWP](https://sourceforge.net/projects/avbuild/files/uwp/ffmpeg-master-uwp-vs2022-lite.7z/download) 26 | 27 | SDK can be used by any C or C++11 compiler, e.g. vs2015, vs2022, mingw g++, clang 28 | 29 | ### Use in Visual Studio 30 | 31 | #### Install via NuGet (Recommended) 32 | mdk is published on https://www.nuget.org/packages/mdk/. Now you can install it in visual studio. 33 | 34 | #### Import from Release Package 35 | mdk sdk can be imported by vs projects. Insert the following line in your vcxproj as the last element of `Project` (assume mdk-sdk is in the same dir as vcxproj) 36 | 37 | 38 | 39 | 40 | Once installed or imported, necessary compile flags and link flags will be added, runtime dlls will be copied to output dir. 41 | 42 | ### Use in CMake Projects 43 | ``` 44 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 45 | target_link_libraries(your_target PRIVATE mdk) 46 | ``` 47 | 48 | ### Qt qmake project 49 | ```qmake 50 | include($$MDK_SDK_DIR/mdk.pri) 51 | ``` 52 | 53 | 54 | ### Recommended settings 55 | ```cpp 56 | player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "hap", "FFmpeg", "dav1d"}); 57 | ``` 58 | 59 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#uwp) 60 | Optional: 61 | - libEGL.dll, libGLESv2.dll, D3DCompiler_47/43.dll. Qt apps can use qt's dlls 62 | 63 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 64 | - D3D11: recommended 65 | - D3D12 66 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via ANGLE or others. The default if EGL runtime is found. 67 | - Vulkan(No UWP) 68 | 69 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 70 | - [FFmpeg](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#ffmpeg). options: threads=N. e.g. -c:v FFmpeg. -c:v FFmpeg:threads=4 71 | - [MFT](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#mft). options: d3d=0/9/11/12, pool=0/1. e.g. -c:v MFT(software), -c:v MFT:d3d=11(hardware) or MFT:d3d=12. 72 | - [D3D11](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#d3d11): via FFmpeg 73 | - [hap](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) 74 | 75 | ## Source code: 76 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 77 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 78 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 79 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 80 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 81 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 82 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 83 | 84 | 85 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 86 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.Windows.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | 3 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 4 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 5 | 6 | 7 | ### Features 8 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 9 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 10 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 11 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 12 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 13 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 14 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 15 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 16 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 17 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 18 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 19 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 20 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 21 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 22 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 23 | 24 | 25 | ## About SDK for Windows Desktop & UWP 26 | SDK is built by 27 | - latest VS2022 with [FFmpeg win32](https://sourceforge.net/projects/avbuild/files/windows-desktop/ffmpeg-master-windows-desktop-vs2022-lite.7z/download) and [FFmpeg UWP](https://sourceforge.net/projects/avbuild/files/uwp/ffmpeg-master-uwp-vs2022-lite.7z/download) 28 | 29 | SDK can be used by any C or C++11 compiler, e.g. vs2015, vs2022, mingw g++, clang 30 | 31 | ### Use in Visual Studio 32 | 33 | #### Install via NuGet (Recommended) 34 | mdk is published on https://www.nuget.org/packages/mdk/. Now you can install it in visual studio. 35 | 36 | #### Import from Release Package 37 | mdk sdk can be imported by vs projects. Insert the following line in your vcxproj as the last element of `Project` (assume mdk-sdk is in the same dir as vcxproj) 38 | 39 | 40 | 41 | 42 | Once installed or imported, necessary compile flags and link flags will be added, runtime dlls will be copied to output dir. 43 | 44 | ### Use in CMake Projects 45 | ``` 46 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 47 | target_link_libraries(your_target PRIVATE mdk) 48 | ``` 49 | 50 | ### Qt qmake project 51 | ```qmake 52 | include($$MDK_SDK_DIR/mdk.pri) 53 | ``` 54 | 55 | 56 | ### Recommended settings 57 | ```cpp 58 | player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "CUDA", "hap", "FFmpeg", "dav1d"}); 59 | ``` 60 | 61 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#windows-desktop) 62 | - Vista+ 63 | - ucrt, vc140+ runtime 64 | 65 | Optional: 66 | - libEGL.dll, libGLESv2.dll, D3DCompiler_47/43.dll. Qt apps can use qt's dlls 67 | - vulkan 68 | 69 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 70 | - D3D11: recommended 71 | - D3D12 72 | - [OpenGL(No UWP)](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via WGL. The default if EGL runtime is not found. 73 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via ANGLE or others. The default if EGL runtime is found. 74 | - Vulkan(No UWP) 75 | 76 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 77 | - [FFmpeg](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#ffmpeg). options: threads=N. e.g. -c:v FFmpeg. -c:v FFmpeg:threads=4 78 | - [MFT](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#mft). options: d3d=0/9/11/12, pool=0/1. e.g. -c:v MFT(software), -c:v MFT:d3d=11(hardware) or MFT:d3d=12. 79 | - [CUDA](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#cuda)(No UWP) 80 | - [D3D11](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#d3d11): via FFmpeg 81 | - [DXVA](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#dxva)(No UWP): via FFmpeg 82 | - [NVDEC](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#nvdec)(No UWP): via FFmpeg 83 | - CUVID(No UWP): via FFmpeg 84 | - [QSV](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#qsv)(No UWP): via FFmpeg 85 | - [BRAW](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#braw): Blackmagic RAW 86 | - [R3D](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#r3d): R3D RAW 87 | - [hap](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) 88 | - [VAAPI](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#vaapi) 89 | 90 | ### Examples 91 | gapless playback for any audio and video: mdkplay.exe(or glfwplay.exe/window.exe/sdlplay.exe) file file2 ... 92 | 93 | N players for 1 video: multiplayers -es -share -c:v D3D11 -win N url 94 | 95 | N videos and N players: multiplayers -es -share -c:v D3D11 url1 url2 ... urlN 96 | 97 | N videos renderers for 1 player: multiwidnows url 98 | 99 | ## Source code: 100 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 101 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 102 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 103 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 104 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 105 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 106 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 107 | 108 | 109 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 110 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.iOS.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 16 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 17 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 18 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 19 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 20 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 21 | 22 | 23 | ## Swift 24 | https://github.com/wang-bin/swift-mdk 25 | 26 | ## About SDK for iOS 27 | SDK is built by Xcode 16 with 28 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/iOS/ffmpeg-master-iOS-lite-lto.tar.xz/download 29 | - Minimal system: iOS 8.0 30 | - Support Metal renderer 31 | 32 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 33 | - Metal: recommended 34 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 35 | 36 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 37 | - VT: videotoolbox hardware decoder. h264, hevc support. propertyes: threads, realTime, async, format, hardware, width, height. e.g. `player.setVideoDecoders({"VT:format=nv12:async=1", "FFmpeg"})` 38 | - VideoToolbox: via ffmpeg 39 | - FFmpeg. Direct rendering via property "pool=CVPixelBuffer" 40 | 41 | ### Use in CMake Projects 42 | ``` 43 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 44 | target_link_libraries(your_target PRIVATE mdk) 45 | ``` 46 | 47 | ### Qt qmake project 48 | ```qmake 49 | include($$MDK_SDK_DIR/mdk.pri) 50 | ``` 51 | 52 | 53 | ### Recommended settings 54 | 55 | - macOS, iOS: `player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"});` 56 | 57 | ### Use in Xcode 58 | Choose any of 59 | - Add mdk.xcframework to your project(Embed & Sign) 60 | - install via cocoapods `pod 'mdk'` 61 | 62 | #### Code Sign 63 | Choose any of 64 | - In `Build Settings` add `--deep` to `Other Code Signing Flags` 65 | - (Recommended) In `Build Phase`, add a `New Run Script Phase` with content `[ -n "$CODE_SIGN_IDENTITY" ] && find "$BUILT_PRODUCTS_DIR" -depth -name "libffmpeg*.dylib" -exec codesign -i mdk.framework.ffmpeg -f -vvvv -s"${EXPANDED_CODE_SIGN_IDENTITY}" ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements,flags {} \;` 66 | 67 | 68 | ## Source code: 69 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 70 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 71 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 72 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 73 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 74 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 75 | 76 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 77 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.macOS.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 16 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 17 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 18 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 19 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 20 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 21 | 22 | 23 | ## Swift 24 | https://github.com/wang-bin/swift-mdk 25 | 26 | ## About SDK for macOS 27 | 28 | - Support Apple sillicon 29 | - Support Metal and Vulkan renderer 30 | - Support VP9 on macOS 11+ 31 | - Support X11 if runtime libraries exist 32 | 33 | SDK is built by Xcode 16 with 34 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/macOS/ffmpeg-master-macOS-lite-lto.tar.xz/download 35 | 36 | ### macOS 10.15+ 37 | Executables download from internet are not able to run. Try to run `./mdk-sdk/catalina.sh` 38 | 39 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#macos) 40 | Optional: 41 | - MoltenVK or Vulkan SDK 42 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via ANGLE project or PowerVR SDK. the default if EGL is available. 0-copy rendering VideoToolbox frames is supported for ANGLE. Can be disabled by environment var GL_EGL=0 or GLRenderAPI. 43 | - X11 via XQuartz 44 | 45 | 46 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 47 | - Metal: recommended 48 | - OpenGL 49 | - OpenGL ES2/3: via ANGLE or others. The default if EGL runtime is found. 50 | - Vulkan 51 | 52 | 53 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 54 | - FFmpeg. Direct rendering via property "pool=CVPixelBuffer" 55 | - VT: videotoolbox hardware decoder. h264, hevc, vp9 support. propertyes: threads, realTime, async, format, hardware, width, height. e.g. `player.setVideoDecoders({"VT:format=nv12:async=1", "FFmpeg"})` 56 | - VideoToolbox: via ffmpeg 57 | 58 | VT default use async mode, and the performance is better performance then FFmpeg's sync VideoToolbox 59 | 60 | ### Examples 61 | gapless playback for any audio and video: glfwplay/sdlplay video1 video2 ... 62 | 63 | N players for 1 video: multiplayers -share -c:v VideoToolbox -win N url 64 | 65 | N videos and N players: multiplayers -share -c:v VideoToolbox url1 url2 ... urlN 66 | 67 | N videos renderers for 1 player: multiwidnows url 68 | 69 | ### Use in CMake Projects 70 | ``` 71 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 72 | target_link_libraries(your_target PRIVATE mdk) 73 | ``` 74 | 75 | ### Qt qmake project 76 | ```qmake 77 | include($$MDK_SDK_DIR/mdk.pri) 78 | ``` 79 | 80 | 81 | ### Recommended settings 82 | 83 | - macOS, iOS: `player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"});` 84 | 85 | 86 | ### Use in Xcode 87 | Choose any of 88 | - Add mdk.xcframework to your project(Embed & Sign) 89 | - install via cocoapods `pod 'mdk'` 90 | 91 | #### Code Sign 92 | Choose any of 93 | - In `Build Settings` add `--deep` to `Other Code Signing Flags` 94 | - (Recommended) In `Build Phase`, add a `New Run Script Phase` with content `[ -n "$CODE_SIGN_IDENTITY" ] && find "$BUILT_PRODUCTS_DIR" -depth -name "libffmpeg*.dylib" -exec codesign -i mdk.framework.ffmpeg -f -vvvv -s"${EXPANDED_CODE_SIGN_IDENTITY}" ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements,flags {} \;` 95 | 96 | 97 | ## Source code: 98 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 99 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 100 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 101 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 102 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 103 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 104 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 105 | 106 | 107 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 108 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status github](https://github.com/wang-bin/mdk-sdk/workflows/Build/badge.svg)](https://github.com/wang-bin/mdk-sdk/actions) 2 | 3 | [![Build Status](https://dev.azure.com/kb137035/mdk/_apis/build/status/mdk-CI-yaml?branchName=master)](https://dev.azure.com/kb137035/mdk/_build/latest?definitionId=2&branchName=master) 4 | 5 | **Download** latest [Nightly Build SDK from sourceforge](https://sourceforge.net/projects/mdk-sdk/files/nightly/) or [github actions](https://nightly.link/wang-bin/mdk-sdk/workflows/build/master) 6 | 7 | 8 | Sourceforge[![Sourceforge](https://img.shields.io/sourceforge/dt/mdk-sdk)](https://sourceforge.net/projects/mdk-sdk/files) 9 | Github Releases[![Github Release](https://img.shields.io/github/downloads/wang-bin/mdk-sdk/total)](https://github.com/wang-bin/mdk-sdk/releases) 10 | NuGet[![NuGet](https://img.shields.io/nuget/dt/mdk)](https://www.nuget.org/packages/mdk) 11 | 12 | 13 | [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md). 14 | [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 15 | 16 | ## Features 17 | 18 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 19 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi, RockChip](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 20 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 21 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 22 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 23 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 24 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 25 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 26 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 27 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 28 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 29 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 30 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 31 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 32 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 33 | 34 | 35 | ## Install 36 | 37 | ### CMake 38 | 39 | ```cmake 40 | include(${MDK_SDK_DIR}/lib/cmake/FindMDK.cmake) 41 | target_link_libraries(your_target PRIVATE mdk) 42 | ``` 43 | 44 | ### Qt qmake 45 | ```qmake 46 | include($$MDK_SDK_DIR/mdk.pri) 47 | ``` 48 | 49 | ### CocoaPods 50 | 51 | #### (Objective-)C/C++ Users 52 | ```ruby 53 | pod 'mdk' 54 | ``` 55 | 56 | Optionally you can use [mdk.xcframework](https://sourceforge.net/projects/mdk-sdk/files/nightly/mdk-sdk-apple.tar.xz/download) directly. 57 | 58 | #### Swift Users 59 | ```ruby 60 | pod 'swift-mdk' 61 | ``` 62 | 63 | and add 64 | ```swift 65 | import swift_mdk 66 | ``` 67 | 68 | ### Nuget 69 | 70 | Install via [NuGet](https://www.nuget.org/packages/mdk) in Visual Studio for both Windows desktop and UWP 71 | 72 | ## macOS Hardened Runtime 73 | You may fail to run(or codesign) with default hardened runtime options because there are some dylib files in mdk.framework not signed correctly. You can either select `Disable Library Validation` in `Hardened Runtime` options, or sign dylib(**RECOMMENDED**): In `Build Phase`, add a `New Run Script Phase` with content 74 | ```bash 75 | [ -n "$CODE_SIGN_IDENTITY" ] && find "$BUILT_PRODUCTS_DIR" -depth -path "*mdk.framework/*" -name "lib*.dylib" -exec codesign -f -vvvv -s"${EXPANDED_CODE_SIGN_IDENTITY}" ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements,flags {} \; 76 | ``` 77 | 78 | ## Distribute 79 | - mdk(libmdk.so.0/ibmdk.dylib/mdk.dll) and ffmpeg library(or standard ffmpeg libraries) are always REQUIRED 80 | - libass.dll/libass.dylib/ass.framework/libass.so can be optional if not using subtitle rendering 81 | - mdk-braw.dll/libmdk-braw.{so,dylib}: optional, for blackmagic raw videos 82 | - mdk-r3d.dll/libmdk-r3d.{so,dylib}: optional, for RED raw videos 83 | - mdk.pdb/libmdk.so*.dsym: debug symbols. 84 | - Add [libdav1d.dll/libdav1d.dylib/dav1d.framework/libdav1d.so](https://sourceforge.net/projects/mdk-sdk/files/deps/dep.7z/download) to support av1 software decoding 85 | 86 | ## Documents 87 | 88 | - [wiki](https://github.com/wang-bin/mdk-sdk/wiki) 89 | - sdk headers 90 | 91 | 92 | ### Recommended settings 93 | 94 | - macOS, iOS: `player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"});` 95 | - Windows: `player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "DXVA", "CUDA", "hap", "FFmpeg", "dav1d"});` 96 | - Linux: 97 | ```cpp 98 | // XInitThreads(); // If using x11. before any x11 api call. some gui toolkits already call this, e.g. qt, glfw 99 | SetGlobalOption("X11Display", DisplayPtr); // If using x11. Requred by VAAPI, VDPAU 100 | player.setDecoders(MediaType::Video, {"VAAPI", "VDPAU", "CUDA", "hap", "FFmpeg", "dav1d"}); 101 | ``` 102 | - Raspberry Pi: use [mdk-sdk-linux.tar.xz](https://sourceforge.net/projects/mdk-sdk/files/nightly/mdk-sdk-linux.tar.xz/download), delete libffmpeg.so.* to use system ffmpeg to support h264, hevc hardware decoder and use OpenGL ES2/3 0-copy rendering 103 | ```cpp 104 | player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg"}); 105 | ``` 106 | 107 | - RockChip: use [mdk-sdk-linux.tar.xz](https://sourceforge.net/projects/mdk-sdk/files/nightly/mdk-sdk-linux.tar.xz/download), delete libffmpeg.so.* and use https://github.com/nyanmisaka/ffmpeg-rockchip to support rkmpp hardware decoders and use OpenGL ES2/3(mali driver only?) 0-copy rendering, including rendering 10bit videos w/o rga filters(the only player supports this feature!) 108 | 109 | ```cpp 110 | SetGlobalOption("gl.yuv_sampler" "1"); // optional 111 | player.setDecoders(MediaType::Video, {"rkmpp", "FFmpeg"}); 112 | ``` 113 | 114 | - Android: 115 | ```cpp 116 | SetGlobalOption("JavaVM", JvmPtr); // REQUIRED 117 | player.setDecoders(MediaType::Video, {"AMediaCodec", "FFmpeg", "dav1d"}); 118 | ``` 119 | 120 | ## Open Source 121 | ### Modules and Dependencies 122 | - [License generator and validator](https://github.com/wang-bin/appkey) 123 | - [Android java wrapper and example](https://github.com/wang-bin/mdk-android) 124 | - [MediaFoundation decoder module](https://github.com/wang-bin/mdk-mft) 125 | - [av1 software decoder module](https://github.com/wang-bin/mdk-dav1d) 126 | - [sunxi decoder + renderer](https://github.com/wang-bin/mdk-sunxi) 127 | - [GFX surface and render loop](https://github.com/wang-bin/ugs) 128 | - [JNI C++ api](https://github.com/wang-bin/JMI) 129 | - [Android java and jni APIs in C++](https://github.com/wang-bin/AND) 130 | - [C++ TLS](https://github.com/wang-bin/ThreadLocal) 131 | - [C++ compatibility layer](https://github.com/wang-bin/cppcompat) 132 | - [cmake tools](https://github.com/wang-bin/cmake-tools) 133 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 134 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 135 | 136 | ### Examples and Plugins for Other Frameworks 137 | - [examples for different platforms and gui toolkits](https://github.com/wang-bin/mdk-examples) 138 | - [Swift player and QuickLook plugin for macOS](https://github.com/wang-bin/SPV) 139 | - [obs-studio video source plugin](https://github.com/wang-bin/obs-mdk) 140 | - [as a qtmultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 141 | 142 | ### Language Bindings 143 | - [Swift binding](https://github.com/wang-bin/swift-mdk) 144 | - [Flutter/Dart](https://pub.dev/packages/fvp) 145 | - [C#](https://github.com/axojhf/MDK.SDK.NET) 146 | 147 | ## Sponsors 148 | [![Sportimization](https://www.sportimization.com/assets/images/logo_sportimization_small.png)](https://www.sportimization.com) 149 | 150 | ## Users 151 | 152 | BigRingVR 153 | Seer 154 | HeavyM 155 | [![Sportimization](https://www.sportimization.com/assets/images/logo_sportimization_small.png)](https://www.sportimization.com) 156 | 157 | [![Flyability](https://www.flyability.com/hs-fs/hubfs/Brand_Identity/Flyability%20Logo%20Package/2%20-%20Horizontal/flyability_logo_horizontal_color_trimmed-1.png)](https://www.flyability.com) 158 | [![Quipu](http://www.quipu.eu/wp-content/uploads/2015/03/logo-quipu-innovative-solutions-in-medical-ultrasound.png)](www.quipu.eu) 159 | [![GyroFlow](https://gyroflow.xyz/assets/logo.png)](https://gyroflow.xyz) 160 | 161 | [![www.connecting-technology](https://static.wixstatic.com/media/85712a_fe1dd2a84e17437e913dcfcdc89f40a4.jpg/v1/fill/w_460,h_240,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/85712a_fe1dd2a84e17437e913dcfcdc89f40a4.jpg)](https://www.connecting-technology.com) 162 | kalismart 163 | [NOTIONTHEORY](https://www.notiontheory.com/) 164 | smartplayer 165 | smartplayer 166 | 167 | [![teleguard](https://teleguard.com/images/logo.png)](https://teleguard.com)[! 168 | ![DaKanji](https://dakanji.app/wp-content/uploads/thegem-logos/logo_a496404d3d63fd29f344146e428d0992_2x.png)](https://dakanji.app) 169 | [![Pimosa](https://pimosa.app/_next/image?url=%2Flogo_final.png&w=64&q=75)](https://pimosa.app) 170 | API Dash 171 | IPTV Smarters Expert 172 | NexTv 173 | 174 | [easy live tv](https://github.com/aiyakuaile/easy_tv_live) 175 | [Kazumi](https://github.com/Predidit/Kazumi) 176 | [金嵘达科技](http://www.kingroda.com) 177 | [爱玩宝](https://www.aiwanbao.com) 178 | 179 | 180 | 181 | 182 | ## License 183 | 184 | - Free for opensource projects, QtAV donors and contributors: you can acquire a key from me. Can be commercial software 185 | - Free for [Flutter](https://pub.dev/packages/fvp) users. A key is already included. Can be commercial softwares. 186 | - Free for other non-commercial users: you can acquire a key from me. 187 | - Commercial license for other users: a key for an app for a single platform or multiple platforms. 188 | - Other users without a key: make sure your sdk is updated, otherwise you may see an QR image in the last frame. 189 | 190 | 191 | License key generator and validator is [open source](https://github.com/wang-bin/appkey) -------------------------------------------------------------------------------- /README.rpi.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | 3 | **Use generic linux sdk package for raspberry pi3/4 with modern RaspberryPi OS** 4 | 5 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 6 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | 8 | ### Features 9 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 10 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 11 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 12 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 13 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 14 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 15 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 16 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 17 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 18 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 19 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 20 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 21 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 22 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 23 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~7.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 24 | 25 | 26 | ## About SDK for Legacy Raspberry Pi 27 | SDK is cross built by clang 19 with 28 | - cmake toolchain file https://github.com/wang-bin/cmake-tools/blob/master/raspberry-pi.clang.cmake 29 | - sysroot: https://sourceforge.net/projects/avbuild/files/raspberry-pi/raspberry-pi-sysroot.tar.xz/download 30 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/raspberry-pi/ffmpeg-master-raspberry-pi-clang-lite.tar.xz/download 31 | - libc++ 17 32 | 33 | SDK can be used by any C or C++11 compiler, e.g. g++, clang 34 | 35 | pi 4: ALSA_DEVICE=sysdefault 36 | 37 | clang >= 9 result dso can not be loaded on rpi1, maybe there is a bug in lld 38 | 39 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#linux-desktop-raspberry-pi-64bit) 40 | - gapless playback hardware decoders may requires 256M GPU memory 41 | 42 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 43 | - OpenGL 44 | - OpenGL ES2/3 45 | 46 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 47 | - mmal: builtin mmal decoder implementation 48 | - MMAL: FFmpeg mmal decoder implementation 49 | - V4L2: or "FFmpeg:hwaccel=v4l2m2m" 50 | 51 | ### Examples 52 | In legacy driver environment, hardware decoder (MMAL, mmal) supports zero copy rendering in GLES2 and has the best performance 53 | - legacy driver gles2: ./window -c:v MMAL test.mp4 54 | 55 | 56 | In mesa vc4/6 driver environment(fake/full kms), hardware decoder is available, but zero copy rendering is not 57 | - vc4/6 egl+es2: LD_PRELOAD=libX11.so.6 ./window -c:v MMAL test.mp4 # if not link against libX11(except weak) or libpulse 58 | - vc4/6 glx: GL_ES=0 LD_PRELOAD=libGL.so.1 ./window -c:v MMAL test.mp4 # if not link against libGL or libOpenGL 59 | - vc4/6 wayland: ./window -c:v MMAL test.mp4 # assume weston is running in x11 or CLI mode via weston-launch 60 | - vc4/6 gbm: ./window -surface gbm -c:v MMAL test.mp4 # assume weston is running # in CLI mode 61 | 62 | Tested on rpi1 and rpi3. 63 | 64 | > Note: the latest sdk links against libGL.so.1, so no need to set LD_PRELOAD. 65 | 66 | ### Use in CMake Projects 67 | ``` 68 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 69 | target_link_libraries(your_target PRIVATE mdk) 70 | ``` 71 | 72 | ### Qt qmake project 73 | ```qmake 74 | include($$MDK_SDK_DIR/mdk.pri) 75 | ``` 76 | 77 | 78 | ## Source code: 79 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 80 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 81 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 82 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 83 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 84 | 85 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 86 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /README.sunxi.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 3 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 4 | 5 | ### Features 6 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 7 | - [Cross platform: Windows, UWP, Linux, macOS, Android, iOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 8 | - [Hardware accelerated decoders](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 9 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 10 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 11 | - [OpenGL, D3D11, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 12 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 13 | - [HDR display, HDR to SDR and SDR to HDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 14 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 15 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 16 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 17 | - [Smart FFmpeg runtime, dynamic load, compatible with 4.0~7.0 abi](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 18 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#braw), [R3D](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#r3d) 19 | 20 | ## About SDK for SUNXI 21 | 22 | mdk sdk for linux sunxi, with allwinner cedarv and vdpau decoder support 23 | 24 | SDK is cross built by clang 15.0 with 25 | - cmake toolchain file https://github.com/wang-bin/cmake-tools/blob/master/sunxi.clang.cmake 26 | - sysroot: https://sourceforge.net/projects/avbuild/files/sunxi/sunxi-sysroot.tar.xz/download 27 | - ffmpeg: https://sourceforge.net/projects/avbuild/files/sunxi/ffmpeg-master-sunxi-clang-lite.tar.xz/download 28 | - libc++ 16.0 29 | 30 | SDK can be used by any C or C++11 compiler, e.g. g++, clang 31 | 32 | ### Runtime Requirements 33 | - https://linux-sunxi.org/CedarX 34 | - https://linux-sunxi.org/Cedrus/libvdpau-sunxi 35 | 36 | tested device info 37 | - pcdiuno, allwinner a10, sun4i, Linaro 12.11, Linux ubuntu 3.4.29+ #1 PREEMPT Tue Nov 26 15:20:06 CST 2013 armv7l armv7l armv7l GNU/Linux 38 | 39 | ### Examples 40 | - [Best performance] cedarv decoder via libvecore, texture uploading is accelerated by UMP: 41 | 42 | `./bin/mdkplay -c:v CedarX video_file` 43 | 44 | 1080p@24fps 7637kb/s h264 decoding + rendering ~28% cpu 45 | 46 | - cedarv decoder via libvecore, no UMP accelerated: `GLVA_HOST=1 ./bin/mdkplay -c:v CedarX video_file` 47 | 48 | 1080p@24fps 7637kb/s h264 decoding + rendering ~96% cpu 49 | 50 | - vdpau decoder copy mode: `GLVA_HOST=1 ./bin/mdkplay -c:v VDPAU video_file` 51 | 52 | 1080p@24fps 7637kb/s h264 decoding + rendering ~97% cpu 53 | 54 | - vdpau decoder zero copy mode via nv interop extension(not tested, I have no working vdpau driver): `./bin/mdkplay -c:v VDPAU video_file` 55 | 56 | - test decoder speed: 57 | 58 | ``` 59 | ./bin/framereader -c:v CedarX video_file # 1080p h264 ~84fps 60 | ./bin/framereader -c:v FFmpeg video_file # 1080p h264 ~12fps 61 | ``` 62 | 63 | if default audio device does not sound correctly, try to change the device name via environment var `ALSA_DEVICE`, e.g. 64 | 65 | `export ALSA_DEVICE="hw:0,0"` 66 | 67 | ### Use in CMake Projects 68 | ``` 69 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 70 | target_link_libraries(your_target PRIVATE mdk) 71 | ``` 72 | 73 | ## Source code: 74 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 75 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 76 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 77 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 78 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 79 | 80 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 81 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /ci-after-build.sh: -------------------------------------------------------------------------------- 1 | ls -lh build/${TARGET_OS}* 2 | if [ -f build/${TARGET_OS}/libmdk.so ]; then 3 | readelf -d build/${TARGET_OS}/libmdk.so 4 | fi 5 | if [ -f build/${TARGET_OS}/cmake_install.cmake ]; then 6 | cmake -P build/${TARGET_OS}/cmake_install.cmake 7 | tools/mksdk.sh mdk-sdk || echo done 8 | fi 9 | if [ -f mdk-sdk/lib/mdk.framework/mdk ]; then 10 | otool -l mdk-sdk/lib/mdk.framework/mdk 11 | otool -L mdk-sdk/lib/mdk.framework/mdk 12 | echo codesign 13 | codesign --force --sign - --deep --timestamp mdk-sdk/lib/mdk.framework 14 | fi 15 | for s in build/${TARGET_OS}-*; do 16 | echo "sdk: $s" 17 | a=${s/*${TARGET_OS}-/} 18 | echo "arch: $a" 19 | if [ -f build/${TARGET_OS}-$a/cmake_install.cmake ]; then 20 | cmake -P build/${TARGET_OS}-$a/cmake_install.cmake 21 | tools/mksdk.sh mdk-sdk-$a $a || echo done # FIXME: android arch 22 | fi 23 | done 24 | find mdk-sdk* -name "*.a" -delete 25 | 26 | echo stripping 27 | export PATH=$PATH:$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin 28 | : ${STRIP:=llvm-strip-$LLVM_VER} 29 | which $STRIP || STRIP=llvm-strip 30 | [ "$TARGET_OS" == "macOS" ] && STRIP=strip && STRIP_ARGS="-u -r" 31 | ls -lh mdk-sdk*/bin/* 32 | which $STRIP && find mdk-sdk*/bin -type f -exec $STRIP $STRIP_ARGS {} \; 33 | ls -lh mdk-sdk*/bin/* 34 | export XZ_OPT="-T0" # -9e. -8/9 will disable mt? 35 | if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == "uwp"* || "$TARGET_OS" == "android" ]]; then 36 | 7z a -ssc -m0=lzma2 -mx=9 -ms=on -mf=off mdk-sdk-${TARGET_OS}.7z mdk-sdk 37 | ls -lh mdk-sdk-${TARGET_OS}.7z 38 | else 39 | TAR=tar 40 | # brew install gnu-tar. gtar result is 1/3 much smaller, but 1/2 slower, also no hidden files(GNUSparseFile.0). T0 is 2x faster than bsdtar 41 | which gtar && TAR=gtar 42 | $TAR Jcvf mdk-sdk-${TARGET_OS}.tar.xz mdk-sdk 43 | ls -lh mdk-sdk-${TARGET_OS}.tar.xz 44 | fi 45 | #if [ `which sshpass` ]; then 46 | #echo sshpass -p "$SF_PW" scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz $SF_USER@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 47 | #sshpass -e scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz $SF_USER@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 48 | #sshpass -e scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz $SF_USER@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ 49 | #echo $? 50 | #fi -------------------------------------------------------------------------------- /ci-before-build.sh: -------------------------------------------------------------------------------- 1 | NDK_HOST=linux 2 | FF_EXTRA=-clang 3 | FFPKG_EXT=tar.xz 4 | 5 | echo "EXTERNAL_DEP_CACHE_HIT: ${EXTERNAL_DEP_CACHE_HIT}" 6 | echo "DEVTOOLS_CACHE_HIT: ${DEVTOOLS_CACHE_HIT}" 7 | 8 | du -hc external 9 | 10 | tolower(){ 11 | echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12 | } 13 | 14 | crt_extra=$(tolower ${CRT_EXTRA}) 15 | 16 | if [[ "$TARGET_OS" == mac* || "$TARGET_OS" == iOS* || "$TARGET_OS" == tvOS* || "$TARGET_OS" == xr* || "$TARGET_OS" == vision* || "$TARGET_OS" == android ]]; then 17 | FF_EXTRA= 18 | fi 19 | if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == "uwp"* ]]; then 20 | FF_EXTRA=-vs2022${crt_extra} 21 | FFPKG_EXT=7z 22 | fi 23 | if [ `which dpkg` ]; then # TODO: multi arch 24 | pkgs="sshpass cmake ninja-build p7zip-full" 25 | #wget https://apt.llvm.org/llvm.sh 26 | if [[ "$TARGET_OS" != android ]]; then 27 | #bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 28 | wget https://apt.llvm.org/llvm.sh 29 | chmod +x llvm.sh 30 | sudo ./llvm.sh ${LLVM_VER} all 31 | fi 32 | if [ "$TARGET_OS" == "linux" ]; then 33 | pkgs+=" libegl1-mesa-dev libgles2-mesa-dev libgl1-mesa-dev libgbm-dev libx11-dev libwayland-dev libasound2-dev libopenal-dev libpulse-dev libva-dev libvdpau-dev libglfw3-dev libsdl2-dev" 34 | elif [ "$TARGET_OS" == "sunxi" -o "$TARGET_OS" == "raspberry-pi" ]; then 35 | pkgs+=" binutils-arm-linux-gnueabihf" 36 | fi 37 | sudo apt install -y $pkgs 38 | elif [ `which brew` ]; then 39 | export HOMEBREW_NO_AUTO_UPDATE=true 40 | #time brew update --preinstall 41 | export HOMEBREW_NO_AUTO_UPDATE=1 42 | pkgs="ninja vulkan-headers dav1d md5sha1sum" # p7zip gnu-tar 43 | #pkgs+=" cmake" # visionOS simulator requires cmake 3.28.4 44 | if [[ "$DEVTOOLS_CACHE_HIT" != "true" ]]; then 45 | pkgs+=" hudochenkov/sshpass/sshpass" 46 | fi 47 | if [ "$TARGET_OS" == "macOS" ]; then 48 | pkgs+=" glfw sdl2" 49 | echo "$TARGET_ARCH" |grep arm >/dev/null || { # FIXME: arm64 host build 50 | pkgs+=" xquartz pulseaudio" # no more cask 51 | } 52 | fi 53 | time brew install $pkgs 54 | type -a cmake 55 | NDK_HOST=darwin 56 | fi 57 | 58 | OS=${TARGET_OS/r*pi/rpi} 59 | OS=${OS/*store/WinRT} 60 | OS=${OS/*uwp*/WinRT} 61 | OS=${OS%%-*} 62 | #OS=${OS/Simulator/} # 63 | [ "$TARGET_OS" == "linux" ] && OS=Linux 64 | mkdir -p external/{bin,lib}/$OS 65 | 66 | if [[ "$EXTERNAL_DEP_CACHE_HIT" != "true" ]]; then 67 | FFPKG=ffmpeg-${FF_VER}-${TARGET_OS}${FF_EXTRA}-lite${LTO_SUFFIX} 68 | curl -kL -o ffmpeg-${TARGET_OS}.${FFPKG_EXT} https://sourceforge.net/projects/avbuild/files/${TARGET_OS}/${FFPKG}.${FFPKG_EXT}/download 69 | if [[ "${FFPKG_EXT}" == 7z ]]; then 70 | 7z x ffmpeg-${TARGET_OS}.${FFPKG_EXT} 71 | else 72 | tar Jxf ffmpeg-${TARGET_OS}.${FFPKG_EXT} 73 | fi 74 | #find ${FFPKG}/lib -name "libav*.so*" -o -name "libsw*.so*" -delete 75 | find ${FFPKG}/lib -name "libffmpeg.a" -delete # FIXME: linking to libffmpeg.a(relocatable obj) by ci results in larger binary size 76 | cp -af ${FFPKG}/lib/* external/lib/$OS 77 | cp -af ${FFPKG}/include external/ 78 | cp -af ${FFPKG}/bin/* external/bin/$OS # ffmpeg dll 79 | 80 | if [ "$TARGET_OS" == "sunxi" ]; then 81 | mkdir -p external/lib/sunxi/armv7 82 | cp -af ${FFPKG}/lib/* external/lib/sunxi/armv7 #single arch package 83 | elif [ "$TARGET_OS" == "windows-desktop" ]; then 84 | # TODO: download in cmake(if check_include_files failed) 85 | curl -kL -o vk.zip https://github.com/KhronosGroup/Vulkan-Headers/archive/main.zip 86 | 7z x vk.zip 87 | cp -af Vulkan-Headers-main/include/* external/include/ 88 | fi 89 | 90 | if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == "uwp"* || "$TARGET_OS" == macOS ]]; then 91 | mkdir -p external/include/{EGL,GLES{2,3},KHR} 92 | for h in GLES2/gl2.h GLES2/gl2ext.h GLES2/gl2platform.h GLES3/gl3.h GLES3/gl3platform.h; do 93 | curl -kL -o external/include/${h} https://www.khronos.org/registry/OpenGL/api/${h} 94 | done 95 | for h in EGL/egl.h EGL/eglext.h EGL/eglplatform.h KHR/khrplatform.h; do 96 | curl -kL -o external/include/${h} https://www.khronos.org/registry/EGL/api/${h} 97 | done 98 | fi 99 | if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == macOS || "$TARGET_OS" == "linux" ]]; then 100 | curl -kL -o R3DSDK.7z https://sourceforge.net/projects/mdk-sdk/files/deps/r3d/R3DSDK.7z/download 101 | 7z x R3DSDK.7z -oexternal 102 | fi 103 | fi 104 | 105 | curl -kL -o libmdk-dep.zip https://nightly.link/wang-bin/devpkgs/workflows/build/main/libmdk-dep.zip 106 | 7z x libmdk-dep.zip 107 | 7z x dep.7z 108 | cp -af dep/* external/ 109 | 110 | if [[ "$SYSROOT_CACHE_HIT" != "true" ]]; then 111 | if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == "uwp"* ]]; then 112 | wget https://sourceforge.net/projects/avbuild/files/dep/msvcrt-dev.7z/download -O msvcrt-dev.7z 113 | echo 7z x msvcrt-dev.7z -o${WINDOWSSDKDIR%/?*} 114 | 7z x msvcrt-dev.7z -o${WINDOWSSDKDIR%/?*} 115 | wget https://sourceforge.net/projects/avbuild/files/dep/winsdk.7z/download -O winsdk.7z 116 | echo 7z x winsdk.7z -o${WINDOWSSDKDIR%/?*} 117 | 7z x winsdk.7z -o${WINDOWSSDKDIR%/?*} 118 | ${WINDOWSSDKDIR}/lowercase.sh 119 | ${WINDOWSSDKDIR}/mkvfs.sh 120 | fi 121 | 122 | if [ "$TARGET_OS" == "sunxi" -o "$TARGET_OS" == "raspberry-pi" -o "$TARGET_OS" == "linux" ]; then 123 | wget https://sourceforge.net/projects/avbuild/files/${TARGET_OS}/${TARGET_OS/r*pi/rpi}-sysroot.tar.xz/download -O sysroot.tar.xz 124 | tar Jxf sysroot.tar.xz 125 | fi 126 | 127 | if [ "$TARGET_OS" == "android" -a ! -d "$ANDROID_NDK_LATEST_HOME" ]; then 128 | wget https://dl.google.com/android/repository/android-ndk-${NDK_VERSION:-r25b}-${NDK_HOST}-x86_64.zip -O ndk.zip 129 | 7z x ndk.zip -o/tmp &>/dev/null 130 | mv /tmp/android-ndk-${NDK_VERSION:-r25b} ${ANDROID_NDK:-/tmp/android-ndk} 131 | fi 132 | fi 133 | -------------------------------------------------------------------------------- /mdk.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'mdk' 3 | s.version = '0.33.0' 4 | s.summary = 'Multimedia Development Kit' 5 | s.homepage = 'https://github.com/wang-bin/mdk-sdk' 6 | 7 | s.author = { 'Wang Bin' => 'wbsecg1@gmail.com' } 8 | s.license = { :type => 'Commercial', :text => <<-LICENSE 9 | Copyright 2020-2025 WangBin 10 | 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: 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 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. 13 | LICENSE 14 | } 15 | 16 | s.platform = :osx, :ios, :tvos, :visionos 17 | s.source = { :http => 'https://sourceforge.net/projects/mdk-sdk/files/nightly/mdk-sdk-apple.tar.xz' } 18 | s.vendored_frameworks = 'mdk-sdk/lib/mdk.xcframework' 19 | # s.osx.vendored_libraries = 'mdk-sdk/lib/mdk.xcframework/macos-arm64_x86_64/mdk.framework/Versions/A/libffmpeg.7.dylib', 'mdk-sdk/lib/mdk.xcframework/macos-arm64_x86_64/mdk.framework/Versions/A/libass.dylib', 'mdk-sdk/lib/mdk.xcframework/macos-arm64_x86_64/mdk.framework/Versions/A/libmdk-braw.dylib', 'mdk-sdk/lib/mdk.xcframework/macos-arm64_x86_64/mdk.framework/Versions/A/libmdk-r3d.dylib' 20 | s.osx.deployment_target = '10.13' 21 | s.ios.deployment_target = '12.0' 22 | s.tvos.deployment_target = '12.0' 23 | s.visionos.deployment_target = '1.0' 24 | s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=*simulator*]' => 'i386'} 25 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=*simulator*]' => 'i386'} 26 | s.visionos.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=*simulator*]' => 'x86_64'} # optional? 27 | s.visionos.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=*simulator*]' => 'x86_64'} 28 | # s.user_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => '' } 29 | # s.pod_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => '' } # VALID_ARCHS is removed in xcode12.0 30 | #s.pod_target_xcconfig = { 'ARCHS[sdk=iphonesimulator*]' => '$(ARCHS_STANDARD_64_BIT)' } 31 | end 32 | -------------------------------------------------------------------------------- /mksdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SDK_DIR=$1 3 | ARCH=$2 4 | SDK_DIR_OUT=$SDK_DIR 5 | [ -n "$ARCH" ] && SDK_DIR_OUT=mdk-sdk 6 | mkdir -p $SDK_DIR_OUT 7 | 8 | mkdir -p $SDK_DIR/include # for apple 9 | SDK_INCLUDE=$SDK_DIR/include/mdk 10 | TMP=`mktemp -d` 11 | # TODO: cmake files for different arch 12 | #find $SDK_DIR/lib -name "*.dylib" -a ! -name "libmdk*.dylib" -exec strip -u -r {} \; 13 | tar cf $TMP/cmake.tar $SDK_DIR/lib/cmake/FindMDK.cmake 14 | if [ -d $SDK_DIR/lib/mdk.framework ]; then 15 | tar cf $TMP/h.tar $SDK_DIR/lib/mdk.framework 16 | rm -rf $SDK_DIR/lib/* 17 | tar xf $TMP/h.tar 18 | ln -sf lib $SDK_DIR/Frameworks 19 | [ -d $SDK_INCLUDE ] && rm -rf $SDK_INCLUDE 20 | [ -L $SDK_INCLUDE ] && rm -f $SDK_INCLUDE 21 | ln -sfv ../lib/mdk.framework/Headers $SDK_INCLUDE #gln -rsfv $SDK_DIR/lib/mdk.framework/Headers $SDK_INCLUDE 22 | mv -v $SDK_DIR/lib/mdk.framework/Versions/Current/mdk.dSYM $SDK_DIR/lib/mdk.framework.dSYM 23 | mv -v $SDK_DIR/lib/mdk.framework/mdk.dSYM $SDK_DIR/lib/mdk.framework.dSYM # iOS 24 | ffdso=(`find $SDK_DIR/lib/mdk.framework -name "libffmpeg.*.dylib"`) 25 | ffdso=${ffdso[$((${#ffdso[@]}-1))]} 26 | ffdso=${ffdso##*lib/} 27 | [ -n "$ffdso" ] && ln -sf $ffdso $SDK_DIR/lib/ 28 | assdso=(`find $SDK_DIR/lib/mdk.framework -name "libass.*.dylib"`) 29 | assdso=${assdso[$((${#assdso[@]}-1))]} 30 | assdso=${assdso##*lib/} 31 | [ -n "$assdso" ] && ln -sf $assdso $SDK_DIR/lib/ 32 | else 33 | tar cf $TMP/h.tar $SDK_DIR/include/mdk 34 | rm -rf $SDK_DIR/include/* 35 | tar xf $TMP/h.tar 36 | if [ -L "$SDK_DIR/lib/libmdk.so" ]; then # on macOS, a symlink is not a regular file, on linux it is 37 | cp -afv $SDK_DIR/lib/libmdk.so $TMP/ 38 | cp -afvL $SDK_DIR/lib/libmdk-*.so $TMP/ 39 | cp -afvL $SDK_DIR/lib/libmdk*.dsym $TMP/ 40 | cp -afvL $SDK_DIR/lib/lib{ass,ffmpeg,mdk}.so.? $TMP/ 41 | cp -afvL $SDK_DIR/lib/libc++.so.1 $TMP/ 42 | elif [ -f "$SDK_DIR/lib/libmdk.so" ]; then # android 43 | cp -afvL $SDK_DIR/lib/lib{ass,ffmpeg,mdk-*}.so $TMP/ 44 | cp -afvL $SDK_DIR/lib/libmdk.so $TMP/ 45 | cp -afvL $SDK_DIR/lib/libmdk.so.dsym $TMP/ 46 | elif [ -f "$SDK_DIR/lib/mdk.lib" ]; then 47 | cp -afvL $SDK_DIR/lib/mdk.lib $TMP/ 48 | cp -afvL $SDK_DIR/bin/{ffmpeg,mdk}*.dll $TMP/ 49 | cp -afvL $SDK_DIR/bin/libass*.dll $TMP/ 50 | cp -afvL $SDK_DIR/bin/mdk*.pdb $TMP/ 51 | elif [ -f "$SDK_DIR/lib/libmdk.dll.a" ]; then 52 | cp -afvL $SDK_DIR/lib/libmdk.dll.a $TMP/ 53 | cp -afvL $SDK_DIR/bin/lib{ass,ffmpeg,mdk}*.dll $TMP/ 54 | fi 55 | rm -rfv $SDK_DIR/lib/* $SDK_DIR/bin/*.{dll,pdb} # clean up unneeded files 56 | 57 | mkdir -p $SDK_DIR_OUT/bin/$ARCH 58 | mv $TMP/*mdk*.{dll,pdb} $TMP/*ffmpeg-?.dll $TMP/libass*.dll $SDK_DIR_OUT/bin/$ARCH 59 | 60 | mkdir -p $SDK_DIR_OUT/lib/$ARCH 61 | mv -v $TMP/libmdk* $TMP/mdk.lib $TMP/libffmpeg.so* $TMP/libass.so $TMP/libc++.so.1 $SDK_DIR_OUT/lib/$ARCH 62 | fi 63 | tar xf $TMP/cmake.tar 64 | 65 | if [ -d "$SDK_INCLUDE/cpp" ]; then 66 | rm -rf $SDK_INCLUDE/*.h 67 | hs=(`find "$SDK_INCLUDE/cpp" -name "*.h"`) 68 | for h in ${hs[@]}; do 69 | echo $h 70 | sed '/#include /s/\.\.\/c\//c\//g' $h > $SDK_INCLUDE/${h##*/} 71 | done 72 | rm -rf "$SDK_INCLUDE/cpp" 73 | fi 74 | 75 | [ -n "$ARCH" ] && { 76 | cp -anvf $SDK_DIR/include $SDK_DIR_OUT 77 | cp -anvf $SDK_DIR/build $SDK_DIR_OUT # for win 78 | cp -anvf $SDK_DIR/doc $SDK_DIR_OUT 79 | cp -nvf $SDK_DIR/* $SDK_DIR_OUT 80 | mkdir -p $SDK_DIR_OUT/lib/cmake/ 81 | cp -anvf $SDK_DIR/lib/cmake/FindMDK.cmake $SDK_DIR_OUT/lib/cmake/ 82 | BIN_DIR_OUT=$SDK_DIR_OUT/bin/$ARCH 83 | mkdir -p $BIN_DIR_OUT 84 | cp -nvf $SDK_DIR/bin/* $BIN_DIR_OUT 85 | } 86 | rm -rf $TMP -------------------------------------------------------------------------------- /mksrc.sh: -------------------------------------------------------------------------------- 1 | 2 | SRC_DIR=$1 3 | INSTALL_DIR=$2 4 | 5 | mkdir -p $INSTALL_DIR/src/{base,core,subtitle} 6 | cp -avf ${SRC_DIR}/core/*.cpp $INSTALL_DIR/src/core 7 | cp -avf ${SRC_DIR}/core/*.h $INSTALL_DIR/src/core 8 | cp -avf ${SRC_DIR}/base/*.h* $INSTALL_DIR/src/base 9 | cp -af ${SRC_DIR}/base/cppcompat $INSTALL_DIR/src/base 10 | cp -avf ${SRC_DIR}/subtitle/SubtitleImageProducer.h $INSTALL_DIR/src/subtitle -------------------------------------------------------------------------------- /nuget/MDK.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UAP 5 | $(MSBuildThisFileDirectory)..\..\bin\$(mdk-DeviceType)\$(PlatformTarget)\ 6 | $(MSBuildThisFileDirectory)..\..\lib\$(PlatformTarget)\ 7 | $(MSBuildThisFileDirectory)..\..\include\ 8 | 9 | 10 | 11 | 12 | $(mdk-LibPath);%(AdditionalLibraryDirectories) 13 | mdk.lib;%(AdditionalDependencies) 14 | 15 | 16 | 17 | 18 | 19 | $(mdk-IncPath);%(AdditionalIncludeDirectories) 20 | 21 | 22 | 23 | 24 | 25 | MdkBinaries 26 | $(ProjectName) 27 | %(Filename)%(Extension) 28 | True 29 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /nuget/README.md: -------------------------------------------------------------------------------- 1 | ## MDK: Multimedia Development Kit 2 | 3 | ### [Changelog](https://github.com/wang-bin/mdk-sdk/blob/master/Changelog.md) 4 | ### [API](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 5 | 6 | 7 | ### Features 8 | - [Simple and powerful API set](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs) 9 | - [Cross platform: Windows(x86, arm), UWP, Linux, macOS, Android, iOS, tvOS, visionOS, Raspberry Pi](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements) 10 | - [Hardware accelerated decoders for all platforms](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 11 | - [0-copy GPU rendering for all platforms and all renderers(Vulkan is WIP.)](https://github.com/wang-bin/mdk-sdk/wiki/Zero-Copy-Renderer) 12 | - [Dynamic OpenGL](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix) 13 | - [OpenGL, D3D11, D3D12, Vulkan and Metal rendering w/ or w/o user provided context](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 14 | - Integrated with any platform native ui apps, gui toolkits or other apps via [OpenGL, D3D11/12, Vulkan and Metal](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) ([WinUI3](https://github.com/Damix48/WinUI3MDK/tree/main), [OBS](https://github.com/wang-bin/obs-mdk), [Flutter](https://pub.dev/packages/fvp), [Qt](https://github.com/wang-bin/mdk-examples/tree/master/Qt), [SDL](https://github.com/wang-bin/mdk-examples/tree/master/SDL), [GLFW](https://github.com/wang-bin/mdk-examples/tree/master/GLFW), [SFML](https://github.com/wang-bin/mdk-examples/tree/master/SFML), [.NET Avalonia](https://github.com/wang-bin/mdk-examples/tree/master/Avalonia) etc.) easily 15 | - [HDR display metadata passthrough, HDR <=> SDR tone mapping](https://github.com/wang-bin/mdk-sdk/wiki/HDR). You can use HDR display in [Qt6(6.6+ for macOS, 6.x for windows)](https://github.com/wang-bin/mdk-examples/tree/master/Qt/qmlrhi), [OBS Studio](https://github.com/wang-bin/obs-mdk), Android SurfaceView and more. 16 | - Dolby Vision rendering, including Profile 5. Support HEVC and AV1. 17 | - HEVC, VP8/9 transparent videos(alpha channel) support for all decoders and renderers 18 | - Professional codecs: GPU accelerated [HAP](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) codec rendering, [Blackmagic RAW](https://github.com/wang-bin/mdk-braw), [R3D](https://github.com/wang-bin/mdk-r3d), [nvJPEG2000](https://github.com/wang-bin/mdk-nvjp2k) 19 | - Subtitle rendering, including ass, plain text, bitmap, closed caption 20 | - [Seamless/Gapless media and bitrate switch for any media](https://github.com/wang-bin/mdk-sdk/wiki/Player-APIs#player-setcolorspace-value-void-vo_opaque--nullptr) 21 | - Optimized Continuous seeking. As fast as mpv, but much lower cpu, memory and gpu load. Suitable for [timeline preview](https://github.com/wang-bin/mdk-sdk/wiki/Typical-Usage#timeline-preview) 22 | - [Smart FFmpeg runtime, dynamic load, binary compatible with 4.0~8.x](https://github.com/wang-bin/mdk-sdk/wiki/FFmpeg-Runtime) 23 | 24 | 25 | ## About SDK for Windows Desktop & UWP 26 | SDK is built by 27 | - latest VS2022 with [FFmpeg win32](https://sourceforge.net/projects/avbuild/files/windows-desktop/ffmpeg-master-windows-desktop-vs2022-lite.7z/download) and [FFmpeg UWP](https://sourceforge.net/projects/avbuild/files/uwp/ffmpeg-master-uwp-vs2022-lite.7z/download) 28 | 29 | SDK can be used by any C or C++11 compiler, e.g. vs2015, vs2022, mingw g++, clang 30 | 31 | ### Use in CMake Projects 32 | ``` 33 | include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) 34 | target_link_libraries(your_target PRIVATE mdk) 35 | ``` 36 | 37 | ### Qt qmake project 38 | ```qmake 39 | include($$MDK_SDK_DIR/mdk.pri) 40 | ``` 41 | 42 | 43 | ### Recommended settings 44 | ```cpp 45 | player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "CUDA", "hap", "FFmpeg", "dav1d"}); 46 | ``` 47 | 48 | ### [Runtime Requirements](https://github.com/wang-bin/mdk-sdk/wiki/System-Requirements#windows-desktop) 49 | - Vista+ 50 | - ucrt, vc140+ runtime 51 | 52 | Optional: 53 | - libEGL.dll, libGLESv2.dll, D3DCompiler_47/43.dll. Qt apps can use qt's dlls 54 | - vulkan 55 | 56 | ### [Supported Graphics APIs:](https://github.com/wang-bin/mdk-sdk/wiki/Render-API) 57 | - D3D11: recommended 58 | - D3D12 59 | - [OpenGL(No UWP)](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via WGL. The default if EGL runtime is not found. 60 | - [OpenGL ES2/3](https://github.com/wang-bin/mdk-sdk/wiki/OpenGL-Support-Matrix): via ANGLE or others. The default if EGL runtime is found. 61 | - Vulkan(No UWP) 62 | 63 | ### [Supported Decoders:](https://github.com/wang-bin/mdk-sdk/wiki/Decoders) 64 | - [FFmpeg](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#ffmpeg). options: threads=N. e.g. -c:v FFmpeg. -c:v FFmpeg:threads=4 65 | - [MFT](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#mft). options: d3d=0/9/11/12, pool=0/1. e.g. -c:v MFT(software), -c:v MFT:d3d=11(hardware) or MFT:d3d=12. 66 | - [CUDA](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#cuda)(No UWP) 67 | - [D3D11](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#d3d11): via FFmpeg 68 | - [DXVA](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#dxva)(No UWP): via FFmpeg 69 | - [NVDEC](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#nvdec)(No UWP): via FFmpeg 70 | - CUVID(No UWP): via FFmpeg 71 | - [QSV](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#qsv)(No UWP): via FFmpeg 72 | - [BRAW](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#braw): Blackmagic RAW 73 | - [R3D](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#r3d): R3D RAW 74 | - [hap](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#hap) 75 | - [VAAPI](https://github.com/wang-bin/mdk-sdk/wiki/Decoders#vaapi) 76 | 77 | ## Source code: 78 | - [some examples using mdk sdk](https://github.com/wang-bin/mdk-examples) 79 | - [OBS Studio plugin](https://github.com/wang-bin/obs-mdk) 80 | - [QtMultimedia plugin](https://github.com/wang-bin/qtmultimedia-plugins-mdk) 81 | - [MFT decoder module](https://github.com/wang-bin/mdk-mft) 82 | - [dav1d decoder module](https://github.com/wang-bin/mdk-dav1d) 83 | - [Blackmagic RAW](https://github.com/wang-bin/mdk-braw) 84 | - [R3D RAW](https://github.com/wang-bin/mdk-r3d) 85 | 86 | 87 | Copyright (c) 2016-2025 WangBin(the author of QtAV) 88 | Free for opensource softwares, non-commercial softwares, flutter, QtAV donors and contributors. -------------------------------------------------------------------------------- /nuget/mdk.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | mdk 5 | 0.33.0.0 6 | MDK 7 | Wang Bin 8 | Wang Bin 9 | false 10 | MIT 11 | 12 | https://github.com/wang-bin/mdk-sdk 13 | 14 | C/C++ Multimedia Development Kit 15 | Cross platform multimedia development kit in C/C++ 16 | https://github.com/wang-bin/mdk-sdk/releases 17 | Copyright 2025 18 | Multimedia MediaPlayer VideoPlayer Video Player Playback HDR DolbyVision FFmpeg CrossPlatform UWP WOA WinUI3 OpenGL Vulkan D3D11 D3D12 BRAW Hap R3D DCP HEVC-Alpha 19 | README.md 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /upload.mk: -------------------------------------------------------------------------------- 1 | all: apple_txz apple_zip mac_txz upload_win_ltl upload_win upload_win64 upload_uwp upload_nupkg 2 | 3 | apple_txz: 4 | [ -f mdk-sdk-apple.tar.xz ] && sshpass -p $$SF_PW scp -o StrictHostKeyChecking=no mdk-sdk-apple.tar.xz $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-apple.tar.xz 5 | mac_txz: 6 | [ -f mdk-sdk-macOS.tar.xz ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-macOS.tar.xz $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-macOS.tar.xz 7 | apple_zip: 8 | [ -f mdk-sdk-apple.zip ] && sshpass -p $$SF_PW scp -o StrictHostKeyChecking=no mdk-sdk-apple.zip $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-apple.zip 9 | upload_win_ltl: 10 | [ -f mdk-sdk-windows-desktop-vs2022-ltl.7z ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-windows-desktop-vs2022-ltl.7z $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-windows-desktop-vs2022-ltl.7z 11 | upload_win: 12 | [ -f mdk-sdk-windows-desktop-vs2022.7z ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-windows-desktop-vs2022.7z* $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-windows-desktop-vs2022.7z 13 | upload_win64: 14 | [ -f mdk-sdk-windows-desktop-vs2022-x64.7z ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-windows-desktop-vs2022-x64.7z* $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-windows-desktop-vs2022-x64.7z 15 | upload_uwp: 16 | [ -f mdk-sdk-uwp-vs2022.7z ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-uwp-vs2022.7z $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-sdk-uwp-vs2022.7z 17 | upload_nupkg: 18 | [ -f mdk-vs2022.nupkg ] && sshpass -p $${SF_PW} scp -o StrictHostKeyChecking=no mdk-vs2022.nupkg $${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/ || echo no mdk-vs2022.nupkg 19 | 20 | .PHONY: all 21 | --------------------------------------------------------------------------------