Skip to content

Commit

Permalink
Move libMXF and libMXF projects into bmx
Browse files Browse the repository at this point in the history
  • Loading branch information
philipnbbc committed Aug 24, 2023
1 parent d448677 commit fbffcfd
Show file tree
Hide file tree
Showing 296 changed files with 31,525 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Configure
shell: bash
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Source release
shell: bash
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ bmx is a library and set of utilities to read and write the [SMPTE ST 377-1 MXF

bmx is used to support standardisation efforts in the broadcast industry. It provides utilities for creating standard compliant sample files. It serves as an example implementation for MXF file format standards.

bmx includes the [libMXF](./deps/libMXF) low-level MXF C library and the [libMXF++](./deps/libMXFpp) C++ wrapper library.

bmx provides a set of commandline applications:

* **raw2bmx**: create MXF files from raw essence files
Expand All @@ -19,7 +21,7 @@ bmx provides a set of file format text dumper and essence extraction tools:
* **movdump**: text dump Quicktime / MP4 files
* **rdd36dump**: text dump SMPTE RDD 36 (Apple ProRes) bitstream files
* **vc2dump**: text dump SMPTE ST 2042 VC-2 bitstream files
* **MXFDump**: text dumper for MXF files from the [AAF SDK](https://sourceforge.net/projects/aaf/). This utility is made available and built as part of [libMXF](https://github.com/bbc/libMXF).
* **MXFDump**: text dumper for MXF files from the [AAF SDK](https://sourceforge.net/projects/aaf/). This utility is made available and built as part of [libMXF](./deps/libMXF).

The following input and output wrapper formats and flavours are supported:

Expand Down Expand Up @@ -73,13 +75,7 @@ The build process has been tested on Ubuntu, Debian, MacOS and Windows (Microsof

### Dependencies

The [libMXF](https://github.com/bbc/libMXF) and [libMXF++](https://github.com/bbc/libMXFpp) libraries are required. They are included as git submodules in the `deps/` directory. Run

```bash
git submodule update --init
```

to ensure the submodules are available and up-to-date in the working tree.
The [libMXF](./deps/libMXF/) and [libMXF++](./deps/libMXFpp/) libraries are required.

The [uriparser](https://github.com/uriparser/uriparser) and [expat](https://github.com/libexpat/libexpat) libraries are required. These libraries are typically provided as software packages on Unix-like systems; the Ubuntu / Debian package names are `liburiparser-dev` and `libexpat1-dev`. The libraries are built from the GitHub source when building on Windows using Microsoft Visual Studio C++.

Expand All @@ -89,7 +85,7 @@ The [libcurl](https://curl.haxx.se/libcurl/) (Ubuntu / Debian package name `libc

### Commands

A basic commandline process is described here for platforms that default to the Unix Makefiles or Visual Studio cmake generators. See [./docs/build.md](./docs/build.md) for more detailed build options.
A basic commandline process is described here for platforms that default to the Unix Makefiles or Visual Studio cmake generators. See [build.md](./docs/build.md) for more detailed build options.

Replace `<build type>` in the commandlines below with `Debug` or `Release`. Note that the Visual Studio generator supports multiple build types for a configuration, which is why the build type is selected _after_ configuration.

Expand Down Expand Up @@ -167,7 +163,7 @@ add_executable(example example.cpp)
target_link_libraries(example bmx)
```

The `BMX_BUILD_LIB_ONLY` cmake option can be set to `ON` to avoid building the apps and examples in bmx, libMXF and libMXF++. Setting the option to `ON` will disable the bmx tests because they requires the apps. Add this line to the cmake
The `BMX_BUILD_LIB_ONLY` cmake option can be set to `ON` to avoid building the apps and examples in bmx, [libMXF](./deps/libMXF) and [libMXF++](./deps/libMXFpp). Setting the option to `ON` will disable the bmx tests because they requires the apps. Add this line to the cmake

```text
set(BMX_BUILD_LIB_ONLY ON CACHE BOOL "Build bmx, MXF and MXF++ libraries only")
Expand All @@ -191,19 +187,13 @@ See [Docker Run](#docker-run) for more details on the script.

### Docker Build

The [Dockerfile](./Dockerfile) is used for building a Docker image containing a set of tools from bmx, libMXF and AAF SDK.
The [Dockerfile](./Dockerfile) is used for building a Docker image containing a set of tools from bmx, [libMXF](./deps/libMXF) and [AAF SDK](https://sourceforge.net/projects/aaf/).

The Dockerfile contains a **build** and **runtime** layer:

* **build**: builds and checks the libMXF, libMXF++ and bmx code.
* **build**: builds and checks the [libMXF](./deps/libMXF), [libMXF++](./deps/libMXFpp) and bmx code.
* **runtime**: provides the commandline tool executables built in the `build` layer.

Ensure that the libMXF and libMXFpp git submodules are available and up-to-date in the `deps/` directory by running,

```bash
git submodule update --init
```

The runtime Docker image can be built in the top-level directory using docker build,

```bash
Expand Down
3 changes: 1 addition & 2 deletions cmake/libmxf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ if(BMX_BUILD_LIBMXF_LIB)
else()
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/deps/libMXF/CMakeLists.txt)
message(FATAL_ERROR
"libMXF submodule source code does not exist at 'deps/libMXF'\n"
"Run 'git submodule update --init' to fetch the source"
"libMXF source code does not exist at 'deps/libMXF'"
)
endif()

Expand Down
3 changes: 1 addition & 2 deletions cmake/libmxfpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ if(BMX_BUILD_LIBMXFPP_LIB)
else()
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/deps/libMXFpp/CMakeLists.txt)
message(FATAL_ERROR
"libMXF submodule source code does not exist at 'deps/libMXFpp'\n"
"Run 'git submodule update --init' to fetch the source"
"libMXF++ source code does not exist at 'deps/libMXFpp'"
)
endif()

Expand Down
1 change: 0 additions & 1 deletion deps/libMXFpp
Submodule libMXFpp deleted from 382fa9
14 changes: 14 additions & 0 deletions deps/libMXFpp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*~
build/
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
out/
69 changes: 69 additions & 0 deletions deps/libMXFpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.15.0)
# Set policy CMP0091 to new to allow use of CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
endif()

project(libMXF++
VERSION 1.1
DESCRIPTION "C++ wrapper library for libMXF that supports reading and writing the SMPTE ST 377-1 MXF file format"
HOMEPAGE_URL https://github.com/bbc/libMXFpp
LANGUAGES CXX
)

include("${CMAKE_CURRENT_LIST_DIR}/cmake/options.cmake")

if(MSVC AND LIBMXFPP_SET_MSVC_RUNTIME AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.15.0)
# cmake version >= 3.15: Use MultiThreadedDLL runtime
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()

if(BUILD_SHARED_LIBS)
# Ensure that static library code can be linked into the dynamic libraries (-fPIC compile option)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
set(CMAKE_CXX_STANDARD 11)

if(MSVC)
add_compile_options(/W3 /EHsc)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

if(LIBMXFPP_SET_MSVC_RUNTIME AND CMAKE_VERSION VERSION_LESS 3.15.0)
# cmake version < 3.15: Update compiler flags to use the MultiThreadedDLL runtime
macro(update_msvc_runtime_flags flags)
string(REGEX REPLACE "/MT" "/MD" ${flags} "${${flags}}")
endmacro()

update_msvc_runtime_flags(CMAKE_C_FLAGS)
update_msvc_runtime_flags(CMAKE_CXX_FLAGS)
foreach(suffix _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
update_msvc_runtime_flags(CMAKE_C_FLAGS${suffix})
update_msvc_runtime_flags(CMAKE_CXX_FLAGS${suffix})
endforeach()
endif()
else()
add_compile_options(-W -Wall -O2)

# Enable large file support on 32-bit systems.
add_definitions(
-D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE
)
endif()

if(LIBMXFPP_BUILD_TESTING AND (NOT DEFINED BUILD_TESTING OR BUILD_TESTING))
enable_testing()
endif()

include("${PROJECT_SOURCE_DIR}/cmake/libmxf.cmake")

configure_file(config.h.in config.h)

add_subdirectory(libMXF++)
add_subdirectory(test)
if(NOT LIBMXF_BUILD_LIB_ONLY)
add_subdirectory(examples)
add_subdirectory(tools)
endif()
26 changes: 26 additions & 0 deletions deps/libMXFpp/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (C) 2014, British Broadcasting Corporation
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the British Broadcasting Corporation nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
72 changes: 72 additions & 0 deletions deps/libMXFpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# libMXF++

libMXF++ is a C++ wrapper library for [libMXF](../libMXF/) that supports reading and writing the [SMPTE ST 377-1 MXF file format](https://ieeexplore.ieee.org/document/7292073).

libMXF++ and [libMXF](../libMXF/) are used in the [bmx](../../) project.

libMXF++ was originally developed as part of the [Ingex Project](http://ingex.sourceforge.net/) where it supported MXF transfer, playback and storage applications.

## Examples

A number of examples can be found in the [examples](./examples) directory. These are not part of the core library and are not required to build [bmx](../../).

* [D10MXFOP1AWriter](./examples/D10MXFOP1AWriter): library code used in the [Ingex Project](http://ingex.sourceforge.net/) for writing [SMPTE ST 386](https://ieeexplore.ieee.org/document/7291350) MXF D-10 (Sony MPEG IMX) files.
* [OPAtomReader](./examples/OPAtomReader): library code used in the [Ingex Project](http://ingex.sourceforge.net/) for recovering Avid MXF OP-Atom files after a system failure.

## Build, Test and Install

libMXF++ is developed on Ubuntu Linux but is supported on other Unix-like systems and Windows.

The [cmake](https://cmake.org/) build system is used, with minimum version **3.12**. The build requires the `git` tool along with the C/C++ compilers.

The build process has been tested on Ubuntu, Debian, MacOS and Windows (Microsoft Visual C++ 2017 v15.9.51 and later versions).

### Dependencies

The [libMXF](../libMXF/) library is required.

### Commands

A basic commandline process is described here for platforms that default to the Unix Makefiles or Visual Studio cmake generators. See [build.md](./docs/build.md) for more detailed build options.

Replace `<build type>` in the commandlines below with `Debug` or `Release`. Note that the Visual Studio generator supports multiple build types for a configuration, which is why the build type is selected _after_ configuration.

The default generator can be overridden using the cmake `-G` option. The list of available generators is shown at the end of the output of `cmake --help`.

Start by creating a build directory and change into it. The commandlines below use a `out/build` build directory in the working tree, which follows the approach taken by Microsoft Visual Studio C++.

#### Unix-like (Unix Makefiles)

```bash
mkdir -p out/build
cd out/build
cmake ../../ -DCMAKE_BUILD_TYPE=<build type>
cmake --build .
make test
sudo make install
```

Run `ldconfig` to update the runtime linker cache. This avoids library link errors similar to "error while loading shared libraries".

```bash
sudo /sbin/ldconfig
```

#### Windows (Visual Studio)

```console
mkdir out\build
cd out\build
cmake ..\..\
cmake --build . --config <build type>
ctest -C <build type>
cmake --build . --config <build type> --target install
```

## Source and Binary Distributions

Source distributions, including dependencies for the Windows build, and Windows binaries are made available as in [bmx](../../).

## License

The libMXF++ library is provided under the BSD 3-clause license. See the [COPYING](./COPYING) file provided with this library for more details.
39 changes: 39 additions & 0 deletions deps/libMXFpp/cmake/git_version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
if(TARGET libmxfpp_git_version)
return()
endif()


# Ensure the cmake targets and code symbols are libMXFpp specific
set(GIT_VERSION_PROJECT_PREFIX "libmxfpp_")

# Set the git release tag pattern to describe relative to
set(GIT_DESCRIBE_TAG_PATTERN "v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(GIT_WORKING_DIR ${PROJECT_SOURCE_DIR})

# Set to ignore git_version errors if there is no .git directory
set(GIT_FAIL_IF_NONZERO_EXIT FALSE)

include(FetchContent)

set(git_version_deps_source "${PROJECT_SOURCE_DIR}/deps/cmake-git-version-tracking")

if(EXISTS ${git_version_deps_source})
FetchContent_Declare(libmxfpp_git_version
SOURCE_DIR ${git_version_deps_source}
)
message("-- Build using git version source: ${git_version_deps_source}")
else()
FetchContent_Declare(libmxfpp_git_version
GIT_REPOSITORY "https://github.com/andrew-hardin/cmake-git-version-tracking.git"
GIT_TAG "904dbda1336ba4b9a1415a68d5f203f576b696bb"
PATCH_COMMAND git clean -fdx
COMMAND git reset --hard
COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/git_version_904dbda.patch"
)
endif()

FetchContent_GetProperties(libmxfpp_git_version)
if(NOT libmxfpp_git_version_POPULATED)
FetchContent_Populate(libmxfpp_git_version)
add_subdirectory(${libmxfpp_git_version_SOURCE_DIR} ${libmxfpp_git_version_BINARY_DIR})
endif()
Loading

0 comments on commit fbffcfd

Please sign in to comment.