Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

[Feature] - video module #7

Merged
merged 45 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5900d37
add mp4 file
MGTheTrain Apr 18, 2024
5e8c04f
add vcpkg dependencies for video module
MGTheTrain Apr 18, 2024
0bf3b67
implement first draft of video module functions
MGTheTrain Apr 18, 2024
ccce3ee
Formatted cpp project with clang-format
github-actions[bot] Apr 18, 2024
b7b0032
add placeholders for tests to implement
MGTheTrain Apr 18, 2024
8e837a6
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 18, 2024
534c6ae
Formatted cpp project with clang-format
github-actions[bot] Apr 18, 2024
ef0dee9
ignore vcpkg folder
MGTheTrain Apr 18, 2024
a1f6009
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 18, 2024
e4832ae
setup first draft of video player app
MGTheTrain Apr 18, 2024
a6782dc
install missing apt dependency required for ffmpeg builds on some Lin…
MGTheTrain Apr 18, 2024
48d532b
add missing pip package reuqired for libsystemd when installing vcpkg…
MGTheTrain Apr 18, 2024
156ed6a
implement video test
MGTheTrain Apr 18, 2024
ef8d1fd
Formatted cpp project with clang-format
github-actions[bot] Apr 18, 2024
efae7d8
add missing apt dependencies required in combination with sdl2 vcpkg
MGTheTrain Apr 18, 2024
ba9f362
update licensing info
MGTheTrain Apr 18, 2024
050dc2a
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 18, 2024
970a77b
Formatted cpp project with clang-format
github-actions[bot] Apr 18, 2024
39f3474
consider find_package(...) to utilize FFMPEG and SDL2 dependencies
MGTheTrain Apr 18, 2024
b74a606
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 18, 2024
5a15c99
uncomment sub dirs to add
MGTheTrain Apr 18, 2024
1627da1
remove redundant lines and keep CMakeLists.txt simple
MGTheTrain Apr 18, 2024
b14803f
install shared lib targets
MGTheTrain Apr 18, 2024
f729e52
include dependencies and make static variable immutable
MGTheTrain Apr 18, 2024
83becbf
Formatted cpp project with clang-format
github-actions[bot] Apr 18, 2024
4f80c45
add bullet point to prerequisites
MGTheTrain Apr 19, 2024
96eab2a
consider apt and brew dependencies for targeted systems
MGTheTrain Apr 19, 2024
ae55c96
rename file
MGTheTrain Apr 19, 2024
033d918
update CMakeLists.txt for proper build artifact generation
MGTheTrain Apr 19, 2024
e9f8d4a
consider struct over static variables and consider struct as referenc…
MGTheTrain Apr 19, 2024
1fcfc05
Formatted cpp project with clang-format
github-actions[bot] Apr 19, 2024
774191f
add doxygen style comments and set struct members variables in constr…
MGTheTrain Apr 19, 2024
710bd11
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 19, 2024
9fc3d05
Formatted cpp project with clang-format
github-actions[bot] Apr 19, 2024
c7975c2
set attributes properly and add checks
MGTheTrain Apr 19, 2024
85b808b
Merge branch 'feature/video-module' of github.com:MGTheTrain/cpp-samp…
MGTheTrain Apr 19, 2024
1e14121
ignore backup files
MGTheTrain Apr 19, 2024
e382ef7
prevent SDL from defining main
MGTheTrain Apr 20, 2024
332e676
link to correct SDL2 static libs
MGTheTrain Apr 20, 2024
f2f3cf9
increment version and document changes
MGTheTrain Apr 20, 2024
98ca762
remove none-listable apt dependencies
MGTheTrain Apr 20, 2024
0fafb55
remove redundant GH Action workflow step
MGTheTrain Apr 20, 2024
1356810
run jobs in parallel
MGTheTrain Apr 20, 2024
09c02c1
[fix] - relocation R_X86_64_PC32 against symbol ff_pw_9 can not be us…
MGTheTrain Apr 20, 2024
6169d8d
ignore video_test due to Failed to create SDL renderer: Couldnt find …
MGTheTrain Apr 20, 2024
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
3 changes: 2 additions & 1 deletion .devcontainer/dotnet-8.0/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
set -euo pipefail

apt-get update
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev nasm libwayland-dev libxkbcommon-dev libegl1-mesa-dev
#pip3 install clang-format cpplint
pip3 install jinja2

cd /tmp/
# vcpkg
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/go/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
set -euo pipefail

apt-get update
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev nasm libwayland-dev libxkbcommon-dev libegl1-mesa-dev
# pip3 install clang-format cpplint
pip3 install jinja2

cd /tmp/
# vcpkg
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/python/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -euo pipefail

apt-get update
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev
pip3 install clang-format cpplint
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev nasm libwayland-dev libxkbcommon-dev libegl1-mesa-dev
pip3 install clang-format cpplint jinja2

cd /tmp/
# vcpkg
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/rust/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -euo pipefail

apt-get update
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev
pip3 install clang-format cpplint
apt-get install -y cmake python3 python3-pip pkg-config portaudio19-dev nasm libwayland-dev libxkbcommon-dev libegl1-mesa-dev
pip3 install clang-format cpplint jinja2

cd /tmp/
# vcpkg
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake portaudio19-dev libasound2-dev alsa-utils
- name: Check ALSA Mixer Settings
run: alsamixer
build-essential \
cmake portaudio19-dev nasm

- name: Install vcpkg
run: |
git clone https://github.com/Microsoft/vcpkg.git
Expand All @@ -30,7 +30,6 @@ jobs:

build_windows:
runs-on: windows-latest
needs: [build_and_test_ubuntu]
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -53,13 +52,12 @@ jobs:

build_macos:
runs-on: macos-latest
needs: [build_and_test_ubuntu]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install third-party brew dependencies
run: |
brew install pkg-config cmake portaudio
brew install pkg-config cmake portaudio nasm
- name: Install vcpkg
run: |
git clone https://github.com/Microsoft/vcpkg.git
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- name: Install third-party apt dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake portaudio19-dev libasound2-dev alsa-utils
- name: Check ALSA Mixer Settings
run: alsamixer
apt-get install -y \
build-essential \
cmake portaudio19-dev nasm

- name: Install vcpkg
run: |
git clone https://github.com/Microsoft/vcpkg.git
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ __pycache__
obj
bin
Cargo.lock
target
target
vcpkg
*.backup
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.7.0] - 20-04-2024

### Added

- [Feature] C++ video module **(Optional, Experimental)**.

## [0.6.0] - 17-04-2024

### Updated
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ A collection of sample code snippets demonstrating how to create bindings for va

- Download and install [CMake from the official website](https://cmake.org/download/) or trough a package manager
- Install [vcpkg from the official website](https://vcpkg.io/en/getting-started.html) or trough a package manager
- Check dependencies required for your Linux, MacOS or Windows system in [pr.yml workflow](./.github/workflows/pr.yml)

### CMake

Expand Down
2 changes: 1 addition & 1 deletion apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# SOFTWARE.

add_subdirectory(audio-player)
# add_subdirectory(video-player)
add_subdirectory(video-player)
23 changes: 23 additions & 0 deletions apps/video-player/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# The MIT License
#
# Copyright (c) 2024 MGTheTrain
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

if(BUILD_APP)
add_subdirectory(src)
endif()
25 changes: 25 additions & 0 deletions apps/video-player/include/video-player.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// The MIT License
//
// Copyright (c) 2024 MGTheTrain
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifdef VIDEO_PLAYER
#include <video.h>
#endif
49 changes: 49 additions & 0 deletions apps/video-player/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# The MIT License
#
# Copyright (c) 2024 MGTheTrain
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cmake_minimum_required(VERSION 3.10)
set(TARGET video_player)
project(${TARGET})

add_definitions(-DVIDEO_PLAYER)

find_package(FFMPEG REQUIRED)
find_package(SDL2 CONFIG REQUIRED)

include_directories(../include
../../../modules/video/include
${FFMPEG_INCLUDE_DIRS}
)
set(VIDEO_PLAYER_SRC video-player.cpp)

add_executable(${TARGET} ${VIDEO_PLAYER_SRC})
if(WIN32)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../../../assets/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/assets/)
elseif(APPLE OR UNIX)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../../../assets/
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/assets/)
else()
message(WARNING "Unsupported platform")
endif()

target_link_libraries(${TARGET} PRIVATE video ${FFMPEG_LIBRARIES} SDL2::SDL2)

install(TARGETS ${TARGET})
53 changes: 53 additions & 0 deletions apps/video-player/src/video-player.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// The MIT License
//
// Copyright (c) 2024 MGTheTrain
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifdef VIDEO_PLAYER
#include <video-player.h>

int main(int argc, char* argv[]) {
if (argc < 2) {
printf("Usage: %s <video_file>\n", argv[0]);
return -1;
}

const char* videoFileName = argv[1];

VideoPlayer player;

if (!initVideoPlayer(player)) {
std::cerr << "Failed to initialize video player\n";
return -1;
}

if (!loadVideo(player, videoFileName)) {
std::cerr << "Failed to load video: " << videoFileName << "\n";
closeVideoPlayer(player);
return -1;
}

playVideo(player);

closeVideoPlayer(player);

return 0;
}
#endif
Binary file added assets/mp4/file_example_MP4_1280_10MG.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion devops/scripts/bash/compile_source_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ echo -e "$BLUE INFO: $NC Compilation of the source code and linking binaries suc

if [ "$NoTests" = false ]; then
cd "build"
ctest --verbose -E audio_test # ignore audio_test executable in workflows
ctest --verbose -E "video_test|audio_test" # ignore audio_test and video_test executable in workflows
# ctest --verbose
fi
2 changes: 1 addition & 1 deletion modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_subdirectory(core)
add_subdirectory(audio)
# add_subdirectory(video)
add_subdirectory(video)
2 changes: 1 addition & 1 deletion modules/audio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ else()
target_link_libraries(${TARGET} SndFile::sndfile portaudio)
target_link_libraries(${TARGET}_wrapper SndFile::sndfile portaudio)
endif()
install(TARGETS ${TARGET})
install(TARGETS ${TARGET} ${TARGET}_wrapper)
2 changes: 1 addition & 1 deletion modules/core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ set(CORE_SRC
add_library(${TARGET} STATIC ${CORE_SRC})
add_library(${TARGET}_wrapper SHARED ${CORE_SRC}) # required for bindings

install(TARGETS ${TARGET})
install(TARGETS ${TARGET} ${TARGET}_wrapper)
28 changes: 27 additions & 1 deletion modules/video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
TBD
# The MIT License
#
# Copyright (c) 2024 MGTheTrain
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

if(BUILD_LIB)
add_subdirectory(src)
endif()

if(BUILD_TEST)
add_subdirectory(test)
endif()
Empty file removed modules/video/include/.gitignore
Empty file.
Loading
Loading