This commit is contained in:
Rmys
2024-11-30 13:09:44 +03:00
parent 9834f04217
commit eff822ea30
10 changed files with 254 additions and 1068 deletions
@@ -1,26 +0,0 @@
commit 94eed33f878e35a8c7b69b0c23b3b30026460f33
Author: hasufell <hasufell@gentoo.org>
Date: Fri Jul 19 18:50:08 2013 +0200
remove stupid uninstall snippet
whoever coded this... it is dangerous
uninstall methods have NO PLACE in install rules
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index c84d944..2b9bf46 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -268,12 +268,6 @@ endif()
# Install Targets (Generic, All Platforms)
-# important to make a clean install each time, else old scripts get loaded.
-install(
- CODE
- "file(REMOVE_RECURSE ${TARGETDIR_VER})"
-)
-
if(WITH_PYTHON)
# install(CODE "message(\"copying blender scripts...\")")
@@ -1,23 +0,0 @@
diff -up blender-2.67b/source/blender/makesrna/intern/rna_access.c.rna blender-2.67b/source/blender/makesrna/intern/rna_access.c
--- blender-2.67b/source/blender/makesrna/intern/rna_access.c.rna 2013-05-16 12:43:18.000000000 +0200
+++ blender-2.67b/source/blender/makesrna/intern/rna_access.c 2013-06-14 16:35:39.263926932 +0200
@@ -1273,13 +1273,15 @@ void RNA_property_enum_items_gettexted(b
int totitem = 0;
/* count */
- for (i = 0; (*item)[i].identifier; i++)
- totitem++;
+ if (*item)
+ for (i = 0; (*item)[i].identifier; i++)
+ totitem++;
nitem = MEM_callocN(sizeof(EnumPropertyItem) * (totitem + 1), "enum_items_gettexted");
- for (i = 0; (*item)[i].identifier; i++)
- nitem[i] = (*item)[i];
+ if (*item)
+ for (i = 0; (*item)[i].identifier; i++)
+ nitem[i] = (*item)[i];
*free = TRUE;
}
@@ -1,31 +0,0 @@
https://developer.blender.org/D13464
From 781c56f054b4c7717739752336427a811f7633eb Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 4 Dec 2021 00:38:59 +0000
Subject: [PATCH] intern/ghost: fix typo in finding XF86VMODE
---
intern/ghost/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 4164231..663598e 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -245,10 +245,10 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
if(WITH_X11_XF86VMODE)
add_definitions(-DWITH_X11_XF86VMODE)
list(APPEND INC_SYS
- ${X11_xf86vmode_INCLUDE_PATH}
+ ${X11_Xxf86vmode_INCLUDE_PATH}
)
list(APPEND LIB
- ${X11_Xf86vmode_LIB}
+ ${X11_Xxf86vmode_LIB}
)
endif()
--
2.34.1
@@ -1,10 +0,0 @@
--- a/source/blender/blenkernel/intern/writeffmpeg.org.c 2021-05-05 15:45:54.647257119 -0700
+++ a/source/blender/blenkernel/intern/writeffmpeg.c 2021-05-05 15:47:57.737338545 -0700
@@ -163,6 +163,7 @@
frame->pts = context->audio_time / av_q2d(c->time_base);
frame->nb_samples = context->audio_input_samples;
frame->format = c->sample_fmt;
+ frame->channels = c->channels;
# ifdef FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT
frame->channel_layout = c->channel_layout;
# endif
@@ -1,190 +0,0 @@
https://src.fedoraproject.org/rpms/blender/blob/rawhide/f/blender-openexr.patch
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -32,30 +32,31 @@
#include <stdexcept>
#include <string>
-#include <Iex.h>
+#include <OpenEXR/Iex.h>
#include <ImathBox.h>
-#include <ImfArray.h>
-#include <ImfChannelList.h>
-#include <ImfCompression.h>
-#include <ImfCompressionAttribute.h>
-#include <ImfIO.h>
-#include <ImfInputFile.h>
-#include <ImfOutputFile.h>
-#include <ImfPixelType.h>
-#include <ImfStandardAttributes.h>
-#include <ImfStringAttribute.h>
-#include <ImfVersion.h>
-#include <half.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfFrameBuffer.h>
+#include <OpenEXR/ImfChannelList.h>
+#include <OpenEXR/ImfCompression.h>
+#include <OpenEXR/ImfCompressionAttribute.h>
+#include <OpenEXR/ImfIO.h>
+#include <OpenEXR/ImfInputFile.h>
+#include <OpenEXR/ImfOutputFile.h>
+#include <OpenEXR/ImfPixelType.h>
+#include <OpenEXR/ImfStandardAttributes.h>
+#include <OpenEXR/ImfStringAttribute.h>
+#include <OpenEXR/ImfVersion.h>
+#include <Imath/half.h>
/* multiview/multipart */
-#include <ImfInputPart.h>
-#include <ImfMultiPartInputFile.h>
-#include <ImfMultiPartOutputFile.h>
-#include <ImfMultiView.h>
-#include <ImfOutputPart.h>
-#include <ImfPartHelper.h>
-#include <ImfPartType.h>
-#include <ImfTiledOutputPart.h>
+#include <OpenEXR/ImfInputPart.h>
+#include <OpenEXR/ImfMultiPartInputFile.h>
+#include <OpenEXR/ImfMultiPartOutputFile.h>
+#include <OpenEXR/ImfMultiView.h>
+#include <OpenEXR/ImfOutputPart.h>
+#include <OpenEXR/ImfPartHelper.h>
+#include <OpenEXR/ImfPartType.h>
+#include <OpenEXR/ImfTiledOutputPart.h>
#include "DNA_scene_types.h" /* For OpenEXR compression constants */
@@ -131,12 +132,12 @@ class IMemStream : public Imf::IStream {
return false;
}
- Int64 tellg() override
+ uint64_t tellg() override
{
return _exrpos;
}
- void seekg(Int64 pos) override
+ void seekg(uint64_t pos) override
{
_exrpos = pos;
}
@@ -146,8 +147,8 @@ class IMemStream : public Imf::IStream {
}
private:
- Int64 _exrpos;
- Int64 _exrsize;
+ uint64_t _exrpos;
+ uint64_t _exrsize;
unsigned char *_exrbuf;
};
@@ -182,12 +183,12 @@ class IFileStream : public Imf::IStream
return check_error();
}
- Int64 tellg() override
+ uint64_t tellg() override
{
return std::streamoff(ifs.tellg());
}
- void seekg(Int64 pos) override
+ void seekg(uint64_t pos) override
{
ifs.seekg(pos);
check_error();
@@ -231,19 +232,19 @@ class OMemStream : public OStream {
ibuf->encodedsize += n;
}
- Int64 tellp() override
+ uint64_t tellp() override
{
return offset;
}
- void seekp(Int64 pos) override
+ void seekp(uint64_t pos) override
{
offset = pos;
ensure_size(offset);
}
private:
- void ensure_size(Int64 size)
+ void ensure_size(uint64_t size)
{
/* if buffer is too small increase it. */
while (size > ibuf->encodedbuffersize) {
@@ -254,7 +255,7 @@ class OMemStream : public OStream {
}
ImBuf *ibuf;
- Int64 offset;
+ uint64_t offset;
};
/* File Output Stream */
@@ -284,12 +285,12 @@ class OFileStream : public OStream {
check_error();
}
- Int64 tellp() override
+ uint64_t tellp() override
{
return std::streamoff(ofs.tellp());
}
- void seekp(Int64 pos) override
+ void seekp(uint64_t pos) override
{
ofs.seekp(pos);
check_error();
--- a/build_files/cmake/Modules/FindOpenEXR.cmake
+++ b/build_files/cmake/Modules/FindOpenEXR.cmake
@@ -25,6 +25,7 @@
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
+
# If OPENEXR_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
@@ -33,6 +34,16 @@ ENDIF()
# Old versions (before 2.0?) do not have any version string, just assuming this should be fine though.
SET(_openexr_libs_ver_init "2.0")
+find_package(Imath CONFIG QUIET)
+if(TARGET Imath::Imath)
+SET(_openexr_FIND_COMPONENTS
+ Imath
+ Iex
+ OpenEXR
+ IlmThread
+)
+
+else()
SET(_openexr_FIND_COMPONENTS
Half
Iex
@@ -40,6 +51,7 @@ SET(_openexr_FIND_COMPONENTS
IlmThread
Imath
)
+endif()
SET(_openexr_SEARCH_DIRS
${OPENEXR_ROOT_DIR}
@@ -121,6 +133,9 @@ IF(OPENEXR_FOUND)
SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
# Both include paths are needed because of dummy OSL headers mixing #include <OpenEXR/foo.h> and #include <foo.h> :(
SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}/OpenEXR)
+ if(TARGET Imath::Imath)
+ list(APPEND OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR}/Imath)
+ endif()
ENDIF()
MARK_AS_ADVANCED(
@@ -0,0 +1,67 @@
From c72dbeafffa5b3262e90023e092bb1f9928d7079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Tue, 14 May 2024 11:03:49 +0200
Subject: [PATCH] Add compatibility with FFMPEG 7.0
key_frame was deprecated then remove, we should use AV_FRAME_FLAG_KEY
instead.
read_seek2 and read_seek were internalized and can't be used anymore, so
we check directly the return of av_seek_frame.
---
intern/ffmpeg/ffmpeg_compat.h | 9 +++++++++
source/blender/imbuf/intern/anim_movie.cc | 11 +++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 91ea1701db6..78778482e8d 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -141,6 +141,15 @@ int64_t av_get_frame_duration_in_pts_units(const AVFrame *picture)
#endif
}
+FFMPEG_INLINE
+bool av_get_cur_key_frame_pts(const AVFrame *picture) {
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 29, 100)
+ return (picture->flags & AV_FRAME_FLAG_KEY);
+#else
+ return (picture->key_frame);
+#endif
+}
+
/* -------------------------------------------------------------------- */
/** \name Deinterlace code block
*
diff --git a/source/blender/imbuf/intern/anim_movie.cc b/source/blender/imbuf/intern/anim_movie.cc
index 3d51969dd46..bb07a8bb14c 100644
--- a/source/blender/imbuf/intern/anim_movie.cc
+++ b/source/blender/imbuf/intern/anim_movie.cc
@@ -653,7 +653,7 @@ static void ffmpeg_decode_store_frame_pts(ImBufAnim *anim)
{
anim->cur_pts = av_get_pts_from_frame(anim->pFrame);
- if (anim->pFrame->key_frame) {
+ if (av_get_cur_key_frame_pts(anim->pFrame)) {
anim->cur_key_frame_pts = anim->cur_pts;
}
@@ -1032,11 +1032,10 @@ static int ffmpeg_seek_to_key_frame(ImBufAnim *anim,
AVFormatContext *format_ctx = anim->pFormatCtx;
- if (format_ctx->iformat->read_seek2 || format_ctx->iformat->read_seek) {
- ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD);
- }
- else {
- ret = ffmpeg_generic_seek_workaround(anim, &seek_pos, pts_to_search);
+ int ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, AVSEEK_FLAG_BACKWARD);
+
+ if (ret < 0) {
+ ret = ffmpeg_generic_seek_workaround(anim, &seek_pos, pts_to_search);\
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
"Adjusted final seek seek_pos = %" PRId64 "\n",
--
2.30.2
@@ -0,0 +1,184 @@
From fc8955ebbbb5d0afde2722b836dec8b4e07f2232 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Sat, 18 May 2024 22:08:34 +0200
Subject: [PATCH] Add compatibility with FFmpeg 7.0 within audaspace plugin
We backport changes specific to FFmpeg 7.0 in audaspace, behind
HAVE_CH_LAYOUT, ensuring compatibility with previous versions.
---
.../audaspace/plugins/ffmpeg/FFMPEGReader.cpp | 27 +++++++++--
.../audaspace/plugins/ffmpeg/FFMPEGWriter.cpp | 46 +++++++++++++++++++
2 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
index c0e16d6a887..3257daab442 100644
--- a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
+++ b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
@@ -31,6 +31,10 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE
#endif
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
+#define HAVE_CH_LAYOUT
+#endif
+
SampleFormat FFMPEGReader::convertSampleFormat(AVSampleFormat format)
{
switch(av_get_packed_sample_fmt(format))
@@ -104,15 +108,22 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
packet.size = orig_size;
#else
avcodec_send_packet(m_codecCtx, &packet);
+
while(true)
{
auto ret = avcodec_receive_frame(m_codecCtx, m_frame);
+#ifdef HAVE_CH_LAYOUT
+ int nb_channels = m_codecCtx->ch_layout.nb_channels;
+#else
+ int nb_channels = m_codecCtx->channels;
+#endif
+
if(ret != 0)
break;
- int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
+ int data_size = av_samples_get_buffer_size(nullptr, nb_channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
if(buf_size - buf_pos < data_size)
{
@@ -122,12 +133,12 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
if(m_tointerleave)
{
- int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
- for(int channel = 0; channel < m_codecCtx->channels; channel++)
+ int single_size = data_size / nb_channels / m_frame->nb_samples;
+ for(int channel = 0; channel < nb_channels; channel++)
{
for(int i = 0; i < m_frame->nb_samples; i++)
{
- std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
+ std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((nb_channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size);
}
}
@@ -207,7 +218,11 @@ void FFMPEGReader::init(int stream)
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
+#ifdef HAVE_CH_LAYOUT
+ m_specs.channels = (Channels) m_codecCtx->ch_layout.nb_channels;
+#else
m_specs.channels = (Channels) m_codecCtx->channels;
+#endif
m_tointerleave = av_sample_fmt_is_planar(m_codecCtx->sample_fmt);
switch(av_get_packed_sample_fmt(m_codecCtx->sample_fmt))
@@ -344,8 +359,12 @@ std::vector<StreamInfo> FFMPEGReader::queryStreams()
info.specs.channels = Channels(m_formatCtx->streams[i]->codec->channels);
info.specs.rate = m_formatCtx->streams[i]->codec->sample_rate;
info.specs.format = convertSampleFormat(m_formatCtx->streams[i]->codec->sample_fmt);
+#else
+#ifdef HAVE_CH_LAYOUT
+ info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->ch_layout.nb_channels);
#else
info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->channels);
+#endif
info.specs.rate = m_formatCtx->streams[i]->codecpar->sample_rate;
info.specs.format = convertSampleFormat(AVSampleFormat(m_formatCtx->streams[i]->codecpar->format));
#endif
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp b/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
index 9cadfe9c092..2f435c14b56 100644
--- a/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
+++ b/extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
@@ -34,6 +34,10 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE
#endif
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
+#define HAVE_CH_LAYOUT
+#endif
+
void FFMPEGWriter::encode()
{
sample_t* data = m_input_buffer.getBuffer();
@@ -77,8 +81,12 @@ void FFMPEGWriter::encode()
m_frame->nb_samples = m_input_samples;
m_frame->format = m_codecCtx->sample_fmt;
+#ifdef HAVE_CH_LAYOUT
+ av_channel_layout_copy(&m_frame->ch_layout, &m_codecCtx->ch_layout);
+#else
m_frame->channel_layout = m_codecCtx->channel_layout;
m_frame->channels = m_specs.channels;
+#endif
if(avcodec_fill_audio_frame(m_frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
@@ -237,6 +245,39 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
break;
}
+#ifdef HAVE_CH_LAYOUT
+ AVChannelLayout channel_layout{};
+
+ switch(m_specs.channels)
+ {
+ case CHANNELS_MONO:
+ channel_layout = AV_CHANNEL_LAYOUT_MONO;
+ break;
+ case CHANNELS_STEREO:
+ channel_layout = AV_CHANNEL_LAYOUT_STEREO;
+ break;
+ case CHANNELS_STEREO_LFE:
+ channel_layout = AV_CHANNEL_LAYOUT_2POINT1;
+ break;
+ case CHANNELS_SURROUND4:
+ channel_layout = AV_CHANNEL_LAYOUT_QUAD;
+ break;
+ case CHANNELS_SURROUND5:
+ channel_layout = AV_CHANNEL_LAYOUT_5POINT0_BACK;
+ break;
+ case CHANNELS_SURROUND51:
+ channel_layout = AV_CHANNEL_LAYOUT_5POINT1_BACK;
+ break;
+ case CHANNELS_SURROUND61:
+ channel_layout = AV_CHANNEL_LAYOUT_6POINT1_BACK;
+ break;
+ case CHANNELS_SURROUND71:
+ channel_layout = AV_CHANNEL_LAYOUT_7POINT1;
+ break;
+ default:
+ AUD_THROW(FileException, "File couldn't be written, channel layout not supported.");
+ }
+#else
uint64_t channel_layout = 0;
switch(m_specs.channels)
@@ -268,6 +309,7 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
default:
AUD_THROW(FileException, "File couldn't be written, channel layout not supported.");
}
+#endif
try
{
@@ -405,8 +447,12 @@ FFMPEGWriter::FFMPEGWriter(const std::string &filename, DeviceSpecs specs, Conta
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
m_codecCtx->bit_rate = bitrate;
+#ifdef HAVE_CH_LAYOUT
+ av_channel_layout_copy(&m_codecCtx->ch_layout, &channel_layout);
+#else
m_codecCtx->channel_layout = channel_layout;
m_codecCtx->channels = m_specs.channels;
+#endif
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
--
2.30.2
@@ -1,673 +0,0 @@
diff -ur blender-2.76/CMakeLists.txt blender-2.76.ffmpeg/CMakeLists.txt
--- blender-2.76/CMakeLists.txt 2015-10-12 00:58:22.000000000 +0200
+++ blender-2.76.ffmpeg/CMakeLists.txt 2016-04-16 15:31:11.524037254 +0200
@@ -982,7 +982,7 @@
if(WITH_CODEC_FFMPEG)
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
- set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
+ set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale avfilter CACHE STRING "FFMPEG Libraries")
mark_as_advanced(FFMPEG)
diff -ur blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp blender-2.76.ffmpeg/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
--- blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp 2015-10-07 02:09:33.000000000 +0200
+++ blender-2.76.ffmpeg/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp 2016-04-16 15:31:11.524037254 +0200
@@ -58,9 +58,9 @@
got_frame = 0;
if(!frame)
- frame = avcodec_alloc_frame();
+ frame = av_frame_alloc();
else
- avcodec_get_frame_defaults(frame);
+ av_frame_unref(frame);
read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
if(read_length < 0)
diff -ur blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp blender-2.76.ffmpeg/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
--- blender-2.76/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp 2015-10-07 02:09:33.000000000 +0200
+++ blender-2.76.ffmpeg/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp 2016-04-16 15:31:11.524037254 +0200
@@ -202,7 +202,7 @@
m_frame = av_frame_alloc();
if (!m_frame)
AUD_THROW(AUD_ERROR_FFMPEG, codec_error);
- avcodec_get_frame_defaults(m_frame);
+ av_frame_unref(m_frame);
m_frame->linesize[0] = m_input_size * samplesize;
m_frame->format = m_codecCtx->sample_fmt;
m_frame->nb_samples = m_input_size;
diff -ur blender-2.76/source/blender/blenkernel/intern/writeffmpeg.c blender-2.76.ffmpeg/source/blender/blenkernel/intern/writeffmpeg.c
--- blender-2.76/source/blender/blenkernel/intern/writeffmpeg.c 2015-10-12 00:58:22.000000000 +0200
+++ blender-2.76.ffmpeg/source/blender/blenkernel/intern/writeffmpeg.c 2016-04-16 15:31:11.527370628 +0200
@@ -138,8 +138,8 @@
context->audio_time += (double) context->audio_input_samples / (double) c->sample_rate;
#ifdef FFMPEG_HAVE_ENCODE_AUDIO2
- frame = avcodec_alloc_frame();
- avcodec_get_frame_defaults(frame);
+ frame = av_frame_alloc();
+ av_frame_unref(frame);
frame->pts = context->audio_time / av_q2d(c->time_base);
frame->nb_samples = context->audio_input_samples;
frame->format = c->sample_fmt;
@@ -172,7 +172,7 @@
}
if (!got_output) {
- avcodec_free_frame(&frame);
+ av_frame_free(&frame);
return 0;
}
#else
@@ -202,7 +202,7 @@
if (av_interleaved_write_frame(context->outfile, &pkt) != 0) {
fprintf(stderr, "Error writing audio packet!\n");
if (frame)
- avcodec_free_frame(&frame);
+ av_frame_free(&frame);
return -1;
}
@@ -210,7 +210,7 @@
}
if (frame)
- avcodec_free_frame(&frame);
+ av_frame_free(&frame);
return 0;
}
@@ -224,7 +224,7 @@
int size;
/* allocate space for the struct */
- f = avcodec_alloc_frame();
+ f = av_frame_alloc();
if (!f) return NULL;
size = avpicture_get_size(pix_fmt, width, height);
/* allocate the actual picture buffer */
@@ -363,8 +363,8 @@
int height = c->height;
AVFrame *rgb_frame;
- if (c->pix_fmt != PIX_FMT_BGR32) {
- rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height);
+ if (c->pix_fmt != AV_PIX_FMT_BGR32) {
+ rgb_frame = alloc_picture(AV_PIX_FMT_BGR32, width, height);
if (!rgb_frame) {
BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame");
return NULL;
@@ -414,14 +414,14 @@
}
}
- if (c->pix_fmt != PIX_FMT_BGR32) {
+ if (c->pix_fmt != AV_PIX_FMT_BGR32) {
sws_scale(context->img_convert_ctx, (const uint8_t *const *) rgb_frame->data,
rgb_frame->linesize, 0, c->height,
context->current_frame->data, context->current_frame->linesize);
delete_picture(rgb_frame);
}
- context->current_frame->format = PIX_FMT_BGR32;
+ context->current_frame->format = AV_PIX_FMT_BGR32;
context->current_frame->width = width;
context->current_frame->height = height;
@@ -586,12 +586,12 @@
}
else {
/* makes HuffYUV happy ... */
- c->pix_fmt = PIX_FMT_YUV422P;
+ c->pix_fmt = AV_PIX_FMT_YUV422P;
}
if (context->ffmpeg_type == FFMPEG_XVID) {
/* arghhhh ... */
- c->pix_fmt = PIX_FMT_YUV420P;
+ c->pix_fmt = AV_PIX_FMT_YUV420P;
c->codec_tag = (('D' << 24) + ('I' << 16) + ('V' << 8) + 'X');
}
@@ -604,26 +604,26 @@
/* Keep lossless encodes in the RGB domain. */
if (codec_id == AV_CODEC_ID_HUFFYUV) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
- c->pix_fmt = PIX_FMT_BGRA;
+ c->pix_fmt = AV_PIX_FMT_BGRA;
}
else {
- c->pix_fmt = PIX_FMT_RGB32;
+ c->pix_fmt = AV_PIX_FMT_RGB32;
}
}
if (codec_id == AV_CODEC_ID_FFV1) {
- c->pix_fmt = PIX_FMT_RGB32;
+ c->pix_fmt = AV_PIX_FMT_RGB32;
}
if (codec_id == AV_CODEC_ID_QTRLE) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
- c->pix_fmt = PIX_FMT_ARGB;
+ c->pix_fmt = AV_PIX_FMT_ARGB;
}
}
if (codec_id == AV_CODEC_ID_PNG) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
- c->pix_fmt = PIX_FMT_RGBA;
+ c->pix_fmt = AV_PIX_FMT_RGBA;
}
}
@@ -661,7 +661,7 @@
context->current_frame = alloc_picture(c->pix_fmt, c->width, c->height);
- context->img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
+ context->img_convert_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
NULL, NULL, NULL);
return st;
}
diff -ur blender-2.76/source/blender/imbuf/intern/anim_movie.c blender-2.76.ffmpeg/source/blender/imbuf/intern/anim_movie.c
--- blender-2.76/source/blender/imbuf/intern/anim_movie.c 2015-10-07 02:09:33.000000000 +0200
+++ blender-2.76.ffmpeg/source/blender/imbuf/intern/anim_movie.c 2016-04-16 15:31:11.527370628 +0200
@@ -474,6 +474,10 @@
const int *inv_table;
#endif
+ anim->last_width = -1;
+ anim->last_height = -1;
+ anim->last_pixfmt = AV_PIX_FMT_NONE;
+
if (anim == NULL) return(-1);
streamcount = anim->streamindex;
@@ -562,21 +566,21 @@
anim->next_pts = -1;
anim->next_packet.stream_index = -1;
- anim->pFrame = avcodec_alloc_frame();
+ anim->pFrame = av_frame_alloc();
anim->pFrameComplete = false;
- anim->pFrameDeinterlaced = avcodec_alloc_frame();
- anim->pFrameRGB = avcodec_alloc_frame();
+ anim->pFrameDeinterlaced = av_frame_alloc();
+ anim->pFrameRGB = av_frame_alloc();
- if (avpicture_get_size(PIX_FMT_RGBA, anim->x, anim->y) !=
+ if (avpicture_get_size(AV_PIX_FMT_RGBA, anim->x, anim->y) !=
anim->x * anim->y * 4)
{
fprintf(stderr,
"ffmpeg has changed alloc scheme ... ARGHHH!\n");
avcodec_close(anim->pCodecCtx);
avformat_close_input(&anim->pFormatCtx);
- av_free(anim->pFrameRGB);
- av_free(anim->pFrameDeinterlaced);
- av_free(anim->pFrame);
+ av_frame_free(&anim->pFrameRGB);
+ av_frame_free(&anim->pFrameDeinterlaced);
+ av_frame_free(&anim->pFrame);
anim->pCodecCtx = NULL;
return -1;
}
@@ -606,7 +610,7 @@
anim->pCodecCtx->pix_fmt,
anim->x,
anim->y,
- PIX_FMT_RGBA,
+ AV_PIX_FMT_RGBA,
SWS_FAST_BILINEAR | SWS_PRINT_INFO | SWS_FULL_CHR_H_INT,
NULL, NULL, NULL);
@@ -615,9 +619,9 @@
"Can't transform color space??? Bailing out...\n");
avcodec_close(anim->pCodecCtx);
avformat_close_input(&anim->pFormatCtx);
- av_free(anim->pFrameRGB);
- av_free(anim->pFrameDeinterlaced);
- av_free(anim->pFrame);
+ av_frame_free(&anim->pFrameRGB);
+ av_frame_free(&anim->pFrameDeinterlaced);
+ av_frame_free(&anim->pFrame);
anim->pCodecCtx = NULL;
return -1;
}
@@ -644,6 +648,74 @@
return (0);
}
+static void delete_filter_graph(struct anim *anim) {
+ if (anim->filter_graph) {
+ av_frame_free(&anim->filter_frame);
+ avfilter_graph_free(&anim->filter_graph);
+ }
+}
+
+static int init_filter_graph(struct anim *anim, enum AVPixelFormat pixfmt, int width, int height) {
+ AVFilterInOut *inputs = NULL, *outputs = NULL;
+ char args[512];
+ int res;
+
+ delete_filter_graph(anim);
+ anim->filter_graph = avfilter_graph_alloc();
+ snprintf(args, sizeof(args),
+ "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
+ "[in]yadif[out];"
+ "[out]buffersink",
+ width, height, pixfmt);
+ res = avfilter_graph_parse2(anim->filter_graph, args, &inputs, &outputs);
+ if (res < 0)
+ return res;
+ if(inputs || outputs)
+ return -1;
+ res = avfilter_graph_config(anim->filter_graph, NULL);
+ if (res < 0)
+ return res;
+
+ anim->buffersrc_ctx = avfilter_graph_get_filter(anim->filter_graph, "Parsed_buffer_0");
+ anim->buffersink_ctx = avfilter_graph_get_filter(anim->filter_graph, "Parsed_buffersink_2");
+ if (!anim->buffersrc_ctx || !anim->buffersink_ctx)
+ return -1;
+ anim->filter_frame = av_frame_alloc();
+ anim->last_width = width;
+ anim->last_height = height;
+ anim->last_pixfmt = pixfmt;
+
+ return 0;
+}
+
+static int process_filter_graph(struct anim *anim, AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pixfmt, int width, int height) {
+ int res;
+
+ if (!anim->filter_graph || width != anim->last_width ||
+ height != anim->last_height || pixfmt != anim->last_pixfmt) {
+ res = init_filter_graph(anim, pixfmt, width, height);
+ if (res < 0)
+ return res;
+ }
+
+ memcpy(anim->filter_frame->data, src->data, sizeof(src->data));
+ memcpy(anim->filter_frame->linesize, src->linesize, sizeof(src->linesize));
+ anim->filter_frame->width = width;
+ anim->filter_frame->height = height;
+ anim->filter_frame->format = pixfmt;
+ res = av_buffersrc_add_frame(anim->buffersrc_ctx, anim->filter_frame);
+ if (res < 0)
+ return res;
+ res = av_buffersink_get_frame(anim->buffersink_ctx, anim->filter_frame);
+ if (res < 0)
+ return res;
+ av_picture_copy(dst, (const AVPicture *) anim->filter_frame, pixfmt, width, height);
+ av_frame_unref(anim->filter_frame);
+
+ return 0;
+}
+
/* postprocess the image in anim->pFrame and do color conversion
* and deinterlacing stuff.
*
@@ -677,7 +749,8 @@
if (anim->ib_flags & IB_animdeinterlace) {
- if (avpicture_deinterlace(
+ if (process_filter_graph(
+ anim,
(AVPicture *)
anim->pFrameDeinterlaced,
(const AVPicture *)
@@ -695,7 +768,7 @@
avpicture_fill((AVPicture *) anim->pFrameRGB,
(unsigned char *) ibuf->rect,
- PIX_FMT_RGBA, anim->x, anim->y);
+ AV_PIX_FMT_RGBA, anim->x, anim->y);
if (ENDIAN_ORDER == B_ENDIAN) {
int *dstStride = anim->pFrameRGB->linesize;
@@ -1138,16 +1211,18 @@
{
if (anim == NULL) return;
+ delete_filter_graph(anim);
+
if (anim->pCodecCtx) {
avcodec_close(anim->pCodecCtx);
avformat_close_input(&anim->pFormatCtx);
- av_free(anim->pFrameRGB);
- av_free(anim->pFrame);
+ av_frame_free(&anim->pFrameRGB);
+ av_frame_free(&anim->pFrame);
if (anim->ib_flags & IB_animdeinterlace) {
MEM_freeN(anim->pFrameDeinterlaced->data[0]);
}
- av_free(anim->pFrameDeinterlaced);
+ av_frame_free(&anim->pFrameDeinterlaced);
sws_freeContext(anim->img_convert_ctx);
IMB_freeImBuf(anim->last_frame);
if (anim->next_packet.stream_index != -1) {
diff -ur blender-2.76/source/blender/imbuf/intern/IMB_anim.h blender-2.76.ffmpeg/source/blender/imbuf/intern/IMB_anim.h
--- blender-2.76/source/blender/imbuf/intern/IMB_anim.h 2015-10-07 02:09:33.000000000 +0200
+++ blender-2.76.ffmpeg/source/blender/imbuf/intern/IMB_anim.h 2016-04-16 15:31:11.527370628 +0200
@@ -76,6 +76,9 @@
# include <libavformat/avformat.h>
# include <libavcodec/avcodec.h>
# include <libswscale/swscale.h>
+# include <libavfilter/avfilter.h>
+# include <libavfilter/buffersrc.h>
+# include <libavfilter/buffersink.h>
#endif
#ifdef WITH_REDCODE
@@ -175,6 +178,14 @@
int64_t last_pts;
int64_t next_pts;
AVPacket next_packet;
+
+ AVFilterContext *buffersink_ctx;
+ AVFilterContext *buffersrc_ctx;
+ AVFilterGraph *filter_graph;
+ AVFrame *filter_frame;
+ int last_width;
+ int last_height;
+ enum AVPixelFormat last_pixfmt;
#endif
#ifdef WITH_REDCODE
diff -ur blender-2.76/source/blender/imbuf/intern/indexer.c blender-2.76.ffmpeg/source/blender/imbuf/intern/indexer.c
--- blender-2.76/source/blender/imbuf/intern/indexer.c 2015-10-07 02:09:33.000000000 +0200
+++ blender-2.76.ffmpeg/source/blender/imbuf/intern/indexer.c 2016-04-16 15:31:11.527370628 +0200
@@ -519,7 +519,7 @@
rv->c->pix_fmt = rv->codec->pix_fmts[0];
}
else {
- rv->c->pix_fmt = PIX_FMT_YUVJ420P;
+ rv->c->pix_fmt = AV_PIX_FMT_YUVJ420P;
}
rv->c->sample_aspect_ratio =
@@ -554,7 +554,7 @@
if (st->codec->width != width || st->codec->height != height ||
st->codec->pix_fmt != rv->c->pix_fmt)
{
- rv->frame = avcodec_alloc_frame();
+ rv->frame = av_frame_alloc();
avpicture_fill((AVPicture *) rv->frame,
MEM_mallocN(avpicture_get_size(
rv->c->pix_fmt,
@@ -675,7 +675,7 @@
sws_freeContext(ctx->sws_ctx);
MEM_freeN(ctx->frame->data[0]);
- av_free(ctx->frame);
+ av_frame_free(&ctx->frame);
}
get_proxy_filename(ctx->anim, ctx->proxy_size,
@@ -905,7 +905,7 @@
memset(&next_packet, 0, sizeof(AVPacket));
- in_frame = avcodec_alloc_frame();
+ in_frame = av_frame_alloc();
stream_size = avio_size(context->iFormatCtx->pb);
@@ -973,7 +973,7 @@
} while (frame_finished);
}
- av_free(in_frame);
+ av_frame_free(&in_frame);
return 1;
}
diff -ur blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.cpp blender-2.76.ffmpeg/source/gameengine/VideoTexture/VideoFFmpeg.cpp
--- blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.cpp 2015-10-12 00:58:22.000000000 +0200
+++ blender-2.76.ffmpeg/source/gameengine/VideoTexture/VideoFFmpeg.cpp 2016-04-16 15:31:11.527370628 +0200
@@ -79,11 +79,16 @@
BLI_listbase_clear(&m_frameCacheBase);
BLI_listbase_clear(&m_packetCacheFree);
BLI_listbase_clear(&m_packetCacheBase);
+ last_width = -1;
+ last_height = -1;
+ last_pixfmt = AV_PIX_FMT_NONE;
+
}
// destructor
VideoFFmpeg::~VideoFFmpeg ()
{
+ delete_filter_graph(this);
}
void VideoFFmpeg::refresh(void)
@@ -140,23 +145,23 @@
AVFrame *VideoFFmpeg::allocFrameRGB()
{
AVFrame *frame;
- frame = avcodec_alloc_frame();
+ frame = av_frame_alloc();
if (m_format == RGBA32)
{
avpicture_fill((AVPicture*)frame,
(uint8_t*)MEM_callocN(avpicture_get_size(
- PIX_FMT_RGBA,
+ AV_PIX_FMT_RGBA,
m_codecCtx->width, m_codecCtx->height),
"ffmpeg rgba"),
- PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
+ AV_PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
} else
{
avpicture_fill((AVPicture*)frame,
(uint8_t*)MEM_callocN(avpicture_get_size(
- PIX_FMT_RGB24,
+ AV_PIX_FMT_RGB24,
m_codecCtx->width, m_codecCtx->height),
"ffmpeg rgb"),
- PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
+ AV_PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
}
return frame;
}
@@ -236,8 +241,8 @@
m_codecCtx = codecCtx;
m_formatCtx = formatCtx;
m_videoStream = videoStream;
- m_frame = avcodec_alloc_frame();
- m_frameDeinterlaced = avcodec_alloc_frame();
+ m_frame = av_frame_alloc();
+ m_frameDeinterlaced = av_frame_alloc();
// allocate buffer if deinterlacing is required
avpicture_fill((AVPicture*)m_frameDeinterlaced,
@@ -248,10 +253,10 @@
m_codecCtx->pix_fmt, m_codecCtx->width, m_codecCtx->height);
// check if the pixel format supports Alpha
- if (m_codecCtx->pix_fmt == PIX_FMT_RGB32 ||
- m_codecCtx->pix_fmt == PIX_FMT_BGR32 ||
- m_codecCtx->pix_fmt == PIX_FMT_RGB32_1 ||
- m_codecCtx->pix_fmt == PIX_FMT_BGR32_1)
+ if (m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32 ||
+ m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32 ||
+ m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32_1 ||
+ m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32_1)
{
// allocate buffer to store final decoded frame
m_format = RGBA32;
@@ -262,7 +267,7 @@
m_codecCtx->pix_fmt,
m_codecCtx->width,
m_codecCtx->height,
- PIX_FMT_RGBA,
+ AV_PIX_FMT_RGBA,
SWS_FAST_BILINEAR,
NULL, NULL, NULL);
} else
@@ -276,7 +281,7 @@
m_codecCtx->pix_fmt,
m_codecCtx->width,
m_codecCtx->height,
- PIX_FMT_RGB24,
+ AV_PIX_FMT_RGB24,
SWS_FAST_BILINEAR,
NULL, NULL, NULL);
}
@@ -293,13 +298,81 @@
av_free(m_frameDeinterlaced);
m_frameDeinterlaced = NULL;
MEM_freeN(m_frameRGB->data[0]);
- av_free(m_frameRGB);
+ av_frame_free(&m_frameRGB);
m_frameRGB = NULL;
return -1;
}
return 0;
}
+void VideoFFmpeg::delete_filter_graph(VideoFFmpeg* video) {
+ if (video->filter_graph) {
+ av_frame_free(&video->filter_frame);
+ avfilter_graph_free(&video->filter_graph);
+ }
+}
+
+int VideoFFmpeg::init_filter_graph(VideoFFmpeg* video, enum AVPixelFormat pixfmt, int width, int height) {
+ AVFilterInOut *inputs = NULL, *outputs = NULL;
+ char args[512];
+ int res;
+
+ delete_filter_graph(video);
+ video->filter_graph = avfilter_graph_alloc();
+ snprintf(args, sizeof(args),
+ "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
+ "[in]yadif[out];"
+ "[out]buffersink",
+ width, height, pixfmt);
+ res = avfilter_graph_parse2(video->filter_graph, args, &inputs, &outputs);
+ if (res < 0)
+ return res;
+ if(inputs || outputs)
+ return -1;
+ res = avfilter_graph_config(video->filter_graph, NULL);
+ if (res < 0)
+ return res;
+
+ video->buffersrc_ctx = avfilter_graph_get_filter(video->filter_graph, "Parsed_buffer_0");
+ video->buffersink_ctx = avfilter_graph_get_filter(video->filter_graph, "Parsed_buffersink_2");
+ if (!video->buffersrc_ctx || !video->buffersink_ctx)
+ return -1;
+ video->filter_frame = av_frame_alloc();
+ video->last_width = width;
+ video->last_height = height;
+ video->last_pixfmt = pixfmt;
+
+ return 0;
+}
+
+int VideoFFmpeg::process_filter_graph(VideoFFmpeg* video, AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pixfmt, int width, int height) {
+ int res;
+
+ if (!video->filter_graph || width != video->last_width ||
+ height != video->last_height || pixfmt != video->last_pixfmt) {
+ res = init_filter_graph(video, pixfmt, width, height);
+ if (res < 0)
+ return res;
+ }
+
+ memcpy(video->filter_frame->data, src->data, sizeof(src->data));
+ memcpy(video->filter_frame->linesize, src->linesize, sizeof(src->linesize));
+ video->filter_frame->width = width;
+ video->filter_frame->height = height;
+ video->filter_frame->format = pixfmt;
+ res = av_buffersrc_add_frame(video->buffersrc_ctx, video->filter_frame);
+ if (res < 0)
+ return res;
+ res = av_buffersink_get_frame(video->buffersink_ctx, video->filter_frame);
+ if (res < 0)
+ return res;
+ av_picture_copy(dst, (const AVPicture *) video->filter_frame, pixfmt, width, height);
+ av_frame_unref(video->filter_frame);
+
+ return 0;
+}
+
/*
* This thread is used to load video frame asynchronously.
* It provides a frame caching service.
@@ -392,7 +465,7 @@
{
if (video->m_deinterlace)
{
- if (avpicture_deinterlace(
+ if (process_filter_graph(video,
(AVPicture*) video->m_frameDeinterlaced,
(const AVPicture*) video->m_frame,
video->m_codecCtx->pix_fmt,
@@ -486,14 +559,14 @@
{
BLI_remlink(&m_frameCacheBase, frame);
MEM_freeN(frame->frame->data[0]);
- av_free(frame->frame);
+ av_frame_free(&frame->frame);
delete frame;
}
while ((frame = (CacheFrame *)m_frameCacheFree.first) != NULL)
{
BLI_remlink(&m_frameCacheFree, frame);
MEM_freeN(frame->frame->data[0]);
- av_free(frame->frame);
+ av_frame_free(&frame->frame);
delete frame;
}
while ((packet = (CachePacket *)m_packetCacheBase.first) != NULL)
@@ -1057,7 +1130,7 @@
if (m_deinterlace)
{
- if (avpicture_deinterlace(
+ if (process_filter_graph(this,
(AVPicture*) m_frameDeinterlaced,
(const AVPicture*) m_frame,
m_codecCtx->pix_fmt,
diff -ur blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.h blender-2.76.ffmpeg/source/gameengine/VideoTexture/VideoFFmpeg.h
--- blender-2.76/source/gameengine/VideoTexture/VideoFFmpeg.h 2015-10-10 10:20:56.000000000 +0200
+++ blender-2.76.ffmpeg/source/gameengine/VideoTexture/VideoFFmpeg.h 2016-04-16 15:31:11.527370628 +0200
@@ -39,6 +39,9 @@
extern "C" {
#include <pthread.h>
#include "ffmpeg_compat.h"
+#include <libavfilter/avfilter.h>
+#include <libavfilter/buffersrc.h>
+#include <libavfilter/buffersink.h>
#include "DNA_listBase.h"
#include "BLI_threads.h"
#include "BLI_blenlib.h"
@@ -207,6 +210,18 @@
AVFrame *allocFrameRGB();
static void *cacheThread(void *);
+
+ AVFilterContext *buffersink_ctx;
+ AVFilterContext *buffersrc_ctx;
+ AVFilterGraph *filter_graph;
+ AVFrame *filter_frame;
+ int last_width;
+ int last_height;
+ enum AVPixelFormat last_pixfmt;
+
+ static void delete_filter_graph(VideoFFmpeg* video);
+ static int init_filter_graph(VideoFFmpeg* video, enum AVPixelFormat pixfmt, int width, int height);
+ static int process_filter_graph(VideoFFmpeg* video, AVPicture *dst, const AVPicture *src, enum AVPixelFormat pixfmt, int width, int height);
};
inline VideoFFmpeg *getFFmpeg(PyImage *self)
@@ -1,113 +0,0 @@
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index e9eea195208..84aea330313 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -264,9 +264,9 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(boost::shared_ptr<AUD_Buffer> buffer) :
m_membuffer(buffer),
m_membufferpos(0)
{
- m_membuf = reinterpret_cast<data_t*>(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE));
+ m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
- m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this,
+ m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this,
read_packet, NULL, seek_packet);
if(!m_aviocontext)
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
index 3f95ac7a4da..2c2f0916406 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
@@ -163,7 +163,7 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
try
{
if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
- m_codecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
AVCodec* codec = avcodec_find_encoder(m_codecCtx->codec_id);
if(!codec)
@@ -185,11 +185,11 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
if(avcodec_open2(m_codecCtx, codec, NULL))
AUD_THROW(AUD_ERROR_FFMPEG, codec_error);
- m_output_buffer.resize(FF_MIN_BUFFER_SIZE);
+ m_output_buffer.resize(AV_INPUT_BUFFER_MIN_SIZE);
int samplesize = AUD_MAX(AUD_SAMPLE_SIZE(m_specs), AUD_DEVICE_SAMPLE_SIZE(m_specs));
if(m_codecCtx->frame_size <= 1) {
- m_input_size = FF_MIN_BUFFER_SIZE * 8 / m_codecCtx->bits_per_coded_sample / m_codecCtx->channels;
+ m_input_size = AV_INPUT_BUFFER_MIN_SIZE * 8 / m_codecCtx->bits_per_coded_sample / m_codecCtx->channels;
m_input_buffer.resize(m_input_size * samplesize);
}
else
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index d7fcd896e11..9e82df17dce 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -619,8 +619,6 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
c->rc_buffer_aggressivity = 1.0;
#endif
- c->me_method = ME_EPZS;
-
codec = avcodec_find_encoder(c->codec_id);
if (!codec)
return NULL;
@@ -682,14 +680,14 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
)
{
PRINT("Using global header\n");
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
/* Determine whether we are encoding interlaced material or not */
if (rd->mode & R_FIELDS) {
PRINT("Encoding interlaced video\n");
- c->flags |= CODEC_FLAG_INTERLACED_DCT;
- c->flags |= CODEC_FLAG_INTERLACED_ME;
+ c->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
+ c->flags |= AV_CODEC_FLAG_INTERLACED_ME;
}
/* xasp & yasp got float lately... */
@@ -779,7 +777,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int
}
if (of->oformat->flags & AVFMT_GLOBALHEADER) {
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
set_ffmpeg_properties(rd, c, "audio", &opts);
@@ -798,14 +796,14 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int
st->codec->time_base.den = st->codec->sample_rate;
#ifndef FFMPEG_HAVE_ENCODE_AUDIO2
- context->audio_outbuf_size = FF_MIN_BUFFER_SIZE;
+ context->audio_outbuf_size = AV_INPUT_BUFFER_MIN_SIZE;
#endif
if (c->frame_size == 0)
// used to be if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
// not sure if that is needed anymore, so let's try out if there are any
// complaints regarding some ffmpeg versions users might have
- context->audio_input_samples = FF_MIN_BUFFER_SIZE * 8 / c->bits_per_coded_sample / c->channels;
+ context->audio_input_samples = AV_INPUT_BUFFER_MIN_SIZE * 8 / c->bits_per_coded_sample / c->channels;
else {
context->audio_input_samples = c->frame_size;
#ifndef FFMPEG_HAVE_ENCODE_AUDIO2
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index eaf4dfd84b4..9c2f42feb52 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -537,7 +537,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
av_opt_set_int(rv->c, "qmax", ffmpeg_quality, 0);
if (rv->of->flags & AVFMT_GLOBALHEADER) {
- rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ rv->c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
if (avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE) < 0) {
+3 -2
View File
@@ -66,10 +66,11 @@
<Dependency>brotli-devel</Dependency>
<Dependency>openpgl-devel</Dependency>
<Dependency>shaderc-devel</Dependency>
<Dependency>wayland-protocols-devel</Dependency>
</BuildDependencies>
<Patches>
<!-- <Patch level="1">blender-openexr.patch</Patch> -->
<!-- <Patch level="1">blender-3.0.0-intern-ghost-fix-typo-in-finding-XF86VMODE.patch</Patch> -->
<Patch level="1">ffmpeg-7-1.patch</Patch>
<Patch level="1">ffmpeg-7-2.patch</Patch>
</Patches>
</Source>