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

Update FFmpeg to version 7.1 #950

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a8a6f92
libavformat/demux.c: remove errant doxygen comment
ulmus-scott Jun 24, 2024
5fedd4b
Revert "fix non UTF-8 files (external)"
ulmus-scott Jun 24, 2024
d672b5b
libavcodec/v4l2_buffers.c: revert unnecessary change
ulmus-scott Jun 25, 2024
c1a38bc
use ffnvcodec/dynlink_loader.h directly
ulmus-scott Jul 12, 2024
ecc68d8
Revert "ffmpeg: Add required cast to w32dlfcn.h"
ulmus-scott Jul 13, 2024
6f1df71
convert use of internal libavformat/url.h to public libavformat/avio.…
ulmus-scott Jul 13, 2024
674876e
avformatdecoder.h: remove undefined functions
ulmus-scott Jul 13, 2024
68f38dd
convert use of internal libavformat/url.h to public libavformat/avio.…
ulmus-scott Jul 14, 2024
9909343
MythAVFormatBuffer: remove unused functions
ulmus-scott Jul 14, 2024
a4cb2e1
mythlogging.h: add pointerToQString()
ulmus-scott Jul 16, 2024
ca9f8b9
convert use of internal libavformat/url.h to public libavformat/avio.…
ulmus-scott Jul 14, 2024
f7229b3
libavformat.v: remove now unused added exports
ulmus-scott Jul 17, 2024
23da227
libavformat/mpegts-mythtv.c: constify AVInputFormats
ulmus-scott Jun 28, 2024
a8ef2f2
libavformat/mpegts-mythtv.c: remove comment not in upstream
ulmus-scott Jun 28, 2024
b1bf592
mpegts-mythtv.h: remove unused added defines
ulmus-scott Jun 29, 2024
0a450b0
mpegts-mythtv.h: remove unused added STREAM_TYPE_*_DVB defines
ulmus-scott Jun 29, 2024
92eaa46
mpegts-mythtv: update DVB defines
ulmus-scott Jun 30, 2024
d06016d
mpegts-mythtv.h: rename DVB_CAROUSEL_ID
ulmus-scott Jun 30, 2024
13e8d89
mpegts-mythtv.c: MISC_types[]: match space with FFmpeg in addition
ulmus-scott Jun 30, 2024
620a263
mpegts-mythtv: remove dead code for identifying private streams
ulmus-scott Jun 30, 2024
761f1e3
mpegts-mythtv.h: remove unnecessary temporary variable
ulmus-scott Jun 30, 2024
a4146dc
mpegts-mythtv.h: remove dead code from DVB VBI descriptor parsing
ulmus-scott Jun 30, 2024
67d1cf9
mpegts-mythtv.h: remove unused MAX_PES_PAYLOAD
ulmus-scott Jun 30, 2024
218b1f5
mpegts-mythtv.c: remove customization to parsing of subtitling_descri…
ulmus-scott Jul 3, 2024
3df4b45
mpegts-mythtv.c: pat_cb(): ensure all PIDs are valid
ulmus-scott Jul 22, 2024
4935a09
mpegts-mythtv.c: remove customizations MpegTSContext::req_sid, scanni…
ulmus-scott Jul 22, 2024
1f51832
mpegts-mythtv.c: remove fallback code from mpegts_read_header()
ulmus-scott Jul 22, 2024
5fd023b
mpegts-mythtv.c: remove unused addition Program::pid
ulmus-scott Jul 22, 2024
285de4a
mpegts-mythtv.c: replace pmt_equal_streams() with is_pmt_equal()
ulmus-scott Jul 23, 2024
7632571
AvFormatDecoder: ensure audio streams match the video stream
ulmus-scott Aug 2, 2024
77aa927
create AvFormatDecoder::autoSelectVideoTrack from ScanStreams()
ulmus-scott Aug 2, 2024
fc482bb
move pmt_section to AVProgram
ulmus-scott Aug 9, 2024
25d5f20
add avprogram_id to streams_changed() callback
ulmus-scott Aug 10, 2024
403eb6e
mpegts-mythtv.c: remove is_pmt_equal()
ulmus-scott Aug 10, 2024
83f917e
mpegts-mythtv.c: remove customization to add_pes_stream()
ulmus-scott Aug 10, 2024
6716364
cmake/configure: remove references to unsupported crystalhd
ulmus-scott Oct 12, 2024
d271e34
constify AVIOContext::write_packet buf parameter
ulmus-scott Oct 12, 2024
1304aee
constify AVIOContext::write_packet buf parameter (plugins)
ulmus-scott Oct 13, 2024
84c1781
Use AVFrame::best_effort_timestamp
ulmus-scott Oct 12, 2024
976ab94
update FFmpeg to version 7.1
ulmus-scott Oct 12, 2024
f8928e8
add ffmpeg_update_instructions.md
ulmus-scott Oct 15, 2024
807ef79
remove support for LIBAVFORMAT_VERSION_MAJOR < 61 (plugins)
ulmus-scott Oct 15, 2024
6c4c268
remove support for LIBAVFORMAT_VERSION_MAJOR < 61
ulmus-scott Oct 15, 2024
5098f34
fix TestMusicMetadata::test_mp4()
ulmus-scott Oct 13, 2024
383aca2
libmythtv/io/mythavformatwriter.cpp: silence AVCodec deprecation warn…
ulmus-scott Oct 13, 2024
d43d574
replace deprecated av_stream_get_side_data()
ulmus-scott Oct 13, 2024
93a9bc4
replace deprecated av_fft API with av_tx
ulmus-scott Oct 13, 2024
ae38250
replace deprecated AVFrame::interlaced_frame, top_field_first, and ke…
ulmus-scott Oct 13, 2024
7849f30
mytharchivehelper.cpp: replace deprecated AVFrame::key_frame
ulmus-scott Oct 13, 2024
e4e850b
replace deprecated av_fft API with av_tx (mythmusic)
ulmus-scott Oct 13, 2024
dc03e8d
remove DecoderBase::m_getRawFrames and m_getRawVideo
ulmus-scott Oct 13, 2024
8f08f60
remove unused no-op functions from DecoderBase
ulmus-scott Oct 13, 2024
ca0e299
mythaverror: add new functions returning std::string
ulmus-scott Oct 14, 2024
b22e19e
split libmyth/mythavframe.h from libmyth/mythaverror.h
ulmus-scott Oct 14, 2024
7fe6c88
create AvFormatDecoder::do_av_seek()
ulmus-scott Oct 14, 2024
31af3ce
remove unused GetAVTimeBaseQ()
ulmus-scott Oct 14, 2024
552e90b
MythMediaBuffer::WaitForAvail(): simplify return logic
ulmus-scott Oct 15, 2024
6b17b01
make macOS Video Toolbox code compile
ulmus-scott Oct 15, 2024
6705a26
update ffnvcodec to 12.2.72.1 for FFmpeg 7.1
ulmus-scott Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 0 additions & 6 deletions cmake/CheckExternalLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ if(ENABLE_DRM)
endif()
endif()

# Needed to pass right config option to FFmpeg
#
# crystalhd: fedora:libcrystalhd-devel debian:libcrystalhd-dev
find_library(CRYSTALHD crystalhd)
add_build_config(CRYSTALHD "crystalhd")

#
# See if there is a system libbluray for FFmpeg.
#
Expand Down
21 changes: 0 additions & 21 deletions cmake/embeddedlibs/FindOrBuildFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ function(find_or_build_ffmpeg)
${CMAKE_COMMAND} -E env ${_PROGS} PKG_CONFIG_PATH=${PKG_CONFIG_PATH_STR}
${CMAKE_CURRENT_SOURCE_DIR}/mythtv/external/FFmpeg/configure ${FF_ARGS}
"${FF_PLATFORM_ARGS}"
$<IF:$<BOOL:${CRYSTALHD_FOUND}>,--enable-crystalhd,--disable-crystalhd>
$<IF:$<BOOL:${SYSTEM_LIBBLURAY_FOUND}>,--enable-libbluray,--disable-libbluray>
$<IF:$<TARGET_EXISTS:Fontconfig::Fontconfig::LIBXVID>,--enable-libfontconfig,--disable-libfontconfig>
$<IF:$<TARGET_EXISTS:LibX264::LibX264>,--enable-libx264,--disable-libx264>
Expand Down Expand Up @@ -136,26 +135,6 @@ function(find_or_build_ffmpeg)
WORKING_DIRECTORY <BINARY_DIR>
COMMAND ${MAKE_EXECUTABLE} install-pkgconfig)

#
# Install internal headers that are used by MythTV. This must go away if
# MythTV is ever want to use the distribution supplied FFmpeg.
#
set(FFMPEG_INSTALL_INCLUDEDIR ${FFMPEG_INSTALL_PREFIX}/include/mythtv/)
ExternalProject_Add_Step(
FFmpeg expose_internal_headers_hack
DEPENDEES install
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/mythtv/external/FFmpeg
COMMAND ${CMAKE_COMMAND} -E make_directory
${FFMPEG_INSTALL_INCLUDEDIR}/compat/cuda
COMMAND ${CMAKE_COMMAND} -E copy libavformat/url.h
${FFMPEG_INSTALL_INCLUDEDIR}/libavformat/
COMMAND ${CMAKE_COMMAND} -E copy libavutil/wchar_filename.h
${FFMPEG_INSTALL_INCLUDEDIR}/libavutil/
COMMAND ${CMAKE_COMMAND} -E copy compat/w32dlfcn.h
${FFMPEG_INSTALL_INCLUDEDIR}/compat/
COMMAND ${CMAKE_COMMAND} -E copy compat/cuda/dynlink_loader.h
${FFMPEG_INSTALL_INCLUDEDIR}/compat/cuda/)

endfunction()

find_or_build_ffmpeg()
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ArchiveRemoteAVFormatContext
return rf->Read(buf, buf_size);
}

static int WriteFunc(void */*opaque*/, uint8_t */*buf*/, int /*buf_size*/)
static int WriteFunc(void */*opaque*/, const uint8_t */*buf*/, int /*buf_size*/)
{ return -1; }

static int64_t SeekFunc(void *opaque, int64_t offset, int whence)
Expand Down
1 change: 1 addition & 0 deletions mythplugins/mytharchive/mytharchive/thumbfinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern "C" {
#include <QScopedPointer>

// mythtv
#include <libmyth/mythavframe.h>
#include <libmythbase/programtypes.h>
#include <libmythtv/mythavutil.h>
#include <libmythui/mythscreentype.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

// MythTV headers
#include <mythconfig.h>
#include <libmyth/mythavframe.h>
#include <libmyth/mythcontext.h>
#include <libmythbase/exitcodes.h>
#include <libmythbase/mythcommandlineparser.h>
Expand Down Expand Up @@ -1653,7 +1654,7 @@ static int grabThumbnail(const QString& inFile, const QString& thumbList, const
frameFinished = true;
if (ret == 0 || ret == AVERROR(EAGAIN))
avcodec_send_packet(codecCtx, &pkt);
int keyFrame = frame->key_frame;
bool keyFrame = (frame->flags & AV_FRAME_FLAG_KEY) != 0;

while (!frameFinished || !keyFrame)
{
Expand All @@ -1670,7 +1671,7 @@ static int grabThumbnail(const QString& inFile, const QString& thumbList, const
frameFinished = true;
if (ret == 0 || ret == AVERROR(EAGAIN))
avcodec_send_packet(codecCtx, &pkt);
keyFrame = frame->key_frame;
keyFrame = (frame->flags & AV_FRAME_FLAG_KEY) != 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/remoteavformatcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class RemoteAVFormatContext
return ret;
}

static int WriteFunc(void */*opaque*/, uint8_t */*buf*/, int/*buf_size*/)
static int WriteFunc(void */*opaque*/, const uint8_t */*buf*/, int/*buf_size*/)
{ return -1; }

static int64_t SeekFunc(void *opaque, int64_t offset, int whence)
Expand Down
45 changes: 33 additions & 12 deletions mythplugins/mythmusic/mythmusic/visualize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
#include "musicplayer.h"
#include "visualize.h"

extern "C" {
#include <libavutil/mem.h>
#include <libavutil/tx.h>
}

VisFactory* VisFactory::g_pVisFactories = nullptr;

VisualBase::VisualBase(bool screensaverenable)
Expand Down Expand Up @@ -986,10 +991,12 @@ Spectrogram::Spectrogram(bool hist)
m_image->fill(Qt::black);
}

m_dftL = static_cast<FFTSample*>(av_malloc(sizeof(FFTSample) * m_fftlen));
m_dftR = static_cast<FFTSample*>(av_malloc(sizeof(FFTSample) * m_fftlen));
m_dftL = static_cast<float*>(av_malloc(sizeof(float) * m_fftlen));
m_dftR = static_cast<float*>(av_malloc(sizeof(float) * m_fftlen));
m_rdftTmp = static_cast<float*>(av_malloc(sizeof(float) * (m_fftlen + 2)));

m_rdftContext = av_rdft_init(std::log2(m_fftlen), DFT_R2C);
// should probably check that this succeeds
av_tx_init(&m_rdftContext, &m_rdft, AV_TX_FLOAT_RDFT, 0, m_fftlen, &k_txScale, 0x0);

// hack!!! Should 44100 sample rate be queried or measured?
// Likely close enough for most audio recordings...
Expand Down Expand Up @@ -1041,7 +1048,8 @@ Spectrogram::~Spectrogram()
{
av_freep(reinterpret_cast<void*>(&m_dftL));
av_freep(reinterpret_cast<void*>(&m_dftR));
av_rdft_end(m_rdftContext);
av_freep(reinterpret_cast<void*>(&m_rdftTmp));
av_tx_uninit(&m_rdftContext);
}

void Spectrogram::resize(const QSize &newsize)
Expand Down Expand Up @@ -1174,8 +1182,13 @@ bool Spectrogram::processUndisplayed(VisualNode *node)
m_dftR[k] = m_sigR[k] * mult;
}
}
av_rdft_calc(m_rdftContext, m_dftL); // run the real FFT!
av_rdft_calc(m_rdftContext, m_dftR);
// run the real FFT!
m_rdft(m_rdftContext, m_rdftTmp, m_dftL, sizeof(float));
m_rdftTmp[1] = m_rdftTmp[m_fftlen];
memcpy(m_dftL, m_rdftTmp, m_fftlen * sizeof(float));
m_rdft(m_rdftContext, m_rdftTmp, m_dftR, sizeof(float));
m_rdftTmp[1] = m_rdftTmp[m_fftlen];
memcpy(m_dftR, m_rdftTmp, m_fftlen * sizeof(float));

QPainter painter(m_image);
painter.setPen(Qt::black); // clear prior content
Expand Down Expand Up @@ -1390,17 +1403,20 @@ Spectrum::Spectrum()

m_fps = 40; // getting 1152 samples / 44100 = 38.28125 fps

m_dftL = static_cast<FFTSample*>(av_malloc(sizeof(FFTSample) * m_fftlen));
m_dftR = static_cast<FFTSample*>(av_malloc(sizeof(FFTSample) * m_fftlen));
m_dftL = static_cast<float*>(av_malloc(sizeof(float) * m_fftlen));
m_dftR = static_cast<float*>(av_malloc(sizeof(float) * m_fftlen));
m_rdftTmp = static_cast<float*>(av_malloc(sizeof(float) * (m_fftlen + 2)));

m_rdftContext = av_rdft_init(std::log2(m_fftlen), DFT_R2C);
// should probably check that this succeeds
av_tx_init(&m_rdftContext, &m_rdft, AV_TX_FLOAT_RDFT, 0, m_fftlen, &k_txScale, 0x0);
}

Spectrum::~Spectrum()
{
av_freep(reinterpret_cast<void*>(&m_dftL));
av_freep(reinterpret_cast<void*>(&m_dftR));
av_rdft_end(m_rdftContext);
av_freep(reinterpret_cast<void*>(&m_rdftTmp));
av_tx_uninit(&m_rdftContext);
}

void Spectrum::resize(const QSize &newsize)
Expand Down Expand Up @@ -1488,8 +1504,13 @@ bool Spectrum::processUndisplayed(VisualNode *node)
m_dftR[k] = m_sigR[k] * mult;
}
}
av_rdft_calc(m_rdftContext, m_dftL); // run the real FFT!
av_rdft_calc(m_rdftContext, m_dftR);
// run the real FFT!
m_rdft(m_rdftContext, m_rdftTmp, m_dftL, sizeof(float));
m_rdftTmp[1] = m_rdftTmp[m_fftlen];
memcpy(m_dftL, m_rdftTmp, m_fftlen * sizeof(float));
m_rdft(m_rdftContext, m_rdftTmp, m_dftR, sizeof(float));
m_rdftTmp[1] = m_rdftTmp[m_fftlen];
memcpy(m_dftR, m_rdftTmp, m_fftlen * sizeof(float));

long w = 0;
QRect *rectspL = m_rectsL.data();
Expand Down
22 changes: 14 additions & 8 deletions mythplugins/mythmusic/mythmusic/visualize.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

#include <complex>
extern "C" {
#include <libavutil/mem.h>
#include <libavcodec/avfft.h>
#include <libavutil/tx.h>
}

static constexpr uint16_t SAMPLES_DEFAULT_SIZE { 512 };
Expand Down Expand Up @@ -253,9 +252,13 @@ class Spectrogram : public VisualBase
int m_color {0}; // color or grayscale
QVector<float> m_sigL; // decaying signal window
QVector<float> m_sigR;
FFTSample* m_dftL { nullptr }; // real in, complex out
FFTSample* m_dftR { nullptr };
RDFTContext* m_rdftContext { nullptr };
float* m_dftL { nullptr }; // real in, complex out
float* m_dftR { nullptr };
float* m_rdftTmp { nullptr };
static constexpr float k_txScale { 1.0F };
AVTXContext* m_rdftContext { nullptr };
av_tx_fn m_rdft { nullptr };

std::array<int,256*6> m_red {0}; // continuous color spectrum
std::array<int,256*6> m_green {0};
std::array<int,256*6> m_blue {0};
Expand Down Expand Up @@ -299,9 +302,12 @@ class Spectrum : public VisualBase
int m_fftlen {16 * 1024}; // window width
QVector<float> m_sigL; // decaying signal window
QVector<float> m_sigR;
FFTSample* m_dftL { nullptr }; // real in, complex out
FFTSample* m_dftR { nullptr };
RDFTContext* m_rdftContext { nullptr };
float* m_dftL { nullptr }; // real in, complex out
float* m_dftR { nullptr };
float* m_rdftTmp { nullptr };
static constexpr float k_txScale { 1.0F };
AVTXContext* m_rdftContext { nullptr };
av_tx_fn m_rdft { nullptr };
};

class Squares : public Spectrum
Expand Down
2 changes: 1 addition & 1 deletion mythtv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -6761,7 +6761,7 @@ ffmpeg_optset ar nm ranlib
ffmpeg_optenable cross_compile libmp3lame libx264 libx265 libvpx libxvid
ffmpeg_optenable vdpau libxml2 libass dxva2
ffmpeg_optenable libbluray libfontconfig libfreetype libiec61883
ffmpeg_optenable crystalhd sdl2 ffplay
ffmpeg_optenable sdl2 ffplay

if test $target_os = "android"; then
enabled mediacodec && enable jni
Expand Down
97 changes: 0 additions & 97 deletions mythtv/external/FFmpeg-sync-instructions.txt

This file was deleted.

1 change: 0 additions & 1 deletion mythtv/external/FFmpeg/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.pnm -diff -text
tests/ref/fate/sub-scc eol=crlf
13 changes: 8 additions & 5 deletions mythtv/external/FFmpeg/.mailmap
Loading
Loading