diff --git a/BUILD.md b/BUILD.md index 414c0f8e..99f5bf6e 100644 --- a/BUILD.md +++ b/BUILD.md @@ -40,6 +40,11 @@ These options can be specified during CMake configuration. For example: cmake -DBUILD_DECODER=ON -DBUILD_ENCODER=OFF -DBUILD_VIDEO_PARSER=ON ... ``` +### FFmpeg Location + +If FFmpeg is installed in a non-standard location, set `FFMPEG_ROOT` to its +install prefix (as a CMake variable or an environment variable). + ## Building On Windows ### Windows Build Requirements diff --git a/CMakeLists.txt b/CMakeLists.txt index b2ef28f5..aae582b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,85 +59,30 @@ if(BUILD_DECODER OR USE_ENCODER_SHADERC) include(FindShaderc) endif() -############ VULKAN_FFMPEG_LIB_PATH ###################################### -if (DEFINED ENV{VULKAN_FFMPEG_LIB_DIR_PATH}) - MESSAGE(STATUS "VULKAN_FFMPEG_LIB_DIR_PATH ENV VAR is set to $ENV{VULKAN_FFMPEG_LIB_DIR_PATH}") - set(VULKAN_FFMPEG_LIB_PATH "$ENV{VULKAN_FFMPEG_LIB_DIR_PATH}" CACHE PATH "Path to FFMPEG library directory" FORCE) -else() - set(VULKAN_FFMPEG_LIB_PATH "${VULKAN_FFMPEG_LIB_PATH}" CACHE PATH "Path to FFMPEG library directory") -endif() - -if (EXISTS "${VULKAN_FFMPEG_LIB_PATH}") - MESSAGE(STATUS "VULKAN_FFMPEG_LIB_PATH is set and valid ${VULKAN_FFMPEG_LIB_PATH}") -else() - if(WIN32) - if ((CMAKE_GENERATOR_PLATFORM MATCHES "^aarch64") OR (CMAKE_GENERATOR_PLATFORM MATCHES "^arm64") OR (CMAKE_GENERATOR_PLATFORM MATCHES "^ARM64")) - set(VULKAN_FFMPEG_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/winarm64/lib" CACHE PATH "Path to FFMPEG libs directory" FORCE) - message(STATUS "FFMPEG Windows ARM64 lib location ${VULKAN_FFMPEG_LIB_PATH}") - set(FFMPEG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/winarm64/include" CACHE PATH "Path to FFMPEG include directory" FORCE) - message(STATUS "FFMPEG Windows ARM64 include location ${FFMPEG_INCLUDE_DIR}") - elseif ((CMAKE_GENERATOR_PLATFORM MATCHES "^arm") OR (CMAKE_GENERATOR_PLATFORM MATCHES "^ARM")) - set(VULKAN_FFMPEG_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/winarm/lib" CACHE PATH "Path to FFMPEG libs directory" FORCE) - message(STATUS "FFMPEG Windows ARM64 lib location ${VULKAN_FFMPEG_LIB_PATH}") - set(FFMPEG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/winarm/include" CACHE PATH "Path to FFMPEG include directory" FORCE) - message(STATUS "FFMPEG Windows ARM64 include location ${FFMPEG_INCLUDE_DIR}") - else() - set(VULKAN_FFMPEG_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/win64/lib" CACHE PATH "Path to FFMPEG libs directory" FORCE) - message(STATUS "FFMPEG Windows x86_64 lib location ${VULKAN_FFMPEG_LIB_PATH}") - set(FFMPEG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg/win64/include" CACHE PATH "Path to FFMPEG include directory" FORCE) - message(STATUS "FFMPEG Windows x86_64 include location ${FFMPEG_INCLUDE_DIR}") - endif() - else() - message( STATUS "The location of the FFMPEG Lib: ${VULKAN_FFMPEG_LIB_PATH} expected the library to be installed to the regular system libs location" ) - endif() -endif() -############ VULKAN_FFMPEG_LIB_PATH ###################################### - -# find_package(FFmpeg REQUIRED) -include(FindFFmpeg) +find_package(FFmpeg) set(FFMPEG_AVAILABLE OFF) -# FFMPEG_FOUND - system has ffmpeg or libav -# FFMPEG_INCLUDE_DIR - the ffmpeg include directory -# FFMPEG_LIBRARIES -# FFMPEG_LIBAVCODEC -# FFMPEG_LIBAVFORMAT -# FFMPEG_LIBAVUTIL if(FFMPEG_FOUND) - message("Found FFMPEG/LibAV libraries") - include_directories(${FFMPEG_INCLUDE_DIR}) + message(STATUS " libavcodec: ${FFMPEG_LIBAVCODEC_LIBRARIES}") + message(STATUS " libavformat: ${FFMPEG_LIBAVFORMAT_LIBRARIES}") + message(STATUS " libavutil: ${FFMPEG_LIBAVUTIL_LIBRARIES}") + include_directories(${FFMPEG_INCLUDE_DIRS}) set(FFMPEG_AVAILABLE ON) -else() + + # Install Windows FFmpeg DLLs and libs if(WIN32) - find_library(AVCODEC_LIB NAMES avcodec PATHS ${VULKAN_FFMPEG_LIB_PATH}) - message(STATUS ${AVCODEC_LIB}) - find_library(AVFORMAT_LIB NAMES avformat PATHS ${VULKAN_FFMPEG_LIB_PATH}) - message(STATUS ${AVFORMAT_LIB}) - find_library(AVUTIL_LIB NAMES avutil PATHS ${VULKAN_FFMPEG_LIB_PATH}) - message(STATUS ${AVUTIL_LIB}) - - if(AVCODEC_LIB AND AVFORMAT_LIB AND AVUTIL_LIB) - message(STATUS "Found FFMPEG libraries manually") - set(FFMPEG_AVAILABLE ON) - include_directories(${FFMPEG_INCLUDE_DIR}) - - install(DIRECTORY "${VULKAN_FFMPEG_LIB_PATH}/../bin/" - DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" - PATTERN "*.def" EXCLUDE - PATTERN "*.a" EXCLUDE) - - install(DIRECTORY "${VULKAN_FFMPEG_LIB_PATH}/" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") - else() - message(WARNING "Can't find libavcodec, libavformat, or libavutil on Windows!") - endif() - else() - message(WARNING "Can't find libavcodec, libavformat, or libavutil on Linux!") + get_filename_component(FFMPEG_BIN_DIR "${FFMPEG_LIB_DIR}/../bin" ABSOLUTE) + install(DIRECTORY "${FFMPEG_BIN_DIR}/" + DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" + PATTERN "*.def" EXCLUDE + PATTERN "*.a" EXCLUDE) + + install(DIRECTORY "${FFMPEG_LIB_DIR}/" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") endif() -endif() - -if (NOT FFMPEG_AVAILABLE) - message(WARNING "FFMPEG demuxing is not going to be supported.") +else() + message(WARNING "Can't find libavcodec, libavformat, or libavutil!\n" + "FFMPEG demuxing is not going to be supported.") endif() # Platform specific settings diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 672c7aeb..900620bf 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -1,230 +1,142 @@ # -# Find the native FFMPEG includes and library -# This module defines -# FFMPEG_INCLUDE_DIR, where to find avcodec.h, avformat.h ... -# FFMPEG_LIBRARIES, the libraries to link against to use FFMPEG. -# FFMPEG_FOUND, If false, do not try to use FFMPEG. -# FFMPEG_ROOT, if this module use this path to find FFMPEG headers -# and libraries. - -# Macro to find header and lib directories -# example: FFMPEG_FIND(AVFORMAT avformat avformat.h) -MACRO(FFMPEG_FIND varname shortname headername) - # old version of ffmpeg put header in $prefix/include/[ffmpeg] - # so try to find header in include directory - FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} - PATHS - ${FFMPEG_ROOT}/include/lib${shortname} - $ENV{FFMPEG_DIR}/include/lib${shortname} - ~/Library/Frameworks/lib${shortname} - /Library/Frameworks/lib${shortname} - /usr/local/include/lib${shortname} - /usr/include/lib${shortname} - /sw/include/lib${shortname} # Fink - /opt/local/include/lib${shortname} # DarwinPorts - /opt/csw/include/lib${shortname} # Blastwave - /opt/include/lib${shortname} - /usr/freeware/include/lib${shortname} - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG Headers" - ) - - FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} - PATHS - ${FFMPEG_ROOT}/include - $ENV{FFMPEG_DIR}/include - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include - /usr/include - /sw/include # Fink - /opt/local/include # DarwinPorts - /opt/csw/include # Blastwave - /opt/include - /usr/freeware/include - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG Headers" - ) - - FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES - NAMES ${shortname} - PATHS - ${FFMPEG_ROOT}/lib - $ENV{FFMPEG_DIR}/lib - ~/Library/Frameworks - /Library/Frameworks - /usr/local/lib - /usr/local/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib - /usr/lib64 - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - DOC "Location of FFMPEG Libraries" - ) - - IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) - SET(FFMPEG_${varname}_FOUND 1) - ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) - -ENDMACRO(FFMPEG_FIND) - -SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG") - -# find stdint.h -IF(WIN32) - - FIND_PATH(FFMPEG_STDINT_INCLUDE_DIR stdint.h - PATHS - ${FFMPEG_ROOT}/include - $ENV{FFMPEG_DIR}/include - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include - /usr/include - /sw/include # Fink - /opt/local/include # DarwinPorts - /opt/csw/include # Blastwave - /opt/include - /usr/freeware/include - PATH_SUFFIXES ffmpeg - DOC "Location of FFMPEG stdint.h Header" - ) - - IF (FFMPEG_STDINT_INCLUDE_DIR) - SET(STDINT_OK TRUE) - ENDIF() - -ELSE() - - SET(STDINT_OK TRUE) - -ENDIF() - -FFMPEG_FIND(LIBAVFORMAT avformat avformat.h) -FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h) -FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h) -FFMPEG_FIND(LIBAVUTIL avutil avutil.h) -FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here. -FFMPEG_FIND(LIBX264 x264 x264.h) -FFMPEG_FIND(LIBX265 x265 x265.h) - -SET(FFMPEG_FOUND "NO") - -# Note we don't check FFMPEG_LIBSWSCALE_FOUND, FFMPEG_LIBAVDEVICE_FOUND, -# and FFMPEG_LIBAVUTIL_FOUND as they are optional. -IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND STDINT_OK) - - SET(FFMPEG_FOUND "YES") - - SET(FFMPEG_INCLUDE_DIR ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}) - - SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS}) - - # Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, - # it will be added if found later. - SET(FFMPEG_LIBRARIES - ${FFMPEG_LIBAVFORMAT_LIBRARIES} - ${FFMPEG_LIBAVDEVICE_LIBRARIES} - ${FFMPEG_LIBAVCODEC_LIBRARIES} - ${FFMPEG_LIBAVUTIL_LIBRARIES} - ${FFMPEG_LIBSWSCALE_LIBRARIES} - ${FFMPEG_LIBX264_LIBRARIES} - ${FFMPEG_LIBX265_LIBRARIES}) -ENDIF() +# Find the native FFmpeg includes and libraries. +# +# This module defines: +# FFMPEG_FOUND - True if FFmpeg was found +# FFMPEG_INCLUDE_DIRS - FFmpeg include directories +# FFMPEG_LIBRARIES - All FFmpeg libraries +# FFMPEG_LIBAVCODEC_LIBRARIES - avcodec library +# FFMPEG_LIBAVFORMAT_LIBRARIES - avformat library +# FFMPEG_LIBAVUTIL_LIBRARIES - avutil library +# FFMPEG_LIB_DIR - Directory containing FFmpeg libraries +# +# Accepts: +# FFMPEG_ROOT or ENV{FFMPEG_ROOT} - Custom search path +# -# Find FFmpeg components +# Try pkg-config first find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) - pkg_check_modules(FFMPEG QUIET + pkg_check_modules(PC_FFMPEG QUIET libavcodec libavformat libavutil - libswscale ) endif() -# Find individual components -find_path(FFMPEG_INCLUDE_DIR - NAMES libavcodec/avcodec.h libavformat/avformat.h libavutil/avutil.h libswscale/swscale.h - PATHS - ${FFMPEG_INCLUDE_DIRS} - /usr/include - /usr/local/include - $ENV{FFMPEG_ROOT}/include +# Windows FFmpeg paths +if(WIN32) + set(FFMPEG_WIN32_PREBUILT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/vk_video_decoder/bin/libs/ffmpeg") + if((CMAKE_GENERATOR_PLATFORM MATCHES "^(aarch64|arm64|ARM64)")) + set(FFMPEG_WIN32_PREBUILT_DIR "${FFMPEG_WIN32_PREBUILT_ROOT}/winarm64") + elseif((CMAKE_GENERATOR_PLATFORM MATCHES "^(arm|ARM)")) + set(FFMPEG_WIN32_PREBUILT_DIR "${FFMPEG_WIN32_PREBUILT_ROOT}/winarm") + else() + set(FFMPEG_WIN32_PREBUILT_DIR "${FFMPEG_WIN32_PREBUILT_ROOT}/win64") + endif() +endif() + +set(FFMPEG_ROOT "$ENV{FFMPEG_ROOT}" CACHE PATH "Location of FFmpeg") + +# Common include search paths +set(FFMPEG_INCLUDE_SEARCH_PATHS + ${FFMPEG_ROOT}/include + ${FFMPEG_WIN32_PREBUILT_DIR}/include + ${PC_FFMPEG_INCLUDE_DIRS} + /Library/Frameworks + ~/Library/Frameworks + /opt/csw/include # Blastwave + /opt/include + /opt/local/include # DarwinPorts + /sw/include # Fink + /usr/freeware/include + /usr/include + /usr/local/include +) + +# Find include directories per component +find_path(FFMPEG_LIBAVCODEC_INCLUDE_DIR + NAMES libavcodec/avcodec.h + PATHS ${FFMPEG_INCLUDE_SEARCH_PATHS} + PATH_SUFFIXES ffmpeg +) + +find_path(FFMPEG_LIBAVFORMAT_INCLUDE_DIR + NAMES libavformat/avformat.h + PATHS ${FFMPEG_INCLUDE_SEARCH_PATHS} PATH_SUFFIXES ffmpeg ) -# Find libraries -find_library(AVCODEC_LIBRARY +find_path(FFMPEG_LIBAVUTIL_INCLUDE_DIR + NAMES libavutil/avutil.h + PATHS ${FFMPEG_INCLUDE_SEARCH_PATHS} + PATH_SUFFIXES ffmpeg +) + +# Common library search paths +set(FFMPEG_LIB_SEARCH_PATHS + ${FFMPEG_ROOT}/lib + ${FFMPEG_WIN32_PREBUILT_DIR}/lib + ${PC_FFMPEG_LIBRARY_DIRS} + /Library/Frameworks + ~/Library/Frameworks + /opt/csw/lib # Blastwave + /opt/lib + /opt/local/lib # DarwinPorts + /sw/lib # Fink + /usr/freeware/lib64 + /usr/lib + /usr/lib/aarch64-linux-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib64 + /usr/local/lib + /usr/local/lib64 +) + +# Find required libraries +find_library(FFMPEG_LIBAVCODEC_LIBRARIES NAMES avcodec - PATHS - ${FFMPEG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - $ENV{FFMPEG_ROOT}/lib + PATHS ${FFMPEG_LIB_SEARCH_PATHS} ) -find_library(AVFORMAT_LIBRARY +find_library(FFMPEG_LIBAVFORMAT_LIBRARIES NAMES avformat - PATHS - ${FFMPEG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - $ENV{FFMPEG_ROOT}/lib + PATHS ${FFMPEG_LIB_SEARCH_PATHS} ) -find_library(AVUTIL_LIBRARY +find_library(FFMPEG_LIBAVUTIL_LIBRARIES NAMES avutil - PATHS - ${FFMPEG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - $ENV{FFMPEG_ROOT}/lib + PATHS ${FFMPEG_LIB_SEARCH_PATHS} ) -find_library(SWSCALE_LIBRARY - NAMES swscale - PATHS - ${FFMPEG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - $ENV{FFMPEG_ROOT}/lib +# All required result variables +set(FFMPEG_REQUIRED_VARS + FFMPEG_LIBAVCODEC_INCLUDE_DIR + FFMPEG_LIBAVFORMAT_INCLUDE_DIR + FFMPEG_LIBAVUTIL_INCLUDE_DIR + FFMPEG_LIBAVCODEC_LIBRARIES + FFMPEG_LIBAVFORMAT_LIBRARIES + FFMPEG_LIBAVUTIL_LIBRARIES ) -# Set FFmpeg libraries -set(FFMPEG_LIBRARIES - ${AVCODEC_LIBRARY} - ${AVFORMAT_LIBRARY} - ${AVUTIL_LIBRARY} - ${SWSCALE_LIBRARY} -) - -# Handle the QUIETLY and REQUIRED arguments include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FFmpeg - REQUIRED_VARS - FFMPEG_INCLUDE_DIR - AVCODEC_LIBRARY - AVFORMAT_LIBRARY - AVUTIL_LIBRARY - SWSCALE_LIBRARY + REQUIRED_VARS ${FFMPEG_REQUIRED_VARS} ) -# Mark as advanced -mark_as_advanced( - FFMPEG_INCLUDE_DIR - AVCODEC_LIBRARY - AVFORMAT_LIBRARY - AVUTIL_LIBRARY - SWSCALE_LIBRARY -) +mark_as_advanced(${FFMPEG_REQUIRED_VARS}) -# Set variables for use in the project if(FFMPEG_FOUND) - set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR}) - set(FFMPEG_DEFINITIONS ${FFMPEG_CFLAGS_OTHER}) -endif() + set(FFMPEG_INCLUDE_DIRS + ${FFMPEG_LIBAVCODEC_INCLUDE_DIR} + ${FFMPEG_LIBAVFORMAT_INCLUDE_DIR} + ${FFMPEG_LIBAVUTIL_INCLUDE_DIR} + ) + list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) + set(FFMPEG_LIBRARIES + ${FFMPEG_LIBAVCODEC_LIBRARIES} + ${FFMPEG_LIBAVFORMAT_LIBRARIES} + ${FFMPEG_LIBAVUTIL_LIBRARIES} + ) + get_filename_component(FFMPEG_LIB_DIR "${FFMPEG_LIBAVCODEC_LIBRARIES}" DIRECTORY) +endif() # FFMPEG_FOUND diff --git a/tests/skipped_samples.json b/tests/skipped_samples.json index d1f206b1..3b202e84 100644 --- a/tests/skipped_samples.json +++ b/tests/skipped_samples.json @@ -7,6 +7,7 @@ "source_filepath": "video/av1/av1-argon_test1019.obu", "format": "vvs", "drivers": [ + "amd", "radv" ], "platforms": [ @@ -22,6 +23,7 @@ "source_filepath": "video/av1/av1-argon_test787.obu", "format": "vvs", "drivers": [ + "amd", "radv" ], "platforms": [ @@ -37,8 +39,9 @@ "source_filepath": "video/av1/av1-argon_test9354_2.obu", "format": "vvs", "drivers": [ - "radv", - "anv" + "amd", + "anv", + "radv" ], "platforms": [ "all" @@ -77,6 +80,20 @@ "bug_url": "", "date_added": "2026-01-19" }, + { + "name": "av1_svc_l1t2_8bit", + "format": "vvs", + "drivers": [ + "amd" + ], + "platforms": [ + "all" + ], + "reproduction": "always", + "reason": "md5 mismatch", + "bug_url": "", + "date_added": "2026-04-01" + }, { "name": "h265_itu_slist_b", "format": "vvs", diff --git a/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt b/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt index 5ebba8a3..e625a2ff 100644 --- a/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt +++ b/vk_video_decoder/demos/vk-video-dec/CMakeLists.txt @@ -102,11 +102,7 @@ else() endif() if(FFMPEG_AVAILABLE) - if(WIN32) - list(APPEND libraries PUBLIC ${AVCODEC_LIB} ${AVFORMAT_LIB} ${AVUTIL_LIB}) - else() - list(APPEND libraries PRIVATE ${FFMPEG_LIBAVCODEC_LIBRARIES} ${FFMPEG_LIBAVUTIL_LIBRARIES} ${FFMPEG_LIBAVFORMAT_LIBRARIES}) - endif() + list(APPEND libraries PRIVATE ${FFMPEG_LIBRARIES}) endif() if(TARGET vulkan) diff --git a/vk_video_decoder/libs/VkDecoderUtils/ElementaryStream.cpp b/vk_video_decoder/libs/VkDecoderUtils/ElementaryStream.cpp index b7663768..e8eb7f88 100644 --- a/vk_video_decoder/libs/VkDecoderUtils/ElementaryStream.cpp +++ b/vk_video_decoder/libs/VkDecoderUtils/ElementaryStream.cpp @@ -174,6 +174,22 @@ VkResult ElementaryStreamCreate(const char *pFilePath, VkSharedBaseObj& videoStreamDemuxer) { VkSharedBaseObj elementaryStream; + + if (codecType == VK_VIDEO_CODEC_OPERATION_NONE_KHR) { + fprintf(stderr, "Error: No video codec specified for %s.\n", pFilePath); + return VK_ERROR_FORMAT_NOT_SUPPORTED; + } + if (defaultWidth <= 0 || defaultHeight <= 0) { + fprintf(stderr, "Error: Invalid video dimensions %dx%d for %s.\n", + defaultWidth, defaultHeight, pFilePath); + return VK_ERROR_FORMAT_NOT_SUPPORTED; + } + if (defaultBitDepth != 8 && defaultBitDepth != 10 && defaultBitDepth != 12) { + fprintf(stderr, "Error: Unsupported bit depth %d for %s. Must be 8, 10, or 12.\n", + defaultBitDepth, pFilePath); + return VK_ERROR_FORMAT_NOT_SUPPORTED; + } + VkResult result = ElementaryStream::Create(pFilePath, codecType, defaultWidth, diff --git a/vk_video_decoder/libs/VkDecoderUtils/VideoStreamDemuxer.cpp b/vk_video_decoder/libs/VkDecoderUtils/VideoStreamDemuxer.cpp index 2bb0e2ed..fea89b07 100644 --- a/vk_video_decoder/libs/VkDecoderUtils/VideoStreamDemuxer.cpp +++ b/vk_video_decoder/libs/VkDecoderUtils/VideoStreamDemuxer.cpp @@ -37,12 +37,10 @@ VkResult VideoStreamDemuxer::Create(const char *pFilePath, defaultBitDepth, videoStreamDemuxer); } else +#else + fprintf(stdout, "Note: This build does not include FFmpeg demuxer support.\n"); #endif // FFMPEG_DEMUXER_SUPPORT { - assert(codecType != VK_VIDEO_CODEC_OPERATION_NONE_KHR); - assert(defaultWidth > 0); - assert(defaultHeight > 0); - assert((defaultBitDepth == 8) || (defaultBitDepth == 10) || (defaultBitDepth == 12)); return ElementaryStreamCreate(pFilePath, codecType, defaultWidth, diff --git a/vk_video_decoder/test/vulkan-video-dec/CMakeLists.txt b/vk_video_decoder/test/vulkan-video-dec/CMakeLists.txt index 084a6676..b54f8595 100644 --- a/vk_video_decoder/test/vulkan-video-dec/CMakeLists.txt +++ b/vk_video_decoder/test/vulkan-video-dec/CMakeLists.txt @@ -77,16 +77,9 @@ else() list(APPEND VULKAN_VIDEO_DEC_LIBRARIES PRIVATE -L${LIBNVPARSER_BINARY_ROOT} -L${CMAKE_INSTALL_LIBDIR} -l${VULKAN_VIDEO_PARSER_LIB}) endif() -######## TODO make FFMPEG libraries and demuxer optional. ################### - if(FFMPEG_AVAILABLE) - if(WIN32) - list(APPEND VULKAN_VIDEO_DEC_LIBRARIES PRIVATE ${AVCODEC_LIB} ${AVFORMAT_LIB} ${AVUTIL_LIB}) - else() - list(APPEND VULKAN_VIDEO_DEC_LIBRARIES PRIVATE ${FFMPEG_LIBAVCODEC_LIBRARIES} ${FFMPEG_LIBAVUTIL_LIBRARIES} ${FFMPEG_LIBAVFORMAT_LIBRARIES}) - endif() + list(APPEND VULKAN_VIDEO_DEC_LIBRARIES PRIVATE ${FFMPEG_LIBRARIES}) endif() -######## END of TODO make FFMPEG linbraries and demuxer optional. ################### if(TARGET vulkan) list(APPEND VULKAN_VIDEO_DEC_DEFINITIONS PRIVATE -DUNINSTALLED_LOADER="$")