From 0c1b6eb37620ca0d0b8fee35c13d88d3e3ad904a Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Mon, 13 Apr 2015 18:36:52 +0300 Subject: [PATCH] ffmpeg: update to ffmpeg-2.6.2 --- packages/multimedia/ffmpeg/package.mk | 2 +- .../ffmpeg/patches/ffmpeg-2.6-kodi.patch | 288 ++++++++---------- 2 files changed, 125 insertions(+), 165 deletions(-) diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index 0c31280fe8..233502f85f 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="ffmpeg" -PKG_VERSION="2.6.1" +PKG_VERSION="2.6.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-2.6-kodi.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-2.6-kodi.patch index c64d51851b..28483ed6b1 100644 --- a/packages/multimedia/ffmpeg/patches/ffmpeg-2.6-kodi.patch +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-2.6-kodi.patch @@ -1,7 +1,7 @@ -From 1c578904e8517f72f71852c79162e8bec9aec00e Mon Sep 17 00:00:00 2001 +From d81499ed3d0c7e165845a63464c0051faccd3e43 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sun, 11 Sep 2011 19:04:51 +0200 -Subject: [PATCH 01/14] Support raw dvdsub palette as stored on normal dvd's +Subject: [PATCH 01/15] Support raw dvdsub palette as stored on normal dvd's This is how the palette is stored on dvd's. Currently only xbmc passes the palette information to libavcodec @@ -53,10 +53,10 @@ index ffb2bcc..fc2adde 100644 int i; av_log(avctx, AV_LOG_DEBUG, "palette:"); -From ee03b1bdb3da5aa8226d768d391112e6ccbc6f69 Mon Sep 17 00:00:00 2001 +From 609ed71bf6b1e5e72802b935b44903a266d6d7d4 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 28 Jun 2010 01:55:31 -0400 -Subject: [PATCH 02/14] if av_read_packet returns AVERROR_IO, we are done. +Subject: [PATCH 02/15] if av_read_packet returns AVERROR_IO, we are done. ffmpeg's codecs might or might not handle returning any completed demuxed packets correctly @@ -65,7 +65,7 @@ Subject: [PATCH 02/14] if av_read_packet returns AVERROR_IO, we are done. 1 file changed, 2 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c -index 17ae300..bdb2cb5 100644 +index 1467f31..fb0bc21 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1319,6 +1319,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) @@ -78,10 +78,10 @@ index 17ae300..bdb2cb5 100644 for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; -From d7826914c19aa8b38633e2c719d25865c0886b76 Mon Sep 17 00:00:00 2001 +From f509b8930a71d1200b1437fb65ff779bbdd1ca86 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 28 Jun 2010 02:10:50 -0400 -Subject: [PATCH 03/14] added: Ticket #7187, TV Teletext support for DVB EBU +Subject: [PATCH 03/15] added: Ticket #7187, TV Teletext support for DVB EBU Teletext streams --- @@ -118,10 +118,10 @@ index 9e9ad47..74a9cc5 100644 }; -From 4365a36e019d9ece6c90184d5ccbf4665aff9577 Mon Sep 17 00:00:00 2001 +From 43a21520a07cc98957146816db857ea1dd63f926 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sun, 18 Sep 2011 19:16:34 +0200 -Subject: [PATCH 04/14] Don't accept mpegts PMT that isn't current +Subject: [PATCH 04/15] Don't accept mpegts PMT that isn't current --- libavformat/mpegts.c | 4 ++++ @@ -157,10 +157,10 @@ index 74a9cc5..3c8d99b 100644 ts->stream->ts_id = h->id; -From 1c4b70896ff64aa3f444a957851de22cbd00fedc Mon Sep 17 00:00:00 2001 +From de503ed6757c7e0f09acd032bed04a2414874087 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sun, 18 Sep 2011 19:17:23 +0200 -Subject: [PATCH 05/14] Don't reparse PMT unless it's version has changed +Subject: [PATCH 05/15] Don't reparse PMT unless it's version has changed --- libavformat/mpegts.c | 6 ++++++ @@ -198,10 +198,10 @@ index 3c8d99b..88e5638 100644 ts->stream->ts_id = h->id; -From 5104bd90c6a147dd126a98246e57fc828d230012 Mon Sep 17 00:00:00 2001 +From 2905dd6f7acdb839ec0bf20636eae6c4f98058e9 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Fri, 9 Jul 2010 16:43:31 -0400 -Subject: [PATCH 06/14] Read PID timestamps as well as PCR timestamps to find +Subject: [PATCH 06/15] Read PID timestamps as well as PCR timestamps to find location in mpegts stream --- @@ -296,20 +296,20 @@ index 88e5638..56cb44f 100644 .priv_class = &mpegtsraw_class, }; -From 986147a9978786b30408f3a968c82bd21b4a3745 Mon Sep 17 00:00:00 2001 +From d8c13412948c24c3b474f4a0f879af795392cb08 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 22 Oct 2011 19:01:38 +0200 -Subject: [PATCH 07/14] Get stream durations using read_timestamp +Subject: [PATCH 07/15] Get stream durations using read_timestamp --- libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c -index bdb2cb5..fbbdbaa 100644 +index fb0bc21..e48e3bb 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c -@@ -2381,6 +2381,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) +@@ -2384,6 +2384,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) #define DURATION_MAX_READ_SIZE 250000LL #define DURATION_MAX_RETRY 4 @@ -351,7 +351,7 @@ index bdb2cb5..fbbdbaa 100644 /* only usable for MPEG-PS streams */ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) { -@@ -2531,6 +2566,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) +@@ -2534,6 +2569,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) * the components */ fill_all_stream_timings(ic); ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; @@ -363,10 +363,10 @@ index bdb2cb5..fbbdbaa 100644 /* less precise: use bitrate info */ estimate_timings_from_bit_rate(ic); -From 7ea45248ab021d5b58309e576d875f1b5f7fa9c7 Mon Sep 17 00:00:00 2001 +From 3815ee4ab3a546d0251f8b4381bdf5c4752b8cee Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 8 Dec 2010 14:03:43 +0000 -Subject: [PATCH 08/14] changed: allow 4 second skew between streams in mov +Subject: [PATCH 08/15] changed: allow 4 second skew between streams in mov before attempting to seek --- @@ -374,10 +374,10 @@ Subject: [PATCH 08/14] changed: allow 4 second skew between streams in mov 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c -index 986af57..0e1b6b4 100644 +index de4004f..a5babb7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c -@@ -4184,8 +4184,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) +@@ -4189,8 +4189,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || (s->pb->seekable && ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && @@ -389,10 +389,10 @@ index 986af57..0e1b6b4 100644 best_dts = dts; *st = avst; -From 14817509dd53bcfa00e1a86c4c15ba210abdaed3 Mon Sep 17 00:00:00 2001 +From 3d83b4730868612b8aac5f51a85ce61cd18f46c8 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Fri, 26 Nov 2010 20:56:48 +0000 -Subject: [PATCH 09/14] fixed: memleak in mpegts demuxer on some malformed (??) +Subject: [PATCH 09/15] fixed: memleak in mpegts demuxer on some malformed (??) mpegts files with too large pes packets at-visions sample file brokenStream.mpg @@ -425,10 +425,10 @@ index 56cb44f..b68a73a 100644 if (ret < 0) { av_free_packet(ts->pkt); -From 4ccc2cebdc67402833f368082075b8f1f51f79eb Mon Sep 17 00:00:00 2001 +From bdf8c821a63ff30681ee2a18de1f7774d7611d27 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 28 Jun 2010 21:26:54 +0000 -Subject: [PATCH 10/14] Speed up mpegts av_find_stream_info +Subject: [PATCH 10/15] Speed up mpegts av_find_stream_info --- libavformat/mpegts.c | 2 +- @@ -448,10 +448,10 @@ index b68a73a..336d869 100644 goto skip; -From 36fa4b26412d410f41aded01a0106c4a76f4a6c2 Mon Sep 17 00:00:00 2001 +From 23e9ea7c3964417e15b83745d2fd6341952cc4a3 Mon Sep 17 00:00:00 2001 From: marc Date: Mon, 18 Feb 2013 17:18:18 +0000 -Subject: [PATCH 11/14] dxva-h264 Fix dxva playback of streams that don't start +Subject: [PATCH 11/15] dxva-h264 Fix dxva playback of streams that don't start with an I-Frame. --- @@ -481,7 +481,7 @@ index 6deccc3..85b25fd 100644 &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 8ec46df..e8d5120 100644 +index a32366e..cbb5385 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1093,6 +1093,7 @@ void ff_h264_flush_change(H264Context *h) @@ -493,10 +493,10 @@ index 8ec46df..e8d5120 100644 /* forget old pics after a seek */ diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index 21e9952..ac3d51a 100644 +index b260d55..5cb7851 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h -@@ -740,6 +740,8 @@ typedef struct H264Context { +@@ -741,6 +741,8 @@ typedef struct H264Context { int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag @@ -506,7 +506,7 @@ index 21e9952..ac3d51a 100644 int sei_buffering_period_present; ///< Buffering period SEI flag int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c -index e9a89d1..80d27e5 100644 +index d8b7bc7..5f80858 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1175,6 +1175,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) @@ -518,10 +518,10 @@ index e9a89d1..80d27e5 100644 init_scan_tables(h); ret = ff_h264_alloc_tables(h); -From cb0afee6caf02396fcb594563a581a0ba47720b7 Mon Sep 17 00:00:00 2001 +From d3112c920a04c24f4b92ab0f67a4275ff4a0c64f Mon Sep 17 00:00:00 2001 From: wsnipex Date: Mon, 16 Feb 2015 09:58:28 +0100 -Subject: [PATCH 12/14] only check for a git rev if the src tree is in a git +Subject: [PATCH 12/15] only check for a git rev if the src tree is in a git repo fixes the version string when building from the kodi depends src tree @@ -584,138 +584,10 @@ index f9754eb..cc23f80 100755 # no revision number found -From b52c216539bdbee830e0d306b372037d4e0cb35f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= -Date: Sun, 8 Mar 2015 19:44:12 +0100 -Subject: [PATCH 13/14] pthread: Fix ff_thread_get_format issues when called - outside frame decode - ---- - libavcodec/pthread_frame.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c -index 5a4ab84..c29d0a9 100644 ---- a/libavcodec/pthread_frame.c -+++ b/libavcodec/pthread_frame.c -@@ -53,6 +53,7 @@ - * Context used by codec threads and stored in their AVCodecInternal thread_ctx. - */ - typedef struct PerThreadContext { -+ int main_thread; - struct FrameThreadContext *parent; - - pthread_t thread; -@@ -83,7 +84,8 @@ typedef struct PerThreadContext { - * Set when the codec calls get_format(). - * State is returned to STATE_SETTING_UP afterwards. - */ -- STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup(). -+ STATE_SETUP_FINISHED, ///< Set after the codec has called ff_thread_finish_setup(). -+ STATE_UPDATE_CONTEXT, ///< Main thread is updating its context - } state; - - /** -@@ -105,6 +107,7 @@ typedef struct PerThreadContext { - * Context stored in the client AVCodecInternal thread_ctx. - */ - typedef struct FrameThreadContext { -+ int main_thread; - PerThreadContext *threads; ///< The contexts for each thread. - PerThreadContext *prev_thread; ///< The last thread submit_packet() was called on. - -@@ -143,6 +146,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg) - AVCodecContext *avctx = p->avctx; - const AVCodec *codec = avctx->codec; - -+ av_assert0(!p->main_thread); - pthread_mutex_lock(&p->mutex); - while (1) { - while (p->state == STATE_INPUT_READY && !fctx->die) -@@ -330,6 +334,8 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt) - - pthread_mutex_lock(&p->mutex); - -+ p->state = STATE_UPDATE_CONTEXT; -+ - release_delayed_buffers(p); - - if (prev_thread) { -@@ -408,6 +414,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, - int finished = fctx->next_finished; - PerThreadContext *p; - int err; -+ av_assert0(fctx->main_thread); - - /* - * Submit a packet to the next decoding thread. -@@ -515,6 +522,7 @@ void ff_thread_finish_setup(AVCodecContext *avctx) { - - if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return; - -+ av_assert0(!p->main_thread); - if(p->state == STATE_SETUP_FINISHED){ - av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n"); - } -@@ -549,6 +557,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) - const AVCodec *codec = avctx->codec; - int i; - -+ av_assert0(fctx->main_thread); - park_frame_worker_threads(fctx, thread_count); - - if (fctx->prev_thread && fctx->prev_thread != fctx->threads) -@@ -634,6 +643,7 @@ int ff_frame_thread_init(AVCodecContext *avctx) - } - - avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext)); -+ fctx->main_thread = 1; - - fctx->threads = av_mallocz_array(thread_count, sizeof(PerThreadContext)); - pthread_mutex_init(&fctx->buffer_mutex, NULL); -@@ -718,6 +728,7 @@ void ff_thread_flush(AVCodecContext *avctx) - - if (!fctx) return; - -+ av_assert0(fctx->main_thread); - park_frame_worker_threads(fctx, avctx->thread_count); - if (fctx->prev_thread) { - if (fctx->prev_thread != &fctx->threads[0]) -@@ -743,7 +754,10 @@ void ff_thread_flush(AVCodecContext *avctx) - int ff_thread_can_start_frame(AVCodecContext *avctx) - { - PerThreadContext *p = avctx->internal->thread_ctx; -- if ((avctx->active_thread_type&FF_THREAD_FRAME) && p->state != STATE_SETTING_UP && -+ if (!(avctx->active_thread_type&FF_THREAD_FRAME)) -+ return 1; -+ av_assert0(!p->main_thread); -+ if (p->state != STATE_SETTING_UP && - (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) { - return 0; - } -@@ -762,6 +776,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int - if (!(avctx->active_thread_type & FF_THREAD_FRAME)) - return ff_get_buffer(avctx, f->f, flags); - -+ av_assert0(!p->main_thread); - if (p->state != STATE_SETTING_UP && - (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); -@@ -819,7 +834,8 @@ enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixe - enum AVPixelFormat res; - PerThreadContext *p = avctx->internal->thread_ctx; - if (!(avctx->active_thread_type & FF_THREAD_FRAME) || avctx->thread_safe_callbacks || -- avctx->get_format == avcodec_default_get_format) -+ avctx->get_format == avcodec_default_get_format || -+ p->main_thread || p->state == STATE_UPDATE_CONTEXT) - return ff_get_format(avctx, fmt); - if (p->state != STATE_SETTING_UP) { - av_log(avctx, AV_LOG_ERROR, "get_format() cannot be called after ff_thread_finish_setup()\n"); - -From ef86b05da8ad38c9c83e6f075536635647e6b799 Mon Sep 17 00:00:00 2001 +From 3bb6304898994e4278263edd879f07e59ab1fd6f Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 12 Mar 2015 12:49:48 +0100 -Subject: [PATCH 14/14] hevc: avoid unnecessary calls to get_format +Subject: [PATCH 13/15] hevc: avoid unnecessary calls to get_format --- libavcodec/hevc.c | 23 ++++++++++++++--------- @@ -777,3 +649,91 @@ index b7ad29a..77b0c0c 100644 return ret; s->seq_decode = s0->seq_decode; + +From 5eac38c7f2593c2e8aced6907e4f283f91e48691 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Thu, 2 Apr 2015 13:43:06 +0200 +Subject: [PATCH 14/15] vda: fix h264 decoding for avcC,vda wants the entire + buffer + +Signed-off-by: Michael Niedermayer +--- + libavcodec/h264.c | 2 +- + libavcodec/vda_h264.c | 20 +++++++++++++++++--- + 2 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/h264.c b/libavcodec/h264.c +index cbb5385..6529d98 100644 +--- a/libavcodec/h264.c ++++ b/libavcodec/h264.c +@@ -1596,7 +1596,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, + decode_postinit(h, nal_index >= nals_needed); + + if (h->avctx->hwaccel && +- (ret = h->avctx->hwaccel->start_frame(h->avctx, NULL, 0)) < 0) ++ (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) + return ret; + if (CONFIG_H264_VDPAU_DECODER && + h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) +diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c +index 081c366..b6b9ab4 100644 +--- a/libavcodec/vda_h264.c ++++ b/libavcodec/vda_h264.c +@@ -320,9 +320,20 @@ static int vda_h264_start_frame(AVCodecContext *avctx, + uint32_t size) + { + VDAContext *vda = avctx->internal->hwaccel_priv_data; +- +- vda->bitstream_size = 0; +- ++ H264Context *h = avctx->priv_data; ++ ++ if (h->is_avc == 1) { ++ void *tmp; ++ vda->bitstream_size = 0; ++ tmp = av_fast_realloc(vda->bitstream, ++ &vda->allocated_size, ++ size); ++ vda->bitstream = tmp; ++ memcpy(vda->bitstream, buffer, size); ++ vda->bitstream_size = size; ++ } else { ++ vda->bitstream_size = 0; ++ } + return 0; + } + +@@ -333,6 +344,9 @@ static int vda_h264_decode_slice(AVCodecContext *avctx, + VDAContext *vda = avctx->internal->hwaccel_priv_data; + void *tmp; + ++ if (h->is_avc == 1) ++ return 0; ++ + tmp = av_fast_realloc(vda->bitstream, + &vda->allocated_size, + vda->bitstream_size + size + 4); + +From e1bde78b7cc95cb13da6c91555d141e37a85b692 Mon Sep 17 00:00:00 2001 +From: Michael Niedermayer +Date: Thu, 2 Apr 2015 15:58:02 +0200 +Subject: [PATCH 15/15] avcodec/vda_h264: try to fix build + +Found-by: Stefano Pigozzi +Signed-off-by: Michael Niedermayer +--- + libavcodec/vda_h264.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c +index b6b9ab4..2a18330 100644 +--- a/libavcodec/vda_h264.c ++++ b/libavcodec/vda_h264.c +@@ -342,6 +342,7 @@ static int vda_h264_decode_slice(AVCodecContext *avctx, + uint32_t size) + { + VDAContext *vda = avctx->internal->hwaccel_priv_data; ++ H264Context *h = avctx->priv_data; + void *tmp; + + if (h->is_avc == 1)