From a93e1ad0a894896c3a6c57a7c99eaa182f05df04 Mon Sep 17 00:00:00 2001 From: Crend King <975235+CrendKing@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:58:32 -0800 Subject: [PATCH] Add documentation of the project structure --- .github/workflows/ci.yml | 136 +++++++++++++++++++-------------------- Project Structure.md | 24 +++++++ 2 files changed, 92 insertions(+), 68 deletions(-) create mode 100644 Project Structure.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 196b87b..ff454c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Project Structure.md b/Project Structure.md new file mode 100644 index 0000000..a73744d --- /dev/null +++ b/Project Structure.md @@ -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.