Projects
Multimedia
bento4
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 23
View file
bento4.changes
Changed
@@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Sat Nov 25 07:08:13 UTC 2023 - Luigi Baldoni <aloisio@gmx.com> + +- Update to version 1.6.0-641 +- Refreshed bento4-shared_library.patch bento4-otherarchs.patch + and bento4-rpmlintrc + +------------------------------------------------------------------- +Sat May 20 03:57:09 UTC 2023 - Luigi Baldoni <aloisio@gmx.com> + +- Update to version 1.6.0-640 + +------------------------------------------------------------------- Sat Jul 24 19:37:09 UTC 2021 - Luigi Baldoni <aloisio@gmx.com> - Update to version 1.6.0-639
View file
bento4.spec
Changed
@@ -1,7 +1,7 @@ # # spec file for package bento4 # -# Copyright (c) 2021 Packman Team <packman@links2linux.de> +# Copyright (c) 2023 Packman Team <packman@links2linux.de> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,10 +16,10 @@ # -%define _over 1.6.0-639 -%define _libver 1_6_0r639 +%define _over 1.6.0-641 +%define _libver 1_6_0r641 Name: bento4 -Version: 1.6.0r639 +Version: 1.6.0r641 Release: 0 Summary: C++ toolkit for all your MP4 and MPEG DASH media format needs License: GPL-2.0-or-later @@ -104,7 +104,8 @@ %files devel %doc README.md Documents/SDK/Bento4_SDK_documentation.pdf -%{_includedir}/ap4 +%{_includedir}/bento4 +%{_libdir}/cmake/bento4 %files -n libap4-%{_libver} %license Documents/LICENSE.txt
View file
bento4-otherarchs.patch
Changed
@@ -1,20 +1,20 @@ -Index: Bento4-1.6.0-634/Source/C++/Core/Ap4Config.h +Index: Bento4-1.6.0-641/Source/C++/Core/Ap4Config.h =================================================================== ---- Bento4-1.6.0-634.orig/Source/C++/Core/Ap4Config.h -+++ Bento4-1.6.0-634/Source/C++/Core/Ap4Config.h +--- Bento4-1.6.0-641.orig/Source/C++/Core/Ap4Config.h ++++ Bento4-1.6.0-641/Source/C++/Core/Ap4Config.h @@ -50,13 +50,13 @@ #define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1 #if !defined(AP4_PLATFORM_BYTE_ORDER) --#if defined(__ppc__) -+#if defined(__ppc__) || defined(__PPC64__) +-#if defined(__ppc__) || defined(__powerpc__) ++#if defined(__ppc__) || defined(__powerpc__) || defined(__PPC64__) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN #elif defined(_MSC_VER) #if defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN #endif --#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) -+#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || defined(__PPC64LE__) +-#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) ++#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || defined(__PPC64LE__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN #endif #endif
View file
bento4-shared_library.patch
Changed
@@ -1,8 +1,8 @@ -Index: Bento4-1.6.0-636/CMakeLists.txt +Index: Bento4-1.6.0-641/CMakeLists.txt =================================================================== ---- Bento4-1.6.0-636.orig/CMakeLists.txt -+++ Bento4-1.6.0-636/CMakeLists.txt -@@ -42,6 +42,14 @@ file(GLOB AP4_SOURCES +--- Bento4-1.6.0-641.orig/CMakeLists.txt ++++ Bento4-1.6.0-641/CMakeLists.txt +@@ -50,6 +50,14 @@ file(GLOB AP4_SOURCES ${SOURCE_SYSTEM}/StdC/*.cpp ) @@ -17,32 +17,35 @@ # Platform specifics if(WIN32) set(AP4_SOURCES ${AP4_SOURCES} ${SOURCE_SYSTEM}/Win32/Ap4Win32Random.cpp) -@@ -57,8 +65,8 @@ set(AP4_INCLUDE_DIRS - ${SOURCE_METADATA} +@@ -71,8 +79,8 @@ file(GLOB AP4_HEADERS + ${SOURCE_METADATA}/*.h ) -add_library(ap4 STATIC ${AP4_SOURCES}) --target_include_directories(ap4 PUBLIC ${AP4_INCLUDE_DIRS}) +-target_include_directories(ap4 PUBLIC +add_library(ap4-__VERSION__ SHARED ${AP4_SOURCES}) -+target_include_directories(ap4-__VERSION__ PUBLIC ${AP4_INCLUDE_DIRS}) ++target_include_directories(ap4-__VERSION__ PUBLIC + ${AP4_INCLUDE_DIRS} + ) - # Use the statically linked C runtime library - if(MSVC) -@@ -72,12 +80,16 @@ if(BUILD_APPS) +@@ -88,9 +96,10 @@ if(BUILD_APPS) file(GLOB BENTO4_APPS RELATIVE ${SOURCE_ROOT}/Apps ${SOURCE_ROOT}/Apps/*) foreach(app ${BENTO4_APPS}) string(TOLOWER ${app} binary_name) + string(CONCAT binary_name "bento4-" ${binary_name}) + list(APPEND BENTO4_APPS_LOWERCASE ${binary_name}) add_executable(${binary_name} ${SOURCE_ROOT}/Apps/${app}/${app}.cpp) - target_link_libraries(${binary_name} ap4) + target_link_libraries(${binary_name} ap4-__VERSION__) -+ INSTALL(TARGETS ${binary_name} DESTINATION bin) if(MSVC) set_property(TARGET ${binary_name} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") - target_compile_definitions(${binary_name} PRIVATE -D_CONSOLE) - endif() - endforeach() -+INSTALL (TARGETS ap4-__VERSION__ DESTINATION lib${LIB_SUFFIX}) -+INSTALL(FILES ${SDK_INCLUDES} DESTINATION include/ap4) - endif(BUILD_APPS) +@@ -120,7 +129,7 @@ configure_package_config_file( + ) + + install( +- TARGETS ap4 ${BENTO4_APPS_LOWERCASE} ++ TARGETS ap4-__VERSION__ ${BENTO4_APPS_LOWERCASE} + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
View file
bento4-1.6.0r641.tar.gz/.github/workflows/codeql.yml
Added
@@ -0,0 +1,41 @@ +name: "CodeQL" + +on: + push: + branches: "master" + pull_request: + branches: "master" + schedule: + - cron: "58 23 * * 4" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: javascript, cpp, python + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{ matrix.language }}"
View file
bento4-1.6.0r639.tar.gz/Build/Docker/Dockerfile -> bento4-1.6.0r641.tar.gz/Build/Docker/Dockerfile
Changed
@@ -1,7 +1,7 @@ FROM alpine:latest # Setup environment variables -ENV BENTO4_VERSION 1.6.0-639 +ENV BENTO4_VERSION 1.6.0-641 # Install Dependencies RUN apk update && apk add --no-cache ca-certificates bash python3 make cmake gcc g++ git @@ -10,7 +10,7 @@ COPY ./ /tmp/bento4 # Build -RUN rm -rf /tmp/bento4/cmakebuild && mkdir -p /tmp/bento4/cmakebuild && cd /tmp/bento4/cmakebuild && cmake -DCMAKE_BUILD_TYPE=Release .. && make +RUN rm -rf /tmp/bento4/cmakebuild && mkdir -p /tmp/bento4/cmakebuild/x86_64-unknown-linux && cd /tmp/bento4/cmakebuild/x86_64-unknown-linux && cmake -DCMAKE_BUILD_TYPE=Release ../.. && make # Install RUN cd /tmp/bento4 && python3 Scripts/SdkPackager.py x86_64-unknown-linux . cmake && mkdir /opt/bento4 && mv /tmp/bento4/SDK/Bento4-SDK-*.x86_64-unknown-linux/* /opt/bento4
View file
bento4-1.6.0r641.tar.gz/Build/Docker/arm.Dockerfile
Added
@@ -0,0 +1,36 @@ +FROM arm64v8/alpine:latest + +# Setup environment variables +ENV BENTO4_VERSION 1.6.0-639 + +# Install Dependencies +RUN apk update && apk add --no-cache ca-certificates bash python3 make cmake gcc g++ git + +# Copy Sources +COPY ./ /tmp/bento4 + +# Build +RUN rm -rf /tmp/bento4/cmakebuild && mkdir -p /tmp/bento4/cmakebuild/arm64-unknown-linux && cd /tmp/bento4/cmakebuild/arm64-unknown-linux && cmake -DCMAKE_BUILD_TYPE=Release ../.. && make -j$(nproc) + +# Install +RUN cd /tmp/bento4 && python3 Scripts/SdkPackager.py arm64-unknown-linux . cmake && mkdir /opt/bento4 && mv /tmp/bento4/SDK/Bento4-SDK-*.arm64-unknown-linux/* /opt/bento4 + +# === Second Stage === +FROM arm64v8/alpine:latest +ARG BENTO4_VERSION +LABEL "com.example.vendor"="Axiomatic Systems, LLC." +LABEL version=$BENTO4_VERSION +LABEL maintainer="bok@bok.net" + +# Setup environment variables +ENV PATH=/opt/bento4/bin:${PATH} + +# Install Dependencies +RUN apk --no-cache add ca-certificates bash python3 libstdc++ + +# Copy Binaries +COPY --from=0 /opt/bento4 /opt/bento4 + +WORKDIR /opt/bento4 + +CMD "bash"
View file
bento4-1.6.0r639.tar.gz/Build/Makefiles/Lib.mak -> bento4-1.6.0r641.tar.gz/Build/Makefiles/Lib.mak
Changed
@@ -14,6 +14,7 @@ Ap4AtomSampleTable.cpp \ Ap4AvccAtom.cpp \ Ap4VpccAtom.cpp \ + Ap4Av1cAtom.cpp \ Ap4ByteStream.cpp \ Ap4Co64Atom.cpp \ Ap4ContainerAtom.cpp \
View file
bento4-1.6.0r641.tar.gz/Build/Targets/arm64-unknown-linux
Added
+(directory)
View file
bento4-1.6.0r641.tar.gz/Build/Targets/arm64-unknown-linux/Config.scons
Added
@@ -0,0 +1,15 @@ +### on x86_64, we need to build all the objects as PIC +picLibBuilder = Builder(action = Action('$ARCOM'), + emitter = '$LIBEMITTER', + prefix = '$LIBPREFIX', + suffix = '$LIBSUFFIX', + src_suffix = '$OBJSUFFIX', + src_builder = 'SharedObject') +env'BUILDERS''StaticLibrary' = picLibBuilder +env'BUILDERS''Library' = picLibBuilder + +### Load common tool settings +LoadTool('gcc-generic', env) + +env.AppendUnique(CPPDEFINES = ('AP4_PLATFORM_BYTE_ORDER', 'AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN')) +
View file
bento4-1.6.0r641.tar.gz/Build/Targets/arm64-unknown-linux/Local.mak
Added
@@ -0,0 +1,7 @@ +####################################################################### +# +# Makefile for arm64-unknown-cygwin +# +####################################################################### +TARGET = arm64-unknown-linux +include ../../any-gnu-gcc/Local.mak
View file
bento4-1.6.0r641.tar.gz/Build/Targets/arm64-unknown-linux/Makefile
Added
@@ -0,0 +1,1 @@ +include ../../Makefiles/Bootstrap.mak
View file
bento4-1.6.0r639.tar.gz/Build/Targets/universal-apple-macosx/Bento4.xcodeproj/project.pbxproj -> bento4-1.6.0r641.tar.gz/Build/Targets/universal-apple-macosx/Bento4.xcodeproj/project.pbxproj
Changed
@@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 51; objects = { /* Begin PBXAggregateTarget section */ @@ -1141,7 +1141,7 @@ CA86EEE419A95E30008A3B00 /* FragmentCreatorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FragmentCreatorTest.cpp; sourceTree = "<group>"; }; CA87B9421F81B08B005F42D6 /* mp4diff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mp4diff; sourceTree = BUILT_PRODUCTS_DIR; }; CA87B94C1F81B122005F42D6 /* Mp4Diff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Diff.cpp; sourceTree = "<group>"; }; - CA87B9521F895A84005F42D6 /* Mp4IframeIndex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = Mp4IframeIndex; path = mp4iframeindex; sourceTree = BUILT_PRODUCTS_DIR; }; + CA87B9521F895A84005F42D6 /* mp4iframeindex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mp4iframeindex; sourceTree = BUILT_PRODUCTS_DIR; }; CA87B95D1F895B14005F42D6 /* Mp4IframeIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4IframeIndex.cpp; sourceTree = "<group>"; }; CA8A94CE1929A65E00836179 /* mp4mux */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mp4mux; sourceTree = BUILT_PRODUCTS_DIR; }; CA8A94DB1929A6C100836179 /* Mp4Mux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Mux.cpp; sourceTree = "<group>"; }; @@ -1803,7 +1803,7 @@ CAE1FBF61AF8493E00607B3C /* mp42hls */, CAFE9C691D1B487700F9FF67 /* LargeFilesTest */, CA87B9421F81B08B005F42D6 /* mp4diff */, - CA87B9521F895A84005F42D6 /* Mp4IframeIndex */, + CA87B9521F895A84005F42D6 /* mp4iframeindex */, ); name = Products; sourceTree = "<group>"; @@ -3082,7 +3082,7 @@ ); name = Mp4IframeIndex; productName = Mp4IframeIndex; - productReference = CA87B9521F895A84005F42D6 /* Mp4IframeIndex */; + productReference = CA87B9521F895A84005F42D6 /* mp4iframeindex */; productType = "com.apple.product-type.tool"; }; CA8A94CD1929A65E00836179 /* Mp4Mux */ = { @@ -3419,7 +3419,7 @@ }; }; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "Bento4" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 10.0"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -4392,10 +4392,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 12.0; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; - VALID_ARCHS = "i386 x86_64"; + VALID_ARCHS = "arm64 arm64e i386 x86_64"; "VALID_ARCHSsdk=iphoneos*" = "armv6 armv7 armv7s arm64"; "VALID_ARCHSsdk=iphonesimulator*" = "i386 x86_64"; }; @@ -4434,10 +4434,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 12.0; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; - VALID_ARCHS = "i386 x86_64"; + VALID_ARCHS = "arm64 arm64e i386 x86_64"; "VALID_ARCHSsdk=iphoneos*" = "armv6 armv7 armv7s arm64"; "VALID_ARCHSsdk=iphonesimulator*" = "i386 x86_64"; }; @@ -4960,7 +4960,6 @@ ); GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = mp4diff; @@ -4992,7 +4991,6 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = mp4diff; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -5026,7 +5024,6 @@ ); GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = mp4iframeindex; @@ -5056,7 +5053,6 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = mp4iframeindex; SDKROOT = macosx; @@ -5516,7 +5512,6 @@ GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5554,7 +5549,6 @@ GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx;
View file
bento4-1.6.0r641.tar.gz/Build/cmake
Added
+(directory)
View file
bento4-1.6.0r641.tar.gz/Build/cmake/Config.cmake.in
Added
@@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@")
View file
bento4-1.6.0r639.tar.gz/CMakeLists.txt -> bento4-1.6.0r641.tar.gz/CMakeLists.txt
Changed
@@ -7,7 +7,15 @@ cmake_minimum_required(VERSION 3.10) endif() -project(bento4) +function(get_bento4_version) + file(STRINGS "Source/C++/Core/Ap4Version.h" _temp REGEX "AP4_VERSION_STRING") + string(REGEX MATCH "\"(^\"+)\"" _temp "${_temp}") + set(BENTO4_VERSION "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +get_bento4_version() +set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "") +project(bento4 VERSION "${BENTO4_VERSION}") # Variables set(SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Source/C++) @@ -51,14 +59,22 @@ # Includes set(AP4_INCLUDE_DIRS - ${SOURCE_CORE} - ${SOURCE_CODECS} - ${SOURCE_CRYPTO} - ${SOURCE_METADATA} + $<BUILD_INTERFACE:${SOURCE_CORE}> + $<BUILD_INTERFACE:${SOURCE_CODECS}> + $<BUILD_INTERFACE:${SOURCE_CRYPTO}> + $<BUILD_INTERFACE:${SOURCE_METADATA}> +) +file(GLOB AP4_HEADERS + ${SOURCE_CORE}/*.h + ${SOURCE_CODECS}/*.h + ${SOURCE_CRYPTO}/*.h + ${SOURCE_METADATA}/*.h ) add_library(ap4 STATIC ${AP4_SOURCES}) -target_include_directories(ap4 PUBLIC ${AP4_INCLUDE_DIRS}) +target_include_directories(ap4 PUBLIC + ${AP4_INCLUDE_DIRS} +) # Use the statically linked C runtime library if(MSVC) @@ -72,6 +88,7 @@ file(GLOB BENTO4_APPS RELATIVE ${SOURCE_ROOT}/Apps ${SOURCE_ROOT}/Apps/*) foreach(app ${BENTO4_APPS}) string(TOLOWER ${app} binary_name) + list(APPEND BENTO4_APPS_LOWERCASE ${binary_name}) add_executable(${binary_name} ${SOURCE_ROOT}/Apps/${app}/${app}.cpp) target_link_libraries(${binary_name} ap4) @@ -81,3 +98,48 @@ endif() endforeach() endif(BUILD_APPS) + +# Install +include(GNUInstallDirs) +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") +set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") +set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") +set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") +set(namespace "${PROJECT_NAME}::") + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${version_config}" COMPATIBILITY SameMajorVersion +) + +configure_package_config_file( + "Build/cmake/Config.cmake.in" + "${project_config}" + INSTALL_DESTINATION "${config_install_dir}" +) + +install( + TARGETS ap4 ${BENTO4_APPS_LOWERCASE} + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +install( + FILES ${AP4_HEADERS} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bento4" +) + +install( + FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}" +) + +install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}" +)
View file
bento4-1.6.0r639.tar.gz/Documents/MkDocs/requirements.txt -> bento4-1.6.0r641.tar.gz/Documents/MkDocs/requirements.txt
Changed
@@ -1,5 +1,5 @@ # This requirements file is for python3 -mkdocs == 1.1 +mkdocs == 1.2.3 mkdocs-material == 7.1.5 mkdocs-material-extensions == 1.0 -pymdown-extensions == 7.0 +pymdown-extensions == 10.0
View file
bento4-1.6.0r639.tar.gz/Documents/MkDocs/src/developers/dash/index.md -> bento4-1.6.0r641.tar.gz/Documents/MkDocs/src/developers/dash/index.md
Changed
@@ -157,6 +157,7 @@ `hls_group_match` | `<hls-group-match>` | (only with `--hls`) | `hls_default` | `YES` or `NO` | (only with `--hls`) | `hls_autoselect` | `YES` or `NO` | (only with `--hls`) | + `hls_characteristic`| `<hls-characteristic>` (string) | (only with `--hls`) | ### Multi-language
View file
bento4-1.6.0r639.tar.gz/Documents/MkDocs/src/downloads.md -> bento4-1.6.0r641.tar.gz/Documents/MkDocs/src/downloads.md
Changed
@@ -5,9 +5,9 @@ As a convenience, we publish here the most recent version of the binary releases (SDK with header files, libraries and command line applications) for the most common platforms, and the corresponding source snapshot. -## Version 1.6.0-638 +## Version 1.6.0-640 -:fontawesome-brands-windows: Binaries for Windows 10(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-638.x86_64-microsoft-win32.zip) -:fontawesome-brands-apple: Binaries for macOS(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-638.universal-apple-macosx.zip) -:fontawesome-brands-linux: Binaries for Linux x86_64(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-638.x86_64-unknown-linux.zip) -:fontawesome-solid-code: Source Snapshot (all platforms)(https://www.bok.net/Bento4/source/Bento4-SRC-1-6-0-638.zip) +:fontawesome-brands-windows: Binaries for Windows 10(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-640.x86_64-microsoft-win32.zip) +:fontawesome-brands-apple: Binaries for macOS(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-640.universal-apple-macosx.zip) +:fontawesome-brands-linux: Binaries for Linux x86_64(https://www.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-640.x86_64-unknown-linux.zip) +:fontawesome-solid-code: Source Snapshot (all platforms)(https://www.bok.net/Bento4/source/Bento4-SRC-1-6-0-640.zip)
View file
bento4-1.6.0r639.tar.gz/README.md -> bento4-1.6.0r641.tar.gz/README.md
Changed
@@ -1,9 +1,6 @@ Bento4 ===== !CI(https://github.com/axiomatic-systems/Bento4/workflows/CI/badge.svg?branch=master) -!Build Status(https://travis-ci.org/axiomatic-systems/Bento4.svg?branch=master)(https://travis-ci.org/axiomatic-systems/Bento4.svg?branch=master) -!Code Quality: Cpp(https://img.shields.io/lgtm/grade/cpp/g/axiomatic-systems/Bento4.svg?logo=lgtm&logoWidth=18)(https://lgtm.com/projects/g/axiomatic-systems/Bento4/context:cpp) -!Total Alerts(https://img.shields.io/lgtm/alerts/g/axiomatic-systems/Bento4.svg?logo=lgtm&logoWidth=18)(https://lgtm.com/projects/g/axiomatic-systems/Bento4/alerts) Bento4 is a C++ class library and tools designed to read and write ISO-MP4 files. This format is defined in international specifications ISO/IEC 14496-12, 14496-14 and 14496-15. @@ -27,7 +24,7 @@ * The UltraViolet (DECE) CFF (Common File Format). * Parsing and multiplexing of H.264 (AVC) video and AAC audio elementary streams * Support for multiple DRM systems that are compatible with MP4-formatted content (usually leveraging CENC Common Encryption), such as Marlin, PlayReady and Widevine. - * Support for a wide range of codecs, including H.264 (AVC), H.265 (HEVC), AAC, AC3 and eAC3 (Dolby Digital), DTS, ALAC, and many more. + * Support for a wide range of codecs, including H.264 (AVC), H.265 (HEVC), AAC, AC-3, EC-3 (Dolby Digital Plus), AC-4, Dolby ATMOS, DTS, ALAC, and many more. Design ------ @@ -93,7 +90,7 @@ mkdir cmakebuild cd cmakebuild - cmake -G Xcode + cmake -G Xcode .. cmake --build . --config Release #### CMake/Visual Studio @@ -139,6 +136,18 @@ For Release builds: ```make AP4_BUILD_CONFIG=Release``` +## Installing Bento4 (vcpkg) + +Alternatively, you can build and install Bento4 using vcpkg(https://github.com/Microsoft/vcpkg/) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + ./vcpkg install bento4 + +The Bento4 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request(https://github.com/Microsoft/vcpkg) on the vcpkg repository. + Release Notes ------------- @@ -158,4 +167,4 @@ Dolby Vision encryption now properly encrypts in a NAL-unit-aware mode ### Previous releases -(no seaparate notes, please refer to commit logs) \ No newline at end of file +(no seaparate notes, please refer to commit logs)
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/AvcInfo/AvcInfo.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/AvcInfo/AvcInfo.cpp
Changed
@@ -167,7 +167,8 @@ const char* primary_pic_type_name = AP4_AvcNalParser::PrimaryPicTypeName(primary_pic_type); if (primary_pic_type_name == NULL) primary_pic_type_name = "UNKNOWN"; printf(" %d:%s\n", primary_pic_type, primary_pic_type_name); - } else if (nalu_type == 1 || nalu_type == 2 || nalu_type == 5 || nalu_type == 19) { + } else if ((nalu_type == 1 || nalu_type == 2 || nalu_type == 5 || nalu_type == 19) + && nalu->GetDataSize() > 1) { PrintSliceInfo(&nalu_payload1); printf("\n"); } else {
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/HevcInfo/HevcInfo.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/HevcInfo/HevcInfo.cpp
Changed
@@ -122,7 +122,7 @@ (int)nalu->GetDataSize(), nalu_type, nalu_type_name); - if (nalu_type == AP4_HEVC_NALU_TYPE_AUD_NUT) { + if (nalu_type == AP4_HEVC_NALU_TYPE_AUD_NUT && nalu->GetDataSize() > 1) { // Access Unit Delimiter unsigned int pic_type = (nalu_payload1>>5); const char* pic_type_name = AP4_HevcNalParser::PicTypeName(pic_type);
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp42Hls/Mp42Hls.cpp
Changed
@@ -82,6 +82,7 @@ const char* segment_url_template; unsigned int segment_duration; unsigned int segment_duration_threshold; + const char* allow_cache; const char* encryption_key_hex; AP4_UI08 encryption_key16; AP4_UI08 encryption_iv16; @@ -148,6 +149,8 @@ " --pcr-offset <offset> in units of 90kHz (default 10000)\n" " --index-filename <filename>\n" " Filename to use for the playlist/index (default: stream.m3u8)\n" + " --allow-cache <YES|NO>\n" + " set #EXT-X-ALLOW-CACHE to YES or NO\n" " --segment-filename-template <pattern>\n" " Filename pattern to use for the segments. Use a printf-style pattern with\n" " one number field for the segment number, unless using single file mode\n" @@ -1358,6 +1361,11 @@ if (video_track) { playlist->WriteString("#EXT-X-INDEPENDENT-SEGMENTS\r\n"); } + if (Options.allow_cache) { + playlist->WriteString("#EXT-X-ALLOW-CACHE:"); + playlist->WriteString(Options.allow_cache); + playlist->WriteString("\r\n"); + } playlist->WriteString("#EXT-X-TARGETDURATION:"); sprintf(string_buffer, "%d\r\n", target_duration); playlist->WriteString(string_buffer); @@ -1580,6 +1588,7 @@ Options.segment_url_template = NULL; Options.segment_duration = 6; Options.segment_duration_threshold = DefaultSegmentDurationThreshold; + Options.allow_cache = NULL; Options.encryption_key_hex = NULL; Options.encryption_mode = ENCRYPTION_MODE_NONE; Options.encryption_iv_mode = ENCRYPTION_IV_MODE_NONE; @@ -1631,6 +1640,12 @@ return 1; } Options.segment_url_template = *args++; + } else if (!strcmp(arg, "--allow-cache")) { + if (*args == NULL || (strcmp(*args, "NO") && strcmp(*args, "YES"))) { + fprintf(stderr, "ERROR: --allow-cache requires a YES or NO argument\n"); + return 1; + } + Options.allow_cache = *args++; } else if (!strcmp(arg, "--pmt-pid")) { if (*args == NULL) { fprintf(stderr, "ERROR: --pmt-pid requires a number\n"); @@ -1850,7 +1865,7 @@ } if (Options.encryption_iv_mode == ENCRYPTION_IV_MODE_FPS) { - if (AP4_StringLength(Options.encryption_key_hex) != 64) { + if (Options.encryption_key_hex == NULL || AP4_StringLength(Options.encryption_key_hex) != 64) { fprintf(stderr, "ERROR: 'fps' IV mode requires a 32 byte key value (64 characters in hex)\n"); return 1; }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp42Ts/Mp42Ts.cpp
Changed
@@ -515,6 +515,8 @@ AP4_Movie* movie = input_file->GetMovie(); if (movie == NULL) { fprintf(stderr, "ERROR: no movie in file\n"); + delete input; + delete input_file; return 1; }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp4AudioClip/Mp4AudioClip.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp4AudioClip/Mp4AudioClip.cpp
Changed
@@ -100,6 +100,16 @@ } } + // check arguments + if (!input_filename) { + fprintf(stderr, "ERROR: missing input file name argument\n"); + return 1; + } + if (!output_filename) { + fprintf(stderr, "ERROR: missing output file name argument\n"); + return 1; + } + // create the input stream AP4_ByteStream* input = NULL; result = AP4_FileByteStream::Create(input_filename, AP4_FileByteStream::STREAM_MODE_READ, input); @@ -130,7 +140,12 @@ // (in almost all cases, there will only be one sample description) // NOTE: we don't transfer the ownership of the object for (unsigned int i=0; i<input_track->GetSampleDescriptionCount(); i++) { - sample_table->AddSampleDescription(input_track->GetSampleDescription(i), false); + AP4_SampleDescription* sample_description = input_track->GetSampleDescription(i); + if (!sample_description) { + fprintf(stderr, "ERROR: invalid/unsupported sample description\n"); + return 1; + } + sample_table->AddSampleDescription(sample_description, false); } // the first output timestamp is 0
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp4Encrypt/Mp4Encrypt.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp4Encrypt/Mp4Encrypt.cpp
Changed
@@ -37,9 +37,9 @@ /*---------------------------------------------------------------------- | constants +---------------------------------------------------------------------*/ -#define BANNER "MP4 Encrypter - Version 1.6\n"\ +#define BANNER "MP4 Encrypter - Version 1.7\n"\ "(Bento4 Version " AP4_VERSION_STRING ")\n"\ - "(c) 2002-2016 Axiomatic Systems, LLC" + "(c) 2002-2021 Axiomatic Systems, LLC" /*---------------------------------------------------------------------- | PrintUsageAndExit @@ -60,6 +60,11 @@ " --fragments-info <filename>\n" " Encrypt the fragments read from <input>, with track info read\n" " from <filename>\n" + " --multi\n" + " Encrypt multiple individual fragment files. With this option,\n" + " <input> is a list of fragment input files, and <output> is a\n" + " printf-style filename pattern where the first %%s is replaced with\n" + " the name of the corresponding input file, with the suffix omitted\n" " --key <n>:<k>:<iv>\n" " Specifies the key to use for a track (or group key).\n" " <n> is a track ID, <k> a 128-bit key in hex (32 characters)\n" @@ -139,6 +144,8 @@ METHOD_ISMA_AES }; +const unsigned int MP4_ENCRYPT_MAX_FILENAME_LENGTH = 2048; + /*---------------------------------------------------------------------- | ProgressListener +---------------------------------------------------------------------*/ @@ -210,6 +217,114 @@ } /*---------------------------------------------------------------------- +| CreateProcessor ++---------------------------------------------------------------------*/ +static AP4_Processor* +CreateProcessor(enum Method method, + const char* kms_uri, + AP4_ProtectionKeyMap& key_map, + AP4_TrackPropertyMap& property_map, + AP4_Array<AP4_PsshAtom*>& pssh_atoms) +{ + if (method == METHOD_ISMA_AES) { + if (kms_uri == NULL) { + fprintf(stderr, "ERROR: method ISMA-IAEC requires --kms-uri\n"); + return NULL; + } + AP4_IsmaEncryptingProcessor* isma_processor = new AP4_IsmaEncryptingProcessor(kms_uri); + isma_processor->GetKeyMap().SetKeys(key_map); + return isma_processor; + } else if (method == METHOD_MARLIN_IPMP_ACBC || + method == METHOD_MARLIN_IPMP_ACGK) { + bool use_group_key = (method == METHOD_MARLIN_IPMP_ACGK); + if (use_group_key) { + // check that the group key is set + if (key_map.GetKey(0) == NULL) { + fprintf(stderr, "ERROR: method MARLIN-IPMP-ACGK requires a group key\n"); + return NULL; + } + } + AP4_MarlinIpmpEncryptingProcessor* marlin_processor = + new AP4_MarlinIpmpEncryptingProcessor(use_group_key); + marlin_processor->GetKeyMap().SetKeys(key_map); + marlin_processor->GetPropertyMap().SetProperties(property_map); + return marlin_processor; + } else if (method == METHOD_OMA_PDCF_CTR || + method == METHOD_OMA_PDCF_CBC) { + AP4_OmaDcfEncryptingProcessor* oma_processor = + new AP4_OmaDcfEncryptingProcessor(method == METHOD_OMA_PDCF_CTR? + AP4_OMA_DCF_CIPHER_MODE_CTR : + AP4_OMA_DCF_CIPHER_MODE_CBC); + oma_processor->GetKeyMap().SetKeys(key_map); + oma_processor->GetPropertyMap().SetProperties(property_map); + return oma_processor; + } else if (method == METHOD_PIFF_CTR || + method == METHOD_PIFF_CBC || + method == METHOD_MPEG_CENC || + method == METHOD_MPEG_CBC1 || + method == METHOD_MPEG_CENS || + method == METHOD_MPEG_CBCS) { + AP4_CencVariant variant = AP4_CENC_VARIANT_MPEG_CENC; + AP4_UI32 options = 0; + + // init local options based on global options + if (AP4_GlobalOptions::GetBool("mpeg-cenc.eme-pssh")) { + options |= AP4_CencEncryptingProcessor::OPTION_EME_PSSH; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.piff-compatible")) { + options |= AP4_CencEncryptingProcessor::OPTION_PIFF_COMPATIBILITY; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.piff-iv-size-16")) { + options |= AP4_CencEncryptingProcessor::OPTION_PIFF_IV_SIZE_16; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.iv-size-8")) { + options |= AP4_CencEncryptingProcessor::OPTION_IV_SIZE_8; + } + if (AP4_GlobalOptions::GetBool("mpeg-cenc.no-senc")) { + options |= AP4_CencEncryptingProcessor::OPTION_NO_SENC; + } + + switch (method) { + case METHOD_PIFF_CBC: + variant = AP4_CENC_VARIANT_PIFF_CBC; + break; + + case METHOD_PIFF_CTR: + variant = AP4_CENC_VARIANT_PIFF_CTR; + break; + + case METHOD_MPEG_CENC: + variant = AP4_CENC_VARIANT_MPEG_CENC; + break; + + case METHOD_MPEG_CBC1: + variant = AP4_CENC_VARIANT_MPEG_CBC1; + break; + + case METHOD_MPEG_CENS: + variant = AP4_CENC_VARIANT_MPEG_CENS; + break; + + case METHOD_MPEG_CBCS: + variant = AP4_CENC_VARIANT_MPEG_CBCS; + break; + + default: + break; + } + AP4_CencEncryptingProcessor* cenc_processor = new AP4_CencEncryptingProcessor(variant, options); + cenc_processor->GetKeyMap().SetKeys(key_map); + cenc_processor->GetPropertyMap().SetProperties(property_map); + for (unsigned int i=0; i<pssh_atoms.ItemCount(); i++) { + cenc_processor->GetPsshAtoms().Append(pssh_atomsi); + } + return cenc_processor; + } + + return NULL; +} + +/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int @@ -223,6 +338,8 @@ const char* input_filename = NULL; const char* output_filename = NULL; const char* fragments_info_filename = NULL; + bool multi = false; + AP4_Array<const char*> input_fragments; AP4_ProtectionKeyMap key_map; AP4_TrackPropertyMap property_map; bool show_progress = false; @@ -274,6 +391,8 @@ return 1; } fragments_info_filename = arg; + } else if (!strcmp(arg, "--multi")) { + multi = true; } else if (!strcmp(arg, "--pssh") || !strcmp(arg, "--pssh-v1")) { bool v1 = (strcmp(arg, "--pssh-v1") == 0); arg = *++argv; @@ -495,6 +614,12 @@ return 1; } AP4_GlobalOptions::SetString(name, value); + } else if (multi) { + if (argv1) { + input_fragments.Append(arg); + } else { + output_filename = arg; + } } else if (input_filename == NULL) { input_filename = arg; } else if (output_filename == NULL) { @@ -510,128 +635,63 @@ fprintf(stderr, "ERROR: missing --method argument\n"); return 1; } - if (input_filename == NULL) { - fprintf(stderr, "ERROR: missing input filename\n"); - return 1; - } - if (output_filename == NULL) { - fprintf(stderr, "ERROR: missing output filename\n"); - return 1; - } - - // create an encrypting processor - AP4_Processor* processor = NULL; - if (method == METHOD_ISMA_AES) { - if (kms_uri == NULL) { - fprintf(stderr, "ERROR: method ISMA-IAEC requires --kms-uri\n"); + if (multi) { + if (fragments_info_filename == NULL) { + fprintf(stderr, "ERROR: --multi requires --fragments-info\n");
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp4Info/Mp4Info.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp4Info/Mp4Info.cpp
Changed
@@ -588,9 +588,17 @@ // Dolby AC-4 specifics AP4_Dac4Atom* dac4 = AP4_DYNAMIC_CAST(AP4_Dac4Atom, desc->GetDetails().GetChild(AP4_ATOM_TYPE_DAC4)); if (dac4) { + printf(" Codecs String: "); + AP4_String codec; + dac4->GetCodecString(codec); + printf("%s", codec.GetChars()); + printf("\n"); + const AP4_Dac4Atom::Ac4Dsi& dsi = dac4->GetDsi(); + printf(" AC-4 dsi version: %d\n", dsi.ac4_dsi_version); unsigned short self_contained = 0; if (dsi.ac4_dsi_version == 1) { + printf(" AC-4 bitstream version: %d\n", dsi.d.v1.bitstream_version); for (unsigned int i = 0; i < dsi.d.v1.n_presentations; i++) { AP4_Dac4Atom::Ac4Dsi::PresentationV1& presentation = dsi.d.v1.presentationsi; if (presentation.presentation_version == 1 || presentation.presentation_version == 2) { @@ -893,16 +901,16 @@ AP4_Dec3Atom* dec3 = AP4_DYNAMIC_CAST(AP4_Dec3Atom, desc->GetDetails().GetChild(AP4_ATOM_TYPE('d', 'e', 'c', '3'))); if (dec3) { printf(",\n"); - printf("\"dolby_digital_info\": {\n"); + printf("\"dolby_digital_plus_info\": {\n"); printf(" \"dec3_payload\": \""); ShowData(dec3->GetRawBytes()); printf("\",\n"); printf(" \"data_rate\": %d,\n", dec3->GetDataRate()); if (dec3->GetFlagEC3ExtensionTypeA()){ - printf(" \"Dolby Digital Plus with Dolby Atmos\": \"Yes\",\n"); - printf(" \"Dolby Atmos Complexity Index\": %d,\n", dec3->GetComplexityIndexTypeA()); + printf(" \"Dolby_Atmos\": \"Yes\",\n"); + printf(" \"complexity_index\": %d,\n", dec3->GetComplexityIndexTypeA()); } else { - printf(" \"Dolby Digital Plus with Dolby Atmos\": \"No\",\n"); + printf(" \"Dolby_Atmos\": \"No\",\n"); } printf(" \"substreams\": \n"); const char* sep = ""; @@ -929,11 +937,12 @@ if (dac4) { printf(",\n"); printf("\"dolby_ac4_info\": {\n"); - - printf(" \"presentations\": \n"); const AP4_Dac4Atom::Ac4Dsi& dsi = dac4->GetDsi(); + printf(" \"dsi version\": %d,\n", dsi.ac4_dsi_version); unsigned short self_contained = 0; if (dsi.ac4_dsi_version == 1) { + printf(" \"bitstream version\": %d,\n", dsi.d.v1.bitstream_version); + printf(" \"presentations\": \n"); const char* separator = ""; for (unsigned int i = 0; i < dsi.d.v1.n_presentations; i++) { AP4_Dac4Atom::Ac4Dsi::PresentationV1& presentation = dsi.d.v1.presentationsi; @@ -1014,7 +1023,48 @@ // Dolby Vision specifics AP4_DvccAtom* dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, desc->GetDetails().GetChild(AP4_ATOM_TYPE_DVCC)); + if(!dvcc) { + dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, desc->GetDetails().GetChild(AP4_ATOM_TYPE_DVVC)); + } if (dvcc) { + /* Codec String */ + char workspace64; + char coding5; + strncpy(coding, codec.GetChars(), 4); + coding4 = '\0'; + /* Non back-compatible */ + if (strcmp(coding, "dvav") == 0 || strcmp(coding, "dva1") == 0 || + strcmp(coding, "dvhe") == 0 || strcmp(coding, "dvh1") == 0){ + AP4_FormatString(workspace, + sizeof(workspace), + "%s.%02d.%02d", + coding, + dvcc->GetDvProfile(), + dvcc->GetDvLevel()); + codec = workspace; + } else { + if (strcmp(coding, "avc1") == 0){ + strcpy(coding, "dva1"); + }else if (strcmp(coding, "avc3") == 0){ + strcpy(coding, "dvav"); + }else if (strcmp(coding, "hev1") == 0){ + strcpy(coding, "dvhe"); + }else if (strcmp(coding, "hvc1") == 0){ + strcpy(coding, "dvh1"); + } + AP4_FormatString(workspace, + sizeof(workspace), + "%s,%s.%02d.%02d", + codec.GetChars(), + coding, + dvcc->GetDvProfile(), + dvcc->GetDvLevel()); + codec = workspace; + } + printf(",\n"); + printf("\"dv_codecs_string\":\""); + printf("%s", codec.GetChars()); + printf("\""); /* Dolby Vision */ printf(",\n"); printf("\"dolby_vision\": {\n"); @@ -1490,7 +1540,7 @@ switch (Options.format) { case TEXT_FORMAT: printf("Movie:\n"); - printf(" duration: %lld (media timescale units)\n", movie.GetDuration()); + printf(" duration: %lld (movie timescale units)\n", movie.GetDuration()); printf(" duration: %d (ms)\n", movie.GetDurationMs()); printf(" time scale: %d\n", movie.GetTimeScale()); printf(" fragments: %s\n", movie.HasFragments()?"yes":"no");
View file
bento4-1.6.0r639.tar.gz/Source/C++/Apps/Mp4Mux/Mp4Mux.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Apps/Mp4Mux/Mp4Mux.cpp
Changed
@@ -91,10 +91,15 @@ "\n" "Supported types:\n" " h264: H264/AVC NAL units\n" + " optional params:\n" + " dv_profile: integer number for Dolby vision profile ID (valid value: 9)\n" + " dv_bc: integer number for Dolby vision BL signal cross-compatibility ID (must be 2 if dv_profile is set to 9)\n" + " frame_rate: floating point number in frames per second (default=24.0)\n" + " format: avc1 (default) or avc3 for AVC tracks and Dolby Vision back-compatible tracks\n" " h265: H265/HEVC NAL units\n" " optional params:\n" - " dv_profile: integer number for Dolby vision profile ID (valid value: 5,8,9)\n" - " dv_bc: integer number for Dolby vision BL signal cross-compatibility ID (mandatory if dv_profile is set to 8/9)\n" + " dv_profile: integer number for Dolby vision profile ID (valid value: 5,8)\n" + " dv_bc: integer number for Dolby vision BL signal cross-compatibility ID (mandatory if dv_profile is set to 8)\n" " frame_rate: floating point number in frames per second (default=24.0)\n" " format: hev1 or hvc1 (default) for HEVC tracks and Dolby Vision backward-compatible tracks\n" " dvhe or dvh1 (default) for Dolby vision tracks\n" @@ -181,7 +186,7 @@ } else if (level <= 3840*2160*60) { dv_level = 9; } else if (level <= 3840*2160*120) { - if(video_width == 7680) { + if (video_width == 7680) { dv_level = 11; } else { dv_level = 10; @@ -237,42 +242,40 @@ format = AP4_SAMPLE_FORMAT_DVH1; } else if (parametersi.m_Value == "dvhe") { format = AP4_SAMPLE_FORMAT_DVHE; + } else if (parametersi.m_Value == "avc1") { + format = AP4_SAMPLE_FORMAT_AVC1; + } else if (parametersi.m_Value == "avc3") { + format = AP4_SAMPLE_FORMAT_AVC3; } else if (parametersi.m_Value == "dvav") { format = AP4_SAMPLE_FORMAT_DVAV; } else if (parametersi.m_Value == "dva1") { format = AP4_SAMPLE_FORMAT_DVA1; + } else { + fprintf(stderr, "ERROR: format name is invalid\n"); + return AP4_ERROR_INVALID_PARAMETERS; } } } //check: sample entry box name is set correctly - if (format) { - if ((format == AP4_SAMPLE_FORMAT_DVAV) || (format == AP4_SAMPLE_FORMAT_DVA1)) { - if (profile != 9) { - fprintf(stderr, "ERROR: sample entry name is mismatch with profile\n"); - return AP4_ERROR_INVALID_PARAMETERS; - } - } else { - if ((profile != 8) && (profile != 5)) { - fprintf(stderr, "ERROR: sample entry name is mismatch with profile\n"); - return AP4_ERROR_INVALID_PARAMETERS; - } - } - } if (format) { - if(profile == 5) { + if (profile == 5) { + // profile 5 does not compatible with other profile, only use dvhe or dvh1 if ((format != AP4_SAMPLE_FORMAT_DVHE) && (format != AP4_SAMPLE_FORMAT_DVH1)) { fprintf(stderr, "ERROR: sample entry name is not correct for profile 5\n"); return AP4_ERROR_INVALID_PARAMETERS; } } else if (profile == 8) { + // profile 8 has CCID with 1, 2, 4, may be compatible with HDR10, SDR or HLG, should + // not use dvhe or dvh1 if ((format != AP4_SAMPLE_FORMAT_HVC1) && (format != AP4_SAMPLE_FORMAT_HEV1)) { fprintf(stderr, "ERROR: sample entry name is not correct for profile 8\n"); return AP4_ERROR_INVALID_PARAMETERS; } } else if (profile == 9) { - if (format != AP4_SAMPLE_FORMAT_AVC1) { + // profile 9 only has CCID with 2, which is SDR compliant, should not use dvav or dva1 + if ((format != AP4_SAMPLE_FORMAT_AVC1) && (format != AP4_SAMPLE_FORMAT_AVC3)) { fprintf(stderr, "ERROR: sample entry name is not correct for profile 9\n"); return AP4_ERROR_INVALID_PARAMETERS; } @@ -656,12 +659,12 @@ 0, 0); // add an edit list with MediaTime==0 to ac3 track defautly. - if(1) { + if (1) { // create an 'edts' container AP4_ContainerAtom* new_edts = new AP4_ContainerAtom(AP4_ATOM_TYPE_EDTS); AP4_ElstAtom* new_elst = new AP4_ElstAtom(); AP4_UI64 duration = 0; - if(!movie.GetTimeScale()) { + if (!movie.GetTimeScale()) { duration = sample_count * 1536; } else { duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale()); @@ -803,12 +806,12 @@ 0, 0); // width, height // add an edit list with MediaTime==0 to ec3 track defautly. - if(1) { + if (1) { // create an 'edts' container AP4_ContainerAtom* new_edts = new AP4_ContainerAtom(AP4_ATOM_TYPE_EDTS); AP4_ElstAtom* new_elst = new AP4_ElstAtom(); AP4_UI64 duration = 0; - if(!movie.GetTimeScale()) { + if (!movie.GetTimeScale()) { duration = sample_count * 1536; } else { duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale()); @@ -951,12 +954,12 @@ 0, 0); // width, height // add an edit list with MediaTime==0 to ac4 track defautly. - if(1) { + if (1) { // create an 'edts' container AP4_ContainerAtom* new_edts = new AP4_ContainerAtom(AP4_ATOM_TYPE_EDTS); AP4_ElstAtom* new_elst = new AP4_ElstAtom(); AP4_UI64 duration = 0; - if(!movie.GetTimeScale()) { + if (!movie.GetTimeScale()) { duration = AP4_UI64(sample_count) * sample_duration; } else { duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), media_time_scale, movie.GetTimeScale()); @@ -1175,7 +1178,7 @@ 0, // auto-select track id movie_timescale, // movie time scale video_track_duration, // track duration - video_frame_rate, // media time scale + media_timescale, // media time scale video_media_duration, // media duration language, // language video_width<<16, // width @@ -1187,7 +1190,7 @@ AP4_ContainerAtom* new_edts = new AP4_ContainerAtom(AP4_ATOM_TYPE_EDTS); AP4_ElstAtom* new_elst = new AP4_ElstAtom(); AP4_UI64 duration = 0; - if(!movie.GetTimeScale()) { + if (!movie.GetTimeScale()) { duration = video_media_duration; } else { duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), media_timescale, movie.GetTimeScale()); @@ -1228,6 +1231,8 @@ AP4_UI32 dv_bl_signal_comp_id = 0; AP4_UI32 dv_level = 0; + AP4_UI32 format = 0; + AP4_ByteStream* input; AP4_Result result = AP4_FileByteStream::Create(input_name, AP4_FileByteStream::STREAM_MODE_READ, input); if (AP4_FAILED(result)) { @@ -1250,6 +1255,16 @@ return; } video_frame_rate = (unsigned int)(1000.0*frame_rate); + } else if (parametersi.m_Name == "format") { + if (parametersi.m_Value == "avc1") { + format = AP4_SAMPLE_FORMAT_AVC1; + } else if (parametersi.m_Value == "avc3") { + format = AP4_SAMPLE_FORMAT_AVC3; + } else if (parametersi.m_Value == "dva1") { + format = AP4_SAMPLE_FORMAT_DVA1; + } else if (parametersi.m_Value == "dvav") { + format = AP4_SAMPLE_FORMAT_DVAV; + } } else if (parametersi.m_Name == "dv_profile") { dv_profile = atoi(parametersi.m_Value.GetChars()); } else if (parametersi.m_Name == "dv_bc") { @@ -1258,7 +1273,7 @@ } //set default frame rate value - if(frame_rate == 0.0) { + if (frame_rate == 0.0) { frame_rate = 24.0; } @@ -1270,6 +1285,13 @@ // parse the input AP4_AvcFrameParser parser; + + if (format == AP4_SAMPLE_FORMAT_AVC3 || format == AP4_SAMPLE_FORMAT_DVAV) { + parser.SetParameterControl(true); + } else if (format == AP4_SAMPLE_FORMAT_AVC1 || format == AP4_SAMPLE_FORMAT_DVA1) { + parser.SetParameterControl(false); + } + for (;;) { bool eos; unsigned char input_bufferAP4_MUX_READ_BUFFER_SIZE; @@ -1402,31 +1424,31 @@ // setup the video the sample descripton AP4_AvcDoviSampleDescription* sample_description = - new AP4_AvcDoviSampleDescription(AP4_SAMPLE_FORMAT_AVC1,
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4Ac3Parser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4Ac3Parser.cpp
Changed
@@ -208,7 +208,7 @@ return AP4_SUCCESS; } else { - m_Bits.ReadByte(); // skip + m_Bits.SkipBytes(1); // skip } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4Ac4Parser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4Ac4Parser.cpp
Changed
@@ -119,7 +119,7 @@ unsigned int firstPresentationNSubstreamGroups = 0; if (m_NPresentations > 0){ - m_PresentationV1= new AP4_Dac4Atom::Ac4Dsi::PresentationV1m_NPresentations; + m_PresentationV1 = new AP4_Dac4Atom::Ac4Dsi::PresentationV1m_NPresentations; AP4_SetMemory(m_PresentationV1, 0, m_NPresentations * sizeof(m_PresentationV10)); } else { m_PresentationV1 = NULL; @@ -168,7 +168,7 @@ m_PresentationV1pres_idx.d.v1.dolby_atmos_indicator |= m_PresentationV1pres_idx.d.v1.substream_groupssg.d.v1.dolby_atmos_indicator; } } - delete substream_groups; + delete substream_groups; if (bObjorAjoc == 0){ m_ChannelCount = AP4_Ac4ChannelCountFromSpeakerGroupIndexMask(speakerGroupIndexMask); @@ -178,6 +178,22 @@ } } +AP4_Ac4Header::~AP4_Ac4Header() +{ + if (m_PresentationV1) { + assert(m_PresentationV1 != NULL); + for (unsigned int pres_idx = 0; pres_idx < m_NPresentations; pres_idx++) { + assert(m_PresentationV1pres_idx.d.v1.substream_groups != NULL); + for (int j = 0; j < m_PresentationV1pres_idx.d.v1.n_substream_groups; j++) + delete m_PresentationV1pres_idx.d.v1.substream_groupsj.d.v1.substreams; + delete m_PresentationV1pres_idx.d.v1.substream_groups; + delete m_PresentationV1pres_idx.d.v1.substream_group_indexs; + } + delete m_PresentationV1; + } +} + + /*----------------------------------------------------------------------+ | AP4_Ac4Header::MatchFixed | @@ -352,7 +368,7 @@ AP4_Ac4Parser::FindFrame(AP4_Ac4Frame& frame) { unsigned int available; - unsigned char *raw_header = new unsigned charAP4_AC4_HEADER_SIZE; + unsigned char raw_headerAP4_AC4_HEADER_SIZE; AP4_Result result; /* align to the start of the next byte */ @@ -369,8 +385,6 @@ return AP4_ERROR_NOT_ENOUGH_DATA; } - delete raw_header; - raw_header = new unsigned charsync_frame_size; /* * Error handling to skip the 'fake' sync word. * - the maximum sync frame size is about (AP4_BITSTREAM_BUFFER_SIZE - 1) bytes. @@ -382,10 +396,15 @@ } return AP4_ERROR_NOT_ENOUGH_DATA; } + + unsigned char *rawframe = new unsigned charsync_frame_size; + // copy the whole frame becasue toc size is unknown - m_Bits.PeekBytes(raw_header, sync_frame_size); + m_Bits.PeekBytes(rawframe, sync_frame_size); /* parse the header */ - AP4_Ac4Header ac4_header(raw_header, sync_frame_size); + AP4_Ac4Header ac4_header(rawframe, sync_frame_size); + + delete rawframe; // Place before goto statement to resolve Xcode compiler issue unsigned int bit_rate_mode = 0; @@ -402,31 +421,33 @@ // TODO: find the proper AP4_AC4_MAX_TOC_SIZE or just parse what this step need ? if (available >= ac4_header.m_FrameSize + ac4_header.m_HeaderSize + ac4_header.m_CrcSize + AP4_AC4_HEADER_SIZE + AP4_AC4_MAX_TOC_SIZE) { // enough to peek at the header of the next frame - unsigned char *peek_raw_header = new unsigned charAP4_AC4_HEADER_SIZE; m_Bits.SkipBytes(ac4_header.m_FrameSize + ac4_header.m_HeaderSize + ac4_header.m_CrcSize); - m_Bits.PeekBytes(peek_raw_header, AP4_AC4_HEADER_SIZE); + m_Bits.PeekBytes(raw_header, AP4_AC4_HEADER_SIZE); // duplicated work, just to get the frame size - AP4_BitReader peak_tmp_bits(peek_raw_header, AP4_AC4_HEADER_SIZE); - unsigned int peak_sync_frame_size = GetSyncFrameSize(peak_tmp_bits); + AP4_BitReader peak_tmp_bits(raw_header, AP4_AC4_HEADER_SIZE); + unsigned int next_sync_frame_size = GetSyncFrameSize(peak_tmp_bits); + + unsigned char *next_rawframe = new unsigned charnext_sync_frame_size; - delete peek_raw_header; - peek_raw_header = new unsigned charpeak_sync_frame_size; // copy the whole frame becasue toc size is unknown - if (m_Bits.GetBytesAvailable() < (peak_sync_frame_size)) { - peak_sync_frame_size = m_Bits.GetBytesAvailable(); + if (m_Bits.GetBytesAvailable() < (next_sync_frame_size)) { + next_sync_frame_size = m_Bits.GetBytesAvailable(); } - m_Bits.PeekBytes(peek_raw_header, peak_sync_frame_size); + m_Bits.PeekBytes(next_rawframe, next_sync_frame_size); m_Bits.SkipBytes(-((int)(ac4_header.m_FrameSize + ac4_header.m_HeaderSize + ac4_header.m_CrcSize))); /* check the header */ - AP4_Ac4Header peek_ac4_header(peek_raw_header, peak_sync_frame_size); + AP4_Ac4Header peek_ac4_header(next_rawframe, next_sync_frame_size); + + delete next_rawframe; + result = peek_ac4_header.Check(); if (AP4_FAILED(result)) { // TODO: need to reserve current sync frame ? - m_Bits.SkipBytes(sync_frame_size + peak_sync_frame_size); + m_Bits.SkipBytes(sync_frame_size + next_sync_frame_size); goto fail; } @@ -434,7 +455,7 @@ /* fixed part of the previous header */ if (!AP4_Ac4Header::MatchFixed(ac4_header, peek_ac4_header)) { // TODO: need to reserve current sync frame ? - m_Bits.SkipBytes(sync_frame_size + peak_sync_frame_size); + m_Bits.SkipBytes(sync_frame_size + next_sync_frame_size); goto fail; } } else if (available < (ac4_header.m_FrameSize + ac4_header.m_HeaderSize + ac4_header.m_CrcSize) || (m_Bits.m_Flags & AP4_BITSTREAM_FLAG_EOS) == 0) {
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4Ac4Parser.h -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4Ac4Parser.h
Changed
@@ -51,6 +51,8 @@ public: // constructor AP4_Ac4Header(const AP4_UI08* bytes, unsigned int size); + // destructor + ~AP4_Ac4Header(); // methods AP4_Result Check();
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4AdtsParser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4AdtsParser.cpp
Changed
@@ -191,7 +191,7 @@ return AP4_SUCCESS; } else { - m_Bits.ReadByte(); // skip + m_Bits.SkipBytes(1); // skip } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4AvcParser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4AvcParser.cpp
Changed
@@ -144,7 +144,8 @@ m_PrevFrameNum(0), m_PrevFrameNumOffset(0), m_PrevPicOrderCntMsb(0), - m_PrevPicOrderCntLsb(0) + m_PrevPicOrderCntLsb(0), + m_keepParameterSets(true) { for (unsigned int i=0; i<256; i++) { m_PPSi = NULL; @@ -1051,6 +1052,7 @@ nal_ref_idc, *slice_header); if (AP4_FAILED(result)) { + delete slice_header; return AP4_ERROR_INVALID_FORMAT; }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4AvcParser.h -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4AvcParser.h
Changed
@@ -293,6 +293,8 @@ unsigned int nal_ref_idc, AP4_AvcSliceHeader& slice_header); + void SetParameterControl(bool isKeep) { m_keepParameterSets = isKeep; } + private: // methods bool SameFrame(unsigned int nal_unit_type_1, unsigned int nal_ref_idc_1, AP4_AvcSliceHeader& sh1, @@ -322,6 +324,9 @@ unsigned int m_PrevFrameNumOffset; int m_PrevPicOrderCntMsb; unsigned int m_PrevPicOrderCntLsb; + + // control if the parameter sets(SPS, PPS) need to be stored in stream('mdat') + bool m_keepParameterSets; }; #endif // _AP4_AVC_PARSER_H_
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4BitStream.h -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4BitStream.h
Changed
@@ -75,7 +75,6 @@ AP4_Result WriteBytes(const AP4_UI08* bytes, AP4_Size byte_count); AP4_Size GetContiguousBytesAvailable(); AP4_Size GetBytesAvailable(); - AP4_UI08 ReadByte(); AP4_Result ReadBytes(AP4_UI08* bytes, AP4_Size byte_count); AP4_UI08 PeekByte(); AP4_Result PeekBytes(AP4_UI08* bytes, AP4_Size byte_count); @@ -283,16 +282,6 @@ } /*---------------------------------------------------------------------- -| AP4_BitStream::ReadByte -+---------------------------------------------------------------------*/ -inline AP4_UI08 -AP4_BitStream::ReadByte() -{ - SkipBits(m_BitsCached & 7); - return (AP4_UI08)ReadBits(8); -} - -/*---------------------------------------------------------------------- | AP4_BitStream::PeekByte +---------------------------------------------------------------------*/ inline AP4_UI08
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4Eac3Parser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4Eac3Parser.cpp
Changed
@@ -422,7 +422,7 @@ return AP4_SUCCESS; } else { - m_Bits.ReadByte(); // skip + m_Bits.SkipBytes(1); // skip skip_size++; } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4HevcParser.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4HevcParser.cpp
Changed
@@ -665,6 +665,57 @@ } /*---------------------------------------------------------------------- +| AP4_HevcVuiParameters::AP4_HevcVuiParameters ++---------------------------------------------------------------------*/ +AP4_HevcVuiParameters::AP4_HevcVuiParameters() : + aspect_ratio_info_present_flag(0), + aspect_ratio_idc(0), + sar_width(0), + sar_height(0), + overscan_info_present_flag(0), + overscan_appropriate_flag(0), + video_signal_type_present_flag(0), + video_format(0), + video_full_range_flag(0), + colour_description_present_flag(0), + colour_primaries(0), + transfer_characteristics(0), + matrix_coeffs(0) +{ +} + +/*---------------------------------------------------------------------- +| AP4_HevcVuiParameters::Parse ++---------------------------------------------------------------------*/ +AP4_Result +AP4_HevcVuiParameters::Parse(AP4_BitReader& bits, unsigned int& transfer_characteristics) +{ + // vui_parameters + aspect_ratio_info_present_flag = bits.ReadBit(); + if (aspect_ratio_info_present_flag) { + aspect_ratio_idc = bits.ReadBits(8); + if (aspect_ratio_idc == 255) { + sar_width = bits.ReadBits(16); + sar_height = bits.ReadBits(16); + } + } + overscan_info_present_flag = bits.ReadBit(); + if (overscan_info_present_flag) overscan_appropriate_flag = bits.ReadBit(); + video_signal_type_present_flag = bits.ReadBit(); + if (video_signal_type_present_flag) { + video_format = bits.ReadBits(3); + video_full_range_flag = bits.ReadBit(); + colour_description_present_flag = bits.ReadBit(); + if (colour_description_present_flag) { + colour_primaries = bits.ReadBits(8); + transfer_characteristics = bits.ReadBits(8); + matrix_coeffs = bits.ReadBits(8); + } + } + return AP4_SUCCESS; +} + +/*---------------------------------------------------------------------- | AP4_HevcPictureParameterSet::AP4_HevcPictureParameterSet +---------------------------------------------------------------------*/ AP4_HevcPictureParameterSet::AP4_HevcPictureParameterSet() : @@ -827,9 +878,11 @@ long_term_ref_pics_present_flag(0), num_long_term_ref_pics_sps(0), sps_temporal_mvp_enabled_flag(0), - strong_intra_smoothing_enabled_flag(0) + strong_intra_smoothing_enabled_flag(0), + vui_parameters_present_flag(0) { AP4_SetMemory(&profile_tier_level, 0, sizeof(profile_tier_level)); + AP4_SetMemory(&vui_parameters, 0, sizeof(vui_parameters)); for (unsigned int i=0; i<8; i++) { sps_max_dec_pic_buffering_minus1i = 0; sps_max_num_reorder_picsi = 0; @@ -935,6 +988,13 @@ } sps_temporal_mvp_enabled_flag = bits.ReadBit(); strong_intra_smoothing_enabled_flag = bits.ReadBit(); + vui_parameters_present_flag = bits.ReadBit(); + if (vui_parameters_present_flag) { + AP4_Result result = vui_parameters.Parse(bits, vui_parameters.transfer_characteristics); + if (AP4_FAILED(result)) { + return result; + } + } return AP4_SUCCESS; } @@ -1045,7 +1105,8 @@ m_AccessUnitFlags(0), m_VclNalUnitsInAccessUnit(0), m_PrevTid0Pic_PicOrderCntMsb(0), - m_PrevTid0Pic_PicOrderCntLsb(0) + m_PrevTid0Pic_PicOrderCntLsb(0), + m_keepParameterSets(true) { for (unsigned int i=0; i<=AP4_HEVC_PPS_MAX_ID; i++) { m_PPSi = NULL;
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4HevcParser.h -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4HevcParser.h
Changed
@@ -154,6 +154,59 @@ }; /*---------------------------------------------------------------------- +| AP4_HevcVuiParameters ++---------------------------------------------------------------------*/ +struct AP4_HevcVuiParameters { + AP4_HevcVuiParameters(); + + // methods + AP4_Result Parse(AP4_BitReader& bits, unsigned int &transfer_characteristics); + + unsigned int aspect_ratio_info_present_flag; + unsigned int aspect_ratio_idc; + unsigned int sar_width; + unsigned int sar_height; + unsigned int overscan_info_present_flag; + unsigned int overscan_appropriate_flag; + unsigned int video_signal_type_present_flag; + unsigned int video_format; + unsigned int video_full_range_flag; + unsigned int colour_description_present_flag; + unsigned int colour_primaries; + unsigned int transfer_characteristics; + unsigned int matrix_coeffs; + //unsigned int chroma_loc_info_present_flag; + //unsigned int chroma_sample_loc_type_top_field; + //unsigned int chroma_sample_loc_type_bottom_field; + //unsigned int neutral_chroma_indication_flag; + //unsigned int field_seq_flag; + //unsigned int frame_field_info_present_flag; + //unsigned int default_display_window_flag; + //unsigned int def_disp_win_left_offset; + //unsigned int def_disp_win_right_offset; + //unsigned int def_disp_win_top_offset; + //unsigned int def_disp_win_bottom_offset; + //unsigned int vui_timing_info_present_flag; + //unsigned int vui_num_units_in_tick; + //unsigned int vui_time_scale; + //unsigned int vui_poc_proportional_to_timing_flag; + //unsigned int vui_num_ticks_poc_diff_one_minus1; + //unsigned int vui_hrd_parameters_present_flag; + + //// skip hrd_parameters + //unsigned int bitstream_restriction_flag; + //unsigned int tiles_fixed_structure_flag; + //unsigned int motion_vectors_over_pic_boundaries_flag; + //unsigned int restricted_ref_pic_lists_flag; + //unsigned int min_spatial_segmentation_idc; + //unsigned int max_bytes_per_pic_denom; + //unsigned int max_bits_per_min_cu_denom; + //unsigned int log2_max_mv_length_horizontal; + //unsigned int log2_max_mv_length_vertical; +}; + + +/*---------------------------------------------------------------------- | AP4_HevcShortTermRefPicSet +---------------------------------------------------------------------*/ typedef struct { @@ -268,7 +321,8 @@ unsigned int num_long_term_ref_pics_sps; unsigned int sps_temporal_mvp_enabled_flag; unsigned int strong_intra_smoothing_enabled_flag; - + unsigned int vui_parameters_present_flag; + AP4_HevcVuiParameters vui_parameters; AP4_HevcShortTermRefPicSet short_term_ref_pic_setsAP4_HEVC_SPS_MAX_RPS; }; @@ -416,6 +470,8 @@ AP4_HevcVideoParameterSet** GetVideoParameterSets() { return &m_VPS0; } AP4_HevcSequenceParameterSet** GetSequenceParameterSets() { return &m_SPS0; } AP4_HevcPictureParameterSet** GetPictureParameterSets() { return &m_PPS0; } + + void SetParameterControl(bool isKeep) { m_keepParameterSets = isKeep; } private: // methods @@ -441,6 +497,9 @@ // picture order counting unsigned int m_PrevTid0Pic_PicOrderCntMsb; unsigned int m_PrevTid0Pic_PicOrderCntLsb; + + // control if the parameter sets(VPS, SPS, PPS) need to be stored in stream('mdat') + bool m_keepParameterSets; }; #endif // _AP4_HEVC_PARSER_H_
View file
bento4-1.6.0r639.tar.gz/Source/C++/Codecs/Ap4Mp4AudioInfo.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Codecs/Ap4Mp4AudioInfo.cpp
Changed
@@ -133,6 +133,7 @@ AP4_Result result = ParseAudioObjectType(parser, m_Extension.m_ObjectType); if (AP4_FAILED(result)) return result; if (m_Extension.m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR) { + if (parser.BitsLeft() < 1) return AP4_ERROR_INVALID_FORMAT; m_Extension.m_SbrPresent = (parser.ReadBits(1) == 1); if (m_Extension.m_SbrPresent) { result = ParseSamplingFrequency(parser, @@ -147,6 +148,7 @@ } } } else if (m_Extension.m_ObjectType == AP4_MPEG4_AUDIO_OBJECT_TYPE_ER_BSAC) { + if (parser.BitsLeft() < 1+4) return AP4_ERROR_INVALID_FORMAT; m_Extension.m_SbrPresent = (parser.ReadBits(1) == 1); if (m_Extension.m_SbrPresent) { result = ParseSamplingFrequency(parser,
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4AvccAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4AvccAtom.cpp
Changed
@@ -141,6 +141,10 @@ AP4_AvccAtom::AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload) : AP4_Atom(AP4_ATOM_TYPE_AVCC, size) { + if (size < AP4_ATOM_HEADER_SIZE + 7) { + return; + } + // make a copy of our configuration bytes unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE; m_RawBytes.SetData(payload, payload_size); @@ -160,11 +164,15 @@ cursor += 2; if (cursor + param_length <= payload_size) { m_SequenceParameters.Append(AP4_DataBuffer()); - m_SequenceParametersi.SetData(&payloadcursor, param_length); + m_SequenceParametersm_SequenceParameters.ItemCount()-1.SetData(&payloadcursor, param_length); cursor += param_length; } } } + + if (cursor >= payload_size) { + return; + } AP4_UI08 num_pic_params = payloadcursor++; m_PictureParameters.EnsureCapacity(num_pic_params); for (unsigned int i=0; i<num_pic_params; i++) { @@ -173,7 +181,7 @@ cursor += 2; if (cursor + param_length <= payload_size) { m_PictureParameters.Append(AP4_DataBuffer()); - m_PictureParametersi.SetData(&payloadcursor, param_length); + m_PictureParametersm_PictureParameters.ItemCount()-1.SetData(&payloadcursor, param_length); cursor += param_length; } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4CommonEncryption.cpp
Changed
@@ -290,6 +290,8 @@ // look for an hevc sample description AP4_HvccAtom* hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("hvc1/hvcC")); if (!hvcc) hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("hev1/hvcC")); + if (!hvcc) hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("dvh1/hvcC")); + if (!hvcc) hvcc = AP4_DYNAMIC_CAST(AP4_HvccAtom, stsd->FindChild("dvhe/hvcC")); if (!hvcc) return; // parse the vps, sps and pps if we have them @@ -2815,7 +2817,13 @@ aux_info_data, aux_info_data_offset, sample_info_table); - if (AP4_FAILED(result)) return result; + // only abort the processing if the error is not due to an invalid + // format: some files have an invalid saio/saiz based construction, + // but may still have a valid `senc`, which we can try to parse + // below + if (!AP4_SUCCEEDED(result) && result != AP4_ERROR_INVALID_FORMAT) { + return result; + } } } @@ -2923,18 +2931,25 @@ const AP4_UI08* info_data = info.GetData(); if (per_sample_iv_size) { + if (per_sample_iv_size > info_size) { + result = AP4_ERROR_INVALID_FORMAT; + goto end; + } table->SetIv(saiz_index, info_data); } else { table->SetIv(saiz_index, constant_iv); } - if (info_size > per_sample_iv_size+2) { - AP4_UI16 subsample_count = AP4_BytesToUInt16BE(info_data+per_sample_iv_size); - if (info_size < per_sample_iv_size+2+subsample_count*6) { - // not enough data - goto end; - } - table->AddSubSampleData(subsample_count, info_data+per_sample_iv_size+2); + if (info_size < per_sample_iv_size+2) { + result = AP4_ERROR_INVALID_FORMAT; + goto end; + } + AP4_UI16 subsample_count = AP4_BytesToUInt16BE(info_data+per_sample_iv_size); + if (info_size < per_sample_iv_size+2+subsample_count*6) { + // not enough data + result = AP4_ERROR_INVALID_FORMAT; + goto end; } + table->AddSubSampleData(subsample_count, info_data+per_sample_iv_size+2); saiz_index++; } } @@ -2977,9 +2992,9 @@ return AP4_ERROR_INVALID_FORMAT; } AP4_CencSampleInfoTable* table = new AP4_CencSampleInfoTable(flags, crypt_byte_block, skip_byte_block, sample_count, (AP4_UI08)iv_size); - table->m_IvData.SetData(serialized, sample_count*iv_size); - serialized += sample_count*iv_size; - serialized_size -= sample_count*iv_size; + table->m_IvData.SetData(serialized, sample_count?sample_count*iv_size:iv_size); + serialized += sample_count?sample_count*iv_size:iv_size; + serialized_size -= sample_count?sample_count*iv_size:iv_size; if (serialized_size < 4) { delete table; @@ -3048,6 +3063,11 @@ m_SkipByteBlock(skip_byte_block), m_IvSize(iv_size) { + if (sample_count == 0) { + // All samples encrypted with a constant IV, reserve some space to + // store the constant IV + sample_count = 1; + } m_IvData.SetDataSize(m_IvSize*sample_count); AP4_SetMemory(m_IvData.UseData(), 0, m_IvSize*sample_count); } @@ -3060,7 +3080,7 @@ { unsigned int size = 4 + 4 + - m_SampleCount*m_IvSize + + (m_SampleCount ? m_SampleCount*m_IvSize : m_IvSize) + 4 + m_BytesOfCleartextData.ItemCount()*2 + m_BytesOfEncryptedData.ItemCount()*4 + @@ -3088,7 +3108,12 @@ *data++ = m_CryptByteBlock; *data++ = m_SkipByteBlock; *data++ = m_IvSize; - AP4_CopyMemory(data, m_IvData.GetData(), m_SampleCount*m_IvSize); data += m_SampleCount*m_IvSize; + if (m_SampleCount) { + AP4_CopyMemory(data, m_IvData.GetData(), m_SampleCount*m_IvSize); data += m_SampleCount*m_IvSize; + } else { + // All samples encrypted, no per-sample IV, create one entry for the default IV + AP4_CopyMemory(data, m_IvData.GetData(), m_IvSize); data += m_IvSize; + } AP4_BytesFromUInt32BE(data, m_BytesOfCleartextData.ItemCount()); data += 4; for (unsigned int i=0; i<m_BytesOfCleartextData.ItemCount(); i++) { AP4_BytesFromUInt16BE(data, m_BytesOfCleartextDatai); data += 2; @@ -3114,7 +3139,12 @@ AP4_Result AP4_CencSampleInfoTable::SetIv(AP4_Ordinal sample_index, const AP4_UI08* iv) { - if (sample_index >= m_SampleCount) return AP4_ERROR_OUT_OF_RANGE; + if (m_SampleCount == 0) { + if (sample_index != 0) return AP4_ERROR_OUT_OF_RANGE; + } else { + if (sample_index >= m_SampleCount) return AP4_ERROR_OUT_OF_RANGE; + } + AP4_ASSERT(m_IvData.GetDataSize() >= m_IvSize*(sample_index+1)); AP4_UI08* dst = m_IvData.UseData()+(m_IvSize*sample_index); AP4_CopyMemory(dst, iv, m_IvSize); @@ -3127,8 +3157,12 @@ const AP4_UI08* AP4_CencSampleInfoTable::GetIv(AP4_Ordinal sample_index) { - if (sample_index >= m_SampleCount) return NULL; - return m_IvData.GetData()+(m_IvSize*sample_index); + if (m_SampleCount == 0) { + return m_IvData.GetData(); + } else { + if (sample_index >= m_SampleCount) return NULL; + return m_IvData.GetData()+(m_IvSize*sample_index); + } } /*---------------------------------------------------------------------- @@ -3164,6 +3198,13 @@ const AP4_UI16*& bytes_of_cleartext_data, const AP4_UI32*& bytes_of_encrypted_data) { + if (m_SampleCount == 0) { + // all samples encrypted entirely, no subsamples + subsample_count = 0; + bytes_of_cleartext_data = NULL; + bytes_of_encrypted_data = NULL; + return AP4_SUCCESS; + } if (sample_index >= m_SampleCount) { return AP4_ERROR_OUT_OF_RANGE; @@ -3359,7 +3400,7 @@ } // check some of the parameters - if (per_sample_iv_size == 0) { + if (per_sample_iv_size == 0 || m_SampleInfoCount == 0) { if (default_constant_iv_size == 0 || default_constant_iv == NULL) { return AP4_ERROR_INVALID_PARAMETERS; } @@ -3372,32 +3413,41 @@ default_skip_byte_block, m_SampleInfoCount, per_sample_iv_size?per_sample_iv_size:default_constant_iv_size); - const AP4_UI08* data = m_SampleInfos.GetData(); - AP4_UI32 data_size = m_SampleInfos.GetDataSize(); - for (unsigned int i=0; i<m_SampleInfoCount; i++) { - if (per_sample_iv_size) { - if (data_size < per_sample_iv_size) goto end; - table->SetIv(i, data); - data += per_sample_iv_size; - data_size -= per_sample_iv_size; - } else { - table->SetIv(i, default_constant_iv); - } - if (has_subsamples) { - if (data_size < 2) goto end; - AP4_UI16 subsample_count = AP4_BytesToUInt16BE(data); - data += 2; - data_size -= 2; - - if (data_size < subsample_count*(unsigned int)6) goto end; - - result = table->AddSubSampleData(subsample_count, data); - if (AP4_FAILED(result)) goto end; - - data += 6*subsample_count; - data_size -= 6*subsample_count; + + // fill the table + if (m_SampleInfoCount == 0) { + // special case, this means all samples are encrypted with the same IV + table->SetIv(0, default_constant_iv); + } else { + const AP4_UI08* data = m_SampleInfos.GetData(); + AP4_UI32 data_size = m_SampleInfos.GetDataSize(); + for (unsigned int i=0; i<m_SampleInfoCount; i++) { + if (per_sample_iv_size) { + if (data_size < per_sample_iv_size) goto end; + table->SetIv(i, data); + data += per_sample_iv_size; + data_size -= per_sample_iv_size; + } else {
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4CommonEncryption.h -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4CommonEncryption.h
Changed
@@ -270,7 +270,7 @@ AP4_Result Serialize(AP4_DataBuffer& buffer); private: - AP4_UI32 m_SampleCount; + AP4_UI32 m_SampleCount; // If 0, all samples are fully encrypted, and there's a single constant IV in m_IvData AP4_UI08 m_Flags; AP4_UI08 m_CryptByteBlock; AP4_UI08 m_SkipByteBlock; @@ -303,7 +303,7 @@ | | 1 byte | 8-bit integer | iv_size | | +---------------+----------------+------------------------------------+ | -| repeat sample_count times: +| repeat sample_count times, or once if sample_count is 0: | +---------------+----------------+------------------------------------+ | | iv_size bytes | byte array | IVi | | +---------------+----------------+------------------------------------+
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4Config.h -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4Config.h
Changed
@@ -50,13 +50,13 @@ #define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1 #if !defined(AP4_PLATFORM_BYTE_ORDER) -#if defined(__ppc__) +#if defined(__ppc__) || defined(__powerpc__) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN #elif defined(_MSC_VER) #if defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN #endif -#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) +#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) #define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN #endif #endif
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4Dac4Atom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4Dac4Atom.cpp
Changed
@@ -418,6 +418,7 @@ delete m_Dsi.d.v1.presentationsi.d.v1.substream_groupsj.d.v1.substreams; } delete m_Dsi.d.v1.presentationsi.d.v1.substream_groups; + delete m_Dsi.d.v1.presentationsi.d.v1.substream_group_indexs; } delete m_Dsi.d.v1.presentations; }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4Descriptor.h -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4Descriptor.h
Changed
@@ -89,7 +89,7 @@ public: AP4_DescriptorFinder(AP4_UI08 tag) : m_Tag(tag) {} AP4_Result Test(AP4_Descriptor* descriptor) const { - return descriptor->GetTag() == m_Tag ? AP4_SUCCESS : AP4_FAILURE; + return (descriptor && descriptor->GetTag() == m_Tag) ? AP4_SUCCESS : AP4_FAILURE; } private:
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4DescriptorFactory.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4DescriptorFactory.cpp
Changed
@@ -127,6 +127,9 @@ descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size); break; } + } else { + stream.Seek(offset); + return AP4_ERROR_INVALID_FORMAT; } // skip to the end of the descriptor
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4DvccAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4DvccAtom.cpp
Changed
@@ -127,18 +127,19 @@ | AP4_DvccAtom::GetCodecString +---------------------------------------------------------------------*/ AP4_Result -AP4_DvccAtom::GetCodecString(AP4_SampleDescription* parent, AP4_String& codec) +AP4_DvccAtom::GetCodecString(const char* parent_codec_string, + AP4_UI32 parent_format, + AP4_String& codec) { char workspace64; - AP4_UI32 format = parent->GetFormat(); - if (format == AP4_ATOM_TYPE_DVAV || - format == AP4_ATOM_TYPE_DVA1 || - format == AP4_ATOM_TYPE_DVHE || - format == AP4_ATOM_TYPE_DVH1) { + if (parent_format == AP4_ATOM_TYPE_DVAV || + parent_format == AP4_ATOM_TYPE_DVA1 || + parent_format == AP4_ATOM_TYPE_DVHE || + parent_format == AP4_ATOM_TYPE_DVH1) { /* Non backward-compatible */ char coding5; - AP4_FormatFourChars(coding, format); + AP4_FormatFourChars(coding, parent_format); AP4_FormatString(workspace, sizeof(workspace), "%s.%02d.%02d", @@ -148,7 +149,8 @@ codec = workspace; } else { /* Backward-compatible */ - switch (format) { + AP4_UI32 format = parent_format; + switch (parent_format) { case AP4_ATOM_TYPE_AVC1: format = AP4_ATOM_TYPE_DVA1; break; @@ -167,12 +169,10 @@ } char coding5; AP4_FormatFourChars(coding, format); - AP4_String parent_codec; - parent->GetCodecString(parent_codec); AP4_FormatString(workspace, sizeof(workspace), "%s,%s.%02d.%02d", - parent_codec.GetChars(), + parent_codec_string, coding, GetDvProfile(), GetDvLevel());
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4DvccAtom.h -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4DvccAtom.h
Changed
@@ -92,7 +92,9 @@ AP4_UI08 GetDvBlSignalCompatibilityID() { return m_DvBlSignalCompatibilityID; } // helpers - AP4_Result GetCodecString(AP4_SampleDescription* parent, AP4_String& codec); + AP4_Result GetCodecString(const char* parent_codec_string, + AP4_UI32 parent_format, + AP4_String& codec); private: // members
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4File.h -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4File.h
Changed
@@ -73,6 +73,10 @@ const AP4_UI32 AP4_FILE_BRAND_AVC1 = AP4_ATOM_TYPE('a','v','c','1'); const AP4_UI32 AP4_FILE_BRAND_HVC1 = AP4_ATOM_TYPE('h','v','c','1'); const AP4_UI32 AP4_FILE_BRAND_DBY1 = AP4_ATOM_TYPE('d','b','y','1'); +const AP4_UI32 AP4_FILE_BRAND_DB1P = AP4_ATOM_TYPE('d','b','1','p'); +const AP4_UI32 AP4_FILE_BRAND_DB2G = AP4_ATOM_TYPE('d','b','2','g'); +const AP4_UI32 AP4_FILE_BRAND_DB4H = AP4_ATOM_TYPE('d','b','4','h'); +const AP4_UI32 AP4_FILE_BRAND_DB4G = AP4_ATOM_TYPE('d','b','4','g'); /*---------------------------------------------------------------------- | AP4_File
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4FileWriter.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4FileWriter.cpp
Changed
@@ -72,10 +72,34 @@ AP4_Position position; stream.Tell(position); + // compute the total size of all the samples + AP4_UI64 total_sample_size = 0; + for (AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem(); + track_item; + track_item = track_item->GetNext()) { + AP4_Track* track = track_item->GetData(); + AP4_Cardinal sample_count = track->GetSampleCount(); + AP4_Sample sample; + for (AP4_Ordinal i=0; i<sample_count; i++) { + track->GetSample(i, sample); + total_sample_size += sample.GetSize(); + } + } + + // decide if we need a 32-bit or 64-bit mdat header + AP4_UI64 mdat_size; + bool mdat_is_large; + if (total_sample_size <= 0xFFFFFFFF - AP4_ATOM_HEADER_SIZE) { + mdat_size = AP4_ATOM_HEADER_SIZE; + mdat_is_large = false; + } else { + mdat_size = 16; + mdat_is_large = true; + } + // backup and recompute all the chunk offsets unsigned int t=0; AP4_Result result = AP4_SUCCESS; - AP4_UI64 mdat_size = AP4_ATOM_HEADER_SIZE; AP4_UI64 mdat_position = position+movie->GetMoovAtom()->GetSize(); AP4_Array<AP4_Array<AP4_UI64>*> trak_chunk_offsets_backup; AP4_Array<AP4_UI64> chunk_offsets; @@ -117,9 +141,14 @@ movie->GetMoovAtom()->Write(stream); // create and write the media data (mdat) - // TODO: this only supports 32-bit mdat size - stream.WriteUI32((AP4_UI32)mdat_size); - stream.WriteUI32(AP4_ATOM_TYPE_MDAT); + if (mdat_is_large) { + stream.WriteUI32(1); + stream.WriteUI32(AP4_ATOM_TYPE_MDAT); + stream.WriteUI64(mdat_size); + } else { + stream.WriteUI32((AP4_UI32)mdat_size); + stream.WriteUI32(AP4_ATOM_TYPE_MDAT); + } // write all tracks and restore the chunk offsets to their backed-up values for (AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4HdlrAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4HdlrAtom.cpp
Changed
@@ -120,6 +120,12 @@ if (AP4_FAILED(result)) return result; result = stream.WriteUI32(m_Reserved2); if (AP4_FAILED(result)) return result; + + // sanity check + if (m_Size32 < AP4_FULL_ATOM_HEADER_SIZE + 20) { + return AP4_ERROR_INVALID_FORMAT; + } + AP4_UI08 name_size = (AP4_UI08)m_HandlerName.GetLength(); if (m_QuickTimeMode) { name_size += 1; @@ -144,8 +150,10 @@ } // pad with zeros if necessary - AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + 20 + name_size); - while (padding--) stream.WriteUI08(0); + if (m_Size32 > AP4_FULL_ATOM_HEADER_SIZE + 20 + name_size) { + AP4_Size padding = m_Size32 - (AP4_FULL_ATOM_HEADER_SIZE + 20 + name_size); + while (padding--) stream.WriteUI08(0); + } return AP4_SUCCESS; }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4HvccAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4HvccAtom.cpp
Changed
@@ -252,7 +252,7 @@ unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE; // keep a raw copy - if (payload_size < 22) return; + if (payload_size < 23) return; m_RawBytes.SetData(payload, payload_size); // parse the payload
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4RtpAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4RtpAtom.cpp
Changed
@@ -44,13 +44,15 @@ stream.ReadUI32(m_DescriptionFormat); // sdptext - int str_size = size-(AP4_ATOM_HEADER_SIZE+4); - if (str_size) { - char* str = new charstr_size+1; - stream.Read(str, str_size); - strstr_size = '\0'; // force null-termination - m_SdpText = str; - delete str; + if (size >= AP4_ATOM_HEADER_SIZE+4) { + int str_size = size-(AP4_ATOM_HEADER_SIZE+4); + if (str_size) { + char* str = new charstr_size+1; + stream.Read(str, str_size); + strstr_size = '\0'; // force null-termination + m_SdpText = str; + delete str; + } } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4SampleDescription.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4SampleDescription.cpp
Changed
@@ -57,6 +57,9 @@ AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_HevcSampleDescription) AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Av1SampleDescription) AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_SubtitleSampleDescription) +AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Ac3SampleDescription) +AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Eac3SampleDescription) +AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Ac4SampleDescription) /*---------------------------------------------------------------------- | AP4_GetFormatName @@ -396,12 +399,6 @@ +---------------------------------------------------------------------*/ AP4_Result AP4_AvcSampleDescription::GetCodecString(AP4_String& codec) { - // Dolby Vision override - AP4_DvccAtom* dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, m_Details.GetChild(AP4_ATOM_TYPE_DVCC)); - if (dvcc) { - return dvcc->GetCodecString(this, codec); - } - char coding5; AP4_FormatFourChars(coding, GetFormat()); char workspace64; @@ -412,8 +409,15 @@ GetProfile(), GetProfileCompatibility(), GetLevel()); - codec = workspace; + // Dolby Vision override + AP4_DvccAtom* dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, m_Details.GetChild(AP4_ATOM_TYPE_DVCC)); + if (dvcc) { + return dvcc->GetCodecString(workspace, GetFormat(), codec); + } + + codec = workspace; + return AP4_SUCCESS; } @@ -606,12 +610,6 @@ +---------------------------------------------------------------------*/ AP4_Result AP4_HevcSampleDescription::GetCodecString(AP4_String& codec) { - // Dolby Vision override - AP4_DvccAtom* dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, m_Details.GetChild(AP4_ATOM_TYPE_DVCC)); - if (dvcc) { - return dvcc->GetCodecString(this, codec); - } - char coding5; AP4_FormatFourChars(coding, GetFormat()); char profile_space2 = {0,0}; @@ -633,6 +631,13 @@ GetGeneralTierFlag()?'H':'L', GetGeneralLevel(), constraints); + + // Dolby Vision override + AP4_DvccAtom* dvcc = AP4_DYNAMIC_CAST(AP4_DvccAtom, m_Details.GetChild(AP4_ATOM_TYPE_DVCC)); + if (dvcc) { + return dvcc->GetCodecString(workspace, GetFormat(), codec); + } + codec = workspace; return AP4_SUCCESS;
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4StszAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4StszAtom.cpp
Changed
@@ -78,26 +78,28 @@ } stream.ReadUI32(m_SampleSize); - stream.ReadUI32(m_SampleCount); + AP4_UI32 sample_count; + stream.ReadUI32(sample_count); if (m_SampleSize == 0) { // means that the samples have different sizes // check for overflow - if (m_SampleCount > (size - AP4_FULL_ATOM_HEADER_SIZE - 8) / 4) { + if (sample_count > (size - AP4_FULL_ATOM_HEADER_SIZE - 8) / 4) { return; } // read the entries - unsigned char* buffer = new unsigned charm_SampleCount * 4; - AP4_Result result = stream.Read(buffer, m_SampleCount * 4); + unsigned char* buffer = new unsigned charsample_count * 4; + AP4_Result result = stream.Read(buffer, sample_count * 4); if (AP4_FAILED(result)) { delete buffer; return; } - m_Entries.SetItemCount((AP4_Cardinal)m_SampleCount); - for (unsigned int i = 0; i < m_SampleCount; i++) { + m_Entries.SetItemCount((AP4_Cardinal)sample_count); + for (unsigned int i = 0; i < sample_count; i++) { m_Entriesi = AP4_BytesToUInt32BE(&bufferi * 4); } delete buffer; } + m_SampleCount = sample_count; } /*----------------------------------------------------------------------
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4Stz2Atom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4Stz2Atom.cpp
Changed
@@ -94,7 +94,6 @@ stream.ReadUI32(sample_count); m_FieldSize = field_size; - m_SampleCount = sample_count; unsigned int table_size = (sample_count * field_size + 7) / 8; if (table_size > size - AP4_FULL_ATOM_HEADER_SIZE - 8) { return; @@ -105,6 +104,7 @@ delete buffer; return; } + m_SampleCount = sample_count; m_Entries.SetItemCount((AP4_Cardinal)sample_count); switch (m_FieldSize) { case 4:
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4Track.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4Track.cpp
Changed
@@ -481,6 +481,8 @@ AP4_Result AP4_Track::GetSampleIndexForTimeStampMs(AP4_UI32 ts_ms, AP4_Ordinal& index) { + if (m_SampleTable == NULL) return AP4_ERROR_INVALID_STATE; + // convert the ts in the timescale of the track's media AP4_UI64 ts = AP4_ConvertTime(ts_ms, 1000, GetMediaTimeScale());
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4TrunAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4TrunAtom.cpp
Changed
@@ -101,52 +101,92 @@ AP4_ByteStream& stream) : AP4_Atom(AP4_ATOM_TYPE_TRUN, size, version, flags) { + if (size < AP4_FULL_ATOM_HEADER_SIZE + 4) { + return; + } AP4_UI32 sample_count = 0; stream.ReadUI32(sample_count); + AP4_Size bytes_left = size - AP4_FULL_ATOM_HEADER_SIZE - 4; // read optional fields int optional_fields_count = (int)ComputeOptionalFieldsCount(flags); if (flags & AP4_TRUN_FLAG_DATA_OFFSET_PRESENT) { AP4_UI32 offset = 0; - stream.ReadUI32(offset); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(offset))) { + return; + } m_DataOffset = (AP4_SI32)offset; + if (optional_fields_count == 0) { + return; + } --optional_fields_count; + bytes_left -= 4; } if (flags & AP4_TRUN_FLAG_FIRST_SAMPLE_FLAGS_PRESENT) { - stream.ReadUI32(m_FirstSampleFlags); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_FirstSampleFlags))) { + return; + } + if (optional_fields_count == 0) { + return; + } --optional_fields_count; + bytes_left -= 4; } // discard unknown optional fields for (int i=0; i<optional_fields_count; i++) { AP4_UI32 discard; - stream.ReadUI32(discard); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(discard))) { + return; + } + bytes_left -= 4; } int record_fields_count = (int)ComputeRecordFieldsCount(flags); - m_Entries.SetItemCount(sample_count); + if (record_fields_count && ((bytes_left / (record_fields_count*4)) < sample_count)) { + // not enough data for all samples, the format is invalid + return; + } + if (AP4_FAILED(m_Entries.SetItemCount(sample_count))) { + return; + } for (unsigned int i=0; i<sample_count; i++) { if (flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) { - stream.ReadUI32(m_Entriesi.sample_duration); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_Entriesi.sample_duration))) { + return;; + } --record_fields_count; + bytes_left -= 4; } if (flags & AP4_TRUN_FLAG_SAMPLE_SIZE_PRESENT) { - stream.ReadUI32(m_Entriesi.sample_size); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_Entriesi.sample_size))) { + return; + } --record_fields_count; + bytes_left -= 4; } if (flags & AP4_TRUN_FLAG_SAMPLE_FLAGS_PRESENT) { - stream.ReadUI32(m_Entriesi.sample_flags); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_Entriesi.sample_flags))) { + return; + } --record_fields_count; + bytes_left -= 4; } if (flags & AP4_TRUN_FLAG_SAMPLE_COMPOSITION_TIME_OFFSET_PRESENT) { - stream.ReadUI32(m_Entriesi.sample_composition_time_offset); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_Entriesi.sample_composition_time_offset))) { + return; + } --record_fields_count; + bytes_left -= 4; } // skip unknown fields for (int j=0;j<record_fields_count; j++) { AP4_UI32 discard; - stream.ReadUI32(discard); + if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(discard))) { + return; + } + bytes_left -= 4; } } }
View file
bento4-1.6.0r639.tar.gz/Source/C++/Core/Ap4UuidAtom.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/Core/Ap4UuidAtom.cpp
Changed
@@ -150,8 +150,11 @@ AP4_UuidAtom(size, false, stream) { // store the data - m_Data.SetDataSize((AP4_Size)size-GetHeaderSize()); - stream.Read(m_Data.UseData(), m_Data.GetDataSize()); + AP4_Size header_size = GetHeaderSize(); + if (size > header_size) { + m_Data.SetDataSize((AP4_Size)size-GetHeaderSize()); + stream.Read(m_Data.UseData(), m_Data.GetDataSize()); + } } /*---------------------------------------------------------------------- @@ -161,8 +164,11 @@ AP4_UuidAtom(size, uuid) { // store the data - m_Data.SetDataSize((AP4_Size)size-GetHeaderSize()); - stream.Read(m_Data.UseData(), m_Data.GetDataSize()); + AP4_Size header_size = GetHeaderSize(); + if (size > header_size) { + m_Data.SetDataSize((AP4_Size)size-GetHeaderSize()); + stream.Read(m_Data.UseData(), m_Data.GetDataSize()); + } } /*----------------------------------------------------------------------
View file
bento4-1.6.0r639.tar.gz/Source/C++/System/StdC/Ap4StdCFileByteStream.cpp -> bento4-1.6.0r641.tar.gz/Source/C++/System/StdC/Ap4StdCFileByteStream.cpp
Changed
@@ -131,19 +131,18 @@ #define AP4_WIN32_A2W(lpa) \ (((_lpa = lpa) == NULL) ? \ NULL : \ - (_convert = (int)(strlen(_lpa) + 1), \ + (_convert = MultiByteToWideChar(CP_UTF8, 0, lpa, -1, NULL, 0), \ (INT_MAX / 2 < _convert) ? \ NULL : \ A2WHelper((LPWSTR)alloca(_convert * sizeof(WCHAR)), _lpa, _convert, CP_UTF8))) -/* +2 instead of +1 temporary fix for Chinese characters */ -#define AP4_WIN32_W2A(lpw) \ - (((_lpw = lpw) == NULL) ? \ - NULL : \ - ((_convert = (lstrlenW(_lpw) + 2), \ - (_convert > INT_MAX / 2) ? \ - NULL : \ - W2AHelper((LPSTR)alloca(_convert * sizeof(WCHAR)), _lpw, _convert * sizeof(WCHAR), CP_UTF8)))) +#define AP4_WIN32_W2A(lpw) \ + (((_lpw = lpw) == NULL) ? \ + NULL : \ + ((_convert = WideCharToMultiByte(CP_UTF8, 0, lpw, -1, NULL, 0, NULL, NULL), \ + (_convert > INT_MAX / 2) ? \ + NULL : \ + W2AHelper((LPSTR)alloca(_convert), _lpw, _convert, CP_UTF8)))) /*---------------------------------------------------------------------- | AP4_fopen_s_utf8
View file
bento4-1.6.0r639.tar.gz/Source/Python/utils/mp4-dash.py -> bento4-1.6.0r641.tar.gz/Source/Python/utils/mp4-dash.py
Changed
@@ -56,12 +56,15 @@ XmlDuration, PrintErrorAndExit, MakeNewDir, - BooleanFromString + BooleanFromString, + ReGroupEC3Sets, + DolbyDigitalWithMPEGDASHScheme, + DolbyAc4WithMPEGDASHScheme ) # setup main options VERSION = "2.0.0" -SDK_REVISION = '639' +SDK_REVISION = '641' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += SCRIPT_PATH @@ -459,7 +462,7 @@ AddDescriptor(adaptation_set, set_attributes, 'video', None) # setup content protection - if options.encryption_key or options.marlin or options.playready or options.widevine: + if options.encryption_key or options.eme_signaling or options.marlin or options.playready or options.widevine or options.clearkey or options.primetime: AddContentProtection(options, adaptation_set, video_tracks, all_audio_tracks + all_video_tracks) if options.on_demand: @@ -500,6 +503,7 @@ # process the audio tracks if audio_sets: period.append(xml.Comment(' Audio ')) + audio_sets = ReGroupEC3Sets(audio_sets) for _, audio_tracks in list(audio_sets.items()): args = period, 'AdaptationSet' kwargs = {'mimeType': AUDIO_MIMETYPE, 'startWithSAP': '1', 'segmentAlignment': 'true'} @@ -515,7 +519,7 @@ AddDescriptor(adaptation_set, set_attributes, 'audio/' + language, 'audio') # setup content protection - if options.encryption_key or options.marlin or options.playready or options.widevine: + if options.encryption_key or options.eme_signaling or options.marlin or options.playready or options.widevine or options.clearkey or options.primetime: AddContentProtection(options, adaptation_set, audio_tracks, all_audio_tracks + all_video_tracks) if options.on_demand: @@ -539,24 +543,43 @@ codecs=audio_track.codec, bandwidth=str(audio_track.bandwidth), audioSamplingRate=str(audio_track.sample_rate)) - if audio_track.codec == 'ec-3': + if audio_track.codec == 'ec-3' or audio_track.codec == 'ac-3': audio_channel_config_value = ComputeDolbyDigitalPlusAudioChannelConfig(audio_track) - scheme_id_uri = DOLBY_DIGITAL_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI + (mpeg_scheme, audio_channel_config_value) = DolbyDigitalWithMPEGDASHScheme(audio_channel_config_value) + if (mpeg_scheme): + scheme_id_uri = ISO_IEC_23001_8_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI + else: + scheme_id_uri = DOLBY_DIGITAL_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI elif audio_track.codec.startswith('ac-4'): audio_channel_config_value = ComputeDolbyAc4AudioChannelConfig(audio_track) - scheme_id_uri = DOLBY_AC4_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI - else: - # detect the actual number of channels - sample_description = audio_track.info'sample_descriptions'0 - if 'mpeg_4_audio_decoder_config' in sample_description: - audio_channel_config_value = str(sample_description'mpeg_4_audio_decoder_config''channels') + (mpeg_scheme, audio_channel_config_value) = DolbyAc4WithMPEGDASHScheme(audio_channel_config_value) + if (mpeg_scheme): + scheme_id_uri = ISO_IEC_23001_8_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI else: - audio_channel_config_value = str(audio_track.channels) + scheme_id_uri = DOLBY_AC4_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI + else: + audio_channel_config_value = str(audio_track.channels) scheme_id_uri = MPEG_DASH_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI if options.use_legacy_audio_channel_config_uri else ISO_IEC_23001_8_AUDIO_CHANNEL_CONFIGURATION_SCHEME_ID_URI xml.SubElement(representation, 'AudioChannelConfiguration', schemeIdUri=scheme_id_uri, value=audio_channel_config_value) + # DD+ Atmos SupplementalProperty + if audio_track.codec_family == 'ec-3' and audio_track.dolby_ddp_atmos == 'Yes': + xml.SubElement(representation, + 'SupplementalProperty', + schemeIdUri='tag:dolby.com,2018:dash:EC3_ExtensionType:2018', + value='JOC') + xml.SubElement(representation, + 'SupplementalProperty', + schemeIdUri='tag:dolby.com,2018:dash:EC3_ExtensionComplexityIndex:2018', + value=str(audio_track.complexity_index)) + # AC-4 IMS SupplementalProperty + if audio_track.codec_family == 'ac-4' and audio_track.dolby_ac4_ims == 'Yes': + xml.SubElement(representation, + 'SupplementalProperty', + schemeIdUri='tag:dolby.com,2016:dash:virtualized_content:2016', + value='1') if options.on_demand: base_url = xml.SubElement(representation, 'BaseURL') @@ -911,7 +934,8 @@ default = not default_selected if default: default_selected = True - master_playlist_file.write('#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="{}",LANGUAGE="{}",NAME="{}",AUTOSELECT={},DEFAULT={},CHANNELS="{}",URI="{}"\n'.format( + + master_playlist_file.write('#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="{}",LANGUAGE="{}",NAME="{}",AUTOSELECT={},DEFAULT={},CHANNELS="{}",URI="{}"'.format( audio_group_name, audio_track.language, media_name, @@ -919,6 +943,13 @@ 'YES' if default else 'NO', audio_track.channels, media_playlist_path)) + + hls_characteristic = audio_track.hls_characteristic + if hls_characteristic != None: + master_playlist_file.write(',CHARACTERISTIC="{}"'.format(hls_characteristic)) + + master_playlist_file.write("\n") + OutputHlsTrack(options, audio_track, all_audio_tracks + all_video_tracks, media_subdir, media_playlist_name, media_file_name) # Add an audio stream entry for audio-only presentations or if the track specifiers include a '-' entry @@ -951,46 +982,66 @@ iframes_playlist_name = options.hls_iframes_playlist_name iframes_playlist_path = media_subdir+'/'+iframes_playlist_name + supplemental_codec_string = '' + if hasattr(video_track, 'supplemental_codec'): + if hasattr(video_track, 'dv_brand'): + supplemental_codec_string = video_track.supplemental_codec+'/'+video_track.dv_brand + else: + supplemental_codec_string = video_track.supplemental_codec + if audio_groups: # one entry per matching audio group for audio_group_name in audio_groups: if '*' not in video_track.hls_group_match and audio_group_name not in video_track.hls_group_match: continue audio_codecs = ','.join(audio_groupsaudio_group_name'codecs') - master_playlist_file.write('#EXT-X-STREAM-INF:{}AUDIO="{}",AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},CODECS="{}",RESOLUTION={:.0f}x{:.0f},FRAME-RATE={:.3f}\n'.format( + master_playlist_file.write('#EXT-X-STREAM-INF:{}AUDIO="{}",AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},VIDEO-RANGE={},CODECS="{}",RESOLUTION={:.0f}x{:.0f},FRAME-RATE={:.3f}'.format( subtitles_group, audio_group_name, video_track.average_segment_bitrate + audio_groupsaudio_group_name'average_segment_bitrate', video_track.max_segment_bitrate + audio_groupsaudio_group_name'max_segment_bitrate', + video_track.video_range, video_track.codec+','+audio_codecs, video_track.width, video_track.height, video_track.frame_rate)) + if supplemental_codec_string != '': + master_playlist_file.write(',SUPPLEMENTAL-CODECS="{}"'.format(supplemental_codec_string)) + master_playlist_file.write('\n') master_playlist_file.write(media_playlist_path+'\n') else: # no audio - master_playlist_file.write('#EXT-X-STREAM-INF:{}AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},CODECS="{}",RESOLUTION={:.0f}x{:.0f},FRAME-RATE={:.3f}\n'.format( + master_playlist_file.write('#EXT-X-STREAM-INF:{}AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},VIDEO-RANGE={},CODECS="{}",RESOLUTION={:.0f}x{:.0f},FRAME-RATE={:.3f}'.format( subtitles_group, video_track.average_segment_bitrate, video_track.max_segment_bitrate, + video_track.video_range, video_track.codec, video_track.width, video_track.height, video_track.frame_rate)) + if supplemental_codec_string != '': + master_playlist_file.write(',SUPPLEMENTAL-CODECS="{}"'.format(supplemental_codec_string)) + master_playlist_file.write('\n') master_playlist_file.write(media_playlist_path+'\n') OutputHlsTrack(options, video_track, all_audio_tracks + all_video_tracks, media_subdir, media_playlist_name, media_file_name) iframe_average_segment_bitrate,iframe_max_bitrate = OutputHlsIframeIndex(options, video_track, all_audio_tracks + all_video_tracks, media_subdir, iframes_playlist_name, media_file_name) # this will be written later - iframe_playlist_lines.append('#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},CODECS="{}",RESOLUTION={:.0f}x{:.0f},URI="{}"\n'.format( + iframe_playlist_lines.append('#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH={:.0f},BANDWIDTH={:.0f},VIDEO-RANGE={},CODECS="{}",RESOLUTION={:.0f}x{:.0f},URI="{}"'.format( iframe_average_segment_bitrate, iframe_max_bitrate, + video_track.video_range, video_track.codec, video_track.width, video_track.height, iframes_playlist_path)) + if supplemental_codec_string != '': + iframe_playlist_lines.append(',SUPPLEMENTAL-CODECS="{}"'.format(supplemental_codec_string)) + iframe_playlist_lines.append('\n') + master_playlist_file.write('\n# I-Frame Playlists\n') master_playlist_file.write(''.join(iframe_playlist_lines)) @@ -1039,11 +1090,13 @@ default = audio_track.hls_default and not default_selected if default: default_selected = True + language = subtitles_file.language + language_name = subtitles_file.language_name master_playlist_file.write('#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles",NAME="{}",AUTOSELECT={},DEFAULT={},LANGUAGE="{}",URI="{}/{}"\n'.format( language_name, 'YES' if subtitles_file.hls_autoselect else 'NO',
View file
bento4-1.6.0r639.tar.gz/Source/Python/utils/mp4-hls.py -> bento4-1.6.0r641.tar.gz/Source/Python/utils/mp4-hls.py
Changed
@@ -31,7 +31,7 @@ # setup main options VERSION = "1.2.0" -SDK_REVISION = '639' +SDK_REVISION = '641' SCRIPT_PATH = path.abspath(path.dirname(__file__)) sys.path += SCRIPT_PATH @@ -330,6 +330,11 @@ # process audio tracks if len(audio_tracks): MakeNewDir(path.join(options.output_dir, 'audio')) + if options.audio_format == 'ts': + for audios in audio_tracks.values(): + for audio in audios: + if audio.codec_family in 'ec-3' and audio.dolby_ddp_atmos == 'Yes': + PrintErrorAndExit('ERROR: For Dolby Digital Plus with Dolby Atmos, the format of segment audio cannot be MPEG2TS, please add "--audio-format packed"') for group_id in audio_tracks: group = audio_tracksgroup_id MakeNewDir(path.join(options.output_dir, 'audio', group_id)) @@ -409,10 +414,11 @@ if default: extra_info += 'DEFAULT=YES,' default = False - master_playlist.write(('#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="%s",NAME="%s",LANGUAGE="%s",%sURI="%s"\n' % ( + master_playlist.write(('#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="%s",NAME="%s",LANGUAGE="%s",CHANNELS="%s",%sURI="%s"\n' % ( group_name, audio_track.media_info'language_name', audio_track.media_info'language', + str(audio_track.channels), extra_info, options.base_url+audio_track.media_info'dir'+'/'+options.media_playlist_name))) audio_groups.append({
View file
bento4-1.6.0r639.tar.gz/Source/Python/utils/mp4utils.py -> bento4-1.6.0r641.tar.gz/Source/Python/utils/mp4utils.py
Changed
@@ -407,6 +407,7 @@ if self.type == 'video': # set the scan type (hardcoded for now) self.scan_type = 'progressive' + self.video_range = 'SDR' # set the width and height self.width = sample_desc'width' @@ -415,25 +416,63 @@ # add dolby vision signaling if present if 'dolby_vision' in sample_desc: dv_info = sample_desc'dolby_vision' - if sample_desc'coding' in 'dvav', 'dva1', 'dvhe', 'dvh1': - # non-backward-compatible - self.codec = sample_desc'coding' + ('.%02d.%02d' % (dv_info'profile', dv_info'level')) + if dv_info'profile' == 5: + self.video_range = 'PQ' + elif dv_info'profile' in 8, 9: + self.supplemental_codec = sample_desc'dv_codecs_string'.split(",")1.split(".")0 + \ + "." + sample_desc'dv_codecs_string'.split(",")1.split(".")1 + str('.%02d' % dv_info'level') + bl_compatibility_id = dv_info'dv_bl_signal_compatibility_id' + if bl_compatibility_id == 1: + self.video_range = 'PQ' + brand = 'db1p' + if brand in self.parent.info'file''compatible_brands': + self.dv_brand = brand + elif bl_compatibility_id == 2: + self.video_range = 'SDR' + brand = 'db2g' + if brand in self.parent.info'file''compatible_brands': + self.dv_brand = brand + elif bl_compatibility_id == 4: + self.video_range = 'HLG' + if 'db4g' in self.parent.info'file''compatible_brands': + self.dv_brand = 'db4g' + elif 'db4h' in self.parent.info'file''compatible_brands': + self.dv_brand = 'db4h' + else: + PrintErrorAndExit('ERROR: unsupported ccid for Dolby Vision profile 8/9.') else: - # backward-compatible - coding_map = { - 'avc1': 'dva1', - 'avc3': 'dvav', - 'hev1': 'dvhe', - 'hvc1': 'dvh1' - } - dv_coding = coding_map.get(sample_desc'coding') - if dv_coding: - dv_string = dv_coding + ('.%02d.%02d' % (dv_info'profile', dv_info'level')) - self.codec += ','+dv_string + PrintErrorAndExit('ERROR: unsupported Dolby Vision profile.') if self.type == 'audio': self.sample_rate = sample_desc'sample_rate' self.channels = sample_desc'channels' + # Set the default values for Dolby audio codec flags + self.dolby_ddp_atmos = 'No' + self.dolby_ac4_ims = 'No' + self.dolby_ac4_cbi = 'No' + if self.codec_family == 'ec-3' and 'dolby_digital_plus_info' in sample_desc: + self.channels = GetDolbyDigitalPlusChannels(self)0 + self.dolby_ddp_atmos = sample_desc'dolby_digital_plus_info''Dolby_Atmos' + if (self.dolby_ddp_atmos == 'Yes'): + self.complexity_index = sample_desc'dolby_digital_plus_info''complexity_index' + self.channels = str(self.info'sample_descriptions'0'dolby_digital_plus_info''complexity_index') + '/JOC' + elif self.codec_family == 'ac-4' and 'dolby_ac4_info' in sample_desc: + self.channels = str(self.channels) + if sample_desc'dolby_ac4_info''dsi version' == 0: + raise Exception("AC4 dsi version 0 is deprecated.") + elif sample_desc'dolby_ac4_info''dsi version' == 1: + if sample_desc'dolby_ac4_info''bitstream version' == 0: + raise Exception("AC4 bitstream version 0 is deprecated.") + if len(sample_desc'dolby_ac4_info''presentations'): + stream_type = sample_desc'dolby_ac4_info''presentations'0'Stream Type' + if stream_type == 'Immersive stereo': + self.dolby_ac4_ims = 'Yes' + self.channels = '2/IMSA' + elif stream_type == 'Channel based immsersive': + self.dolby_ac4_cbi = 'Yes' + self.channels = self.channels + '/IMSA' + elif 'mpeg_4_audio_decoder_config' in sample_desc: + self.channels = sample_desc'mpeg_4_audio_decoder_config''channels' self.language = info'language' self.language_name = LanguageNames.get(LanguageCodeMap.get(self.language, 'und'), '') @@ -862,14 +901,20 @@ def GetDolbyDigitalPlusChannels(track): sample_desc = track.info'sample_descriptions'0 - if 'dolby_digital_info' not in sample_desc: + if 'dolby_digital_plus_info' not in sample_desc and 'dolby_digital_info' not in sample_desc: return (track.channels, ) - dd_info = sample_desc'dolby_digital_info''substreams'0 - channels = DolbyDigital_acmoddd_info'acmod': - if dd_info'lfeon' == 1: + elif 'dolby_digital_plus_info' in sample_desc: + if 'substreams' in sample_desc'dolby_digital_plus_info': + ddp_or_dd_info = sample_desc'dolby_digital_plus_info''substreams'0 + elif 'dolby_digital_info' in sample_desc: + if 'stream_info' in sample_desc'dolby_digital_info': + ddp_or_dd_info = sample_desc'dolby_digital_info''stream_info' + + channels = DolbyDigital_acmodddp_or_dd_info'acmod': + if ddp_or_dd_info'lfeon' == 1: channels.append('LFE') - if dd_info'num_dep_sub' and 'chan_loc' in dd_info: - chan_loc_value = dd_info'chan_loc' + if 'num_dep_sub' in ddp_or_dd_info and ddp_or_dd_info'num_dep_sub' and 'chan_loc' in ddp_or_dd_info: + chan_loc_value = ddp_or_dd_info'chan_loc' for i in range(9): if chan_loc_value & (1<<i): channels.append(DolbyDigital_chan_loci) @@ -909,6 +954,17 @@ config |= flagschannel return hex(config).upper()2: +# ETSI TS 102 366 V1.4.1 (2017-09) Table I.1.1 +def DolbyDigitalWithMPEGDASHScheme(mask): + available_mask_dict = {'4000': '1' , 'A000': '2' , 'E000': '3' , 'E100': '4' , + 'F800': '5' , 'F801': '6' , 'F821': '7' , 'A100': '9' , + 'B800': '10', 'E301': '11', 'FA01': '12', 'F811': '14', + 'F815': '16', 'F89D': '17', 'E255': '19'} + if mask in available_mask_dict: + return (True, available_mask_dictmask) + else: + return (False, mask) + def ComputeDolbyAc4AudioChannelConfig(track): sample_desc = track.info'sample_descriptions'0 if 'dolby_ac4_info' in sample_desc: @@ -920,6 +976,42 @@ return '000000' +# ETSI TS 103 190-2 V1.2.1 (2018-02) Table G.1 +def DolbyAc4WithMPEGDASHScheme(mask): + available_mask_dict = { + '000002' : '1' , '000001' : '2' , '000003' : '3' , '008003' : '4' , + '000007' : '5' , '000047' : '6' , '020047' : '7' , '008001' : '9' , + '000005' : '10', '008047' : '11', '00004F' : '12', '02FF7F' : '13', + '06FF6F' : '13', '000057' : '14', '040047' : '14', '00145F' : '15', + '04144F' : '15', '000077' : '16', '040067' : '16', '000A77' : '17', + '040A67' : '17', '000A7F' : '18', '040A6F' : '18', '00007F' : '19', + '04006F' : '19', '01007F' : '20', '05006F' : '2'} + if mask in available_mask_dict: + return (True, available_mask_dictmask) + else: + return (False, mask) + +def ReGroupEC3Sets(audio_sets): + regroup_audio_sets = {} + audio_adaptation_sets = {} + for name, audio_tracks in audio_sets.items(): + if audio_tracks0.codec_family == 'ec-3': + for track in audio_tracks: + if track.info'sample_descriptions'0'dolby_digital_plus_info''Dolby_Atmos' == 'Yes': + adaptation_set_name = ('audio', track.language, track.codec_family, track.channels, 'ATMOS') + else: + adaptation_set_name = ('audio', track.language, track.codec_family, track.channels) + adaptation_set = audio_adaptation_sets.get(adaptation_set_name, ) + audio_adaptation_setsadaptation_set_name = adaptation_set + adaptation_set.append(track) + else: + regroup_audio_setsname = audio_tracks + + for name, tracks in audio_adaptation_sets.items(): + regroup_audio_setsname = tracks + + return regroup_audio_sets + def ComputeDolbyDigitalPlusAudioChannelMask(track): masks = { 'L': 0x1, # SPEAKER_FRONT_LEFT
View file
bento4-1.6.0r639.tar.gz/Source/Python/utils/subtitles.py -> bento4-1.6.0r641.tar.gz/Source/Python/utils/subtitles.py
Changed
@@ -3,7 +3,7 @@ import xml.etree.ElementTree as ET import os.path as path -from mp4utils import LanguageCodeMap, LanguageNames +from mp4utils import LanguageCodeMap, LanguageNames, BooleanFromString TTML_XML_NAMESPACE = 'http://www.w3.org/ns/ttml' XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace' @@ -39,6 +39,14 @@ if '+media' in media_source.spec: self.media_name = media_source.spec'+media' + # HLS options + self.hls_default = media_source.spec.get('+hls_default', None) # None means: unspecified + if self.hls_default is not None: + self.hls_default = BooleanFromString(self.hls_default) + self.hls_autoselect = BooleanFromString(media_source.spec.get('+hls_autoselect', 'YES')) + self.hls_group = media_source.spec.get('+hls_group') + self.hls_group_match = media_source.spec.get('+hls_group_match', '*').split('&') + def parse_ttml(self, options): self.format = 'ttml' self.mime_type = 'application/ttml+xml'
View file
bento4-1.6.0r639.tar.gz/tasks/build.py -> bento4-1.6.0r641.tar.gz/tasks/build.py
Changed
@@ -37,4 +37,4 @@ @task(rebuild) def sdk(ctx): - ctx.run("python Scripts/SdkPackager.py") + ctx.run("python3 Scripts/SdkPackager.py")
View file
bento4-rpmlintrc
Changed
@@ -1,6 +1,2 @@ -# this can't be helped -addFilter("no-manual-page-for-binary .*bento4-.*") - # false positives addFilter("shlib-unversioned-lib .*libap4.*so") -addFilter("libap4.* shlib-policy-missing-lib")
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.