Skip to content
Open
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
6 changes: 3 additions & 3 deletions .augment-guidelines
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ OpenConverter/

### File Headers

All source files (doesn't inlcude FFmpeg code) should include Apache 2.0 license header:
All source files should include the Apache 2.0 license header:
```cpp
/*
* Copyright 2025 Jack Lau
Expand All @@ -187,7 +187,7 @@ All source files (doesn't inlcude FFmpeg code) should include Apache 2.0 license
*/
```

**Note**: `src/transcoder/` (use FFmpeg code) should include LGPL 2.1 license (check existing files for header format)
**Note**: Using the FFmpeg API does not make a file a derivative work of FFmpeg, so no file needs an LGPL header — every file uses the Apache 2.0 header above. The *pre-built binaries* are distributed under GPL-3.0 (see [README.md](README.md)), because they link against a GPL-enabled FFmpeg build (libx264/libx265) and the LGPLv3 build of Qt.

### Qt-Specific Guidelines

Expand Down Expand Up @@ -683,7 +683,7 @@ All transcoders implement the same interface, allowing runtime switching.

- Author: Jack Lau
- Email: jacklau1222gm@gmail.com
- License: Apache 2.0 (most files), LGPL 2.1 (transcoder directory)
- License: Apache 2.0 (source code); pre-built binaries are distributed under GPL-3.0

---

Expand Down
54 changes: 54 additions & 0 deletions .github/pre-commit/check_license_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
# Copyright 2026 Jack Lau
# Email: jacklau1222gm@gmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Fail when a source file is missing the project's Apache-2.0 license header.

Used as a pre-commit hook (see .github/pre-commit/config.yaml). Only source
files are checked; documentation and third-party files are out of scope.
"""
import sys
from pathlib import Path

# a file passes when the first lines contain both markers
MARKERS = (
"Copyright 20",
"Licensed under the Apache License, Version 2.0",
)
HEAD_LINES = 25


def has_header(path: Path) -> bool:
try:
lines = path.read_text(encoding="utf-8", errors="ignore").splitlines()
except OSError:
return False
head = "\n".join(lines[:HEAD_LINES])
return all(marker in head for marker in MARKERS)


def main(argv):
missing = [f for f in argv if Path(f).is_file() and not has_header(Path(f))]
if missing:
print("Missing Apache-2.0 license header (see .augment-guidelines):")
for f in missing:
print(f" {f}")
print("\nAdd the header documented in .augment-guidelines to each file above.")
return 1
return 0


if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
7 changes: 7 additions & 0 deletions .github/pre-commit/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ repos:
- --ignore-words=.github/pre-commit/ignored-words.txt
- --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
exclude: ^tools/(patcheck|clean-diff)$
- repo: local
hooks:
- id: check-license-header
name: check Apache-2.0 license header
entry: python3 .github/pre-commit/check_license_header.py
language: system
files: \.(cpp|h|py|sh)$
20 changes: 20 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ jobs:
echo export LD_LIBRARY_PATH="~/.local/share/OpenConverter/Python.framework/lib:./lib" >> src/build/run.sh
echo ./OpenConverter >> src/build/run.sh
cp src/resources/requirements.txt src/build/requirements.txt
# License files: the source is Apache-2.0, the packages are GPL-3.0
# (see THIRD_PARTY_NOTICES.md)
cp LICENSE THIRD_PARTY_NOTICES.md src/build/
rm -rf src/build/licenses
cp -r licenses src/build/licenses
cp -r $BMF_ROOT_PATH src/build/
(mkdir -p src/build/modules/weights &&
cd src/build/modules/weights &&
Expand Down Expand Up @@ -219,6 +224,16 @@ jobs:
# Copy icon file
cp src/resources/openconverter-256.png ll-builder/template_app/icons/hicolor/256x256/apps/

# License files: the source is Apache-2.0, the packages are GPL-3.0
# (see THIRD_PARTY_NOTICES.md). ll-builder copies template_app/* into
# ${PREFIX}/share, so this ends up in share/licenses/.
mkdir -p ll-builder/template_app/licenses
cp LICENSE THIRD_PARTY_NOTICES.md licenses/GPL-3.0.txt ll-builder/template_app/licenses/

# Drop the copy that arrived with the binary artifact so the layer does
# not carry a second set under ${PREFIX}/bin
rm -rf ll-builder/binary/LICENSE ll-builder/binary/THIRD_PARTY_NOTICES.md ll-builder/binary/licenses

- name: Build Linglong package
run: |
cd ll-builder
Expand Down Expand Up @@ -471,6 +486,11 @@ jobs:
}
}

# 7) Bundle license files: the source code is Apache-2.0, the packages
# are distributed as a whole under GPL-3.0 (see THIRD_PARTY_NOTICES.md)
Copy-Item -Path "LICENSE", "THIRD_PARTY_NOTICES.md" -Destination "OpenConverter_win64"
Copy-Item -Path "licenses" -Destination "OpenConverter_win64" -Recurse

# Upload the build artifacts (upload-artifact will automatically zip the folder)
- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Root-level files:
- **FFmpeg error style**: Combine assignment and check: `if ((ret = avcodec_open2(...)) < 0)`
- **FFmpeg cleanup**: Use `goto end` pattern for error-path cleanup
- **Threading**: Long operations in `QThread::create()`; UI updates via `QMetaObject::invokeMethod(Qt::QueuedConnection)`
- **License headers**: Apache 2.0 for most files; LGPL 2.1 for `src/transcoder/`
- **License headers**: Apache 2.0 for all source files, including `src/transcoder/` (using the FFmpeg API does not make a file a derivative work of FFmpeg). Pre-built binaries are distributed under GPL-3.0 due to the GPL-enabled FFmpeg and LGPLv3 Qt linkage
- **File endings**: No trailing whitespace, single newline at EOF (enforced by pre-commit)

## Key Patterns
Expand Down
Loading
Loading