Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FFMPEG] support ffmpeg 7 #2987

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions .github/workflows/build_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,39 @@ jobs:
- name: Build examples, etc
run: cmake --build build --config Release --parallel 2

ubuntu-latest-ffmpeg7:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt update
sudo apt install make yasm

- name: Cache FFmpeg 7
uses: actions/cache@v3
id: cache-ffmpeg7
with:
path: /home/runner/ffmpeg-n7.0.1_installation
key: ffmpeg-n7.0.1_try2

- name: Build FFmpeg 7
if: steps.cache-ffmpeg7.outputs.cache-hit != 'true'
run: |
wget https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n7.0.1.tar.gz
tar -xf n7.0.1.tar.gz
cd FFmpeg-n7.0.1
./configure --prefix=/home/runner/ffmpeg-n7.0.1_installation --disable-doc --disable-programs
make -j4
make install
cd ..

- name: Configure
run: cmake . -B build -DCMAKE_PREFIX_PATH=/home/runner/ffmpeg-n7.0.1_installation
- name: Build ffmpeg example
run: cmake --build build --config Release --target ffmpeg_video_muxing_ex --parallel 4

windows-latest:
runs-on: 'windows-latest'
steps:
Expand Down
6 changes: 5 additions & 1 deletion dlib/media/ffmpeg_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ extern "C" {
#include <memory>
#include "../logger.h"

#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
#define FFMPEG_HAS_CH_LAYOUT 1
#endif

namespace dlib { namespace ffmpeg { namespace details
{

Expand Down Expand Up @@ -156,7 +160,7 @@ namespace dlib { namespace ffmpeg { namespace details
}
}

#if FF_API_OLD_CHANNEL_LAYOUT
#if FFMPEG_HAS_CH_LAYOUT

inline AVChannelLayout convert_layout(const uint64_t channel_layout)
{
Expand Down
2 changes: 1 addition & 1 deletion dlib/media/ffmpeg_muxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ namespace dlib
}
}

#if FF_API_OLD_CHANNEL_LAYOUT
#if FFMPEG_HAS_CH_LAYOUT
if (pCodec->ch_layouts)
{
bool channel_layout_supported = false;
Expand Down
2 changes: 1 addition & 1 deletion dlib/media/ffmpeg_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ namespace dlib
if (std::tie(src_sample_rate, src_channel_layout, src_fmt) !=
std::tie(dst_sample_rate, dst_channel_layout, dst_fmt))
{
#if FF_API_OLD_CHANNEL_LAYOUT
#if LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 5, 100)
AVChannelLayout layout_src = convert_layout(src_channel_layout);
AVChannelLayout layout_dst = convert_layout(dst_channel_layout);

Expand Down
Loading