Initial commit

This commit is contained in:
admin1
2026-07-14 11:11:36 +08:00
commit 656499cf94
604 changed files with 119518 additions and 0 deletions
@@ -0,0 +1,79 @@
## 1.0.11
- **FIX**(windows): do not bundle MSVCP/UCRT DLLs.
## 1.0.10
- fix windows crash by @Airyzz [#900](https://github.com/media-kit/media-kit/pull/900)
## 1.0.9
- [mpv-player/mpv@`652a1dd`](https://github.com/mpv-player/mpv/commit/652a1dd90711839acdccc08004056d25514ef2d8)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
- feat: improve compile-time failure handling
## 1.0.8
- [mpv-player/mpv@`c0fb9b4`](https://github.com/mpv-player/mpv/commit/c0fb9b4b83905ff29f2b4c678af431561b5b53be)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
## 1.0.7
- [mpv-player/mpv@`140ec21`](https://github.com/mpv-player/mpv/commit/140ec21c89d671d392877a7f3b91d67e7d7b9239)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
- fix: DASH having BaseURL(s) with special characters not loading ([#353](https://github.com/media-kit/media-kit/issues/353))
- fix: AV1 support ([#351](https://github.com/media-kit/media-kit/issues/351))
## 1.0.6
- [mpv-player/mpv@`140ec21`](https://github.com/mpv-player/mpv/commit/140ec21c89d671d392877a7f3b91d67e7d7b9239)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
## 1.0.5
- [mpv-player/mpv@`140ec21`](https://github.com/mpv-player/mpv/commit/140ec21c89d671d392877a7f3b91d67e7d7b9239)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
- fix: HLS support
- perf: reduce bundle size
## 1.0.4
- [mpv-player/mpv@`140ec21`](https://github.com/mpv-player/mpv/commit/140ec21c89d671d392877a7f3b91d67e7d7b9239)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
- perf: reduce bundle size
## 1.0.2
- [mpv-player/mpv@`7ae7fc0`](https://github.com/mpv-player/mpv/commit/7ae7fc01122c4fdfdb51600463872a6f8e78b975)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
- feat: migrate to the plugin template
- feat: make package optional during build
- feat: add MEDIA_KIT_LIBS_AVAILABLE option
## 1.0.1
- [mpv-player/mpv@`7990dd8`](https://github.com/mpv-player/mpv/commit/7990dd8f3f664e01c984a405dad7c8af320cabf1)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
## 1.0.0
- [mpv-player/mpv@`7990dd8`](https://github.com/mpv-player/mpv/commit/7990dd8f3f664e01c984a405dad7c8af320cabf1)
- [ANGLE 2.1.18844 git hash: 2693b03eba82](https://github.com/google/angle)
- MSVCRT
- UCRT
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 & onwards Hitesh Kumar Saini <saini123hitesh@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,55 @@
# media_kit_libs_windows_video (vendored fork)
Fork of `media_kit_libs_windows_video 1.0.11` from pub.dev. Windows-only, wired
into the main app via `dependency_overrides` in the project `pubspec.yaml`. Not
published to pub.
## Why fork
Upstream 1.0.11 downloads the media-kit organisation's 2023-09-24 `mpv-dev`
archive at build time. Its bundled FFmpeg is compiled with
`--disable-decoders` plus an explicit allow-list that omits two decoders we
need:
- `truehd` — Dolby TrueHD audio (mpv reports
`Failed to initialize a decoder for codec 'truehd'`)
- `hdmv_pgs_subtitle` (`pgssub`) — Blu-ray PGS bitmap subtitles (track can be
selected via `sid`, but nothing renders on screen)
Both symptoms are documented in the upstream tracker
([media-kit/media-kit#1269](https://github.com/media-kit/media-kit/issues/1269),
[#1371](https://github.com/media-kit/media-kit/issues/1371)) and both are fixed
by swapping in a full libmpv build.
## What changed vs. upstream 1.0.11
Only three variables in `windows/CMakeLists.txt` — the archive name, download
URL, and MD5. The download / extract / bundle logic is untouched, and the
archive layout (`libmpv-2.dll` + `include/mpv/*.h`) matches upstream.
| | Upstream 1.0.11 | This fork |
|---|-----------------|-----------|
| Source | `media-kit/libmpv-win32-video-build` | `zhongfly/mpv-winbuild` |
| Tag / date | `2023-09-24` | `2026-07-11-e5486b96d7` |
| Archive | `mpv-dev-x86_64-20230924-git-652a1dd.7z` | `mpv-dev-x86_64-20260711-git-e5486b96d7.7z` |
| Build flavour | Stripped (allow-listed decoders only) | Full (all upstream FFmpeg decoders) |
| CPU baseline | Generic x86_64 | Generic x86_64 (not `-v3`, so no AVX2 requirement) |
The plugin registrar (`MediaKitLibsWindowsVideoPluginCApi`), ANGLE bundle, and
package name / class name / API are identical to upstream so no other change
to `media_kit` / `media_kit_video` is required.
## Follow-ups (not blocking)
- `zhongfly/mpv-winbuild` is a nightly repository. Historical releases can be
pruned. To keep CI reproducible long-term, mirror the pinned archive to a
project-owned GitHub Release (same pattern as `mdk-sdk v0.37.0`) and repoint
`LIBMPV_URL`.
- Android has the same missing decoders in `media_kit_libs_android_video`.
Android currently falls back to media3/fvp so this is not urgent; if we
ever need mpv on Android too, mirror this vendor pattern there.
## License
Original MIT license retained in [`LICENSE`](./LICENSE). Upstream copyright:
Hitesh Kumar Saini and contributors.
@@ -0,0 +1,20 @@
name: media_kit_libs_windows_video
description: Vendored fork of media_kit_libs_windows_video 1.0.11 that ships a
full libmpv build (adds truehd audio + hdmv_pgs_subtitle decoders). Local path
dependency only, do not publish to pub.dev.
version: 1.0.11+smplayer.1
publish_to: 'none'
environment:
sdk: ">=2.17.0 <4.0.0"
flutter: ">=3.0.0"
dependencies:
flutter:
sdk: flutter
flutter:
plugin:
platforms:
windows:
pluginClass: MediaKitLibsWindowsVideoPluginCApi
@@ -0,0 +1,183 @@
# This file is a part of media_kit (https://github.com/media-kit/media-kit).
#
# Copyright © 2021 & onwards, Hitesh Kumar Saini <saini123hitesh@gmail.com>.
# All rights reserved.
# Use of this source code is governed by MIT license that can be found in the LICENSE file.
cmake_minimum_required(VERSION 3.14)
# This option is read by the other packages which are part of package:media_kit.
option(MEDIA_KIT_LIBS_AVAILABLE "package:media_kit libraries are available." ON)
set(PROJECT_NAME "media_kit_libs_windows_video")
project(${PROJECT_NAME} LANGUAGES CXX)
# Deal with MSVC incompatiblity
add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
# ------------------------------------------------------------------------------
function(download_and_verify url md5 locationForArchive)
# Check if the archive exists.
if(EXISTS "${locationForArchive}")
file(MD5 "${locationForArchive}" ARCHIVE_MD5)
# If MD5 doesn't match, delete the archive to download again.
if(NOT md5 STREQUAL ARCHIVE_MD5)
file(REMOVE "${locationForArchive}")
message(STATUS "MD5 mismatch. File deleted.")
endif()
endif()
# Download the archive if it doesn't exist.
if(NOT EXISTS "${locationForArchive}")
message(STATUS "Downloading archive from ${url}...")
file(DOWNLOAD "${url}" "${locationForArchive}")
message(STATUS "Downloaded archive to ${locationForArchive}.")
# Verify MD5 of the newly downloaded file.
file(MD5 "${locationForArchive}" ARCHIVE_MD5)
if(md5 STREQUAL ARCHIVE_MD5)
message(STATUS "${locationForArchive} Verification successful.")
else()
message(FATAL_ERROR "${locationForArchive} Integrity check failed, please try to re-build project again.")
endif()
endif()
endfunction()
function(check_directory_exists_and_not_empty dir result_var)
# Check if the directory exists
if(EXISTS "${dir}")
# Check if the directory is not empty
file(GLOB dir_contents "${dir}/*")
if(dir_contents)
set(${result_var} TRUE PARENT_SCOPE)
else()
set(${result_var} FALSE PARENT_SCOPE)
message(STATUS "Directory ${dir} exists but is empty!")
endif()
else()
set(${result_var} FALSE PARENT_SCOPE)
message(STATUS "Directory ${dir} does not exist!")
endif()
endfunction()
# libmpv archive containing the pre-built shared libraries & headers.
#
# Vendored fork: pinned to a zhongfly/mpv-winbuild full build so that libmpv's
# bundled FFmpeg ships the truehd audio decoder and the hdmv_pgs_subtitle
# bitmap decoder — both are missing from upstream media-kit's stripped
# allow-listed build (media-kit/media-kit#1269 / #1371). See the vendored
# plugin README for the rationale and follow-ups.
set(LIBMPV "mpv-dev-x86_64-20260711-git-e5486b96d7.7z")
# Download URL & MD5 hash of the libmpv archive.
set(LIBMPV_URL "https://github.com/zhongfly/mpv-winbuild/releases/download/2026-07-11-e5486b96d7/${LIBMPV}")
set(LIBMPV_MD5 "32c8d72df54259bcce914aeb620db261")
# Download location of the libmpv archive.
set(LIBMPV_ARCHIVE "${CMAKE_BINARY_DIR}/${LIBMPV}")
set(LIBMPV_SRC "${CMAKE_BINARY_DIR}/libmpv")
download_and_verify(
${LIBMPV_URL}
${LIBMPV_MD5}
${LIBMPV_ARCHIVE}
)
check_directory_exists_and_not_empty(${LIBMPV_SRC} LIBMPV_SRC_VALID)
# Extract the libmpv archive.
if(NOT LIBMPV_SRC_VALID)
message(STATUS "Extracting ${LIBMPV}...")
make_directory("${LIBMPV_SRC}")
add_custom_target("${PROJECT_NAME}_LIBMPV_EXTRACT" ALL)
add_custom_command(
TARGET "${PROJECT_NAME}_LIBMPV_EXTRACT"
COMMAND "${CMAKE_COMMAND}" -E tar xzf "\"${LIBMPV_ARCHIVE}\""
COMMAND xcopy "\"${LIBMPV_SRC}/include/mpv\"" "\"${LIBMPV_SRC}/mpv\"" /E /H /C /I
COMMAND rmdir "\"${LIBMPV_SRC}/include\"" /S /Q
COMMAND ren "\"${LIBMPV_SRC}/mpv\"" "\"include\""
WORKING_DIRECTORY "${LIBMPV_SRC}"
)
endif()
# ------------------------------------------------------------------------------
# ANGLE archive containing the pre-built shared libraries & headers.
set(ANGLE "ANGLE.7z")
# Download URL & MD5 hash of the ANGLE archive.
set(ANGLE_URL "https://github.com/alexmercerind/flutter-windows-ANGLE-OpenGL-ES/releases/download/v1.0.1/ANGLE.7z")
set(ANGLE_MD5 "e866f13e8d552348058afaafe869b1ed")
# Download location of the ANGLE archive.
set(ANGLE_ARCHIVE "${CMAKE_BINARY_DIR}/${ANGLE}")
set(ANGLE_SRC "${CMAKE_BINARY_DIR}/ANGLE")
download_and_verify(
${ANGLE_URL}
${ANGLE_MD5}
${ANGLE_ARCHIVE}
)
check_directory_exists_and_not_empty(${ANGLE_SRC} ANGLE_SRC_VALID)
# Extract the ANGLE archive.
if(NOT ANGLE_SRC_VALID)
message(STATUS "Extracting ${ANGLE}...")
make_directory("${ANGLE_SRC}")
add_custom_target("${PROJECT_NAME}_ANGLE_EXTRACT" ALL)
add_custom_command(
TARGET "${PROJECT_NAME}_ANGLE_EXTRACT"
COMMAND "${CMAKE_COMMAND}" -E tar xzf "\"${ANGLE_ARCHIVE}\""
WORKING_DIRECTORY "${ANGLE_SRC}"
)
endif()
# ------------------------------------------------------------------------------
set(PLUGIN_NAME "media_kit_libs_windows_video_plugin")
add_library(
${PLUGIN_NAME} SHARED
"include/media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h"
"media_kit_libs_windows_video_plugin_c_api.cpp"
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(
${PLUGIN_NAME}
PROPERTIES
CXX_VISIBILITY_PRESET
hidden
)
target_compile_definitions(
${PLUGIN_NAME}
PRIVATE
FLUTTER_PLUGIN_IMPL
)
target_include_directories(
${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
target_link_libraries(
${PLUGIN_NAME}
PRIVATE
flutter
flutter_wrapper_plugin
)
set(
media_kit_libs_windows_video_bundled_libraries
"${LIBMPV_SRC}/libmpv-2.dll"
"${ANGLE_SRC}/d3dcompiler_47.dll"
"${ANGLE_SRC}/libEGL.dll"
"${ANGLE_SRC}/libGLESv2.dll"
"${ANGLE_SRC}/vk_swiftshader.dll"
"${ANGLE_SRC}/vulkan-1.dll"
"${ANGLE_SRC}/zlib.dll"
PARENT_SCOPE
)
@@ -0,0 +1,24 @@
#ifndef FLUTTER_PLUGIN_MEDIA_KIT_LIBS_WINDOWS_VIDEO_PLUGIN_C_API_H_
#define FLUTTER_PLUGIN_MEDIA_KIT_LIBS_WINDOWS_VIDEO_PLUGIN_C_API_H_
#include <flutter_plugin_registrar.h>
#ifdef FLUTTER_PLUGIN_IMPL
#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport)
#else
#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport)
#endif
#if defined(__cplusplus)
extern "C" {
#endif
FLUTTER_PLUGIN_EXPORT void
MediaKitLibsWindowsVideoPluginCApiRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef registrar);
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // FLUTTER_PLUGIN_MEDIA_KIT_LIBS_WINDOWS_VIDEO_PLUGIN_C_API_H_
@@ -0,0 +1,6 @@
#include "include/media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h"
#include <flutter/plugin_registrar_windows.h>
void MediaKitLibsWindowsVideoPluginCApiRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef) {}