Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dextinfire committed Dec 14, 2024
1 parent 0951e82 commit f044120
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 219 deletions.
15 changes: 6 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1001,31 +1001,28 @@ if (NOT DEFINED IMPACTO_DISABLE_FFMPEG)
)

if (NOT VCPKG_TOOLCHAIN)
set(AVCPP_PATCH git apply ${CMAKE_CURRENT_SOURCE_DIR}/avcpp.patch)
FetchContent_Declare(
avcpp
GIT_REPOSITORY "https://github.com/h4tr3d/avcpp"
GIT_TAG "v2.4.0"
PATCH_COMMAND ${AVCPP_PATCH}
UPDATE_DISCONNECTED 1
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/avcpp
SYSTEM
EXCLUDE_FROM_ALL
)
include(CMakePrintHelpers)

# Hack to get the header files to match vcpkg's dir structure
set(AVCPP_INCLUDE ${AvCpp_SOURCE_DIR}/inc/avcpp)
FetchContent_MakeAvailable(avcpp)
file(GLOB_RECURSE AVCPP_HEADERS ${AvCpp_SOURCE_DIR}/src/*.h)
file(MAKE_DIRECTORY AVCPP_INCLUDE)
file(COPY ${AVCPP_HEADERS} DESTINATION ${AVCPP_INCLUDE})
include_directories(${AVCPP_INCLUDE}/..)

list(APPEND Impacto_Libs
AvCpp
avcpp
)

list(APPEND Impacto_Libs
${FFMPEG_LIBRARIES}
)
include_directories(${FFMPEG_INCLUDE_DIRS})
include_directories(${AvCpp_SOURCE_DIR}/src)

else ()
find_package(avcpp CONFIG REQUIRED)
Expand Down
37 changes: 37 additions & 0 deletions avcpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 732a4b2..d4a4ee1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)

find_package(FFmpeg
- COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE AVFILTER SWSCALE SWRESAMPLE REQUIRED)
+ COMPONENTS AVCODEC AVFORMAT AVUTIL AVFILTER SWSCALE SWRESAMPLE REQUIRED)

add_subdirectory(src)

diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
index 2746b39..91c9b56 100644
--- a/cmake/FindFFmpeg.cmake
+++ b/cmake/FindFFmpeg.cmake
@@ -166,7 +166,6 @@ if (NOT FFMPEG_LIBRARIES)
# Check for all possible component.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
- find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
diff --git a/src/ffmpeg.h b/src/ffmpeg.h
index 397204f..1bb9d10 100644
--- a/src/ffmpeg.h
+++ b/src/ffmpeg.h
@@ -9,7 +9,6 @@ extern "C"
#include <libavutil/mathematics.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
-#include <libavdevice/avdevice.h>
#include <libswscale/swscale.h>
#include <libswresample/swresample.h>
#include <libavformat/version.h>
190 changes: 0 additions & 190 deletions modules/FindFFMPEG.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions src/audio/openal/ffmpegaudioplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "../audiosystem.h"
#include "al.h"
#include <mutex>
#include <avcpp/audioresampler.h>
#include <avcpp/timestamp.h>
#include <audioresampler.h>
#include <timestamp.h>

extern "C" {
#include <libavutil/avutil.h>
Expand Down
2 changes: 1 addition & 1 deletion src/video/clock.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <chrono>
#include <avcpp/timestamp.h>
#include <timestamp.h>

namespace Impacto::Video {

Expand Down
22 changes: 11 additions & 11 deletions src/video/ffmpegplayer.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "ffmpegplayer.h"

#include <avcpp/av.h>
#include <avcpp/avtime.h>
#include <avcpp/avutils.h>
#include <avcpp/codec.h>
#include <avcpp/dictionary.h>
#include <avcpp/formatcontext.h>
#include <avcpp/codeccontext.h>
#include <avcpp/timestamp.h>

#include <avcpp/packet.h>
#include <avcpp/rational.h>
#include <av.h>
#include <avtime.h>
#include <avutils.h>
#include <codec.h>
#include <dictionary.h>
#include <formatcontext.h>
#include <codeccontext.h>
#include <timestamp.h>

#include <packet.h>
#include <rational.h>

#include <algorithm>
#include <chrono>
Expand Down
4 changes: 2 additions & 2 deletions src/video/ffmpegplayer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <avcpp/formatcontext.h>
#include <avcpp/timestamp.h>
#include <formatcontext.h>
#include <timestamp.h>
#include <libavutil/avutil.h>
#include <chrono>
#include <condition_variable>
Expand Down
8 changes: 4 additions & 4 deletions src/video/ffmpegstream.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <mutex>
#include <avcpp/codeccontext.h>
#include <avcpp/stream.h>
#include <avcpp/frame.h>
#include <avcpp/packet.h>
#include <codeccontext.h>
#include <stream.h>
#include <frame.h>
#include <packet.h>

#include "../impacto.h"
#include "clock.h"
Expand Down

0 comments on commit f044120

Please sign in to comment.