Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Set up build dir
timeout-minutes: 1
run: mkdir obj && ln -s ../testdata obj/testdata
run: mkdir obj

- name: Configure
timeout-minutes: 5
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:

- name: Set up build dir
timeout-minutes: 1
run: mkdir obj && ln -s ../testdata obj/testdata
run: mkdir obj

- name: Configure
timeout-minutes: 5
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ add_subdirectory(tools/ld-dropout-correct)
add_subdirectory(tools/ld-export-metadata)
add_subdirectory(tools/ld-json-converter)
add_subdirectory(tools/ld-lds-converter)
add_subdirectory(tools/ld-process-ac3)
add_subdirectory(tools/ld-process-efm)
add_subdirectory(tools/ld-process-vbi)
add_subdirectory(tools/ld-process-vits)
add_subdirectory(tools/library)
Expand Down
12 changes: 12 additions & 0 deletions cmake_modules/LdDecodeTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,15 @@ add_test(
--expect-vbi 0,8449774,8449774
${TESTDATA_DIR}/pal/kagemusha-leadout-cbar.ldf
)

add_test(
NAME ldf-reader-full
COMMAND ${SCRIPTS_DIR}/test-ldf-reader
--build ${CMAKE_BINARY_DIR}
--testdata ${TESTDATA_DIR}
--input ggv-ntsc-mb-v2800.ldf
--full-sha256 0984ab9a4e66b49426b61e2d4de266e7783801dc48f566ed805257bc596098ec
--offset 1000000
--partial-bytes 1000000
--partial-sha256 7dae0f342b4b365d5d607676961ca28b39ef78c71b7b0be11f77c303a7ac50f7
)
2 changes: 1 addition & 1 deletion lddecode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def _close(self):
def _open(self, sample):
self._close()

command = ["ld-ldf-reader", self.filename, str(sample)]
command = ["ld-ldf-reader", "--quiet", "--start-offset", str(sample), self.filename]

ldfreader = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
Expand Down
3 changes: 3 additions & 0 deletions prototypes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prototypes

This folder contains stand-alone applications which are not integrated into the standard ld-decode tools/ (for example, are not Qt, do not use correct libraries, are not CI/CD integrated, etc.)
16 changes: 16 additions & 0 deletions prototypes/ld-process-ac3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build directories
build/

# CMake generated files
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
CTestTestfile.cmake
Makefile

# Build artifacts
*.o
*.a
*.so
*.dylib
*.exe
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
cmake_minimum_required(VERSION 3.16)

project(ld-process-ac3)

if(MSVC)
find_package(Getopt REQUIRED)
endif()
Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions prototypes/ld-process-ac3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ld-process-ac3/ld-ac3-*

**AC3 Audio Decoder for LaserDisc RF Signals**

## Overview

ld-process-ac3/ld-ac3-* tools decode AC3 Audio.

## Building

```
mkdir build
cd build
cmake ..
make all
```

## Usage

### Basic Syntax
```bash
ld-ac3-demodulate [options] source_file output_file [log_file]
ld-ac3-decode [options] source_file output_file [log_file]
```

## Options

### ld-ac3-demodulate
This tool does not support `--help`

#### Arguments
- `source_file`: Input RF signal file (use '-' for stdin)
- `output_file`: Output QPSK symbols file (use '-' for stdout)
- `log_file`: Optional log file (defaults to stderr)

### ld-ac3-decode
#### Options
- `-v <int>`: Set the logging level (0-3: DEBUG, INFO, WARN, ERR)
- `-h`: Print help information

#### Arguments
- `source_file`: Input QPSK symbols file (use '-' for stdin)
- `output_file`: Output AC3 audio file (use '-' for stdout)
- `log_file`: Optional log file (defaults to stderr)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ if(MSVC)
target_link_libraries(ld-ac3-decode PRIVATE ${Getopt_LIBRARIES})
target_include_directories(ld-ac3-decode PRIVATE ${Getopt_INCLUDE_DIRS})
endif()
target_include_directories(ld-ac3-decode PRIVATE . ../../efm-decoder/libs/ezpwd/c++)
target_include_directories(ld-ac3-decode PRIVATE . ../../../tools/efm-decoder/libs/ezpwd/c++)

install(TARGETS ld-ac3-decode)
File renamed without changes.
19 changes: 19 additions & 0 deletions prototypes/ld-process-efm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Build directories
build/

# CMake generated files
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
CTestTestfile.cmake
Makefile

# Build artifacts
*.o
*.a
*.so
*.dylib
*.exe

# Duplicate library - use the main submodule instead
ezpwd/
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
cmake_minimum_required(VERSION 3.16)

project(ld-process-efm)

# Find Qt5
find_package(Qt5 REQUIRED COMPONENTS Core)

add_executable(ld-process-efm
efmprocess.cpp
main.cpp
../../tools/library/tbc/logging.cpp
Datatypes/audio.cpp
Datatypes/f1frame.cpp
Datatypes/f2frame.cpp
Expand All @@ -19,8 +27,14 @@ add_executable(ld-process-efm
Decoders/syncf3frames.cpp
)

target_include_directories(ld-process-efm PRIVATE .)
target_include_directories(ld-process-efm PRIVATE . ../../tools/library/tbc ../../tools/efm-decoder/libs/ezpwd/c++)

# Define application version info
target_compile_definitions(ld-process-efm PRIVATE
APP_BRANCH="prototypes"
APP_COMMIT="unknown"
)

target_link_libraries(ld-process-efm PRIVATE Qt::Core lddecode-library)
target_link_libraries(ld-process-efm PRIVATE Qt5::Core)

install(TARGETS ld-process-efm)
9 changes: 9 additions & 0 deletions prototypes/ld-process-efm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ld-process-efm (DEPRECATED)

> [!WARNING]
> DEPRECATED: This single tool has been deprecated and replaced by a suite of specialized tools in `tools/efm-decoder/`. Use `efm-decoder-*` tools for digital audio decoding, and/or other efm-decoder tools for specific use cases.


> [!NOTE]
> This tool has been moved to prototypes rather than being removed from ld-decode completely in case there are any remaining unsolved use-cases with the new tools.
> If you have an issue - make sure you put it in an issue - otherwise this tool will be removed from the repo in the near future.
File renamed without changes.
112 changes: 112 additions & 0 deletions scripts/test-ldf-reader
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
# Test script for ld-ldf-reader
#
# This script tests the ld-ldf-reader tool by:
# 1. Extracting a complete LDF file and verifying the checksum
# 2. Extracting a partial file with offset and verifying the checksum

set -e

# Default values
BUILD_DIR="${BUILD_DIR:-build}"
TESTDATA_DIR="${TESTDATA_DIR:-testdata}"
INPUT_FILE=""
FULL_SHA256=""
PARTIAL_SHA256=""
OFFSET=0
PARTIAL_BYTES=0

# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--build)
BUILD_DIR="$2"
shift 2
;;
--testdata)
TESTDATA_DIR="$2"
shift 2
;;
--input)
INPUT_FILE="$2"
shift 2
;;
--full-sha256)
FULL_SHA256="$2"
shift 2
;;
--partial-sha256)
PARTIAL_SHA256="$2"
shift 2
;;
--offset)
OFFSET="$2"
shift 2
;;
--partial-bytes)
PARTIAL_BYTES="$2"
shift 2
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

# Validate required parameters
if [[ -z "$INPUT_FILE" ]]; then
echo "Error: --input is required"
exit 1
fi

if [[ -z "$FULL_SHA256" ]]; then
echo "Error: --full-sha256 is required"
exit 1
fi

# Construct full paths
LDF_READER="$BUILD_DIR/tools/ld-ldf-reader/ld-ldf-reader"
INPUT_PATH="$TESTDATA_DIR/$INPUT_FILE"

# Check if files exist
if [[ ! -f "$LDF_READER" ]]; then
echo "Error: ld-ldf-reader not found at $LDF_READER"
exit 1
fi

if [[ ! -f "$INPUT_PATH" ]]; then
echo "Error: Test file not found at $INPUT_PATH"
exit 1
fi

echo "Testing ld-ldf-reader with $INPUT_FILE"

# Test 1: Extract full file and verify checksum
echo "Test 1: Extracting full file..."
ACTUAL_FULL_SHA256=$($LDF_READER --quiet "$INPUT_PATH" 2>/dev/null | sha256sum | awk '{print $1}')

if [[ "$ACTUAL_FULL_SHA256" != "$FULL_SHA256" ]]; then
echo "FAIL: Full file checksum mismatch"
echo " Expected: $FULL_SHA256"
echo " Got: $ACTUAL_FULL_SHA256"
exit 1
fi
echo "PASS: Full file checksum matches"

# Test 2: Extract partial file with offset (if parameters provided)
if [[ -n "$PARTIAL_SHA256" && "$PARTIAL_BYTES" -gt 0 ]]; then
echo "Test 2: Extracting partial file with offset $OFFSET samples, $PARTIAL_BYTES bytes..."
ACTUAL_PARTIAL_SHA256=$($LDF_READER --quiet --start-offset "$OFFSET" "$INPUT_PATH" 2>/dev/null | head -c "$PARTIAL_BYTES" | sha256sum | awk '{print $1}')

if [[ "$ACTUAL_PARTIAL_SHA256" != "$PARTIAL_SHA256" ]]; then
echo "FAIL: Partial file checksum mismatch"
echo " Expected: $PARTIAL_SHA256"
echo " Got: $ACTUAL_PARTIAL_SHA256"
exit 1
fi
echo "PASS: Partial file checksum matches"
fi

echo "All tests passed!"
exit 0
3 changes: 2 additions & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ This directory contains the complete suite of tools for processing LaserDisc cap
- **Dependencies**: Most tools require FFmpeg and other multimedia libraries
- **Performance**: Many tools support multi-threading for faster processing

**⚠️ Important**: The SQLite metadata format is **internal to ld-decode tools only** and subject to change without notice. External tools and scripts should **not** access this database directly. Instead, use `ld-export-metadata` or similar tools to export metadata in stable, documented formats.
> [!WARNING]
> The SQLite metadata format is **internal to ld-decode tools only** and subject to change without notice. External tools and scripts should **not** access this database directly. Instead, use `ld-export-metadata` or similar tools to export metadata in stable, documented formats.

## Documentation

Expand Down
1 change: 0 additions & 1 deletion tools/efm-decoder/libs/efm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc

# Add the include directory for the ezpwd library
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/ezpwd/c++)
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/tools/ld-process-efm/)

# Link Qt libraries
target_link_libraries(${TARGET_NAME} Qt::Core)
Expand Down
3 changes: 2 additions & 1 deletion tools/ld-json-converter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

ld-json-converter converts TBC JSON metadata files into a relational SQLite database for easier querying and analysis.

**⚠️ Important**: The SQLite metadata format is **internal to ld-decode tools only** and subject to change without notice. External tools and scripts should **not** access this database directly. Instead, use `ld-export-metadata` or similar tools to export metadata in stable, documented formats.
> [!WARNING]
> The SQLite metadata format is **internal to ld-decode tools only** and subject to change without notice. External tools and scripts should **not** access this database directly. Instead, use `ld-export-metadata` or similar tools to export metadata in stable, documented formats.

## Usage

Expand Down
6 changes: 4 additions & 2 deletions tools/ld-ldf-reader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
)

add_executable(ld-ldf-reader
ld-ldf-reader.c)
ldfreader.cpp
main.cpp
)

target_link_libraries(ld-ldf-reader PkgConfig::FFMPEG)
target_link_libraries(ld-ldf-reader PRIVATE Qt::Core PkgConfig::FFMPEG lddecode-library)

install(TARGETS ld-ldf-reader)
Loading