diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/smpeg2 | |
Diffstat (limited to 'vcpkg/ports/smpeg2')
| -rw-r--r-- | vcpkg/ports/smpeg2/003-fix-double-ptr-to-int-comparison.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/smpeg2/CMakeLists.txt | 73 | ||||
| -rw-r--r-- | vcpkg/ports/smpeg2/hufftable-uint.patch | 27 | ||||
| -rw-r--r-- | vcpkg/ports/smpeg2/portfile.cmake | 41 | ||||
| -rw-r--r-- | vcpkg/ports/smpeg2/vcpkg.json | 19 |
5 files changed, 173 insertions, 0 deletions
diff --git a/vcpkg/ports/smpeg2/003-fix-double-ptr-to-int-comparison.patch b/vcpkg/ports/smpeg2/003-fix-double-ptr-to-int-comparison.patch new file mode 100644 index 0000000..31128a8 --- /dev/null +++ b/vcpkg/ports/smpeg2/003-fix-double-ptr-to-int-comparison.patch @@ -0,0 +1,13 @@ +diff --git a/audio/mpegtoraw.cpp b/audio/mpegtoraw.cpp +index 493c870..a4eabdc 100644 +--- a/audio/mpegtoraw.cpp ++++ b/audio/mpegtoraw.cpp +@@ -448,7 +448,7 @@ int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len) + if (audio->timestamp[0] != -1){ + double timeshift = audio->Time() - audio->timestamp[0]; + double correction = 0; +- assert(audio->timestamp >= 0); ++ assert(audio->timestamp[0] >= 0); + if (fabs(timeshift) > 1.0){ + correction = -timeshift; + #ifdef DEBUG_TIMESTAMP_SYNC diff --git a/vcpkg/ports/smpeg2/CMakeLists.txt b/vcpkg/ports/smpeg2/CMakeLists.txt new file mode 100644 index 0000000..bdbe2d5 --- /dev/null +++ b/vcpkg/ports/smpeg2/CMakeLists.txt @@ -0,0 +1,73 @@ +cmake_minimum_required(VERSION 3.25) +project(smpeg2 CXX) + +set(CMAKE_CXX_STANDARD 11) # 17 does not allow 'register' + +find_package(SDL2 CONFIG REQUIRED) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + # some c++ code just assumes memset is available + add_definitions(-FIstring.h) +endif() +add_definitions(-DNOCONTROLS -DTHREADED_AUDIO) + +add_library(smpeg2 + audio/bitwindow.cpp + audio/filter.cpp + audio/filter_2.cpp + audio/hufftable.cpp + audio/mpeglayer1.cpp + audio/mpeglayer2.cpp + audio/mpeglayer3.cpp + audio/mpegtable.cpp + audio/mpegtoraw.cpp + audio/MPEGaudio.cpp + video/decoders.cpp + video/floatdct.cpp + video/gdith.cpp + video/jrevdct.cpp + video/motionvec.cpp + video/parseblock.cpp + video/readfile.cpp + video/util.cpp + video/video.cpp + video/MPEGvideo.cpp + MPEG.cpp + MPEGlist.cpp + MPEGring.cpp + MPEGstream.cpp + MPEGsystem.cpp + smpeg.cpp) + +if(WIN32 AND BUILD_SHARED_LIBS) + target_compile_definitions(smpeg2 PRIVATE -DDLL_EXPORT) +endif() + +target_include_directories(smpeg2 PUBLIC + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" + $<INSTALL_INTERFACE:include> +) + + +if(TARGET SDL2::SDL2) + target_link_libraries(smpeg2 SDL2::SDL2) +else() + target_link_libraries(smpeg2 SDL2::SDL2-static) +endif() + +install(TARGETS smpeg2 + EXPORT smpeg2-targets + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +install(EXPORT smpeg2-targets + FILE unofficial-smpeg2-config.cmake + NAMESPACE unofficial::smpeg2:: + DESTINATION share/unofficial-smpeg2 +) + +if(NOT SMPEG_SKIP_HEADERS) + install(FILES smpeg.h MPEGframe.h DESTINATION include) +endif() diff --git a/vcpkg/ports/smpeg2/hufftable-uint.patch b/vcpkg/ports/smpeg2/hufftable-uint.patch new file mode 100644 index 0000000..14036a3 --- /dev/null +++ b/vcpkg/ports/smpeg2/hufftable-uint.patch @@ -0,0 +1,27 @@ +diff --git a/audio/hufftable.cpp b/audio/hufftable.cpp +index 6bc8e86..1ef2d7e 100644 +--- a/audio/hufftable.cpp ++++ b/audio/hufftable.cpp +@@ -550,11 +550,11 @@ htd33[ 31][2]={{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 1}, + + const HUFFMANCODETABLE MPEGaudio::ht[HTN]= + { +- { 0, 0-1, 0-1, 0, 0, htd33}, ++ { 0, 0u-1, 0u-1, 0, 0, htd33}, + { 1, 2-1, 2-1, 0, 7,htd01}, + { 2, 3-1, 3-1, 0, 17,htd02}, + { 3, 3-1, 3-1, 0, 17,htd03}, +- { 4, 0-1, 0-1, 0, 0, htd33}, ++ { 4, 0u-1, 0u-1, 0, 0, htd33}, + { 5, 4-1, 4-1, 0, 31,htd05}, + { 6, 4-1, 4-1, 0, 31,htd06}, + { 7, 6-1, 6-1, 0, 71,htd07}, +@@ -564,7 +564,7 @@ const HUFFMANCODETABLE MPEGaudio::ht[HTN]= + {11, 8-1, 8-1, 0,127,htd11}, + {12, 8-1, 8-1, 0,127,htd12}, + {13,16-1,16-1, 0,511,htd13}, +- {14, 0-1, 0-1, 0, 0, htd33}, ++ {14, 0u-1, 0u-1, 0, 0, htd33}, + {15,16-1,16-1, 0,511,htd15}, + {16,16-1,16-1, 1,511,htd16}, + {17,16-1,16-1, 2,511,htd16}, diff --git a/vcpkg/ports/smpeg2/portfile.cmake b/vcpkg/ports/smpeg2/portfile.cmake new file mode 100644 index 0000000..fe66aa8 --- /dev/null +++ b/vcpkg/ports/smpeg2/portfile.cmake @@ -0,0 +1,41 @@ +vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.libsdl.org/projects/smpeg/release/smpeg2-${VERSION}.tar.gz"
+ FILENAME "smpeg2-${VERSION}.tar.gz"
+ SHA512 80a779d01e7aa76778ef6ceea8041537db9e4b354df413214c4413c875cb98551891cef98fa0f057cc6a3222e4983da9ae65b86bdad2f87f9e2a6751837e2baf
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ hufftable-uint.patch
+ 003-fix-double-ptr-to-int-comparison.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_DEBUG
+ -DSMPEG_SKIP_HEADERS=ON
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_DISABLE_FIND_PACKAGE_ALSA
+ CMAKE_REQUIRE_FIND_PACKAGE_ALSA
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-smpeg2)
+file(READ "${CURRENT_PACKAGES_DIR}/share/unofficial-smpeg2/unofficial-smpeg2-config.cmake" config)
+file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-smpeg2/unofficial-smpeg2-config.cmake"
+"include(CMakeFindDependencyMacro)
+find_dependency(SDL2 CONFIG)
+${config}"
+)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(READ "${SOURCE_PATH}/video/video.h" video_terms)
+string(REGEX REPLACE "#ifndef .*" "" video_terms "${video_terms}")
+file(WRITE "${SOURCE_PATH}/Additional notes" "${video_terms}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/Additional notes")
diff --git a/vcpkg/ports/smpeg2/vcpkg.json b/vcpkg/ports/smpeg2/vcpkg.json new file mode 100644 index 0000000..762a8e3 --- /dev/null +++ b/vcpkg/ports/smpeg2/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "smpeg2", + "version": "2.0.0", + "port-version": 11, + "description": "SDL MPEG Player Library", + "homepage": "https://www.libsdl.org/projects/smpeg/", + "license": null, + "dependencies": [ + "sdl2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |