Skip to content

Commit da8ebbf

Browse files
committed
Initial FFmpeg 8 support.
1 parent 8ded6b7 commit da8ebbf

File tree

8 files changed

+79
-6
lines changed

8 files changed

+79
-6
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,29 @@ jobs:
3737
fileName: ffmpeg-7.0-full_build-shared.7z
3838
tarBall: false
3939
zipBall: false
40+
- name: Get FFmpeg 8
41+
uses: robinraju/release-downloader@v1
42+
with:
43+
repository: GyanD/codexffmpeg
44+
tag: "8.0"
45+
fileName: ffmpeg-8.0-full_build-shared.7z
46+
tarBall: false
47+
zipBall: false
4048
# A note to myself and other: FFmpeg build is for x64, but it doesn't matter. Only the include files are
4149
# necessary for NAV to work as it will use runtime loading.
4250
- name: Extract FFmpeg
4351
run: |
4452
7z x ffmpeg-5.0-full_build-shared.7z
4553
7z x ffmpeg-6.0-full_build-shared.7z
4654
7z x ffmpeg-7.0-full_build-shared.7z
55+
7z x ffmpeg-8.0-full_build-shared.7z
4756
- name: Configure
4857
run: |
4958
cmake -Bbuild -S. -A ${{ matrix.PLATFORM }} --install-prefix %CD%\install -DBUILD_SHARED_LIBS=1 ^
5059
-DFFMPEG5_DIR=%CD%\ffmpeg-5.0-full_build-shared ^
5160
-DFFMPEG6_DIR=%CD%\ffmpeg-6.0-full_build-shared ^
52-
-DFFMPEG7_DIR=%CD%\ffmpeg-7.0-full_build-shared
61+
-DFFMPEG7_DIR=%CD%\ffmpeg-7.0-full_build-shared ^
62+
-DFFMPEG8_DIR=%CD%\ffmpeg-8.0-full_build-shared
5363
- name: Install
5464
run: cmake --build build --config RelWithDebInfo --target install -j%NUMBER_OF_PROCESSORS%
5565
- name: Artifact
@@ -173,13 +183,36 @@ jobs:
173183
cd build
174184
../configure --disable-doc --disable-encoders --disable-programs --disable-static --enable-shared --disable-x86asm --prefix=$PWD/installdir
175185
make install -j$(nproc)
186+
# FFmpeg 8
187+
- name: Checkout FFmpeg 8
188+
uses: actions/checkout@v4
189+
with:
190+
repository: FFmpeg/FFmpeg
191+
ref: n8.0
192+
path: ffmpeg8
193+
- name: Cache FFmpeg 8
194+
id: ffmpeg8
195+
uses: actions/cache@v4
196+
with:
197+
path: ffmpeg8/build/installdir
198+
key: ffmpeg8
199+
- name: Build FFmpeg 8
200+
if: steps.ffmpeg8.outputs.cache-hit != 'true'
201+
working-directory: ffmpeg8
202+
run: |
203+
set -e
204+
mkdir build
205+
cd build
206+
../configure --disable-doc --disable-encoders --disable-programs --disable-static --enable-shared --disable-x86asm --prefix=$PWD/installdir
207+
make install -j$(nproc)
176208
- name: Configure
177209
run: |
178210
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=RelWithDebInfo --install-prefix $PWD/install -DBUILD_SHARED_LIBS=1 \
179211
-DFFMPEG4_DIR=$PWD/ffmpeg4/build/installdir \
180212
-DFFMPEG5_DIR=$PWD/ffmpeg5/build/installdir \
181213
-DFFMPEG6_DIR=$PWD/ffmpeg6/build/installdir \
182-
-DFFMPEG7_DIR=$PWD/ffmpeg7/build/installdir
214+
-DFFMPEG7_DIR=$PWD/ffmpeg7/build/installdir \
215+
-DFFMPEG8_DIR=$PWD/ffmpeg8/build/installdir
183216
- name: Install
184217
run: cmake --build build --target install -j$(nproc)
185218
- name: Artifact

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ add_library(nav ${NAV_SHARED_VALUE}
6868
src/ffmpeg6/FFmpeg6Backend.hpp
6969
src/ffmpeg7/FFmpeg7Backend.cpp
7070
src/ffmpeg7/FFmpeg7Backend.hpp
71+
src/ffmpeg8/FFmpeg8Backend.cpp
72+
src/ffmpeg8/FFmpeg8Backend.hpp
7173
src/gstreamer/GStreamerBackend.cpp
7274
src/gstreamer/GStreamerBackend.hpp
7375
src/gstreamer/GStreamerPointers.h
@@ -126,15 +128,15 @@ if(MSVC)
126128
endif()
127129

128130
# Find FFmpeg
129-
if(DEFINED FFMPEG4_DIR OR DEFINED FFMPEG5_DIR OR DEFINED FFMPEG6_DIR OR DEFINED FFMPEG7_DIR)
131+
if(DEFINED FFMPEG4_DIR OR DEFINED FFMPEG5_DIR OR DEFINED FFMPEG6_DIR OR DEFINED FFMPEG7_DIR OR DEFINED FFMPEG8_DIR)
130132
# Multi FFmpeg mode
131133
if(DEFINED FFMPEG_DIR)
132134
message(FATAL_ERROR "Cannot combine multi-FFmpeg include directories with single FFmpeg")
133135
endif()
134136

135137
# Ok I trust you
136138
message(STATUS "Multi-FFmpeg mode activates:")
137-
foreach(i RANGE 4 7)
139+
foreach(i RANGE 4 8)
138140
if(FFMPEG${i}_DIR)
139141
set_source_files_properties(
140142
src/ffmpeg${i}/FFmpeg${i}Backend.cpp

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ NAV relies on various backends to perform audio and video decoding.
1717
| [FFmpeg] 5 | 3rd-Party | Windows, Linux, Android | `"ffmpeg5"` | `FFMPEG5` | Requires the appropriate header files to be present.\*\* |
1818
| [FFmpeg] 6 | 3rd-Party | Windows, Linux, Android | `"ffmpeg6"` | `FFMPEG6` | Requires the appropriate header files to be present.\*\* |
1919
| [FFmpeg] 7 | 3rd-Party | Windows, Linux, Android | `"ffmpeg7"` | `FFMPEG7` | Requires the appropriate header files to be present.\*\* |
20+
| [FFmpeg] 8 | 3rd-Party | Windows, Linux, Android | `"ffmpeg8"` | `FFMPEG8` | Requires the appropriate header files to be present.\*\* |
2021
| [GStreamer] | 3rd-Party | Linux | `"gstreamer"` | `GSTREAMER` | Requires the appropriate header files to be present. |
2122
| [MediaFoundation] | OS API | Windows | `"mediafoundation"` | `MEDIAFOUNDATION` | UWP target is not supported. |
2223

src/NAV.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "ffmpeg5/FFmpeg5Backend.hpp"
1313
#include "ffmpeg6/FFmpeg6Backend.hpp"
1414
#include "ffmpeg7/FFmpeg7Backend.hpp"
15+
#include "ffmpeg8/FFmpeg8Backend.hpp"
1516
#include "gstreamer/GStreamerBackend.hpp"
1617
#include "mediafoundation/MediaFoundationBackend.hpp"
1718
#include "Error.hpp"
@@ -150,8 +151,8 @@ static class BackendContainer
150151
std::mutex mutex;
151152
nav_settings defaultSettings;
152153
} backendContainer({
153-
#ifdef NAV_BACKEND_ANDROIDNDK
154-
&nav::androidndk::create,
154+
#ifdef NAV_BACKEND_FFMPEG_8
155+
&nav::ffmpeg8::create,
155156
#endif
156157
#ifdef NAV_BACKEND_FFMPEG_7
157158
&nav::ffmpeg7::create,
@@ -165,6 +166,9 @@ static class BackendContainer
165166
#ifdef NAV_BACKEND_FFMPEG_4
166167
&nav::ffmpeg4::create,
167168
#endif
169+
#ifdef NAV_BACKEND_ANDROIDNDK
170+
&nav::androidndk::create,
171+
#endif
168172
#ifdef NAV_BACKEND_GSTREAMER
169173
&nav::gstreamer::create,
170174
#endif

src/NAVConfig.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ extern "C" {
3434
# include <libswscale/version.h>
3535
}
3636
# if \
37+
(LIBAVCODEC_VERSION_MAJOR == 62 && LIBAVCODEC_VERSION_MINOR >= 11) && \
38+
(LIBAVFORMAT_VERSION_MAJOR == 62 && LIBAVFORMAT_VERSION_MINOR >= 3) && \
39+
(LIBAVUTIL_VERSION_MAJOR == 60 && LIBAVUTIL_VERSION_MINOR >= 8) && \
40+
(LIBSWRESAMPLE_VERSION_MAJOR == 6 && LIBSWRESAMPLE_VERSION_MINOR >= 1) && \
41+
(LIBSWSCALE_VERSION_MAJOR == 9 && LIBSWSCALE_VERSION_MINOR >= 1)
42+
# define NAV_BACKEND_FFMPEG_8
43+
# elif \
3744
(LIBAVCODEC_VERSION_MAJOR == 61 && LIBAVCODEC_VERSION_MINOR >= 3) && \
3845
(LIBAVFORMAT_VERSION_MAJOR == 61 && LIBAVFORMAT_VERSION_MINOR >= 1) && \
3946
(LIBAVUTIL_VERSION_MAJOR == 59 && LIBAVUTIL_VERSION_MINOR >= 8) && \

src/ffmpeg8/FFmpeg8Backend.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "NAVConfig.hpp"
2+
3+
#ifdef NAV_BACKEND_FFMPEG_8
4+
5+
#include "FFmpeg8Backend.hpp"
6+
#include "ffmpeg_common/FFmpegBackend.cpp"
7+
8+
#endif /* NAV_BACKEND_FFMPEG_7 */

src/ffmpeg8/FFmpeg8Backend.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _NAV_BACKEND_FFMPEG_8_
2+
#define _NAV_BACKEND_FFMPEG_8_
3+
4+
#include "NAVConfig.hpp"
5+
6+
#ifdef NAV_BACKEND_FFMPEG_8
7+
8+
#ifdef _NAV_FFMPEG_VERSION
9+
#undef _NAV_FFMPEG_VERSION
10+
#endif
11+
#define _NAV_FFMPEG_VERSION 8
12+
13+
#include "ffmpeg_common/FFmpegBackend.hpp"
14+
#undef _NAV_BACKEND_FFMPEG_
15+
16+
#endif /* NAV_BACKEND_FFMPEG_8 */
17+
#endif /* _NAV_BACKEND_FFMPEG_8_ */

src/multiffmpegconfig.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
#cmakedefine NAV_BACKEND_FFMPEG_5
33
#cmakedefine NAV_BACKEND_FFMPEG_6
44
#cmakedefine NAV_BACKEND_FFMPEG_7
5+
#cmakedefine NAV_BACKEND_FFMPEG_8

0 commit comments

Comments
 (0)