Skip to content

Commit

Permalink
Merge pull request #8 from ChristianFeldmann/addFFmpeg7
Browse files Browse the repository at this point in the history
Add definitions for FFmpeg7
  • Loading branch information
ChristianFeldmann authored Apr 22, 2024
2 parents c8ff788 + da16fc7 commit f069619
Show file tree
Hide file tree
Showing 41 changed files with 451 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
{os: ubuntu-latest, artifactName: ffmpegTestUbuntu, azureFolder: ubuntu-22.04, unzipCommand: unzip },
{os: macos-latest, artifactName: ffmpegTestMacIntel, azureFolder: macos-intel, unzipCommand: unzip },
{os: macos-14, artifactName: ffmpegTestMacM1, azureFolder: macos-m1, unzipCommand: unzip } ]
ffmpegVersions: [2.8.22, 3.4.13, 4.4.4, 5.1.4, 6.1.1]
ffmpegVersions: ["2.8.22", "3.4.13", "4.4.4", "5.1.4", "6.1.1", "7.0"]
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/download-artifact@master
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
if: matrix.config.os != 'windows-latest'

- name: Add ffmpeg to path
run: echo "C:\Program Files\FFmpeg\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
run: echo "C:\ProgramData\chocolatey\lib\ffmpeg-shared\tools\ffmpeg-7.0-full_build-shared\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: matrix.config.os == 'windows-latest'

- name: Download Test files
Expand Down
45 changes: 45 additions & 0 deletions docs/buildScripts/Ubuntu/buildFFmpegVersion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

if [[ $# -ne 5 ]]; then
echo "Illegal number of parameters" >&2
exit 2
fi

if [ ! -d "FFmpeg" ]; then
echo "FFmpeg directory not found. FFmpeg must be checked out here already." >&2
exit 2
fi

echo "Building FFmpeg $1"
echo "With library versions:"
echo " avcodec: $2"
echo " avformat: $3"
echo " avutil: $4"
echo " swresample: $5"

cd FFmpeg
git checkout n$1

echo "Configuring FFmpeg..."
./configure --disable-static --enable-shared --disable-debug --disable-everything --enable-decoder=h264 --enable-demuxer=mov --enable-demuxer=matroska --enable-protocol=file
make clean
make -j 8
git reset --hard

cd ..
mkdir tmpFiles
cd tmpFiles

cp ../FFmpeg/libavcodec/libavcodec.so.$2 .
cp ../FFmpeg/libavformat/libavformat.so.$3 .
cp ../FFmpeg/libavutil/libavutil.so.$4 .
cp ../FFmpeg/libswresample/libswresample.so.$5 .
cp ../FFmpeg/ffmpeg .
cp ../FFmpeg/ffprobe .

zip ffmpeg-$1.zip *
cd ..
mv tmpFiles/ffmpeg-$1.zip .

rm -rf tmpFiles

1 change: 1 addition & 0 deletions docs/buildScripts/Windows/buildAllVersions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

git clone [email protected]:FFmpeg/FFmpeg.git

./buildFFmpegVersion.sh 7.0 61 61 59 5
./buildFFmpegVersion.sh 6.1.1 60 60 58 4
./buildFFmpegVersion.sh 5.1.4 59 59 57 4
./buildFFmpegVersion.sh 4.4.4 58 58 56 3
Expand Down
3 changes: 2 additions & 1 deletion docs/buildScripts/macOS/BuildMacos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
build:
strategy:
matrix:
ffmpeg: [{version: 6.1.1, avcodec: 60, avformat: 60, avutil: 58, swresample: 4},
ffmpeg: [{version: "7.0", avcodec: 61, avformat: 61, avutil: 59, swresample: 5},
{version: 6.1.1, avcodec: 60, avformat: 60, avutil: 58, swresample: 4},
{version: 5.1.4, avcodec: 59, avformat: 59, avutil: 57, swresample: 4},
{version: 4.4.4, avcodec: 58, avformat: 58, avutil: 56, swresample: 3},
{version: 3.4.13, avcodec: 57, avformat: 57, avutil: 55, swresample: 2},
Expand Down
3 changes: 2 additions & 1 deletion src/lib/AVCodec/wrappers/AVCodecContextWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ using ffmpeg::internal::avcodec::AVCodecContext_57;
using ffmpeg::internal::avcodec::AVCodecContext_58;
using ffmpeg::internal::avcodec::AVCodecContext_59;
using ffmpeg::internal::avcodec::AVCodecContext_60;
using ffmpeg::internal::avcodec::AVCodecContext_61;

namespace internal
{
Expand Down Expand Up @@ -75,7 +76,7 @@ AVCodecContextWrapper::~AVCodecContextWrapper()
}

bool AVCodecContextWrapper::openContextForDecoding(
const avformat::AVCodecParametersWrapper &codecParameters)
const avcodec::AVCodecParametersWrapper &codecParameters)
{
const auto decoderCodec =
ffmpegLibraries->avcodec.avcodec_find_decoder(codecParameters.getCodecID());
Expand Down
4 changes: 2 additions & 2 deletions src/lib/AVCodec/wrappers/AVCodecContextWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#pragma once

#include <AVCodec/wrappers/AVCodecParametersWrapper.h>
#include <AVCodec/wrappers/AVPacketWrapper.h>
#include <AVFormat/wrappers/AVCodecParametersWrapper.h>
#include <AVUtil/ColorSpace.h>
#include <AVUtil/MediaType.h>
#include <AVUtil/wrappers/AVFrameWrapper.h>
Expand All @@ -31,7 +31,7 @@ class AVCodecContextWrapper
AVCodecContextWrapper(AVCodecContextWrapper &&wrapper);
~AVCodecContextWrapper();

bool openContextForDecoding(const avformat::AVCodecParametersWrapper &codecParameters);
bool openContextForDecoding(const avcodec::AVCodecParametersWrapper &codecParameters);
bool openContextForDecoding();

ReturnCode sendPacket(const avcodec::AVPacketWrapper &packet);
Expand Down
116 changes: 81 additions & 35 deletions src/lib/AVCodec/wrappers/AVCodecContextWrapperInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ struct AVCodecContext_56
int log_level_offset{};

AVMediaType codec_type{};
const AVCodec * codec{};
const AVCodec *codec{};
char codec_name[32]{};
AVCodecID codec_id{};
unsigned int codec_tag{};
unsigned int stream_codec_tag{};
void * priv_data{};
void *priv_data{};
AVCodecInternal *internal{};
void * opaque{};
void *opaque{};
int bit_rate{};
int bit_rate_tolerance{};
int global_quality{};
int compression_level{};
int flags{};
int flags2{};
uint8_t * extradata{};
uint8_t *extradata{};
int extradata_size{};
AVRational time_base{};
int ticks_per_frame{};
Expand All @@ -42,7 +42,7 @@ struct AVCodecContext_56
AVPixelFormat pix_fmt{};
int me_method{};
void (*draw_horiz_band)(AVCodecContext *s,
const AVFrame * src,
const AVFrame *src,
int offset[AV_NUM_DATA_POINTERS],
int y,
int type,
Expand All @@ -64,7 +64,7 @@ struct AVCodecContext_56
float dark_masking{};
int slice_count{};
int prediction_method{};
int * slice_offset{};
int *slice_offset{};
AVRational sample_aspect_ratio{};
int me_cmp{};
int me_sub_cmp{};
Expand All @@ -83,8 +83,8 @@ struct AVCodecContext_56
int slice_flags{};
int xvmc_acceleration{};
int mb_decision{};
uint16_t * intra_matrix{};
uint16_t * inter_matrix{};
uint16_t *intra_matrix{};
uint16_t *inter_matrix{};
int scenechange_threshold{};
int noise_reduction{};
int me_threshold{};
Expand Down Expand Up @@ -115,24 +115,24 @@ struct AVCodecContext_56

struct AVCodecContext_57
{
const AVClass * av_class{};
const AVClass *av_class{};
int log_level_offset{};
AVMediaType codec_type{};
const AVCodec * codec{};
const AVCodec *codec{};
char codec_name[32]{};
AVCodecID codec_id{};
unsigned int codec_tag{};
unsigned int stream_codec_tag{};
void * priv_data{};
void *priv_data{};
AVCodecInternal *internal{};
void * opaque{};
void *opaque{};
int64_t bit_rate{};
int bit_rate_tolerance{};
int global_quality{};
int compression_level{};
int flags{};
int flags2{};
uint8_t * extradata{};
uint8_t *extradata{};
int extradata_size{};
AVRational time_base{};
int ticks_per_frame{};
Expand All @@ -143,7 +143,7 @@ struct AVCodecContext_57
AVPixelFormat pix_fmt{};
int me_method{};
void (*draw_horiz_band)(AVCodecContext *s,
const AVFrame * src,
const AVFrame *src,
int offset[AV_NUM_DATA_POINTERS],
int y,
int type,
Expand All @@ -165,7 +165,7 @@ struct AVCodecContext_57
float dark_masking{};
int slice_count{};
int prediction_method{};
int * slice_offset{};
int *slice_offset{};
AVRational sample_aspect_ratio{};
int me_cmp{};
int me_sub_cmp{};
Expand All @@ -184,8 +184,8 @@ struct AVCodecContext_57
int slice_flags{};
int xvmc_acceleration{};
int mb_decision{};
uint16_t * intra_matrix{};
uint16_t * inter_matrix{};
uint16_t *intra_matrix{};
uint16_t *inter_matrix{};
int scenechange_threshold{};
int noise_reduction{};
int me_threshold{};
Expand Down Expand Up @@ -216,22 +216,22 @@ struct AVCodecContext_57

struct AVCodecContext_58
{
const AVClass * av_class{};
const AVClass *av_class{};
int log_level_offset{};
AVMediaType codec_type{};
const AVCodec * codec{};
const AVCodec *codec{};
AVCodecID codec_id{};
unsigned int codec_tag{};
void * priv_data{};
void *priv_data{};
AVCodecInternal *internal{};
void * opaque{};
void *opaque{};
int64_t bit_rate{};
int bit_rate_tolerance{};
int global_quality{};
int compression_level{};
int flags{};
int flags2{};
uint8_t * extradata{};
uint8_t *extradata{};
int extradata_size{};
AVRational time_base{};
int ticks_per_frame{};
Expand All @@ -241,7 +241,7 @@ struct AVCodecContext_58
int gop_size{};
AVPixelFormat pix_fmt{};
void (*draw_horiz_band)(AVCodecContext *s,
const AVFrame * src,
const AVFrame *src,
int offset[AV_NUM_DATA_POINTERS],
int y,
int type,
Expand All @@ -262,7 +262,7 @@ struct AVCodecContext_58
float dark_masking{};
int slice_count{};
int prediction_method{};
int * slice_offset{};
int *slice_offset{};
AVRational sample_aspect_ratio{};
int me_cmp{};
int me_sub_cmp{};
Expand All @@ -277,8 +277,8 @@ struct AVCodecContext_58
int me_range{};
int slice_flags{};
int mb_decision{};
uint16_t * intra_matrix{};
uint16_t * inter_matrix{};
uint16_t *intra_matrix{};
uint16_t *inter_matrix{};
int scenechange_threshold{};
int noise_reduction{};
int intra_dc_precision{};
Expand Down Expand Up @@ -306,22 +306,22 @@ struct AVCodecContext_58

struct AVCodecContext_59
{
const AVClass * av_class{};
const AVClass *av_class{};
int log_level_offset{};
AVMediaType codec_type{};
const AVCodec * codec{};
const AVCodec *codec{};
AVCodecID codec_id{};
unsigned int codec_tag{};
void * priv_data{};
void *priv_data{};
AVCodecInternal *internal{};
void * opaque{};
void *opaque{};
int64_t bit_rate{};
int bit_rate_tolerance{};
int global_quality{};
int compression_level{};
int flags{};
int flags2{};
uint8_t * extradata{};
uint8_t *extradata{};
int extradata_size{};
AVRational time_base{};
int ticks_per_frame{};
Expand All @@ -331,7 +331,7 @@ struct AVCodecContext_59
int gop_size{};
AVPixelFormat pix_fmt{};
void (*draw_horiz_band)(AVCodecContext *s,
const AVFrame * src,
const AVFrame *src,
int offset[AV_NUM_DATA_POINTERS],
int y,
int type,
Expand All @@ -349,7 +349,7 @@ struct AVCodecContext_59
float p_masking{};
float dark_masking{};
int slice_count{};
int * slice_offset{};
int *slice_offset{};
AVRational sample_aspect_ratio{};
int me_cmp{};
int me_sub_cmp{};
Expand All @@ -363,8 +363,8 @@ struct AVCodecContext_59
int me_range{};
int slice_flags{};
int mb_decision{};
uint16_t * intra_matrix{};
uint16_t * inter_matrix{};
uint16_t *intra_matrix{};
uint16_t *inter_matrix{};
int intra_dc_precision{};
int skip_top{};
int skip_bottom{};
Expand All @@ -386,4 +386,50 @@ struct AVCodecContext_59

typedef AVCodecContext_59 AVCodecContext_60;

struct AVCodecContext_61
{
const AVClass *av_class{};
int log_level_offset{};
AVMediaType codec_type{};
const AVCodec *codec{};
AVCodecID codec_id{};
unsigned int codec_tag{};
void *priv_data{};
AVCodecInternal *internal{};
void *opaque{};
int64_t bit_rate;
int flags;
int flags2;
uint8_t *extradata;
int extradata_size;
AVRational time_base;
AVRational pkt_timebase;
AVRational framerate;
int ticks_per_frame;
int delay;
int width, height;
int coded_width, coded_height;
AVRational sample_aspect_ratio;
enum AVPixelFormat pix_fmt;
enum AVPixelFormat sw_pix_fmt;
enum AVColorPrimaries color_primaries;
enum AVColorTransferCharacteristic color_trc;
enum AVColorSpace colorspace;
enum AVColorRange color_range;
enum AVChromaLocation chroma_sample_location;
enum AVFieldOrder field_order;
int refs;
int has_b_frames;
int slice_flags;
void (*draw_horiz_band)(struct AVCodecContext *s,
const AVFrame *src,
int offset[AV_NUM_DATA_POINTERS],
int y,
int type,
int height);
enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt);

// Actually, there is more here, but the variables above are the only we need.
};

} // namespace ffmpeg::internal::avcodec
Loading

0 comments on commit f069619

Please sign in to comment.