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

View File

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

View File

@ -1,6 +1,7 @@
NAME=libavcodec NAME=libavcodec
SOURCE_PORT=ffmpeg SOURCE_PORT=ffmpeg
BUILD_LIBRARIES='libfontconfig? libfreetype? libiconv? liblzma? libssl? libtheora? libvorbis? libxml2? libz?' BUILD_LIBRARIES='libfontconfig? libfreetype? libiconv? liblzma? libssl? libtheora? libvorbis? libxml2? libz?'
LICENSE=LGPL-3-or-later
BUILD_SYSTEM=configure BUILD_SYSTEM=configure
DIRTY_FILE=ffbuild/config.mak DIRTY_FILE=ffbuild/config.mak
CONFIGURE_ARGS='--disable-x86asm --enable-version3 --optflags=" " --disable-debug --disable-programs' 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 diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-player/video-player.cpp
--- video-player.upstream/video-player.cpp --- video-player.upstream/video-player.cpp
+++ video-player/video-player.cpp +++ video-player/video-player.cpp
@@ -0,0 +1,313 @@ @@ -0,0 +1,302 @@
+#define __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS
+#define __STDC_LIMIT_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; + int audio_stream_id;
+ AVStream* video_stream = NULL; + AVStream* video_stream = NULL;
+ AVStream* audio_stream = NULL; + AVStream* audio_stream = NULL;
+ AVCodec* video_codec = NULL; + const AVCodec* video_codec = NULL;
+ AVCodec* audio_codec = NULL; + const AVCodec* audio_codec = NULL;
+ AVCodecContext* video_codec_ctx = NULL; + AVCodecContext* video_codec_ctx = NULL;
+ AVCodecContext* audio_codec_ctx = NULL; + AVCodecContext* audio_codec_ctx = NULL;
+ AVFrame* video_frame = 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))) + if ( audio_codec && !(audio_codec_ctx = avcodec_alloc_context3(audio_codec)))
+ goto cleanup_video_codec_ctx; + goto cleanup_video_codec_ctx;
+ +
+
+ if ( 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 ) + if ( (av_error = avcodec_open2(video_codec_ctx, NULL, NULL)) < 0 )
+ goto cleanup_audio_codec_ctx; + goto cleanup_audio_codec_ctx;
+ } + }
+ if ( 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 ) + if ( (av_error = avcodec_open2(audio_codec_ctx, NULL, NULL)) < 0 )
+ goto cleanup_audio_codec_ctx; + 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)) ) + while ( !need_exit && 0 <= (av_error = av_read_frame(format_ctx, &packet)) )
+ { + {
+ int stream_index = packet.stream_index; + int stream_index = packet.stream_index;
+ int packet_off = 0; + if ( stream_index == video_stream->index )
+ while ( stream_index == video_stream->index && packet_off < packet.size )
+ { + {
+ packet.data += packet_off; packet.size -= packet_off; + if ( (av_error = avcodec_send_packet(video_codec_ctx,
+ int got_frame; + &packet)) < 0 )
+ 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 )
+ goto break_decode_loop; + goto break_decode_loop;
+ if ( !got_frame ) + while ( !(av_error = avcodec_receive_frame(video_codec_ctx,
+ break; + video_frame)) )
+ packet_off += bytes_used;
+
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ while ( timespec_le(now, next_frame_at) )
+ { + {
+ struct timespec left = timespec_sub(next_frame_at, now); + struct timespec now;
+ clock_nanosleep(CLOCK_MONOTONIC, 0, &left, NULL);
+ clock_gettime(CLOCK_MONOTONIC, &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));
+ } + }
+ + if ( av_error != AVERROR(EAGAIN) && av_error != AVERROR_EOF )
+ DisplayVideoFrame(video_frame, connection); + goto break_decode_loop;
+
+ 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));
+ } + }
+ 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. + // TODO: Add sound support when an backend is available.
+ packet_off = packet.size;
+ } + }
+ } + }
+break_decode_loop: +break_decode_loop:
@ -288,14 +280,12 @@ diff -Paur --no-dereference -- video-player.upstream/video-player.cpp video-play
+cleanup_audio_codec_ctx: +cleanup_audio_codec_ctx:
+ if ( audio_codec_ctx ) + if ( audio_codec_ctx )
+ { + {
+ audio_codec_ctx->extradata = NULL;
+ avcodec_close(audio_codec_ctx); + avcodec_close(audio_codec_ctx);
+ av_free(audio_codec_ctx); + av_free(audio_codec_ctx);
+ } + }
+cleanup_video_codec_ctx: +cleanup_video_codec_ctx:
+ if ( video_codec_ctx ) + if ( video_codec_ctx )
+ { + {
+ video_codec_ctx->extradata = NULL;
+ avcodec_close(video_codec_ctx); + avcodec_close(video_codec_ctx);
+ av_free(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"); + error(1, 0, "couldn't create dispd rgba window");
+ struct dispd_window* connection = window; + struct dispd_window* connection = window;
+#endif +#endif
+ av_register_all();
+ +
+#ifdef DISPLAY +#ifdef DISPLAY
+ WINDOW_WIDTH = 800; + WINDOW_WIDTH = 800;