Skip to content

Commit

Permalink
👓 Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tristetemps666 committed Aug 5, 2023
1 parent 0b95bed commit bd5a356
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}\build --config Debug --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}\build\Debug\${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Windows_MSVC_Release:
name: Windows MSVC Release
Expand All @@ -45,9 +42,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}\build --config Release --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}\build\Release\${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Windows_Clang_Debug:
name: Windows Clang Debug
Expand All @@ -63,9 +57,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}\build --config Debug --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}\build\Debug\${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Windows_Clang_Release:
name: Windows Clang Release
Expand All @@ -81,9 +72,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}\build --config Release --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}\build\Release\${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Linux_GCC_Debug:
name: Linux GCC Debug
Expand All @@ -104,9 +92,6 @@ jobs:

- name: Build
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Linux_GCC_Release:
Expand All @@ -129,9 +114,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Linux_Clang_Debug:
name: Linux Clang Debug
Expand All @@ -153,9 +135,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
Linux_Clang_Release:
name: Linux Clang Release
Expand All @@ -177,9 +156,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
MacOS_Clang_Debug:
name: MacOS Clang Debug
Expand All @@ -195,9 +171,6 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu

#-----------------------------------------------------------------------------------------------
MacOS_Clang_Release:
name: MacOS Clang Release
Expand All @@ -211,7 +184,4 @@ jobs:
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_WEBCAM_INFO=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=$(brew --prefix llvm@15)/bin/clang -D CMAKE_CXX_COMPILER=$(brew --prefix llvm@15)/bin/clang++

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}}

- name: Run
run: ${{github.workspace}}/build/${{env.TARGET}} -nogpu
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}}
83 changes: 0 additions & 83 deletions .github/workflows/create_release_executables.yml

This file was deleted.

33 changes: 16 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ add_library(webcam_info)
add_library(webcam_info::webcam_info ALIAS webcam_info)
target_compile_features(webcam_info PUBLIC cxx_std_17)

if(WIN32)
target_link_libraries(webcam_info PRIVATE strmiids)
endif()

# ---Add source files---
if(WARNINGS_AS_ERRORS_FOR_WEBCAM_INFO)
target_include_directories(webcam_info PUBLIC include)
Expand All @@ -18,21 +14,8 @@ else()
endif()

file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS src/*.cpp)
file(GLOB_RECURSE SRC_FILES_MACOS CONFIGURE_DEPENDS src/*.mm)
target_sources(webcam_info PRIVATE ${SRC_FILES})

if(APPLE)
target_link_libraries(webcam_info PRIVATE "-framework AVFoundation")
target_link_libraries(webcam_info PRIVATE "-framework CoreMedia")
target_link_libraries(webcam_info PRIVATE "-framework IOKit")

if(NOT XCODE)
target_sources(webcam_info PRIVATE ${SRC_FILES_MACOS})
else()
set_source_files_properties(${SRC_FILES_MACOS} PROPERTIES COMPILE_FLAGS -fobjc-arc)
endif()
endif()

# ---Set warning level---
if(MSVC)
target_compile_options(webcam_info PRIVATE /W4)
Expand All @@ -48,3 +31,19 @@ if(WARNINGS_AS_ERRORS_FOR_WEBCAM_INFO)
target_compile_options(webcam_info PRIVATE -Werror)
endif()
endif()

# ---Platform-specific setup---
if(WIN32)
target_link_libraries(webcam_info PRIVATE strmiids)
elseif(APPLE)
target_link_libraries(webcam_info PRIVATE "-framework AVFoundation")
target_link_libraries(webcam_info PRIVATE "-framework CoreMedia")

# target_link_libraries(webcam_info PRIVATE "-framework IOKit")
file(GLOB_RECURSE SRC_FILES_MACOS CONFIGURE_DEPENDS src/*.mm)
target_sources(webcam_info PRIVATE ${SRC_FILES_MACOS})

if(NOT XCODE)
set_source_files_properties(${SRC_FILES_MACOS} PROPERTIES COMPILE_FLAGS -fobjc-arc)
endif()
endif()
3 changes: 2 additions & 1 deletion Dev Notes.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#### Direct Show VS. Media Foundation (For Windows)
We choose to use Direct Show instead of Media Foundation even if it is deprecated because Media Foundation is not compatible with the use of virtual cameras from OBS.

We chose to use Direct Show instead of Media Foundation even if it is deprecated because Media Foundation is not compatible with the use of virtual cameras from OBS.
11 changes: 6 additions & 5 deletions build/imgui.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Window][MyMainDockSpace]
Pos=0,0
Size=1920,964
Size=1920,1017
Collapsed=0

[Window][Debug##Default]
Expand All @@ -9,15 +9,16 @@ Size=400,400
Collapsed=0

[Window][Dear ImGui Demo]
Pos=766,45
Pos=889,47
Size=550,680
Collapsed=0

[Window][webcam_info tests]
Pos=314,0
Size=1440,964
Pos=0,0
Size=1920,1017
Collapsed=0
DockId=0xF3CABE56,0

[Docking][Data]
DockSpace ID=0xF3CABE56 Window=0x74B75B81 Pos=0,64 Size=1920,964 CentralNode=1
DockSpace ID=0xF3CABE56 Window=0x74B75B81 Pos=0,23 Size=1920,1017 CentralNode=1 Selected=0xFB8B11AA

24 changes: 9 additions & 15 deletions include/webcam_info/webcam_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,20 @@

namespace webcam_info {

enum class pixel_format { unknown,
yuyv,
mjpeg };

auto to_string(webcam_info::pixel_format format) -> std::string;

struct resolution {
int width{1};
int height{1};
auto operator==(const resolution& res) const -> bool
struct Resolution {
int width{1};
int height{1};
friend auto operator==(Resolution const& a, Resolution const& b) -> bool
{
return res.width == width && res.height == height;
return a.width == b.width && a.height == b.height;
};
};
struct info {

struct Info {
std::string name{};
std::vector<resolution> list_resolution{};
pixel_format format{pixel_format::unknown};
std::vector<Resolution> available_resolutions{};
};

auto get_all_webcams() -> std::vector<info>;
auto grab_all_webcams_infos() -> std::vector<Info>;

} // namespace webcam_info
Loading

0 comments on commit bd5a356

Please sign in to comment.