From 822f798d9b5b89aaf7514adc3824282c946ed88a Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 6 Nov 2017 19:19:31 +0100 Subject: [PATCH] ffmpeg: apply upstream patch for compatibility. --- media-video/ffmpeg/ffmpeg-3.4.recipe | 2 +- .../ffmpeg/patches/ffmpeg-3.4.patchset | 106 +++++++++++++++++- 2 files changed, 105 insertions(+), 3 deletions(-) diff --git a/media-video/ffmpeg/ffmpeg-3.4.recipe b/media-video/ffmpeg/ffmpeg-3.4.recipe index 853e75966..ae004b2f2 100644 --- a/media-video/ffmpeg/ffmpeg-3.4.recipe +++ b/media-video/ffmpeg/ffmpeg-3.4.recipe @@ -7,7 +7,7 @@ COPYRIGHT="2000-2003 Fabrice Bellard 2003-2017 the FFmpeg developers" LICENSE="GNU LGPL v2.1 GNU GPL v2" -REVISION="1" +REVISION="2" SOURCE_URI="https://ffmpeg.org/releases/ffmpeg-$portVersion.tar.xz" CHECKSUM_SHA256="aeee06e4d8b18d852c61ebbfe5e1bb7014b1e118e8728c1c2115f91e51bffbef" PATCHES="ffmpeg-$portVersion.patchset" diff --git a/media-video/ffmpeg/patches/ffmpeg-3.4.patchset b/media-video/ffmpeg/patches/ffmpeg-3.4.patchset index 70c97b685..3bd506283 100644 --- a/media-video/ffmpeg/patches/ffmpeg-3.4.patchset +++ b/media-video/ffmpeg/patches/ffmpeg-3.4.patchset @@ -1,4 +1,4 @@ -From c2b5fa37ae0ed5af19e1f171b458fa65d673400d Mon Sep 17 00:00:00 2001 +From a3a73c183d740c6b9e3f52dc26e401ca2a0ad11b Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 16 Oct 2017 18:31:07 +0200 Subject: disable ebx on x86. @@ -17,5 +17,107 @@ index 18d80ee..1547cf8 100755 # add_dep lib dep -- -2.7.0 +2.14.2 + + +From 54d69f3a0979721f61b46c3beb13c50b8836ae62 Mon Sep 17 00:00:00 2001 +From: Nicolas George +Date: Fri, 27 Oct 2017 20:46:28 +0200 +Subject: lavf/avio: temporarily accept 0 as EOF. + +Print a warning to let applicatios fix their use. +After a deprecation period, check with a low-level assert. +Also make the constraint explicit in the doxygen comment. + +Signed-off-by: Nicolas George + +diff --git a/libavformat/avio.h b/libavformat/avio.h +index f9c5972..250cf90 100644 +--- a/libavformat/avio.h ++++ b/libavformat/avio.h +@@ -452,6 +452,8 @@ void avio_free_directory_entry(AVIODirEntry **entry); + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. ++ * For stream protocols, must never return 0 but rather ++ * a proper AVERROR code. + * @param write_packet A function for writing the buffer contents, may be NULL. + * The function may not change the input buffers content. + * @param seek A function for seeking to specified byte position, may be NULL. +diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c +index 636cb46..a862d27 100644 +--- a/libavformat/aviobuf.c ++++ b/libavformat/aviobuf.c +@@ -531,6 +531,24 @@ void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType typ + s->last_time = time; + } + ++static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) ++{ ++ int ret; ++ ++ if (!s->read_packet) ++ return AVERROR_EOF; ++ ret = s->read_packet(s->opaque, buf, size); ++#if FF_API_OLD_AVIO_EOF_0 ++ if (!ret && !s->max_packet_size) { ++ av_log(NULL, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n"); ++ ret = AVERROR_EOF; ++ } ++#else ++ av_assert2(ret || s->max_packet_size); ++#endif ++ return ret; ++} ++ + /* Input stream */ + + static void fill_buffer(AVIOContext *s) +@@ -569,10 +587,7 @@ static void fill_buffer(AVIOContext *s) + len = s->orig_buffer_size; + } + +- if (s->read_packet) +- len = s->read_packet(s->opaque, dst, len); +- else +- len = 0; ++ len = read_packet_wrapper(s, dst, len); + if (len <= 0) { + /* do not modify buffer if EOF reached so that a seek back can + be done without rereading data */ +@@ -644,8 +659,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) + if (len == 0 || s->write_flag) { + if((s->direct || size > s->buffer_size) && !s->update_checksum) { + // bypass the buffer and read data directly into buf +- if(s->read_packet) +- len = s->read_packet(s->opaque, buf, size); ++ len = read_packet_wrapper(s, buf, size); + + if (len <= 0) { + /* do not modify buffer if EOF reached so that a seek back can +@@ -711,7 +725,7 @@ int avio_read_partial(AVIOContext *s, unsigned char *buf, int size) + return -1; + + if (s->read_packet && s->write_flag) { +- len = s->read_packet(s->opaque, buf, size); ++ len = read_packet_wrapper(s, buf, size); + if (len > 0) + s->pos += len; + return len; +diff --git a/libavformat/version.h b/libavformat/version.h +index 878917d..ba400e1 100644 +--- a/libavformat/version.h ++++ b/libavformat/version.h +@@ -97,6 +97,9 @@ + #ifndef FF_API_OLD_ROTATE_API + #define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 58) + #endif ++#ifndef FF_API_OLD_AVIO_EOF_0 ++#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 58) ++#endif + + + #ifndef FF_API_R_FRAME_RATE +-- +2.14.2