Skip to content

Commit

Permalink
Merge pull request #29 from HolyWu/libp2p
Browse files Browse the repository at this point in the history
Add libp2p as submodule and update README for compilation
  • Loading branch information
myrsloik authored Feb 21, 2024
2 parents 141c3b9 + e09ba3f commit a059c10
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 22 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -59,10 +61,6 @@ jobs:
popd
rm -rf ffmpeg
- name: Download libp2p
run: |
git clone https://github.com/sekrit-twc/libp2p.git --depth 1
- name: Build
run: |
meson setup build
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
Expand All @@ -27,10 +29,6 @@ jobs:
echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV
echo "PATH=/usr/local/opt/llvm/bin:$PATH" >> $GITHUB_ENV
- name: Download libp2p
run: |
git clone https://github.com/sekrit-twc/libp2p.git --depth 1
- name: Build
run: |
meson setup -Dcpp_link_args=-fuse-ld=lld build
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: msys2/setup-msys2@v2
with:
Expand Down Expand Up @@ -49,10 +51,6 @@ jobs:
popd
rm -rf ffmpeg
- name: Download libp2p
run: |
git clone https://github.com/sekrit-twc/libp2p.git --depth 1
- name: Build
run: |
meson setup -Dlink_static=true build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libp2p"]
path = libp2p
url = https://github.com/sekrit-twc/libp2p.git
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
# BestSource

[![Windows](https://github.com/vapoursynth/bestsource/actions/workflows/windows.yml/badge.svg)](https://github.com/vapoursynth/bestsource/actions/workflows/windows.yml)
[![Linux](https://github.com/vapoursynth/bestsource/actions/workflows/linux.yml/badge.svg)](https://github.com/vapoursynth/bestsource/actions/workflows/linux.yml)
[![macOS](https://github.com/vapoursynth/bestsource/actions/workflows/macos.yml/badge.svg)](https://github.com/vapoursynth/bestsource/actions/workflows/macos.yml)
[![codespell](https://github.com/vapoursynth/bestsource/actions/workflows/codespell.yml/badge.svg)](https://github.com/vapoursynth/bestsource/actions/workflows/codespell.yml)

**BestSource** (abbreviated as **BS**) is a cross-platform wrapper library around [FFmpeg](http://ffmpeg.org)
that ensures sample/frame accurate access to audio and video by always linearly decoding the input files. With a few tricks this can guarantee accurate "seeking" and can be surprisingly... not slow.
that ensures sample/frame accurate access to audio and video by always linearly decoding the input files. With a few tricks this can guarantee accurate "seeking" and can be surprisingly... not slow.

It can be used as either a C++ library directly or through the VapourSynth plugin that's included.

### Compiling
## Dependencies

- FFmpeg 5.1 or later. Only `libavcodec`, `libavformat`, `libavutil` and `libswscale` libraries are required.
- Jansson
- libp2p (already included as submodule)

### Linux and macOS Compilation

Requires `pkg-config`, `meson` and `ninja-build`.

Requires FFmpeg, Jansson and libp2p to compile.
```
git clone https://github.com/vapoursynth/bestsource.git --depth 1 --recurse-submodules --shallow-submodules
cd bestsource
meson setup build
ninja -C build
ninja -C build install
```

### VapourSynth plugin
## VapourSynth plugin

bs.AudioSource(string source[, int track = -1, int adjustdelay = -1, int threads = 0, bint exact = True, bint enable_drefs = False, bint use_absolute_path = False, float drc_scale = 0, string cachepath, int cachesize = 100, bint showprogress = True])
`bs.AudioSource(string source[, int track = -1, int adjustdelay = -1, int threads = 0, bint exact = True, bint enable_drefs = False, bint use_absolute_path = False, float drc_scale = 0, string cachepath, int cachesize = 100, bint showprogress = True])`

bs.VideoSource(string source[, int track = -1, bint variableformat = False, int threads = 0, int seekpreroll = 20, bint exact = True, bint enable_drefs = False, bint use_absolute_path = False, string cachepath, int cachesize = 1000, string hwdevice, bint showprogress = True])
`bs.VideoSource(string source[, int track = -1, bint variableformat = False, int threads = 0, int seekpreroll = 20, bint exact = True, bint enable_drefs = False, bint use_absolute_path = False, string cachepath, int cachesize = 1000, string hwdevice, bint showprogress = True])`

*track*: Either a positive number starting from 0 specifying the absolute track number or a negative number to select the nth audio or video track. Throws an error on wrong type or no matching track.

Expand All @@ -40,12 +56,12 @@ bs.VideoSource(string source[, int track = -1, bint variableformat = False, int

*cachesize*: Maximum internal cache size in MB.

*hwdevice*: The interface to use for hardware decoding. Depends on OS and hardware. On windows `d3d11va` and `cuda` are probably the ones most likely to work. Defaults to CPU decoding. Will throw errors for formats where hardware decoding isn't possible.
*hwdevice*: The interface to use for hardware decoding. Depends on OS and hardware. On windows `d3d11va` and `cuda` are probably the ones most likely to work. `vulkan` decoding for H264, HEVC and AV1 is available since FFmpeg 6.1. Defaults to CPU decoding. Will throw errors for formats where hardware decoding isn't possible.

*showprogress*: Print indexing progress as VapourSynth information level log messages when *exact* frame/sample count is determined.

bs.SetLogLevel(int level)
`bs.SetLogLevel(int level)`

bs.GetLogLevel()
`bs.GetLogLevel()`

Sets the log level of the FFmpeg library. By default quiet. See FFmpeg documentation for allowed constants. Both functions return the current/newly set level. Mostly useful for debugging purposes.
Sets the log level of the FFmpeg library. By default quiet. See FFmpeg documentation for allowed constants. Both functions return the current/newly set level. Mostly useful for debugging purposes.
1 change: 1 addition & 0 deletions libp2p
Submodule libp2p added at 5e6567

0 comments on commit a059c10

Please sign in to comment.