Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from RainwayApp/beta
Browse files Browse the repository at this point in the history
feat(0.3.0): Stabilize from `0.3.0-beta.1` to `0.3.0`
  • Loading branch information
bengreenier authored May 31, 2022
2 parents 15a742b + 075af01 commit 486afa5
Show file tree
Hide file tree
Showing 10 changed files with 838 additions and 69 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ on:
pull_request:
branches:
- main
- beta
push:
branches:
- main
- beta

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -25,20 +27,20 @@ jobs:
run: cmake . -B build && cmake --build build --config Debug && cmake --build build --config Release

- name: Parse git commit
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}
run: echo GH_REL_TAG=$(git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/v0-\1/") >> $GITHUB_ENV

# Remotely we create and push the tag
- name: Create Release Tag
run: git tag ${{ env.GH_REL_TAG }} && git push origin ${{ env.GH_REL_TAG }}
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}

# Locally we debug the tag parse
- run: echo ${{ env.GH_REL_TAG }}
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}

- name: Package Public
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}
shell: pwsh
run: |
mkdir rel
Expand All @@ -48,9 +50,10 @@ jobs:
# Remotely we create the release from the tag
- name: GH Release
if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' }}
uses: softprops/[email protected]
with:
tag_name: ${{ env.GH_REL_TAG }}
prerelease: ${{ github.ref != 'refs/heads/main' }}
generate_release_notes: true
files: rel/*.zip
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,27 @@
cmake_minimum_required(VERSION 3.22.0)
project("rainway-sdk-native-examples")

include(FetchContent)

# The version of the Rainway SDK to use
set(RAINWAY_SDK_VERSION "0.3.0")

# The md5 hash of the Rainway SDK zip for this version
# From powershell you can use `Get-FileHash -Algorithm MD5 -Path <path>`
set(RAINWAY_SDK_MD5_HASH "6F80A5F0B5D019518193E84AA8EF53BE")

message("Attempting to download Rainway SDK v${RAINWAY_SDK_VERSION} with md5 hash '${RAINWAY_SDK_MD5_HASH}'")

# Download the sdk
FetchContent_Declare(
rainwaysdk
URL https://sdk-builds.rainway.com/cpp/${RAINWAY_SDK_VERSION}.zip
URL_HASH MD5=${RAINWAY_SDK_MD5_HASH}
)

# Make the SDK available for use
FetchContent_MakeAvailable(rainwaysdk)

# Add our example subdirectories
add_subdirectory("echo-example")
add_subdirectory("host-example")
add_subdirectory("video-player-example")
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ For more information about using Rainway, see [our docs](https://docs.rainway.co

## Getting Started

Get [CMake `>=3.22.0`](https://cmake.org/download/) and [a supported Generator](https://cmake.org/cmake/help/v3.22/manual/cmake-generators.7.html) (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)).

To build all examples:

```
```sh
# Generate the build system for all examples
cmake . -B build

# Run the builds using the generated system
cmake --build build
```

See `README.md` within each example for further instructions.
37 changes: 0 additions & 37 deletions echo-example/README.md

This file was deleted.

22 changes: 1 addition & 21 deletions echo-example/CMakeLists.txt → host-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# You may install cmake from https://cmake.org/download/
cmake_minimum_required(VERSION 3.22.0)
project("echo-example")
include(FetchContent)

# The version of the Rainway SDK to use
set(RAINWAY_SDK_VERSION "0.2.8")

# The md5 hash of the Rainway SDK zip for this version
# From powershell you can use `Get-FileHash -Algorithm MD5 -Path <path>`
set(RAINWAY_SDK_MD5_HASH "F2F9B0A9C7569FE13EB337858CF01C64")

message("Attempting to download Rainway SDK v${RAINWAY_SDK_VERSION} with md5 hash '${RAINWAY_SDK_MD5_HASH}'")

# Download the sdk
FetchContent_Declare(
rainwaysdk
URL https://sdk-builds.rainway.com/cpp/${RAINWAY_SDK_VERSION}.zip
URL_HASH MD5=${RAINWAY_SDK_MD5_HASH}
)

# Make the SDK available for use
FetchContent_MakeAvailable(rainwaysdk)
project("host-example")

# Create an executable target from our source
add_executable(${PROJECT_NAME} src/main.cpp)
Expand Down
20 changes: 20 additions & 0 deletions host-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# host-example

This example demonstrates how to build a simple host application using the Rainway SDK in a C++ application.

It accepts all incoming stream requests from clients (such as the [Web Demo](https://webdemo.rainway.com/)).

For more information about Rainway, see [our docs](https://docs.rainway.com). To sign up, visit [rainway.com](https://rainway.com).

## Building and running this example

See the [parent README](../README.md) for detailed build instructions.

```ps1
cd ..
cmake . -B build
cmake --build build -t host-example
# Get your Rainway API key here: https://hub.rainway.com/keys
.\build\bin\Debug\host-example.exe pk_live_YourRainwayApiKey
```
9 changes: 5 additions & 4 deletions echo-example/src/main.cpp → host-example/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Mirrors rainway::RainwayLogLevel indicies for conversion to string
const char *LOG_LEVEL_STR_MAP[] = {"Silent", "Error", "Warning", "Info", "Debug", "Trace"};

// echo-example entry point
// host-example entry point
// expects your API_KEY as the first and only argument
int main(int argc, char *argv[])
{
Expand All @@ -24,7 +24,7 @@ int main(int argc, char *argv[])
// The Rainway API Key to authentication with
apiKey,
// The Rainway External Id to identify ourselves as
"rainway-sdk-native-echo-example",
"rainway-sdk-native-host-example",
// The min host port to use (zero is default)
0,
// The max host port to use (zero disables limiting the port)
Expand Down Expand Up @@ -62,11 +62,12 @@ int main(int argc, char *argv[])
[](const rainway::Runtime &runtime, const rainway::StreamRequest req)
{
// accept all stream requests, granting full input permissions
req.accept(rainway::RainwayStreamConfig{
req.accept(rainway::StreamConfig{
rainway::RAINWAY_STREAM_TYPE_FULL_DESKTOP,
rainway::RAINWAY_INPUT_LEVEL_ALL,
nullptr, // no input filter
nullptr, // no isolation pids
0, // 0 isolation pids
0, // 0 isolation pids
});
},
// Optional callback for when a stream announcement has been received
Expand Down
34 changes: 34 additions & 0 deletions video-player-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# You may install cmake from https://cmake.org/download/
cmake_minimum_required(VERSION 3.22.0)
project("video-player-example")

# Create an executable target from our source
add_executable(${PROJECT_NAME} src/main.cpp)
add_compile_definitions(NOMINMAX)

# Specify the target uses the c++ linker
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)

# Specify the target binary should output to <build_dir>/bin
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

# Specify the target uses c++17
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

# Link the target against the downloaded rainwaysdk
target_link_libraries(${PROJECT_NAME} rainwaysdk)

# Include the downloaded rainwaysdk include dir (where the header is) for the target
# Note: rainwaysdk_SOURCE_DIR is autocreated by FetchContent_MakeAvailable()
target_include_directories(${PROJECT_NAME} PRIVATE ${rainwaysdk_SOURCE_DIR}/include)

# Include the downloaded rainwaysdk root dir (where the dll and lib are) for the target
# Note: rainwaysdk_SOURCE_DIR is autocreated by FetchContent_MakeAvailable()
target_link_directories(${PROJECT_NAME} PRIVATE ${rainwaysdk_SOURCE_DIR})

# Add a custom command to copy the rainwaysdk dll to the build directory
# If the build directory has a different version (or no dll)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${rainwaysdk_SOURCE_DIR}/rainwaysdk.dll"
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
20 changes: 20 additions & 0 deletions video-player-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# video-player-example

This C++ example uses the Rainway SDK's [BYOFB mode](https://docs.rainway.com/docs/byofb) and [MediaFoundation](https://docs.microsoft.com/en-us/windows/win32/medfound/microsoft-media-foundation-sdk) to stream video from a file.

It accepts all incoming stream requests from clients (such as the [Web Demo](https://webdemo.rainway.com/)), and streams the video to them. Try connecting with multiple clients at once!

For more information about Rainway, see [our docs](https://docs.rainway.com). To sign up, visit [rainway.com](https://rainway.com).

## Building and running this example

See the [parent README](../README.md) for detailed build instructions.

```ps1
cd ..
cmake . -B build
cmake --build build -t video-player-example
# Get your Rainway API key here: https://hub.rainway.com/keys
.\build\bin\Debug\video-player-example.exe pk_live_YourRainwayApiKey C:\path\to\media.mp4
```
Loading

0 comments on commit 486afa5

Please sign in to comment.