### Gapless Playback with MDK Examples Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Demonstrates how to achieve gapless playback of multiple audio and video files using MDK's `glfwplay` or `sdlplay` example command-line tools. ```Shell glfwplay/sdlplay video1 video2 ... ``` -------------------------------- ### Integrate MDK SDK with Qt qmake Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet demonstrates how to include the MDK SDK in a Qt qmake project. It requires the MDK_SDK_DIR variable to be defined, pointing to the SDK's installation directory, to correctly include the mdk.pri file. ```QMake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### MDK SDK Playback and Context Examples Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Demonstrates various command-line options for MDK SDK players (`glfwplay`, `mdkplay`, `multiplayers`, `multiwindows`) to configure GL contexts, achieve gapless playback, and manage multiple players or windows. ```shell glfwplay -gl:opengl=1 glwfplay -gl:opengl=1:egl=1 glwfplay -gl mdkplay x11win ``` ```shell glfwplay multiplayers multiwindows (via glfw) sdlplay(via sdl) ``` ```shell mdkplay file file2 ... ``` ```shell multiplayers -share -win N url ``` ```shell multiplayers -share url1 url2 ... urlN ``` ```shell multiwidnows url ``` -------------------------------- ### Install MDK SDK via CocoaPods for Objective-C/C++ Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet provides the Podfile entry for installing the MDK SDK for Objective-C/C++ projects using CocoaPods. Users can also opt to use the mdk.xcframework directly as an alternative installation method. ```Ruby pod 'mdk' ``` -------------------------------- ### Install MDK SDK via CocoaPods for Swift Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet shows the Podfile entry for Swift projects using CocoaPods to install the MDK SDK, along with the required import statement. It enables Swift projects to access MDK functionalities after installation. ```Ruby pod 'swift-mdk' ``` ```Swift import swift_mdk ``` -------------------------------- ### Configure MDK-SDK Video Decoders for Windows Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet provides the recommended video decoder settings for MDK-SDK on Windows, leveraging hardware acceleration APIs like MFT, D3D11, DXVA, and CUDA, along with hap, FFmpeg, and dav1d. ```C++ player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "DXVA", "CUDA", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### MDK SDK Command-Line Playback Examples Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md Demonstrates various command-line usages of MDK SDK players for different playback scenarios, including gapless playback, multiple players for one video, multiple videos with multiple players, and multiple renderers for one player. ```Shell mdkplay.exe(or glfwplay.exe/window.exe/sdlplay.exe) file file2 ... ``` ```Shell multiplayers -es -share -c:v D3D11 -win N url ``` ```Shell multiplayers -es -share -c:v D3D11 url1 url2 ... urlN ``` ```Shell multiwidnows url ``` -------------------------------- ### Configure MDK SDK Global Options and Decoders in C++ Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Android.md Example C++ code demonstrating how to set the JavaVM global option and configure video decoders for the MDK player, prioritizing AMediaCodec, FFmpeg, and dav1d. ```C++ SetGlobalOption("JavaVM", JvmPtr); // REQUIRED player.setDecoders(MediaType::Video, {"AMediaCodec", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Configure MDK-SDK Video Decoders for Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet provides recommended video decoder settings for MDK-SDK on Raspberry Pi, focusing on V4L2M2M and FFmpeg with DRM hardware context for optimal performance with system FFmpeg and OpenGL ES rendering. ```C++ player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg"}); ``` -------------------------------- ### Multiple Renderers for Single Player with MDK Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Example of using a single MDK player to render a video across multiple windows or renderers. ```Shell multiwidnows url ``` -------------------------------- ### Configure MDK-SDK Video Decoders for RockChip Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet details recommended video decoder settings for MDK-SDK on RockChip devices, including an optional global option for YUV sampler and prioritizing rkmpp for hardware decoding, especially for 10-bit videos with OpenGL ES rendering. ```C++ SetGlobalOption("gl.yuv_sampler" "1"); // optional player.setDecoders(MediaType::Video, {"rkmpp", "FFmpeg"}); ``` -------------------------------- ### Configure MDK-SDK Video Decoders for Linux Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet outlines the recommended video decoder settings for MDK-SDK on Linux, including optional X11 display configuration and prioritizing VAAPI, VDPAU, CUDA, hap, FFmpeg, and dav1d for hardware acceleration. ```C++ // XInitThreads(); // If using x11. before any x11 api call. some gui toolkits already call this, e.g. qt, glfw SetGlobalOption("X11Display", DisplayPtr); // If using x11. Requred by VAAPI, VDPAU player.setDecoders(MediaType::Video, {"VAAPI", "VDPAU", "CUDA", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### MDK SDK Supported Video Decoders and Options Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md Lists the video decoders supported by MDK SDK, along with their configuration options and usage examples. Some decoders have platform limitations (e.g., No UWP). ```APIDOC Decoders: - FFmpeg: Description: General-purpose video decoder. Options: threads: N (Number of threads) Example Usage: -c:v FFmpeg -c:v FFmpeg:threads=4 - MFT: Description: Microsoft Media Foundation Transform decoder. Options: d3d: 0/9/11/12 (Direct3D version for hardware acceleration) pool: 0/1 (Memory pool usage) Example Usage: -c:v MFT(software) -c:v MFT:d3d=11(hardware) -c:v MFT:d3d=12 - CUDA: Description: NVIDIA CUDA decoder. Limitations: No UWP support. - D3D11: Description: Direct3D 11 decoder, via FFmpeg. - DXVA: Description: DirectX Video Acceleration decoder, via FFmpeg. Limitations: No UWP support. - NVDEC: Description: NVIDIA NVDEC decoder, via FFmpeg. Limitations: No UWP support. - CUVID: Description: NVIDIA CUVID decoder, via FFmpeg. Limitations: No UWP support. - QSV: Description: Intel Quick Sync Video decoder, via FFmpeg. Limitations: No UWP support. - BRAW: Description: Blackmagic RAW decoder. - R3D: Description: R3D RAW decoder. - hap: Description: Hap video codec decoder. - VAAPI: Description: Video Acceleration API decoder (Linux). ``` -------------------------------- ### Integrate MDK SDK with CMake Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet shows how to include and link the MDK SDK in a CMake project. It assumes MDK_SDK_DIR is set to the SDK's root directory, allowing your target to link against the mdk library. ```CMake include(${MDK_SDK_DIR}/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Configure MDK-SDK Video Decoders for Android Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet shows the recommended video decoder settings for MDK-SDK on Android, requiring the JavaVM global option and prioritizing AMediaCodec for hardware acceleration, followed by FFmpeg and dav1d. ```C++ SetGlobalOption("JavaVM", JvmPtr); // REQUIRED player.setDecoders(MediaType::Video, {"AMediaCodec", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Sign MDK Framework dylibs for macOS Hardened Runtime Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This Bash script is a recommended solution for signing dylib files within the mdk.framework to resolve issues with macOS Hardened Runtime. It should be added as a 'New Run Script Phase' in Xcode's Build Phases to ensure proper code signing. ```Bash [ -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 {} \; ``` -------------------------------- ### Configure MDK-SDK Video Decoders for macOS and iOS Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.md This snippet shows the recommended video decoder settings for MDK-SDK on Apple platforms (macOS, iOS), prioritizing hardware acceleration and specific codecs like VT and hap, followed by FFmpeg and dav1d. ```C++ player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Configure MDK Player Decoders in C++ Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md This C++ code snippet provides an example of how to set the preferred video decoders for the MDK player. It specifies a prioritized list of decoders, including hardware-accelerated options like MFT, D3D11, CUDA, and software decoders like FFmpeg and dav1d. ```C++ player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "CUDA", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### MDK Player VT (VideoToolbox) Decoder Properties and Usage Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.iOS.md This API documentation outlines the configurable properties for the VT (VideoToolbox) hardware decoder in MDK, including settings for threads, real-time processing, asynchronous operation, and output format. An example demonstrates how to set these properties for specific video decoding requirements. ```APIDOC VT Decoder Properties: - threads: Number of threads for decoding. - realTime: Boolean, indicates real-time decoding. - async: Boolean, enables asynchronous decoding. - format: Output pixel format (e.g., nv12). - hardware: Boolean, indicates hardware acceleration. - width: Output width. - height: Output height. Example Usage: player.setVideoDecoders({"VT:format=nv12:async=1", "FFmpeg"}) ``` -------------------------------- ### Integrate MDK into Qt QMake Project Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Instructions for integrating the MDK SDK into a Qt qmake project by including the MDK pri file, which handles necessary configurations. ```QMake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### MDK SDK Integration for Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Provides the qmake command to include the MDK SDK's project file, enabling MDK functionalities in a Qt qmake project. ```qmake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Integrate MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This snippet shows how to integrate the MDK SDK into a Qt qmake project by including the `mdk.pri` file. This file typically sets up the necessary include paths and library dependencies, relying on the `MDK_SDK_DIR` variable to locate the SDK. ```qmake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Multiple Videos and Players with MDK Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Illustrates how to use multiple MDK players to display N different videos simultaneously, sharing resources and utilizing VideoToolbox for decoding. ```Shell multiplayers -share -c:v VideoToolbox url1 url2 ... urlN ``` -------------------------------- ### Configure MDK SDK Decoders on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Recommended C++ settings for MDK SDK on Raspberry Pi, specifically configuring video decoders to leverage `V4L2M2M` and `FFmpeg` with `drm` hardware context for optimal performance and 0-copy rendering. Requires using the `mdk-sdk-linux.tar.xz` package and removing bundled `libffmpeg.so.*`. ```cpp player.setDecoders(MediaType::Video, {"V4L2M2M", "FFmpeg:hwcontext=drm", "FFmpeg"}); ``` -------------------------------- ### Integrate MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Android.md Instructions for including the MDK SDK in a Qt qmake project by sourcing the 'mdk.pri' file. ```QMake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Xcode Code Signing: Add Run Script Phase for Dynamic Libraries Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md This recommended Xcode build phase script ensures that dynamic libraries like `libffmpeg*.dylib` are properly code-signed during the build process. It uses `codesign` to sign files found within the built products directory, preserving metadata and using the project's signing identity. ```Shell Script [ -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 {} \; ``` -------------------------------- ### Include MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md This qmake snippet illustrates how to integrate the MDK SDK into a Qt qmake project. By including the 'mdk.pri' file, the project gains access to the SDK's build settings and libraries. ```QMake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Run MDK SDK on macOS 10.15+ Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Instructions to run MDK SDK executables downloaded from the internet on macOS 10.15+ due to security restrictions. This script helps to make the executables runnable. ```Shell ./mdk-sdk/catalina.sh ``` -------------------------------- ### MDK SDK Integration for CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Shows the necessary CMake commands to find and link against the MDK SDK in a CMake-based project. This allows your target to use MDK functionalities. ```cmake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Import MDK SDK into Visual Studio vcxproj Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md This snippet shows how to integrate the MDK SDK into a Visual Studio C++ project by adding an tag to the .vcxproj file. This method ensures that necessary compile flags, link flags, and runtime DLLs are automatically handled. ```XML ``` -------------------------------- ### Multiple Players for Single Video with MDK Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Shows how to run multiple MDK players concurrently, sharing resources, to display a single video across N windows using VideoToolbox for decoding. ```Shell multiplayers -share -c:v VideoToolbox -win N url ``` -------------------------------- ### Integrate MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/nuget/README.md This snippet shows how to include the MDK SDK in a Qt qmake project by referencing the 'mdk.pri' file. The 'MDK_SDK_DIR' variable must be set to the SDK's root directory. ```Qt qmake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### DRM Prime Video Playback with FFmpeg on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Demonstrates how to use `glfwplay` with system FFmpeg and `drm_prime` for hardware-accelerated video decoding on Raspberry Pi OS, supporting both X11 and Wayland environments. Requires `libglfw3-wayland` for Wayland. ```shell ./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -gl test.mp4 ``` ```shell ./glfwplay -c:v V4L2M2M,FFmpeg:hwcontext=drm:sw_fallback=1 -es test.mp4 ``` -------------------------------- ### Test Decoder Speed with FrameReader Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md These commands demonstrate how to use the `framereader` utility to test the decoding speed of different codecs. It compares CedarX and FFmpeg decoders for 1080p H.264 video, showing significant performance differences. ```Shell ./bin/framereader -c:v CedarX video_file # 1080p h264 ~84fps ./bin/framereader -c:v FFmpeg video_file # 1080p h264 ~12fps ``` -------------------------------- ### Import MDK SDK in Visual Studio C++ Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md This snippet shows how to import the MDK SDK into a Visual Studio C++ project by adding an Import element to the .vcxproj file. This ensures necessary compile and link flags are added, and runtime DLLs are copied automatically. ```XML ``` -------------------------------- ### Run MDK Player with CedarX Decoder (UMP Accelerated) Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md This command demonstrates how to run the MDK player using the CedarX decoder, leveraging UMP acceleration for optimal performance. It achieves approximately 28% CPU usage for 1080p@24fps H.264 decoding and rendering. ```Shell ./bin/mdkplay -c:v CedarX video_file ``` -------------------------------- ### Integrate MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.iOS.md This snippet shows how to integrate the MDK SDK into a Qt qmake project. By including the mdk.pri file, your project gains access to the necessary MDK build configurations and libraries for multimedia development within the Qt framework. ```QMake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Run MDK Player with VDPAU Decoder (Zero Copy Mode) Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md This command attempts to run the MDK player with the VDPAU decoder in zero-copy mode, utilizing the NV interop extension. Note that this mode was not tested by the SDK developers due to lack of a working VDPAU driver. ```Shell ./bin/mdkplay -c:v VDPAU video_file ``` -------------------------------- ### Run MDK with VC4/6 EGL+ES2 Driver on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This command executes the MDK player in a VC4/6 EGL+ES2 environment. It uses `LD_PRELOAD` to ensure `libX11.so.6` is loaded, which might be necessary if the application is not strongly linked against `libX11` or `libpulse`. ```Shell LD_PRELOAD=libX11.so.6 ./window -c:v MMAL test.mp4 ``` -------------------------------- ### Integrate MDK SDK in Qt qmake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md This qmake snippet illustrates how to include the MDK SDK's project file in a Qt qmake project. It assumes the MDK SDK directory is specified by the MDK_SDK_DIR variable. ```qmake include($$MDK_SDK_DIR/mdk.pri) ``` -------------------------------- ### Configure MFT Decoder for MDK SDK Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md Shows how to select MFT (Media Foundation Transform) as a video decoder and set its options, including D3D version (0, 9, 11, 12) and pooling (0, 1), for hardware or software decoding with MDK SDK. ```Command Line -c:v MFT(software), -c:v MFT:d3d=11(hardware) or MFT:d3d=12. ``` -------------------------------- ### Configure Recommended Decoders for MDK Player Source: https://github.com/wang-bin/mdk-sdk/blob/master/nuget/README.md This C++ snippet illustrates how to set a recommended list of video decoders for the MDK player. The order of decoders in the list indicates preference, allowing the player to try hardware-accelerated options like MFT, D3D11, CUDA, and hap before falling back to software decoders like FFmpeg and dav1d. ```C++ player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "CUDA", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### MDK SDK Environment Variable Reference Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md This section documents the environment variables available for configuring the MDK SDK's runtime behavior, including graphics context selection, OpenGL/OpenGL ES modes, VDPAU and VAAPI interoperation, and CUDA settings. ```APIDOC GL_EGL: Description: Controls the graphics context type. Values: 0 (use GLX context), 1 (use EGL context if created by MDK) GL_ES: Description: Controls OpenGL rendering mode. Values: 0 (use OpenGL), 1 (use OpenGL ES if created by MDK) VDPAU_GL: Description: Defines VDPAU interoperation mode with OpenGL. Values: video (interop with video surface), output (interop with output surface), pixmap (interop with X11 pixmap, required by EGL from X11) VAAPI_GL: Description: Defines VAAPI interoperation mode with OpenGL. Values: x11 (interop with GLX/EGL via X11 pixmap), drm (interop with DRM prime), drm2 (interop with DRM prime2) CUDA_STREAM: Description: Enables/disables CUDA stream usage. Values: 0, 1 CUDA_PBO: Description: Enables/disables CUDA Pixel Buffer Object (PBO) usage. Values: 0, 1 CUDA_HOST: Description: Enables/disables CUDA host memory usage. Values: 0, 1 CUDA_DEVICE: Description: Specifies the CUDA device index. Values: number (integer) ``` -------------------------------- ### Configure FFmpeg Decoder for MDK SDK Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md Demonstrates how to specify FFmpeg as a video decoder and configure its options, such as the number of threads, for use with the MDK SDK. The '-c:v' option is used to select the video codec. ```Command Line -c:v FFmpeg. -c:v FFmpeg:threads=4 ``` -------------------------------- ### Configure MDK SDK Decoders and X11 on Linux Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md Recommended C++ settings for MDK SDK on Linux, including optional `XInitThreads()` for X11 and setting the X11 display pointer. Configures video decoders to prioritize hardware acceleration (VAAPI, VDPAU, CUDA) before software fallbacks. ```cpp // XInitThreads(); // If using x11. before any x11 api call. some gui toolkits already call this, e.g. qt, glfw SetGlobalOption("X11Display", DisplayPtr); // If using x11. Requred by VAAPI, VDPAU player.setDecoders(MediaType::Video, {"VAAPI", "VDPAU", "CUDA", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Run MDK with Legacy Driver GLES2 on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This command runs the MDK player using the legacy driver with GLES2, enabling hardware decoding via MMAL for optimal performance and zero-copy rendering. ```Shell ./window -c:v MMAL test.mp4 ``` -------------------------------- ### Integrate MDK into CMake Project Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Instructions for integrating the MDK SDK into a CMake project by including the provided FindMDK.cmake module and linking against the MDK library. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Run MDK Player with CedarX Decoder (No UMP Acceleration) Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md This command shows how to run the MDK player with the CedarX decoder without UMP acceleration. This configuration results in higher CPU usage, around 96% for 1080p@24fps H.264 decoding and rendering. ```Shell GLVA_HOST=1 ./bin/mdkplay -c:v CedarX video_file ``` -------------------------------- ### Configure MDK Player Video Decoders (C++) Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md Demonstrates how to configure the MDK player's video decoders using a C++-like API call. It prioritizes the VideoToolbox (VT) hardware decoder with specific format and asynchronous settings, falling back to FFmpeg if VT is unavailable or unsuitable. VT is noted for better performance. ```C++ player.setVideoDecoders({"VT:format=nv12:async=1", "FFmpeg"}) ``` -------------------------------- ### Run MDK Player with VDPAU Decoder (Copy Mode) Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md This command illustrates running the MDK player with the VDPAU decoder in copy mode. Similar to the non-UMP accelerated CedarX mode, it results in high CPU usage, approximately 97% for 1080p@24fps H.264 decoding and rendering. ```Shell GLVA_HOST=1 ./bin/mdkplay -c:v VDPAU video_file ``` -------------------------------- ### MDK Android SDK Supported Features and Configuration Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Android.md Overview of supported graphics APIs, video decoders, audio renderers, and data source schemes for the MDK SDK on Android. This section details the available options for configuring media playback and rendering. ```APIDOC Supported Graphics APIs: - OpenGL ES2/3 - Vulkan OpenGL Context: - Create by mdk: use SurfaceView's Surface to initialize rendering thread - Created by user: use GLSurfaceView, TextureView or whatever Supported Decoders: - FFmpeg - MediaCodec: FFmpeg mediacodec implementation - AMediaCodec: builtin mediacodec implementation, using libmediandk or java api (Note: MediaCodec/AMediaCodec decoder will not be destroyed if app go to background, and continues to work when resumed.) Audio Renderers: - OpenSLES - AudioTrack (default) Data Source Schemes: - content: - android.resource: - assets: ``` -------------------------------- ### Configure CMake Project and Compiler Standards Source: https://github.com/wang-bin/mdk-sdk/blob/master/CMakeLists.txt This snippet initializes the CMake project, sets the minimum required CMake version, defines the project name, and enforces C++20 standard. It also includes policy settings for CMake versions. ```CMake cmake_minimum_required(VERSION 3.16) # precompile headers if(NOT DEFINED PROJECT_NAME) set(PROJECT_NAME mdk) else() add_definitions(-DMDK_NS=${PROJECT_NAME}) endif() if(POLICY CMP0091) # CMAKE_MSVC_RUNTIME_LIBRARY. since 3.15 cmake_policy(SET CMP0091 NEW) endif() project(${PROJECT_NAME} VERSION 0.20.0 DESCRIPTION "Multimedia Dev Kit ${GIT_COMMIT}" #LANGUAGES C CXX OBJC OBJCXX ) set(PROJECT_VERSION_TWEAK 0) set(TARGET_NAME ${PROJECT_NAME}) # https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ (global and specified target) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) #set(ENV{PKG_CONFIG_SYSROOT_DIR} "=") #set(CMAKE_CXX_EXTENSIONS OFF) message("CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}, CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}, CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}") message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}. CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}. LINUX: ${LINUX}") message("CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") message("CMAKE: ${CMAKE_VERSION}") ``` -------------------------------- ### MDK Command Line Option for Decoder Selection Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Linux.md This command-line argument allows users to explicitly specify the video decoder to be used by the MDK SDK, overriding default or auto-detected decoders for specific media playback scenarios. ```Shell -c:v decodername ``` -------------------------------- ### Run MDK with VC4/6 GLX Driver on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This command runs the MDK player in a VC4/6 GLX environment. `GL_ES=0` disables OpenGL ES, and `LD_PRELOAD` ensures `libGL.so.1` is loaded if the application is not strongly linked against `libGL` or `libOpenGL`. ```Shell GL_ES=0 LD_PRELOAD=libGL.so.1 ./window -c:v MMAL test.mp4 ``` -------------------------------- ### Set Recommended Decoders for mdk-sdk Player Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md This snippet demonstrates how to configure the mdk-sdk player to use a specific sequence of video decoders on macOS and iOS, prioritizing hardware-accelerated options like VideoToolbox (VT) and Hap, followed by FFmpeg and dav1d. ```C++ player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This snippet demonstrates how to include the MDK SDK's CMake configuration and link its libraries to a target in a CMake project. It requires specifying the path to the MDK SDK directory to find the necessary CMake modules. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Change ALSA Audio Device Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md If the default audio device does not produce correct sound, this command shows how to specify an alternative ALSA device by setting the `ALSA_DEVICE` environment variable. ```Shell export ALSA_DEVICE="hw:0,0" ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md This CMake snippet demonstrates how to find and link the MDK SDK to a target in a CMake project. It includes the MDK CMake module and links the 'mdk' library to 'your_target'. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Configure MDK Player Video Decoders in C++ Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.WinRT.md This C++ snippet shows how to set the preferred video decoders for the MDK player. It specifies a prioritized list of decoders including MFT, D3D11, hap, FFmpeg, and dav1d for optimal playback. ```C++ player.setDecoders(MediaType::Video, {"MFT:d3d=11", "D3D11", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Run MDK with VC4/6 Wayland Driver on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This command runs the MDK player in a VC4/6 Wayland environment, assuming a Wayland compositor like Weston is active in X11 or CLI mode. ```Shell ./window -c:v MMAL test.mp4 ``` -------------------------------- ### Run MDK with VC4/6 GBM Driver on Raspberry Pi Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.rpi.md This command runs the MDK player using the GBM (Generic Buffer Management) surface in a VC4/6 environment, typically when Weston is running in CLI mode. ```Shell ./window -surface gbm -c:v MMAL test.mp4 ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.sunxi.md This CMake snippet illustrates the necessary commands to include the MDK SDK in your CMake-based project. It involves finding the MDK package and linking its library to your target executable or library. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Android.md Instructions for linking the MDK SDK library in a CMake-based project by including the FindMDK.cmake module and linking against the 'mdk' target. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Define and Configure MDK Shared Library Target Source: https://github.com/wang-bin/mdk-sdk/blob/master/CMakeLists.txt This snippet defines the MDK shared library target, includes necessary directories, compiles source files, and sets various target properties including macOS framework settings, versioning, and output name. ```CMake include(CheckLibraryExists) set(SO_NAME ${TARGET_NAME}) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) endif() include_directories( include src/ src/base/cppcompat/include ) file(GLOB SRC "src/core/*.cpp") add_library(${TARGET_NAME} SHARED ${SRC} ) target_compile_definitions(${TARGET_NAME} PRIVATE -DBUILD_MDK_LIB) target_link_directories(${TARGET_NAME} PRIVATE lib) # 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 target_link_libraries(${TARGET_NAME} PRIVATE mdkObj avglue ugl ugs glva-static vpl snappy) set_target_properties(${TARGET_NAME} PROPERTIES MACOSX_RPATH ON FRAMEWORK ON MACOSX_FRAMEWORK_IDENTIFIER com.mediadevkit.${TARGET_NAME} MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} #MACOSX_FRAMEWORK_INFO_PLIST #XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY FRAMEWORK_VERSION A # codesign assumes framework version is A VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME ${SO_NAME} CLEAN_DIRECT_OUTPUT 1 ) ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/nuget/README.md This snippet demonstrates how to include and link the MDK SDK in a CMake-based project. It assumes the MDK SDK directory is known and its 'FindMDK.cmake' module is available. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Integrate MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.iOS.md This snippet demonstrates how to include the MDK SDK in a CMake-based project. It involves finding the MDK package and linking your target executable or library against the MDK library, enabling access to its multimedia functionalities. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Configure Recommended Video Decoders for macOS and iOS Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.iOS.md This configuration snippet sets the preferred video decoders for MDK on macOS and iOS platforms. It prioritizes hardware-accelerated decoders like VideoToolbox (VT) and hap, followed by FFmpeg and dav1d, to ensure optimal playback performance and compatibility. ```C++ player.setDecoders(MediaType::Video, {"VT", "hap", "FFmpeg", "dav1d"}); ``` -------------------------------- ### Link MDK SDK in CMake Projects Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.Windows.md This CMake snippet demonstrates how to include the MDK SDK in a CMake-based project. It involves sourcing the FindMDK.cmake module and then linking your target against the 'mdk' library, which handles the necessary build configurations. ```CMake include(mdk-sdk-dir/lib/cmake/FindMDK.cmake) target_link_libraries(your_target PRIVATE mdk) ``` -------------------------------- ### Add MDK Code Signing Run Script Phase in Xcode Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.iOS.md This Xcode build phase run script ensures proper code signing of FFmpeg dynamic libraries embedded within the MDK framework. It's a recommended step to prevent code signing issues, especially when distributing applications, by applying the correct signing identity to the libraries. ```Shell [ -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 {} \; ``` -------------------------------- ### Link Platform-Specific Libraries in CMake Source: https://github.com/wang-bin/mdk-sdk/blob/master/CMakeLists.txt This snippet demonstrates conditional linking of libraries based on the operating system. It checks for `libdl` on Unix-like systems, links OpenGL, Threads, and specific multimedia and system libraries for Windows. ```CMake CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) if(HAVE_LIBDL) target_link_libraries(${TARGET_NAME} PRIVATE dl) endif() # only static libs are enough for reloc obj targets, otherwise static + shared target_link_libraries(${TARGET_NAME} PRIVATE ${EXTRA_LIBS}) if(POLICY CMP0072) cmake_policy(SET CMP0072 NEW) endif() set(OpenGL_GL_PREFERENCE GLVND) include(FindOpenGL) if(OPENGL_FOUND) list(APPEND EXTRA_DYLIBS OpenGL::GL) target_link_libraries(${TARGET_NAME} PRIVATE OpenGL::GL) endif() find_package(Threads) target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads) # link_libraries() affect targets ONLY add later if(WIN32) target_link_libraries(${TARGET_NAME} PRIVATE mfplat mfuuid version wmcodecdspuuid xaudio2 dsound ole32 d3d11 user32 Mf gdi32 advapi32 ) endif() ``` -------------------------------- ### Xcode Code Signing: Add Deep Signing Flag Source: https://github.com/wang-bin/mdk-sdk/blob/master/README.macOS.md This method for Xcode code signing involves adding the `--deep` flag to the 'Other Code Signing Flags' in your project's Build Settings. While simpler, it might have limitations compared to more granular signing approaches. ```Xcode Build Settings --deep ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.