Update to ffmpeg-5.0.1.

This commit is contained in:
Jonas 'Sortie' Termansen 2022-07-09 23:34:37 +02:00
parent 68a444c85e
commit 5aecdea33d
4 changed files with 48 additions and 55 deletions

View File

@ -16,7 +16,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
--shlibdir=DIR install shared libs in DIR [LIBDIR]
--incdir=DIR install includes in DIR [PREFIX/include]
--mandir=DIR install man page in DIR [PREFIX/share/man]
@@ -770,7 +772,9 @@
@@ -780,7 +782,9 @@
set_default(){
for opt; do
@ -27,7 +27,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
done
}
@@ -2444,6 +2448,8 @@
@@ -2528,6 +2532,8 @@
"
PATHS_LIST="
@ -36,7 +36,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
bindir
datadir
docdir
@@ -2462,6 +2468,7 @@
@@ -2546,6 +2552,7 @@
arch
as
assert_level
@ -44,7 +44,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
build_suffix
cc
objcc
@@ -2474,6 +2481,7 @@
@@ -2558,6 +2565,7 @@
env
extra_version
gas
@ -52,7 +52,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
host_cc
host_cflags
host_extralibs
@@ -2500,6 +2508,7 @@
@@ -2586,6 +2594,7 @@
sws_max_filter_size
sysinclude
sysroot
@ -60,7 +60,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
target_exec
target_os
target_path
@@ -3714,11 +3723,12 @@
@@ -3836,11 +3845,12 @@
# installation paths
prefix_default="/usr/local"
@ -75,7 +75,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
mandir_default='${prefix}/share/man'
# toolchain
@@ -4075,8 +4085,10 @@
@@ -4200,8 +4210,10 @@
optname="${opt%%=*}"
optname="${optname#--}"
optname=$(echo "$optname" | sed 's/-/_/g')
@ -86,7 +86,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
elif is_in $optname $CMDLINE_APPEND; then
append $optname "$optval"
else
@@ -4279,6 +4291,16 @@
@@ -4404,6 +4416,16 @@
;;
esac
@ -103,7 +103,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
if test -n "$cross_prefix"; then
test -n "$arch" && test -n "$target_os" ||
die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
@@ -5541,6 +5563,9 @@
@@ -5702,6 +5724,9 @@
;;
minix)
;;
@ -113,7 +113,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
none)
;;
*)
@@ -7214,6 +7239,7 @@
@@ -7457,6 +7482,7 @@
if test "$quiet" != "yes"; then
echo "install prefix $prefix"
@ -121,7 +121,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
echo "source path $source_path"
echo "C compiler $cc"
echo "C library $libc_type"
@@ -7367,6 +7393,7 @@
@@ -7614,6 +7640,7 @@
FFMPEG_CONFIG_MAK=1
FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
prefix=$prefix
@ -129,7 +129,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/configure ffmpeg/configure
LIBDIR=\$(DESTDIR)$libdir
SHLIBDIR=\$(DESTDIR)$shlibdir
INCDIR=\$(DESTDIR)$incdir
@@ -7628,6 +7655,7 @@
@@ -7883,6 +7910,7 @@
shared=$shared
build_suffix=$build_suffix
prefix=$prefix
@ -152,7 +152,7 @@ diff -Paur --no-dereference -- ffmpeg.upstream/ffbuild/pkgconfig_generate.sh ffm
diff -Paur --no-dereference -- ffmpeg.upstream/fftools/Makefile ffmpeg/fftools/Makefile
--- ffmpeg.upstream/fftools/Makefile
+++ ffmpeg/fftools/Makefile
@@ -30,6 +30,8 @@
@@ -25,6 +25,8 @@
all: $(AVPROGS)
@ -170,8 +170,8 @@ diff -Paur --no-dereference -- ffmpeg.upstream/libavformat/codec2.c ffmpeg/libav
-#include <memory.h>
#include "libavcodec/codec2utils.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avio_internal.h"
diff -Paur --no-dereference -- ffmpeg.upstream/libavformat/udp.c ffmpeg/libavformat/udp.c
--- ffmpeg.upstream/libavformat/udp.c
+++ ffmpeg/libavformat/udp.c
@ -185,13 +185,15 @@ diff -Paur --no-dereference -- ffmpeg.upstream/libavformat/udp.c ffmpeg/libavfor
if (addr->sa_family != AF_INET) {
#if HAVE_STRUCT_GROUP_SOURCE_REQ && defined(MCAST_BLOCK_SOURCE)
/* For IPv4 prefer the old approach, as that alone works reliably on
@@ -791,8 +793,10 @@
@@ -796,10 +798,12 @@
if (dscp >= 0) {
dscp <<= 2;
+#ifdef IP_TOS
if (setsockopt (udp_fd, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != 0)
if (setsockopt (udp_fd, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != 0) {
ret = ff_neterrno();
goto fail;
}
+#endif
}

View File

@ -1,12 +1,13 @@
NAME=ffmpeg
BUILD_LIBRARIES='libavcodec libGL? libSDL? libSDL2?'
VERSION=4.3.1
VERSION=5.0.1
DISTNAME=$NAME-$VERSION
COMPRESSION=tar.xz
ARCHIVE=$DISTNAME.$COMPRESSION
SHA256SUM=ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb
SHA256SUM=ef2efae259ce80a240de48ec85ecb062cecca26e4352ffb3fda562c21a93007b
UPSTREAM_SITE=https://ffmpeg.org/releases
UPSTREAM_ARCHIVE=$ARCHIVE
LICENSE=LGPL-3-or-later
BUILD_SYSTEM=configure
DIRTY_FILE=ffbuild/config.mak
CONFIGURE_ARGS='--disable-x86asm --enable-version3 --optflags=" " --disable-debug'

View File

@ -1,6 +1,7 @@
NAME=libavcodec
SOURCE_PORT=ffmpeg
BUILD_LIBRARIES='libfontconfig? libfreetype? libiconv? liblzma? libssl? libtheora? libvorbis? libxml2? libz?'
LICENSE=LGPL-3-or-later
BUILD_SYSTEM=configure
DIRTY_FILE=ffbuild/config.mak
CONFIGURE_ARGS='--disable-x86asm --enable-version3 --optflags=" " --disable-debug --disable-programs'

View File

@ -41,7 +41,7 @@ diff -Paur --no-dereference -- video-player.upstream/Makefile video-player/Makef
diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-player/video-player.cpp
--- video-player.upstream/video-player.cpp
+++ video-player/video-player.cpp
@@ -0,0 +1,313 @@
@@ -0,0 +1,302 @@
+#define __STDC_CONSTANT_MACROS
+#define __STDC_LIMIT_MACROS
+
@ -166,8 +166,8 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+ int audio_stream_id;
+ AVStream* video_stream = NULL;
+ AVStream* audio_stream = NULL;
+ AVCodec* video_codec = NULL;
+ AVCodec* audio_codec = NULL;
+ const AVCodec* video_codec = NULL;
+ const AVCodec* audio_codec = NULL;
+ AVCodecContext* video_codec_ctx = NULL;
+ AVCodecContext* audio_codec_ctx = NULL;
+ AVFrame* video_frame = NULL;
@ -207,17 +207,14 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+ if ( audio_codec && !(audio_codec_ctx = avcodec_alloc_context3(audio_codec)))
+ goto cleanup_video_codec_ctx;
+
+
+ if ( video_codec_ctx )
+ {
+ video_codec_ctx->extradata = video_stream->codec->extradata;
+ video_codec_ctx->extradata_size = video_stream->codec->extradata_size;
+ if ( (av_error = avcodec_open2(video_codec_ctx, NULL, NULL)) < 0 )
+ goto cleanup_audio_codec_ctx;
+ }
+ if ( audio_codec_ctx )
+ {
+ audio_codec_ctx->extradata = audio_stream->codec->extradata;
+ audio_codec_ctx->extradata_size = audio_stream->codec->extradata_size;
+ if ( (av_error = avcodec_open2(audio_codec_ctx, NULL, NULL)) < 0 )
+ goto cleanup_audio_codec_ctx;
+ }
@ -233,41 +230,36 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+ while ( !need_exit && 0 <= (av_error = av_read_frame(format_ctx, &packet)) )
+ {
+ int stream_index = packet.stream_index;
+ int packet_off = 0;
+ while ( stream_index == video_stream->index && packet_off < packet.size )
+ if ( stream_index == video_stream->index )
+ {
+ packet.data += packet_off; packet.size -= packet_off;
+ int got_frame;
+ int bytes_used = avcodec_decode_video2(video_codec_ctx, video_frame,
+ &got_frame, &packet);
+ packet.data -= packet_off; packet.size += packet_off;
+
+ if ( (av_error = bytes_used) < 0 )
+ if ( (av_error = avcodec_send_packet(video_codec_ctx,
+ &packet)) < 0 )
+ goto break_decode_loop;
+ if ( !got_frame )
+ break;
+ packet_off += bytes_used;
+
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ while ( timespec_le(now, next_frame_at) )
+ while ( !(av_error = avcodec_receive_frame(video_codec_ctx,
+ video_frame)) )
+ {
+ struct timespec left = timespec_sub(next_frame_at, now);
+ clock_nanosleep(CLOCK_MONOTONIC, 0, &left, NULL);
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ while ( timespec_le(now, next_frame_at) )
+ {
+ struct timespec left = timespec_sub(next_frame_at, now);
+ clock_nanosleep(CLOCK_MONOTONIC, 0, &left, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ }
+
+ DisplayVideoFrame(video_frame, connection);
+
+ uintmax_t usecs = video_codec_ctx->ticks_per_frame * 1000000 *
+ video_codec_ctx->time_base.num /
+ video_codec_ctx->time_base.den;
+ next_frame_at = timespec_add(next_frame_at, timespec_make(0, usecs * 1000));
+ }
+
+ DisplayVideoFrame(video_frame, connection);
+
+ uintmax_t usecs = video_codec_ctx->ticks_per_frame * 1000000 *
+ video_codec_ctx->time_base.num /
+ video_codec_ctx->time_base.den;
+ next_frame_at = timespec_add(next_frame_at, timespec_make(0, usecs * 1000));
+ if ( av_error != AVERROR(EAGAIN) && av_error != AVERROR_EOF )
+ goto break_decode_loop;
+ }
+ while ( stream_index == audio_stream->index && packet_off < packet.size )
+ if ( stream_index == audio_stream->index )
+ {
+ // TODO: Add sound support when an backend is available.
+ packet_off = packet.size;
+ }
+ }
+break_decode_loop:
@ -288,14 +280,12 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+cleanup_audio_codec_ctx:
+ if ( audio_codec_ctx )
+ {
+ audio_codec_ctx->extradata = NULL;
+ avcodec_close(audio_codec_ctx);
+ av_free(audio_codec_ctx);
+ }
+cleanup_video_codec_ctx:
+ if ( video_codec_ctx )
+ {
+ video_codec_ctx->extradata = NULL;
+ avcodec_close(video_codec_ctx);
+ av_free(video_codec_ctx);
+ }
@ -326,7 +316,6 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+ error(1, 0, "couldn't create dispd rgba window");
+ struct dispd_window* connection = window;
+#endif
+ av_register_all();
+
+#ifdef DISPLAY
+ WINDOW_WIDTH = 800;