Skip to content

Commit

Permalink
Add documentation of the project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
CrendKing committed Nov 16, 2024
1 parent 706bc8d commit a93e1ad
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 68 deletions.
136 changes: 68 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
name: CI

on:
push:
branches:
- master
- test
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
prepare:
runs-on: windows-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
$matrixItems = New-Object System.Collections.ArrayList
$matrixItems.Add(@{
configuration = 'Debug'
platform = 'x64'
'output-dir' = 'x64'
})
$matrixItems.Add(@{
configuration = 'Debug'
platform = 'x86'
'output-dir' = 'Win32'
})
if ($env:GITHUB_REF -like 'refs/heads/master*') {
$matrixItems.Add(@{
configuration = 'Release'
platform = 'x64'
'output-dir' = 'x64'
})
$matrixItems.Add(@{
configuration = 'Release'
platform = 'x86'
'output-dir' = 'Win32'
})
}
Set-Content -Path $env:GITHUB_OUTPUT -Value "matrix=$(@{ include = $matrixItems } | ConvertTo-Json -Compress)"
build:
name: ${{ matrix.configuration }} ${{ matrix.platform }}
runs-on: windows-latest
needs: prepare
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: pwsh -File build.ps1 -configuration ${{ matrix.configuration }} -platform ${{ matrix.platform }}

- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.configuration }} ${{ matrix.platform }}
path: |
${{ matrix.output-dir }}/${{ matrix.configuration }}/*.ax
${{ matrix.output-dir }}/${{ matrix.configuration }}/*.pdb
if-no-files-found: error
name: CI

on:
push:
branches:
- master
- test
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
prepare:
runs-on: windows-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
$matrixItems = New-Object System.Collections.ArrayList
$matrixItems.Add(@{
configuration = 'Debug'
platform = 'x64'
'output-dir' = 'x64'
})
$matrixItems.Add(@{
configuration = 'Debug'
platform = 'x86'
'output-dir' = 'Win32'
})
if ($env:GITHUB_REF -like 'refs/heads/master*') {
$matrixItems.Add(@{
configuration = 'Release'
platform = 'x64'
'output-dir' = 'x64'
})
$matrixItems.Add(@{
configuration = 'Release'
platform = 'x86'
'output-dir' = 'Win32'
})
}
Set-Content -Path $env:GITHUB_OUTPUT -Value "matrix=$(@{ include = $matrixItems } | ConvertTo-Json -Compress)"
build:
name: ${{ matrix.configuration }} ${{ matrix.platform }}
runs-on: windows-latest
needs: prepare
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: pwsh -File build.ps1 -configuration ${{ matrix.configuration }} -platform ${{ matrix.platform }}

- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.configuration }} ${{ matrix.platform }}
path: |
${{ matrix.output-dir }}/${{ matrix.configuration }}/*.ax
${{ matrix.output-dir }}/${{ matrix.configuration }}/*.pdb
if-no-files-found: error
24 changes: 24 additions & 0 deletions Project Structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The project is roughly divided into 3 pieces: the DirectShow filter for AviSynth (`avisynth_filter`), for VapourSynth (`vapoursynth_filter`) and the common logic sharing between the two (`filter_common`). The base classes of DirectShow are also included in the repository (`baseclasses`).

The frame server specific module, i.e. `avisynth_filter` and `vapoursynth_filter`, contains the logic specific to that server:

* `frameserver.cpp`: Initialization and destruction of the instance of the frame server, as well as script manipulation and frame processing.
* `frame_handler.cpp`: Translation of frames between DirectShow and the frame server, as well as the cache of the frames.
* `format.cpp`: Interpretation and manipulation of video formats specific to the frame server, as well as frame content I/O.

Note that logic of the aspects above that are common between frame servers stays in `filter_common`. For example, there is `frameserver_common.cpp` that supplements `frameserver.cpp`, `frame_handler_common.cpp` supplements `frame_handler.cpp`. `format.h` houses the SIMD functions for copying frame content from one format to another, e.g. from interleaving NV12 to individual Y, U, V planes.

The common module `filter_common` houses the rest of the project. A few notable components are:

* `environment.cpp`: Setting up logging facility. Loading and saving settings in file or registry.
* `filter.cpp`: Main file for setting up the DirectShow filter.
* `main.cpp`: Entry point of the DLL, registering DLL as well as setting up DirectShow pins.
* `prop_settings.cpp`: The "Settings" tab of the filter property window.
* `prop_status.cpp`: The "Status" tab of the filter property window.
* `remote_control.cpp`: Handling the remote control requests, i.e. the APIs. The definitions of the APIs can be found in `api.h`.

The Visual Studio project files (`*.vcxproj`, `*.vcxitems`) are all hand-crafted. They follow the same principle of reusing as much common logic as possible, similar to the project structure.

* `common.props` from the root directory: Contain the common Visual Studio project content. Both .vcxproj must import this file to form valid project file.
* `filter_common.vcxitems` from `filter_common`: Shared items for .vcxproj. Contains the files from `filter_common` and the DirectShow `baseclasses`.
* `avisynth_filter.vcxproj` and `vapoursynth_filter.vcxproj`: Main project files with their specific definitions of preprocessors and build options. Must import the two files above.

0 comments on commit a93e1ad

Please sign in to comment.