Browse Source

- ffmpeg-arm: bump version to 4.0.2; align patches

* allow to build unpatched ffmpeg using FFMPEG_UNPATCHED variable
* TODO: fix deprecated warnings in libstb-hal and neutrino code
master
vanhofen 6 years ago
parent
commit
5c0a6aed77
  1. 2127
      archive-patches/ffmpeg-3.3-add-dash-demux.patch
  2. 16
      archive-patches/ffmpeg-3.3-chunked_transfer_fix_eof.patch
  3. 16
      archive-patches/ffmpeg-3.3-fix-edit-list-parsing.patch
  4. 18
      archive-patches/ffmpeg-3.3-fix-mpegts.patch
  5. 137
      archive-patches/ffmpeg-3.3-hls-replace-key-uri.patch
  6. 132
      archive-patches/ffmpeg-4.0.2-allow_to_choose_rtmp_impl_at_runtime.patch
  7. 16
      archive-patches/ffmpeg-4.0.2-fix_edit_list_parsing.patch
  8. 6
      archive-patches/ffmpeg-4.0.2-fix_hls.patch
  9. 16
      archive-patches/ffmpeg-4.0.2-fix_mpegts.patch
  10. 47
      archive-patches/ffmpeg-4.0.2-hls_replace_key_uri.patch
  11. 36
      archive-patches/ffmpeg-4.0.2-increase_buffer_size.patch
  12. 40
      archive-patches/ffmpeg-4.0.2-optimize_aac.patch
  13. 28
      make/ffmpeg-arm.mk

2127
archive-patches/ffmpeg-3.3-add-dash-demux.patch

File diff suppressed because it is too large

16
archive-patches/ffmpeg-3.3-chunked_transfer_fix_eof.patch

@ -1,16 +0,0 @@
diff -uNr ffmpeg-3.2.2_orig/libavformat/http.c ffmpeg-3.2.2_chunked_transfer_fix_eof/libavformat/http.c
--- ffmpeg-3.2.2_orig/libavformat/http.c 2016-12-06 00:28:58.000000000 +0100
+++ ffmpeg-3.2.2_chunked_transfer_fix_eof/libavformat/http.c 2018-01-04 16:39:45.484670390 +0100
@@ -1194,8 +1194,11 @@
"Chunked encoding data size: %"PRIu64"'\n",
s->chunksize);
- if (!s->chunksize)
+ if (!s->chunksize) {
+ /* we need to remember endof*/
+ s->chunksize = UINT64_MAX;
return 0;
+ }
else if (s->chunksize == UINT64_MAX) {
av_log(h, AV_LOG_ERROR, "Invalid chunk size %"PRIu64"\n",
s->chunksize);

16
archive-patches/ffmpeg-3.3-fix-edit-list-parsing.patch

@ -1,16 +0,0 @@
Taapat: disable log to fix freezing on edit list parsing intruduced in:
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=ca6cae73db207f17a0d5507609de12842d8f0ca3
--- a/libavformat/mov.c 2016-11-14 20:09:13.779085246 +0200
+++ b/libavformat/mov.c 2016-11-14 20:09:30.715351822 +0200
@@ -3177,8 +3177,10 @@
curr_cts = current->timestamp + msc->dts_shift;
if (ctts_data_old && ctts_index_old < ctts_count_old) {
+ /*
av_log(mov->fc, AV_LOG_DEBUG, "shifted frame pts, curr_cts: %"PRId64" @ %"PRId64", ctts: %d, ctts_count: %"PRId64"\n",
curr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old);
+ */
curr_cts += ctts_data_old[ctts_index_old].duration;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {

18
archive-patches/ffmpeg-3.3-fix-mpegts.patch

@ -1,18 +0,0 @@
Fix VIDEO_GET_PTS error in libeplayer3 intruduced in:
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=14f7a3d55a43c1082ee1186a1990a431c641052d
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -917,10 +917,10 @@
pes->buffer = NULL;
reset_pes_packet_state(pes);
- sd = av_packet_new_side_data(pkt, AV_PKT_DATA_MPEGTS_STREAM_ID, 1);
+ /*sd = av_packet_new_side_data(pkt, AV_PKT_DATA_MPEGTS_STREAM_ID, 1);
if (!sd)
return AVERROR(ENOMEM);
- *sd = pes->stream_id;
+ *sd = pes->stream_id;*/
return 0;
}

137
archive-patches/ffmpeg-3.3-hls-replace-key-uri.patch

@ -1,137 +0,0 @@
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -204,8 +204,94 @@
char *http_proxy; ///< holds the address of the HTTP proxy server
AVDictionary *avio_opts;
int strict_std_compliance;
+ char *key_uri_replace_old;
+ char *key_uri_replace_new;
} HLSContext;
+/* http://creativeandcritical.net/str-replace-c */
+static char *repl_str(const char *str, const char *from, const char *to)
+{
+ /* Adjust each of the below values to suit your needs. */
+
+ /* Increment positions cache size initially by this number. */
+ size_t cache_sz_inc = 16;
+ /* Thereafter, each time capacity needs to be increased,
+ * multiply the increment by this factor. */
+ const size_t cache_sz_inc_factor = 3;
+ /* But never increment capacity by more than this number. */
+ const size_t cache_sz_inc_max = 1048576;
+
+ char *pret, *ret = NULL;
+ const char *pstr2, *pstr = str;
+ size_t i, count = 0;
+#if (__STDC_VERSION__ >= 199901L)
+ uintptr_t *pos_cache_tmp, *pos_cache = NULL;
+#else
+ ptrdiff_t *pos_cache_tmp, *pos_cache = NULL;
+#endif
+ size_t cache_sz = 0;
+ size_t cpylen, orglen, retlen, tolen, fromlen = strlen(from);
+
+ /* Find all matches and cache their positions. */
+ while ((pstr2 = strstr(pstr, from)) != NULL) {
+ count++;
+
+ /* Increase the cache size when necessary. */
+ if (cache_sz < count) {
+ cache_sz += cache_sz_inc;
+ pos_cache_tmp = realloc(pos_cache, sizeof(*pos_cache) * cache_sz);
+ if (pos_cache_tmp == NULL) {
+ goto end_repl_str;
+ } else pos_cache = pos_cache_tmp;
+ cache_sz_inc *= cache_sz_inc_factor;
+ if (cache_sz_inc > cache_sz_inc_max) {
+ cache_sz_inc = cache_sz_inc_max;
+ }
+ }
+
+ pos_cache[count-1] = pstr2 - str;
+ pstr = pstr2 + fromlen;
+ }
+
+ orglen = pstr - str + strlen(pstr);
+
+ /* Allocate memory for the post-replacement string. */
+ if (count > 0) {
+ tolen = strlen(to);
+ retlen = orglen + (tolen - fromlen) * count;
+ } else retlen = orglen;
+ ret = malloc(retlen + 1);
+ if (ret == NULL) {
+ goto end_repl_str;
+ }
+
+ if (count == 0) {
+ /* If no matches, then just duplicate the string. */
+ strcpy(ret, str);
+ } else {
+ /* Otherwise, duplicate the string whilst performing
+ * the replacements using the position cache. */
+ pret = ret;
+ memcpy(pret, str, pos_cache[0]);
+ pret += pos_cache[0];
+ for (i = 0; i < count; i++) {
+ memcpy(pret, to, tolen);
+ pret += tolen;
+ pstr = str + pos_cache[i] + fromlen;
+ cpylen = (i == count-1 ? orglen : pos_cache[i+1]) - pos_cache[i] - fromlen;
+ memcpy(pret, pstr, cpylen);
+ pret += cpylen;
+ }
+ ret[retlen] = '\0';
+ }
+
+end_repl_str:
+ /* Free the cache and return the post-replacement string,
+ * which will be NULL in the event of an error. */
+ free(pos_cache);
+ return ret;
+}
+
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
{
int len = ff_get_line(s, buf, maxlen);
@@ -1106,8 +1192,18 @@
AVDictionary *opts2 = NULL;
char iv[33], key[33], url[MAX_URL_SIZE];
if (strcmp(seg->key, pls->key_url)) {
+ char *key_url = NULL;
AVIOContext *pb;
- if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts, NULL) == 0) {
+
+ if (NULL != c->key_uri_replace_old && \
+ NULL != c-> key_uri_replace_new && \
+ '\0' != c->key_uri_replace_old[0]) {
+ key_url = repl_str(seg->key, c->key_uri_replace_old, c->key_uri_replace_new);
+ } else {
+ key_url = seg->key;
+ }
+
+ if (open_url(pls->parent, &pb, key_url, c->avio_opts, opts, NULL) == 0) {
ret = avio_read(pb, pls->key, sizeof(pls->key));
if (ret != sizeof(pls->key)) {
av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
@@ -1119,6 +1215,10 @@
seg->key);
}
av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url));
+
+ if (key_url != seg->key) {
+ free(key_url);
+ }
}
ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0);
ff_data_to_hex(key, pls->key, sizeof(pls->key), 0);
@@ -2128,6 +2228,8 @@
static const AVOption hls_options[] = {
{"live_start_index", "segment index to start live streams at (negative values are from the end)",
OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS},
+ { "key_uri_old", "allow to replace part of AES key uri - old", OFFSET(key_uri_replace_old), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, FLAGS },
+ { "key_uri_new", "allow to replace part of AES key uri - new", OFFSET(key_uri_replace_new), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, FLAGS },
{NULL}
};

132
archive-patches/ffmpeg-3.3-allow-to-choose-rtmp-impl-at-runtime.patch → archive-patches/ffmpeg-4.0.2-allow_to_choose_rtmp_impl_at_runtime.patch

@ -1,40 +1,94 @@
--- ffmpeg-3.2.2/configure
+++ ffmpeg-3.2.2/configure
@@ -3033,10 +3033,8 @@
--- a/configure 2018-08-17 11:51:31.066805453 +0200
+++ b/configure 2018-08-17 12:03:19.617555506 +0200
@@ -3229,10 +3229,8 @@
# protocols
async_protocol_deps="threads"
bluray_protocol_deps="libbluray"
-ffrtmpcrypt_protocol_deps="!librtmp_protocol"
-ffrtmpcrypt_protocol_conflict="librtmp_protocol"
ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
ffrtmpcrypt_protocol_select="tcp_protocol"
-ffrtmphttp_protocol_deps="!librtmp_protocol"
-ffrtmphttp_protocol_conflict="librtmp_protocol"
ffrtmphttp_protocol_select="http_protocol"
ftp_protocol_select="tcp_protocol"
gopher_protocol_select="network"
@@ -3053,14 +3051,12 @@
libssh_protocol_deps="libssh"
mmsh_protocol_select="http_protocol"
@@ -3255,20 +3253,18 @@
mmst_protocol_select="network"
-rtmp_protocol_deps="!librtmp_protocol"
libsrt_protocol_deps="libsrt"
libsrt_protocol_select="network"
-rtmp_protocol_conflict="librtmp_protocol"
-rtmp_protocol_select="tcp_protocol"
-rtmp_protocol_suggest="zlib"
-rtmpe_protocol_select="ffrtmpcrypt_protocol"
-rtmps_protocol_deps="!librtmp_protocol"
-rtmpe_protocol_suggest="zlib"
-rtmps_protocol_conflict="librtmp_protocol"
-rtmps_protocol_select="tls_protocol"
-rtmps_protocol_suggest="zlib"
-rtmpt_protocol_select="ffrtmphttp_protocol"
-rtmpt_protocol_suggest="zlib"
-rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
-rtmpte_protocol_suggest="zlib"
-rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
-rtmpts_protocol_suggest="zlib"
+ffrtmp_protocol_select="tcp_protocol"
+ffrtmp_protocol_suggest="zlib"
+ffrtmpe_protocol_select="ffrtmpcrypt_protocol"
+ffrtmpe_protocol_suggest="zlib"
+ffrtmps_protocol_select="tls_protocol"
+ffrtmps_protocol_suggest="zlib"
+ffrtmpt_protocol_select="ffrtmphttp_protocol"
+ffrtmpt_protocol_suggest="zlib"
+ffrtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
+ffrtmpte_protocol_suggest="zlib"
+ffrtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
+ffrtmpts_protocol_suggest="zlib"
rtp_protocol_select="udp_protocol"
schannel_conflict="openssl gnutls libtls"
sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
sctp_protocol_select="network"
--- ffmpeg-3.2.2/libavformat/rtmpproto.c
+++ ffmpeg-3.2.2/libavformat/rtmpproto.c
@@ -2612,7 +2612,7 @@
--- a/libavformat/Makefile 2018-07-18 15:52:01.000000000 +0200
+++ b/libavformat/Makefile 2018-08-17 12:06:16.348291303 +0200
@@ -594,12 +594,12 @@
OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
OBJS-$(CONFIG_PROMPEG_PROTOCOL) += prompeg.o
-OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
-OBJS-$(CONFIG_RTMPE_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
-OBJS-$(CONFIG_RTMPS_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
-OBJS-$(CONFIG_RTMPT_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
-OBJS-$(CONFIG_RTMPTE_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
-OBJS-$(CONFIG_RTMPTS_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMP_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPE_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPS_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPT_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPTE_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPTS_PROTOCOL) += rtmpproto.o rtmpdigest.o rtmppkt.o
OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o
OBJS-$(CONFIG_SCTP_PROTOCOL) += sctp.o
OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o
--- a/libavformat/protocols.c 2018-08-17 12:07:59.489872867 +0200
+++ b/libavformat/protocols.c 2018-08-17 12:08:24.450255607 +0200
@@ -44,12 +44,12 @@
extern const URLProtocol ff_md5_protocol;
extern const URLProtocol ff_pipe_protocol;
extern const URLProtocol ff_prompeg_protocol;
-extern const URLProtocol ff_rtmp_protocol;
-extern const URLProtocol ff_rtmpe_protocol;
-extern const URLProtocol ff_rtmps_protocol;
-extern const URLProtocol ff_rtmpt_protocol;
-extern const URLProtocol ff_rtmpte_protocol;
-extern const URLProtocol ff_rtmpts_protocol;
+extern const URLProtocol ff_ffrtmp_protocol;
+extern const URLProtocol ff_ffrtmpe_protocol;
+extern const URLProtocol ff_ffrtmps_protocol;
+extern const URLProtocol ff_ffrtmpt_protocol;
+extern const URLProtocol ff_ffrtmpte_protocol;
+extern const URLProtocol ff_ffrtmpts_protocol;
extern const URLProtocol ff_rtp_protocol;
extern const URLProtocol ff_sctp_protocol;
extern const URLProtocol ff_srtp_protocol;
--- a/libavformat/rtmpproto.c 2018-07-18 15:52:02.000000000 +0200
+++ b/libavformat/rtmpproto.c 2018-08-17 12:11:43.844590847 +0200
@@ -2592,7 +2592,7 @@
static int rtmp_open(URLContext *s, const char *uri, int flags, AVDictionary **opts)
{
RTMPContext *rt = s->priv_data;
@ -43,16 +97,18 @@
char *old_app, *qmark, *n, fname_buffer[1024];
uint8_t buf[2048];
int port;
@@ -2623,7 +2623,7 @@
@@ -2603,7 +2603,9 @@
rt->is_input = !(flags & AVIO_FLAG_WRITE);
- av_url_split(proto, sizeof(proto), auth, sizeof(auth),
+ memset(tmpProto, 0, sizeof(tmpProto)); proto = &tmpProto[2]; av_url_split(tmpProto, sizeof(tmpProto), auth, sizeof(auth),
+ memset(tmpProto, 0, sizeof(tmpProto));
+ proto = &tmpProto[2];
+ av_url_split(tmpProto, sizeof(tmpProto), auth, sizeof(auth),
hostname, sizeof(hostname), &port,
path, sizeof(path), s->filename);
@@ -3157,9 +3157,9 @@
@@ -3137,9 +3139,9 @@
};
@ -68,45 +124,3 @@
+RTMP_PROTOCOL(ffrtmpt)
+RTMP_PROTOCOL(ffrtmpte)
+RTMP_PROTOCOL(ffrtmpts)
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -566,12 +566,12 @@
OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
OBJS-$(CONFIG_PROMPEG_PROTOCOL) += prompeg.o
-OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMPE_PROTOCOL) += rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMPS_PROTOCOL) += rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMPT_PROTOCOL) += rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMPTE_PROTOCOL) += rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMPTS_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMP_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPE_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPS_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPT_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPTE_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_FFRTMPTS_PROTOCOL) += rtmpproto.o rtmppkt.o
OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o
OBJS-$(CONFIG_SCTP_PROTOCOL) += sctp.o
OBJS-$(CONFIG_SRTP_PROTOCOL) += srtpproto.o srtp.o
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -44,12 +44,12 @@
extern const URLProtocol ff_md5_protocol;
extern const URLProtocol ff_pipe_protocol;
extern const URLProtocol ff_prompeg_protocol;
-extern const URLProtocol ff_rtmp_protocol;
-extern const URLProtocol ff_rtmpe_protocol;
-extern const URLProtocol ff_rtmps_protocol;
-extern const URLProtocol ff_rtmpt_protocol;
-extern const URLProtocol ff_rtmpte_protocol;
-extern const URLProtocol ff_rtmpts_protocol;
+extern const URLProtocol ff_ffrtmp_protocol;
+extern const URLProtocol ff_ffrtmpe_protocol;
+extern const URLProtocol ff_ffrtmps_protocol;
+extern const URLProtocol ff_ffrtmpt_protocol;
+extern const URLProtocol ff_ffrtmpte_protocol;
+extern const URLProtocol ff_ffrtmpts_protocol;
extern const URLProtocol ff_rtp_protocol;
extern const URLProtocol ff_sctp_protocol;
extern const URLProtocol ff_srtp_protocol;

16
archive-patches/ffmpeg-4.0.2-fix_edit_list_parsing.patch

@ -0,0 +1,16 @@
Taapat: disable log to fix freezing on edit list parsing intruduced in:
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=ca6cae73db207f17a0d5507609de12842d8f0ca3
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3542,8 +3542,10 @@
if (ctts_data_old && ctts_index_old < ctts_count_old) {
curr_ctts = ctts_data_old[ctts_index_old].duration;
+ /*
av_log(mov->fc, AV_LOG_DEBUG, "stts: %"PRId64" ctts: %"PRId64", ctts_index: %"PRId64", ctts_count: %"PRId64"\n",
curr_cts, curr_ctts, ctts_index_old, ctts_count_old);
+ */
curr_cts += curr_ctts;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {

6
archive-patches/ffmpeg-3.3-fix-hls.patch → archive-patches/ffmpeg-4.0.2-fix_hls.patch

@ -1,6 +1,6 @@
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1899,8 +1899,10 @@
--- a/libavformat/hls.c 2018-08-17 13:06:01.428702126 +0200
+++ b/libavformat/hls.c 2018-08-17 13:06:15.077944569 +0200
@@ -2079,8 +2079,10 @@
HLSContext *c = s->priv_data;
int ret, i, minplaylist = -1;

16
archive-patches/ffmpeg-4.0.2-fix_mpegts.patch

@ -0,0 +1,16 @@
diff -uNr ffmpeg-3.4.2/libavformat/mpegts.c ffmpeg-3.4.2_fix_mpegts/libavformat/mpegts.c
--- ffmpeg-3.4.2/libavformat/mpegts.c 2018-02-12 01:29:06.000000000 +0100
+++ ffmpeg-3.4.2_fix_mpegts/libavformat/mpegts.c 2018-02-14 19:36:28.175054407 +0100
@@ -930,10 +930,12 @@
pes->buffer = NULL;
reset_pes_packet_state(pes);
+ /*
sd = av_packet_new_side_data(pkt, AV_PKT_DATA_MPEGTS_STREAM_ID, 1);
if (!sd)
return AVERROR(ENOMEM);
*sd = pes->stream_id;
+ */
return 0;
}

47
archive-patches/ffmpeg-4.0.2-hls_replace_key_uri.patch

@ -0,0 +1,47 @@
--- a/libavformat/hls.c 2018-08-17 13:16:57.721007600 +0200
+++ b/libavformat/hls.c 2018-08-17 13:33:57.530170057 +0200
@@ -213,6 +213,8 @@
int max_reload;
int http_persistent;
int http_multiple;
+ char *key_uri_replace_old;
+ char *key_uri_replace_new;
AVIOContext *playlist_pb;
} HLSContext;
@@ -1196,8 +1198,16 @@
AVDictionary *opts2 = NULL;
char iv[33], key[33], url[MAX_URL_SIZE];
if (strcmp(seg->key, pls->key_url)) {
+ char *key_url = NULL;
AVIOContext *pb = NULL;
- if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts, NULL) == 0) {
+ if (NULL != c->key_uri_replace_old && \
+ NULL != c-> key_uri_replace_new && \
+ '\0' != c->key_uri_replace_old[0]) {
+ key_url = av_strireplace(seg->key, c->key_uri_replace_old, c->key_uri_replace_new);
+ } else {
+ key_url = seg->key;
+ }
+ if (open_url(pls->parent, &pb, key_url, c->avio_opts, opts, NULL) == 0) {
ret = avio_read(pb, pls->key, sizeof(pls->key));
if (ret != sizeof(pls->key)) {
av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
@@ -1209,6 +1219,8 @@
seg->key);
}
av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url));
+ if (key_url != seg->key)
+ av_free(key_url);
}
ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0);
ff_data_to_hex(key, pls->key, sizeof(pls->key), 0);
@@ -2332,6 +2344,8 @@
OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{"http_multiple", "Use multiple HTTP connections for fetching segments",
OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
+ { "key_uri_old", "allow to replace part of AES key uri - old", OFFSET(key_uri_replace_old), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, FLAGS },
+ { "key_uri_new", "allow to replace part of AES key uri - new", OFFSET(key_uri_replace_new), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, FLAGS },
{NULL}
};

36
archive-patches/ffmpeg-3.3-buffer-size.patch → archive-patches/ffmpeg-4.0.2-increase_buffer_size.patch

@ -1,6 +1,8 @@
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 75912ce..56f0a4d 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -281,12 +281,6 @@
@@ -290,12 +290,6 @@ typedef struct AVIOContext {
*/
int writeout_count;
@ -13,6 +15,8 @@
/**
* Threshold to favor readahead over seek.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index e752d0e..108f089 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -33,7 +33,7 @@
@ -24,21 +28,21 @@
/**
* Do seeks within this distance ahead of the current buffer by skipping
@@ -88,7 +88,6 @@
int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
@@ -90,7 +90,6 @@ int ffio_init_context(AVIOContext *s,
memset(s, 0, sizeof(AVIOContext));
s->buffer = buffer;
- s->orig_buffer_size =
s->buffer_size = buffer_size;
s->buf_ptr = buffer;
s->opaque = opaque;
@@ -534,16 +533,16 @@
s->buf_ptr_max = buffer;
@@ -570,16 +569,16 @@ static void fill_buffer(AVIOContext *s)
}
/* make buffer smaller in case it ended up large after probing */
- if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size) {
+ if (s->read_packet && s->buffer_size > max_buffer_size) {
if (dst == s->buffer) {
if (dst == s->buffer && s->buf_ptr != dst) {
- int ret = ffio_set_buf_size(s, s->orig_buffer_size);
+ int ret = ffio_set_buf_size(s, max_buffer_size);
if (ret < 0)
@ -52,22 +56,23 @@
+ len = max_buffer_size;
}
if (s->read_packet)
@@ -985,7 +984,6 @@
len = read_packet_wrapper(s, dst, len);
@@ -1087,7 +1086,6 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size)
av_free(s->buffer);
s->buffer = buffer;
- s->orig_buffer_size =
s->buffer_size = buf_size;
s->buf_ptr = buffer;
s->buf_ptr = s->buf_ptr_max = buffer;
url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c25eab4..02ce5e2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -118,6 +118,25 @@
MAKE_ACCESSORS(AVFormatContext, format, AVOpenCallback, open_cb)
FF_ENABLE_DEPRECATION_WARNINGS
@@ -138,6 +138,25 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
+
#endif
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
+{
+ if (min_size < *size)
@ -86,6 +91,7 @@
+
+ return ptr;
+}
+
int64_t av_stream_get_end_pts(const AVStream *st)
{
if (st->internal->priv_pts) {

40
archive-patches/ffmpeg-3.3-aac.patch → archive-patches/ffmpeg-4.0.2-optimize_aac.patch

@ -1,14 +1,3 @@
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -2381,7 +2381,7 @@
* @param decode 1 if tool is used normally, 0 if tool is used in LTP.
* @param coef spectral coefficients
*/
-static void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
+static __attribute__((optimize(0))) void apply_tns(INTFLOAT coef[1024], TemporalNoiseShaping *tns,
IndividualChannelStream *ics, int decode)
{
const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb);
--- a/libavcodec/mdct_template.c
+++ b/libavcodec/mdct_template.c
@@ -102,7 +102,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
@ -20,9 +9,17 @@
{
int k, n8, n4, n2, n, j;
const uint16_t *revtab = s->revtab;
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -654,7 +654,7 @@
@@ -110,7 +110,6 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
const FFTSample *tsin = s->tsin;
const FFTSample *in1, *in2;
FFTComplex *z = (FFTComplex *)output;
-
n = 1 << s->mdct_bits;
n2 = n >> 1;
n4 = n >> 2;
--- a/libavcodec/aacps.c 2016-01-16 14:08:47.122752224 +0200
+++ b/libavcodec/aacps.c 2016-01-16 14:15:59.300895278 +0200
@@ -659,7 +659,7 @@
par[ 1] = AAC_HALF_SUM(par[ 0], par[ 1]);
}
@ -33,7 +30,7 @@
LOCAL_ALIGNED_16(INTFLOAT, transient_gain, [34], [PS_QMF_TIME_SLOTS]);
--- a/libavcodec/fft_template.c
+++ b/libavcodec/fft_template.c
@@ -475,7 +475,7 @@
@@ -536,7 +536,7 @@
pass(z,FFT_NAME(ff_cos_##n),n4/2);\
}
@ -42,7 +39,7 @@
{
FFTDouble t1, t2, t3, t4, t5, t6, t7, t8;
@@ -489,7 +489,7 @@
@@ -550,7 +550,7 @@
BF(z[2].im, z[0].im, t2, t5);
}
@ -51,3 +48,14 @@
{
FFTDouble t1, t2, t3, t4, t5, t6;
--- a/libavcodec/aacdec_template.c 2018-02-16 09:57:05.180695169 +0100
+++ b/libavcodec/aacdec_template.c 2018-02-16 09:56:13.430147406 +0100
@@ -2483,7 +2483,7 @@
* @param decode 1 if tool is used normally, 0 if tool is used in LTP.
* @param coef spectral coefficients
*/
-static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
+static __attribute__((optimize(0))) void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
IndividualChannelStream *ics, int decode)
{
const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb);

28
make/ffmpeg-arm.mk

@ -4,7 +4,7 @@
# -----------------------------------------------------------------------------
FFMPEG_VER = 3.3
FFMPEG_VER = 4.0.2
FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VER).tar.xz
$(ARCHIVE)/$(FFMPEG_SOURCE):
@ -12,16 +12,16 @@ $(ARCHIVE)/$(FFMPEG_SOURCE):
# -----------------------------------------------------------------------------
FFMPEG_PATCH = ffmpeg-$(FFMPEG_VER)-fix-hls.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-buffer-size.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-aac.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-fix-edit-list-parsing.patch
FFMPEG_UNPATCHED := no
FFMPEG_PATCH = ffmpeg-$(FFMPEG_VER)-fix_hls.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-increase_buffer_size.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-optimize_aac.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-fix_edit_list_parsing.patch
# ffmpeg exteplayer3 patches
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-fix-mpegts.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-allow-to-choose-rtmp-impl-at-runtime.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-add-dash-demux.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-hls-replace-key-uri.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-chunked_transfer_fix_eof.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-fix_mpegts.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-allow_to_choose_rtmp_impl_at_runtime.patch
FFMPEG_PATCH += ffmpeg-$(FFMPEG_VER)-hls_replace_key_uri.patch
# -----------------------------------------------------------------------------
@ -43,7 +43,6 @@ FFMPEG_CONFIGURE_GENERIC = \
--disable-txtpages \
\
--disable-ffplay \
--disable-ffserver \
--enable-ffprobe \
\
--disable-altivec \
@ -71,7 +70,7 @@ FFMPEG_CONFIGURE_GENERIC = \
--disable-ssse3 \
--disable-vfp \
--disable-xop \
--disable-yasm \
--disable-x86asm \
\
--disable-dxva2 \
--disable-vaapi \
@ -350,8 +349,11 @@ FFMPEG_CONFIGURE_PLATFORM = \
$(D)/ffmpeg: $(FFMPEG_DEPS) $(ARCHIVE)/$(FFMPEG_SOURCE) | $(TARGET_DIR)
$(REMOVE)/ffmpeg-$(FFMPEG_VER)
$(UNTAR)/$(FFMPEG_SOURCE)
ifneq ($(FFMPEG_UNPATCHED), yes)
set -e; cd $(BUILD_TMP)/ffmpeg-$(FFMPEG_VER); \
$(call apply_patches, $(FFMPEG_PATCH))
endif
set -e; cd $(BUILD_TMP)/ffmpeg-$(FFMPEG_VER); \
$(call apply_patches, $(FFMPEG_PATCH)); \
./configure \
$(FFMPEG_CONFIGURE_GENERIC) \
$(FFMPEG_CONFIGURE_PLATFORM) \

Loading…
Cancel
Save