From 6c8947f0458055ee748ef73145d372d67c82066d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 17 May 2017 09:04:45 +0200 Subject: [PATCH 01/40] upgrade ffmpeg to 3.2.3 --- ...ub-palette-as-stored-on-normal-dvd-s.patch | 63 ------- ...h => 0001-bfin-disable-optimization.patch} | 1 - ...t-returns-AVERROR_IO-we-are-done.-ff.patch | 32 ---- ...7-TV-Teletext-support-for-DVB-EBU-Te.patch | 47 ----- ...accept-mpegts-PMT-that-isn-t-current.patch | 46 ----- ...-PMT-unless-it-s-version-has-changed.patch | 48 ----- ...mps-as-well-as-PCR-timestamps-to-fin.patch | 105 ----------- ...tream-durations-using-read_timestamp.patch | 74 -------- ...second-skew-between-streams-in-mov-b.patch | 33 ---- ...-mpegts-demuxer-on-some-malformed-mp.patch | 44 ----- ...-Speed-up-mpegts-av_find_stream_info.patch | 30 ---- ...va-playback-of-streams-that-don-t-st.patch | 77 -------- package/ffmpeg/Config.in | 17 +- package/ffmpeg/ffmpeg.hash | 2 + package/ffmpeg/ffmpeg.mk | 168 +++++++++++++----- package/x264/x264.hash | 2 + package/x264/x264.mk | 8 +- 17 files changed, 150 insertions(+), 647 deletions(-) delete mode 100644 package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch rename package/ffmpeg/{0013-bfin-disable-optimization.patch => 0001-bfin-disable-optimization.patch} (99%) delete mode 100644 package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch delete mode 100644 package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch delete mode 100644 package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch delete mode 100644 package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch delete mode 100644 package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch delete mode 100644 package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch delete mode 100644 package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch delete mode 100644 package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch delete mode 100644 package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch delete mode 100644 package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch create mode 100644 package/ffmpeg/ffmpeg.hash create mode 100644 package/x264/x264.hash diff --git a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch deleted file mode 100644 index a51a7d3c9c..0000000000 --- a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 74f1c9b43b191a9d6b494e90a4a11677fca33c13 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 11 Sep 2011 19:04:51 +0200 -Subject: [PATCH 01/13] 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 -this way. - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c -index 39604f3..a711e16 100644 ---- a/libavcodec/dvdsubdec.c -+++ b/libavcodec/dvdsubdec.c -@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * - } - } - -+static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) -+{ -+ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; -+ uint8_t r, g, b; -+ int i, y, cb, cr, a; -+ int r_add, g_add, b_add; -+ -+ for (i = num_values; i > 0; i--) { -+ a = *ayvu++; -+ y = *ayvu++; -+ cr = *ayvu++; -+ cb = *ayvu++; -+ YUV_TO_RGB1_CCIR(cb, cr); -+ YUV_TO_RGB2_CCIR(r, g, b, y); -+ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; -+ } -+} -+ - static int decode_run_2bit(GetBitContext *gb, int *color) - { - unsigned int v, t; -@@ -697,6 +715,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) - parse_ifo_palette(ctx, ctx->ifo_str); - if (ctx->palette_str) - parse_palette(ctx, ctx->palette_str); -+ -+ if (!ctx->has_palette && avctx->extradata_size == 64) { -+ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); -+ ctx->has_palette = 1; -+ } -+ - if (ctx->has_palette) { - int i; - av_log(avctx, AV_LOG_DEBUG, "palette:"); --- -2.1.0 - diff --git a/package/ffmpeg/0013-bfin-disable-optimization.patch b/package/ffmpeg/0001-bfin-disable-optimization.patch similarity index 99% rename from package/ffmpeg/0013-bfin-disable-optimization.patch rename to package/ffmpeg/0001-bfin-disable-optimization.patch index 039007a9a4..1d8a4f015d 100644 --- a/package/ffmpeg/0013-bfin-disable-optimization.patch +++ b/package/ffmpeg/0001-bfin-disable-optimization.patch @@ -24,4 +24,3 @@ diff -Nur ffmpeg-2.8.7.orig/libavcodec/hevcdsp_template.c ffmpeg-2.8.7/libavcode ptrdiff_t _xstride, ptrdiff_t _ystride, int beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q) - diff --git a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch deleted file mode 100644 index 034413405f..0000000000 --- a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 54200b3e6009c6870e33c02c8bbcf023fcd92cac Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Mon, 28 Jun 2010 01:55:31 -0400 -Subject: [PATCH 03/13] if av_read_packet returns AVERROR_IO, we are done. - ffmpeg's codecs might or might not handle returning any completed demuxed - packets correctly - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/utils.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index ae6347a..3e8af50 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -1304,6 +1304,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) - if (ret < 0) { - if (ret == AVERROR(EAGAIN)) - return ret; -+ if (ret == AVERROR(EIO)) -+ return ret; - /* flush the parsers */ - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; --- -2.1.0 - diff --git a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch deleted file mode 100644 index bc6a2d456d..0000000000 --- a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e9236f6fe3fae1ad4a3a2b6b63db493b083f0b21 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Mon, 28 Jun 2010 02:10:50 -0400 -Subject: [PATCH 04/13] added: Ticket #7187, TV Teletext support for DVB EBU - Teletext streams - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/avcodec.h | 4 ++++ - libavformat/mpegts.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index dabae1b..dd6ef3f 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -520,6 +520,10 @@ enum AVCodecID { - AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), - AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska - -+ /* data codecs */ -+ AV_CODEC_ID_VBI_DATA= 0x17500, -+ AV_CODEC_ID_VBI_TELETEXT, -+ - /* other specific kind of codecs (generally used for attachments) */ - AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. - AV_CODEC_ID_TTF = 0x18000, -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 97da0a3..5dd28f1 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -729,6 +729,8 @@ static const StreamType DESC_types[] = { - { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, - { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, - { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ -+ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ -+ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ - { 0 }, - }; - --- -2.1.0 - diff --git a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch deleted file mode 100644 index feb58f7b25..0000000000 --- a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 1f48ee2290e9041b0371eb9a9cb742e9568930a1 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 18 Sep 2011 19:16:34 +0200 -Subject: [PATCH 05/13] Don't accept mpegts PMT that isn't current - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 5dd28f1..9f85aed 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -572,6 +572,7 @@ typedef struct SectionHeader { - uint8_t tid; - uint16_t id; - uint8_t version; -+ uint8_t current; - uint8_t sec_num; - uint8_t last_sec_num; - } SectionHeader; -@@ -643,6 +644,7 @@ static int parse_section_header(SectionHeader *h, - val = get8(pp, p_end); - if (val < 0) - return val; -+ h->current = val & 0x1; - h->version = (val >> 1) & 0x1f; - val = get8(pp, p_end); - if (val < 0) -@@ -1968,6 +1970,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (ts->skip_changes) - return; -+ if (!h->current) -+ return; - - ts->stream->ts_id = h->id; - --- -2.1.0 - diff --git a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch deleted file mode 100644 index 0418f25eb1..0000000000 --- a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch +++ /dev/null @@ -1,48 +0,0 @@ -From db98fbe37f2f7175ff03b8d582e940518ddf3642 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 18 Sep 2011 19:17:23 +0200 -Subject: [PATCH 06/13] Don't reparse PMT unless it's version has changed - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 9f85aed..25007a6 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -88,6 +88,7 @@ struct MpegTSFilter { - int es_id; - int last_cc; /* last cc code (-1 if first packet) */ - int64_t last_pcr; -+ int last_version; /* last version of data on this pid */ - enum MpegTSFilterType type; - union { - MpegTSPESFilter pes_filter; -@@ -450,6 +451,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, - filter->es_id = -1; - filter->last_cc = -1; - filter->last_pcr= -1; -+ filter->last_version = -1; - - return filter; - } -@@ -1972,6 +1974,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (!h->current) - return; -+ if (h->version == filter->last_version) -+ return; -+ filter->last_version = h->version; -+ av_dlog(ts->stream, "version=%d\n", filter->last_version); - - ts->stream->ts_id = h->id; - --- -2.1.0 - diff --git a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch deleted file mode 100644 index 259b35939e..0000000000 --- a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch +++ /dev/null @@ -1,105 +0,0 @@ -From fdd8caea6535434a877587f5325e914ba50ed17f Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Fri, 9 Jul 2010 16:43:31 -0400 -Subject: [PATCH 07/13] Read PID timestamps as well as PCR timestamps to find - location in mpegts stream - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 46 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 25007a6..d5a8a45 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -2459,6 +2459,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { - av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); - } - -+static int parse_timestamp(int64_t *ts, const uint8_t *buf) -+{ -+ int afc, flags; -+ const uint8_t *p; -+ -+ if(!(buf[1] & 0x40)) /* must be a start packet */ -+ return -1; -+ -+ afc = (buf[3] >> 4) & 3; -+ p = buf + 4; -+ if (afc == 0 || afc == 2) /* invalid or only adaption field */ -+ return -1; -+ if (afc == 3) -+ p += p[0] + 1; -+ if (p >= buf + TS_PACKET_SIZE) -+ return -1; -+ -+ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ -+ return -1; -+ -+ flags = p[3] | 0x100; /* stream type */ -+ if (!((flags >= 0x1c0 && flags <= 0x1df) || -+ (flags >= 0x1e0 && flags <= 0x1ef) || -+ (flags == 0x1bd) || (flags == 0x1fd))) -+ return -1; -+ -+ flags = p[7]; -+ if ((flags & 0xc0) == 0x80) { -+ *ts = ff_parse_pes_pts(p+9); -+ return 0; -+ } else if ((flags & 0xc0) == 0xc0) { -+ *ts = ff_parse_pes_pts(p+9+5); -+ return 0; -+ } -+ return -1; -+} -+ -+ - static int mpegts_read_header(AVFormatContext *s) - { - MpegTSContext *ts = s->priv_data; -@@ -2658,6 +2696,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - uint8_t buf[TS_PACKET_SIZE]; - int pcr_l, pcr_pid = - ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; -+ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; - int pos47 = ts->pos47_full % ts->raw_packet_size; - pos = - ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * -@@ -2679,6 +2718,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - *ppos = pos; - return timestamp; - } -+ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && -+ parse_timestamp(×tamp, buf) == 0) { -+ *ppos = pos; -+ return timestamp; -+ } - pos += ts->raw_packet_size; - } - -@@ -2778,7 +2822,7 @@ AVInputFormat ff_mpegts_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegts_class, - }; -@@ -2790,7 +2834,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_raw_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegtsraw_class, - }; --- -2.1.0 - diff --git a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch deleted file mode 100644 index 0b80c113e1..0000000000 --- a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch +++ /dev/null @@ -1,74 +0,0 @@ -From c57e5b8154f5fe1457f4c64e04885a2cdfb37f51 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sat, 22 Oct 2011 19:01:38 +0200 -Subject: [PATCH 08/13] Get stream durations using read_timestamp - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index 3e8af50..f4fb172 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -2356,6 +2356,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) - #define DURATION_MAX_READ_SIZE 250000LL - #define DURATION_MAX_RETRY 4 - -+static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) -+{ -+ AVStream *st; -+ int i, step= 1024; -+ int64_t ts, pos; -+ -+ for(i=0;inb_streams;i++) { -+ st = ic->streams[i]; -+ -+ pos = 0; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) -+ st->start_time = ts; -+ -+ pos = avio_size(ic->pb) - 1; -+ do { -+ pos -= step; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); -+ step += step; -+ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); -+ -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ -+ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) -+ st->duration = ts - st->start_time; -+ } -+ -+ fill_all_stream_timings(ic); -+ -+ avio_seek(ic->pb, old_offset, SEEK_SET); -+} -+ - /* only usable for MPEG-PS streams */ - static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) - { -@@ -2506,6 +2541,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; -+ } else if (ic->iformat->read_timestamp && -+ file_size && ic->pb->seekable) { -+ /* get accurate estimate from the PTSes */ -+ av_estimate_timings_from_pts2(ic, old_offset); - } else { - /* less precise: use bitrate info */ - estimate_timings_from_bit_rate(ic); --- -2.1.0 - diff --git a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch deleted file mode 100644 index fb0aad1e13..0000000000 --- a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 4bcec3ef0042244b0ade00d132368d0872f73c72 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Wed, 8 Dec 2010 14:03:43 +0000 -Subject: [PATCH 09/13] changed: allow 4 second skew between streams in mov - before attempting to seek - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mov.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 8d66c0a..127ffd9 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -4028,8 +4028,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 && -- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || -- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { -+ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || -+ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { - sample = current_sample; - best_dts = dts; - *st = avst; --- -2.1.0 - diff --git a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch deleted file mode 100644 index d13d0730b8..0000000000 --- a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch +++ /dev/null @@ -1,44 +0,0 @@ -From cb7c19124165508ae5f38a385a14f9c13b096a27 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Fri, 26 Nov 2010 20:56:48 +0000 -Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??) - mpegts files with too large pes packets - -at-visions sample file brokenStream.mpg - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index d5a8a45..e070f1f 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -832,6 +832,10 @@ static void reset_pes_packet_state(PESContext *pes) - - static void new_pes_packet(PESContext *pes, AVPacket *pkt) - { -+ if(pkt->data) { -+ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); -+ av_free_packet(pkt); -+ } - av_init_packet(pkt); - - pkt->buf = pes->buffer; -@@ -2649,6 +2653,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) - - pkt->size = -1; - ts->pkt = pkt; -+ ts->pkt->data = NULL; -+ - ret = handle_packets(ts, 0); - if (ret < 0) { - av_free_packet(ts->pkt); --- -2.1.0 - diff --git a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch deleted file mode 100644 index 7c81f1d5fd..0000000000 --- a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c315a758a292200c22925603682e259849d6d558 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Mon, 28 Jun 2010 21:26:54 +0000 -Subject: [PATCH 11/13] Speed up mpegts av_find_stream_info - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index e070f1f..dd9e129 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -994,7 +994,7 @@ static int mpegts_push_data(MpegTSFilter *filter, - goto skip; - - /* stream not present in PMT */ -- if (!pes->st) { -+ if (ts->auto_guess && !pes->st) { - if (ts->skip_changes) - goto skip; - --- -2.1.0 - diff --git a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch deleted file mode 100644 index f346da131f..0000000000 --- a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 939ebbbc46ca9995637415594f1815633587104f Mon Sep 17 00:00:00 2001 -From: marc -Date: Mon, 18 Feb 2013 17:18:18 +0000 -Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start - with an I-Frame. - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/dxva2_h264.c | 8 ++++++++ - libavcodec/h264.c | 1 + - libavcodec/h264.h | 2 ++ - libavcodec/h264_slice.c | 1 + - 4 files changed, 12 insertions(+) - -diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c -index 6deccc3..85b25fd 100644 ---- a/libavcodec/dxva2_h264.c -+++ b/libavcodec/dxva2_h264.c -@@ -451,6 +451,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) - - if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) - return -1; -+ -+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs -+ if (!h->got_first_iframe) { -+ if (!(ctx_pic->pp.wBitFields & (1 << 15))) -+ return -1; -+ h->got_first_iframe = 1; -+ } -+ - ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, - &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 222bf58..ea2ec17 100644 ---- a/libavcodec/h264.c -+++ b/libavcodec/h264.c -@@ -1085,6 +1085,7 @@ void ff_h264_flush_change(H264Context *h) - h->mmco_reset = 1; - for (i = 0; i < h->nb_slice_ctx; i++) - h->slice_ctx[i].list_count = 0; -+ h->got_first_iframe = 0; - } - - /* forget old pics after a seek */ -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index b94f06b..bc9458b 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -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 - -+ int got_first_iframe; -+ - // Timestamp stuff - 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 53f61ca..b171d78 100644 ---- a/libavcodec/h264_slice.c -+++ b/libavcodec/h264_slice.c -@@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) - ff_h264_free_tables(h, 0); - h->first_field = 0; - h->prev_interlaced_frame = 1; -+ h->got_first_iframe = 0; - - init_scan_tables(h); - ret = ff_h264_alloc_tables(h); --- -2.1.0 - diff --git a/package/ffmpeg/Config.in b/package/ffmpeg/Config.in index e5981fee55..b5850db722 100644 --- a/package/ffmpeg/Config.in +++ b/package/ffmpeg/Config.in @@ -1,8 +1,13 @@ +config BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS + bool + # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW on nios2 + # No support for ARMv7-M in the ARM assembly logic + # Microblaze build affected by gcc PR71124 (infinite loop) + default y if !BR2_nios2 && !BR2_ARM_CPU_ARMV7M && !BR2_microblaze + menuconfig BR2_PACKAGE_FFMPEG bool "ffmpeg" - # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW - depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305 - depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201405 + depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS help FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. @@ -36,12 +41,16 @@ config BR2_PACKAGE_FFMPEG_FFMPEG config BR2_PACKAGE_FFMPEG_FFPLAY bool "Build ffplay" select BR2_PACKAGE_FFMPEG_SWSCALE - select BR2_PACKAGE_SDL + select BR2_PACKAGE_SDL2 + depends on !BR2_STATIC_LIBS # sdl2 help FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs. +comment "ffplay needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS + config BR2_PACKAGE_FFMPEG_FFSERVER bool "Build ffserver" depends on BR2_USE_MMU # fork() diff --git a/package/ffmpeg/ffmpeg.hash b/package/ffmpeg/ffmpeg.hash new file mode 100644 index 0000000000..6adf7e440a --- /dev/null +++ b/package/ffmpeg/ffmpeg.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 54ce502aca10b7e6059f19220ea2f68fa0c9c4c4d255ae13e615f08f0c94dcc5 ffmpeg-3.2.3.tar.xz diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 5ba1ce091f..6540d41c52 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -4,11 +4,10 @@ # ################################################################################ -FFMPEG_VERSION = 2.8.7 -FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.bz2 +FFMPEG_VERSION = 3.2.3 +FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES -FFMPEG_INSTALL_TARGET = NO FFMPEG_LICENSE = LGPLv2.1+, libjpeg license FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1 @@ -19,8 +18,6 @@ endif FFMPEG_CONF_OPTS = \ --prefix=/usr \ - --enable-static \ - --disable-shared \ --enable-avfilter \ --disable-version3 \ --enable-logging \ @@ -39,29 +36,25 @@ FFMPEG_CONF_OPTS = \ --enable-mdct \ --enable-rdft \ --disable-crystalhd \ - --disable-vdpau \ --disable-dxva2 \ --enable-runtime-cpudetect \ --disable-hardcoded-tables \ --disable-memalign-hack \ + --disable-mipsdsp \ + --disable-mipsdspr2 \ --disable-msa \ --enable-hwaccels \ --disable-avisynth \ --disable-frei0r \ --disable-libopencore-amrnb \ --disable-libopencore-amrwb \ - --disable-libopencv \ + --disable-libcdio \ --disable-libdc1394 \ - --disable-libfaac \ --disable-libgsm \ - --disable-libmp3lame \ + --disable-libilbc \ --disable-libnut \ --disable-libopenjpeg \ - --disable-librtmp \ --disable-libschroedinger \ - --disable-libspeex \ - --disable-libtheora \ - --disable-libvo-aacenc \ --disable-libvo-amrwbenc \ --disable-symver \ --disable-doc @@ -87,9 +80,9 @@ FFMPEG_CONF_OPTS += --disable-ffmpeg endif ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y) -FFMPEG_DEPENDENCIES += sdl +FFMPEG_DEPENDENCIES += sdl2 FFMPEG_CONF_OPTS += --enable-ffplay -FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config +FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config else FFMPEG_CONF_OPTS += --disable-ffplay endif @@ -196,6 +189,18 @@ else FFMPEG_CONF_OPTS += --disable-bzlib endif +ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy) +FFMPEG_CONF_OPTS += --enable-libfdk-aac +FFMPEG_DEPENDENCIES += fdk-aac +else +FFMPEG_CONF_OPTS += --disable-libfdk-aac +endif + +ifeq ($(BR2_PACKAGE_GNUTLS),y) +FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl +FFMPEG_DEPENDENCIES += gnutls +else +FFMPEG_CONF_OPTS += --disable-gnutls ifeq ($(BR2_PACKAGE_OPENSSL),y) # openssl isn't license compatible with GPL ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx) @@ -207,6 +212,18 @@ endif else FFMPEG_CONF_OPTS += --disable-openssl endif +endif + +ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy) +FFMPEG_DEPENDENCIES += libebur128 +endif + +ifeq ($(BR2_PACKAGE_LIBOPENH264),y) +FFMPEG_CONF_OPTS += --enable-libopenh264 +FFMPEG_DEPENDENCIES += libopenh264 +else +FFMPEG_CONF_OPTS += --disable-libopenh264 +endif ifeq ($(BR2_PACKAGE_LIBVORBIS),y) FFMPEG_DEPENDENCIES += libvorbis @@ -223,6 +240,25 @@ else FFMPEG_CONF_OPTS += --disable-vaapi endif +ifeq ($(BR2_PACKAGE_LIBVDPAU),y) +FFMPEG_CONF_OPTS += --enable-vdpau +FFMPEG_DEPENDENCIES += libvdpau +else +FFMPEG_CONF_OPTS += --disable-vdpau +endif + +# To avoid a circular dependency only use opencv if opencv itself does +# not depend on ffmpeg. +ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx) +FFMPEG_CONF_OPTS += --enable-libopencv +FFMPEG_DEPENDENCIES += opencv +else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx) +FFMPEG_CONF_OPTS += --enable-libopencv +FFMPEG_DEPENDENCIES += opencv3 +else +FFMPEG_CONF_OPTS += --disable-libopencv +endif + ifeq ($(BR2_PACKAGE_OPUS),y) FFMPEG_CONF_OPTS += --enable-libopus FFMPEG_DEPENDENCIES += opus @@ -237,6 +273,62 @@ else FFMPEG_CONF_OPTS += --disable-libvpx endif +ifeq ($(BR2_PACKAGE_LIBASS),y) +FFMPEG_CONF_OPTS += --enable-libass +FFMPEG_DEPENDENCIES += libass +else +FFMPEG_CONF_OPTS += --disable-libass +endif + +ifeq ($(BR2_PACKAGE_LIBBLURAY),y) +FFMPEG_CONF_OPTS += --enable-libbluray +FFMPEG_DEPENDENCIES += libbluray +else +FFMPEG_CONF_OPTS += --disable-libbluray +endif + +ifeq ($(BR2_PACKAGE_RTMPDUMP),y) +FFMPEG_CONF_OPTS += --enable-librtmp +FFMPEG_DEPENDENCIES += rtmpdump +else +FFMPEG_CONF_OPTS += --disable-librtmp +endif + +ifeq ($(BR2_PACKAGE_LAME),y) +FFMPEG_CONF_OPTS += --enable-libmp3lame +FFMPEG_DEPENDENCIES += lame +else +FFMPEG_CONF_OPTS += --disable-libmp3lame +endif + +ifeq ($(BR2_PACKAGE_LIBMODPLUG),y) +FFMPEG_CONF_OPTS += --enable-libmodplug +FFMPEG_DEPENDENCIES += libmodplug +else +FFMPEG_CONF_OPTS += --disable-libmodplug +endif + +ifeq ($(BR2_PACKAGE_SPEEX),y) +FFMPEG_CONF_OPTS += --enable-libspeex +FFMPEG_DEPENDENCIES += speex +else +FFMPEG_CONF_OPTS += --disable-libspeex +endif + +ifeq ($(BR2_PACKAGE_LIBTHEORA),y) +FFMPEG_CONF_OPTS += --enable-libtheora +FFMPEG_DEPENDENCIES += libtheora +else +FFMPEG_CONF_OPTS += --disable-libtheora +endif + +ifeq ($(BR2_PACKAGE_WAVPACK),y) +FFMPEG_CONF_OPTS += --enable-libwavpack +FFMPEG_DEPENDENCIES += wavpack +else +FFMPEG_CONF_OPTS += --disable-libwavpack +endif + # ffmpeg freetype support require fenv.h which is only # available/working on glibc. # The microblaze variant doesn't provide the needed exceptions @@ -261,6 +353,13 @@ else FFMPEG_CONF_OPTS += --disable-libx264 endif +ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy) +FFMPEG_CONF_OPTS += --enable-libx265 +FFMPEG_DEPENDENCIES += x265 +else +FFMPEG_CONF_OPTS += --disable-libx265 +endif + ifeq ($(BR2_X86_CPU_HAS_MMX),y) FFMPEG_CONF_OPTS += --enable-yasm FFMPEG_DEPENDENCIES += host-yasm @@ -340,33 +439,17 @@ FFMPEG_CONF_OPTS += --disable-vfp endif ifeq ($(BR2_ARM_CPU_HAS_NEON),y) FFMPEG_CONF_OPTS += --enable-neon -endif - -ifeq ($(BR2_MIPS_SOFT_FLOAT),y) -FFMPEG_CONF_OPTS += \ - --disable-mipsfpu -else -FFMPEG_CONF_OPTS += \ - --enable-mipsfpu -endif - -ifeq ($(BR2_mips_32r2),y) -FFMPEG_CONF_OPTS += \ - --enable-mips32r2 else -FFMPEG_CONF_OPTS += \ - --disable-mips32r2 +FFMPEG_CONF_OPTS += --disable-neon endif -ifeq ($(BR2_mips_64r2),y) -FFMPEG_CONF_OPTS += \ - --enable-mipsdspr1 \ - --enable-mipsdspr2 +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +ifeq ($(BR2_MIPS_SOFT_FLOAT),y) +FFMPEG_CONF_OPTS += --disable-mipsfpu else -FFMPEG_CONF_OPTS += \ - --disable-mipsdspr1 \ - --disable-mipsdspr2 +FFMPEG_CONF_OPTS += --enable-mipsfpu endif +endif # MIPS ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y) FFMPEG_CONF_OPTS += --enable-altivec @@ -380,14 +463,19 @@ else FFMPEG_CONF_OPTS += --disable-pic endif -FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) - -ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) +# Default to --cpu=generic for MIPS architecture, in order to avoid a +# warning from ffmpeg's configure script. +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +FFMPEG_CONF_OPTS += --cpu=generic +else ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU) else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH) endif + +FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) + # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others define FFMPEG_CONFIGURE_CMDS (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \ diff --git a/package/x264/x264.hash b/package/x264/x264.hash new file mode 100644 index 0000000000..95510938e0 --- /dev/null +++ b/package/x264/x264.hash @@ -0,0 +1,2 @@ +# Locally computed +sha256 9fc4651981453d0428a2ad16889b6b63d1f2e7347ea321f20347fc3a021ee912 x264-97eaef2ab82a46d13ea5e00270712d6475fbe42b.tar.gz diff --git a/package/x264/x264.mk b/package/x264/x264.mk index 66b327f4e0..80437c408c 100644 --- a/package/x264/x264.mk +++ b/package/x264/x264.mk @@ -4,7 +4,7 @@ # ################################################################################ -X264_VERSION = stable +X264_VERSION = 97eaef2ab82a46d13ea5e00270712d6475fbe42b X264_SITE = git://git.videolan.org/x264.git X264_LICENSE = GPLv2+ X264_DEPENDENCIES = host-pkgconf @@ -13,8 +13,10 @@ X264_INSTALL_STAGING = YES X264_CONF_OPTS = --disable-avs ifeq ($(BR2_i386)$(BR2_x86_64),y) +# yasm needed for assembly files X264_DEPENDENCIES += host-yasm -else ifeq ($(BR2_ARM_CPU_ARMV7A),y) +X264_CONF_ENV += AS="$(HOST_DIR)/usr/bin/yasm" +else ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_aarch64),y) # We need to pass gcc as AS, because the ARM assembly files have to be # preprocessed X264_CONF_ENV += AS="$(TARGET_CC)" @@ -23,7 +25,7 @@ X264_CONF_OPTS += --disable-asm endif ifeq ($(BR2_STATIC_LIBS),) -X264_CONF_OPTS += --enable-pic +X264_CONF_OPTS += --enable-pic --enable-shared endif ifeq ($(BR2_PACKAGE_X264_CLI),) From c140e080eefd1514e9b4eb9165a2df86b1e11557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 18 May 2017 13:06:32 +0200 Subject: [PATCH 02/40] revert kernel rpi3 due to issue with ffmpeg --- configs/raspberrypi3_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/raspberrypi3_defconfig b/configs/raspberrypi3_defconfig index a9dbe08d66..ced74a6833 100644 --- a/configs/raspberrypi3_defconfig +++ b/configs/raspberrypi3_defconfig @@ -24,7 +24,7 @@ BR2_ROOTFS_OVERLAY="board/common/overlay board/raspberrypi3/overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/common/postscript.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_TARBALL=y -BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/04c8e47067d4873c584395e5cb260b4f170a99ea.tar.gz" +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/a59ca8f1e8e068dd58bc453dc88295e7045dafcf.tar.gz" BR2_LINUX_KERNEL_DEFCONFIG="bcm2709" BR2_LINUX_KERNEL_ZIMAGE=y BR2_LINUX_KERNEL_DTS_SUPPORT=y From 9ab4cde950d8b1db458ac645492c0b3313b6c9d5 Mon Sep 17 00:00:00 2001 From: cedricve Date: Thu, 18 May 2017 19:41:18 +0200 Subject: [PATCH 03/40] dont install target ffmpeg --- package/ffmpeg/ffmpeg.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 6540d41c52..9fa9d50b37 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -8,6 +8,7 @@ FFMPEG_VERSION = 3.2.3 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES +FFMPEG_INSTALL_TARGET = NO FFMPEG_LICENSE = LGPLv2.1+, libjpeg license FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1 From a8566755cc4fd207e3d82baaeed26624a452929f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Fri, 19 May 2017 11:44:20 +0200 Subject: [PATCH 04/40] enable-static --- package/ffmpeg/ffmpeg.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 9fa9d50b37..ee0c2fa100 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -19,6 +19,8 @@ endif FFMPEG_CONF_OPTS = \ --prefix=/usr \ + --enable-static \ + --disable-shared \ --enable-avfilter \ --disable-version3 \ --enable-logging \ From 375d4a0102cac3940c313843452288d20a1e7b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Fri, 19 May 2017 11:45:28 +0200 Subject: [PATCH 05/40] Update x264.mk --- package/x264/x264.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/x264/x264.mk b/package/x264/x264.mk index 80437c408c..fde976d58b 100644 --- a/package/x264/x264.mk +++ b/package/x264/x264.mk @@ -25,7 +25,7 @@ X264_CONF_OPTS += --disable-asm endif ifeq ($(BR2_STATIC_LIBS),) -X264_CONF_OPTS += --enable-pic --enable-shared +X264_CONF_OPTS += --enable-pic endif ifeq ($(BR2_PACKAGE_X264_CLI),) From db6ea89984f1f538a5b23a99af117736f366723c Mon Sep 17 00:00:00 2001 From: cedricve Date: Fri, 19 May 2017 11:49:47 +0200 Subject: [PATCH 06/40] remove gdb and gdbserver --- configs/raspberrypi2_defconfig | 2 -- configs/raspberrypi3_defconfig | 2 -- configs/raspberrypi_defconfig | 2 -- 3 files changed, 6 deletions(-) diff --git a/configs/raspberrypi2_defconfig b/configs/raspberrypi2_defconfig index 76b83b6931..2409ced9ee 100644 --- a/configs/raspberrypi2_defconfig +++ b/configs/raspberrypi2_defconfig @@ -158,5 +158,3 @@ BR2_PACKAGE_EIGEN=y BR2_PACKAGE_KERBEROSIO_WEB=y BR2_PACKAGE_KERBEROSIO_MACHINERY=y BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y -BR2_PACKAGE_GDB=y -BR2_PACKAGE_GDB_DEBUGGER=y diff --git a/configs/raspberrypi3_defconfig b/configs/raspberrypi3_defconfig index ced74a6833..af9ce74a00 100644 --- a/configs/raspberrypi3_defconfig +++ b/configs/raspberrypi3_defconfig @@ -159,5 +159,3 @@ BR2_PACKAGE_EIGEN=y BR2_PACKAGE_KERBEROSIO_WEB=y BR2_PACKAGE_KERBEROSIO_MACHINERY=y BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y -BR2_PACKAGE_GDB=y -BR2_PACKAGE_GDB_DEBUGGER=y diff --git a/configs/raspberrypi_defconfig b/configs/raspberrypi_defconfig index 4b8a6ba38a..9c016c26e6 100644 --- a/configs/raspberrypi_defconfig +++ b/configs/raspberrypi_defconfig @@ -158,5 +158,3 @@ BR2_PACKAGE_EIGEN=y BR2_PACKAGE_KERBEROSIO_WEB=y BR2_PACKAGE_KERBEROSIO_MACHINERY=y BR2_PACKAGE_KERBEROSIO_MACHINERY_RPI=y -BR2_PACKAGE_GDB=y -BR2_PACKAGE_GDB_DEBUGGER=y From 1e3204a2f3fce1876e12538fe9c3163171aeddf5 Mon Sep 17 00:00:00 2001 From: cedricve Date: Sun, 21 May 2017 22:13:44 +0200 Subject: [PATCH 07/40] upgrade ffmpeg compile flags + enable bellagio hw accel --- package/ffmpeg/ffmpeg.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index ee0c2fa100..5a728092dd 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -1,3 +1,4 @@ + ################################################################################ # # ffmpeg @@ -9,6 +10,7 @@ FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES FFMPEG_INSTALL_TARGET = NO +FFMPEG_DEPENDENCIES = bellagio FFMPEG_LICENSE = LGPLv2.1+, libjpeg license FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1 @@ -20,7 +22,9 @@ endif FFMPEG_CONF_OPTS = \ --prefix=/usr \ --enable-static \ - --disable-shared \ + --disable-shared \ + --enable-omx \ + --enable-omx-rpi \ --enable-avfilter \ --disable-version3 \ --enable-logging \ @@ -494,7 +498,6 @@ define FFMPEG_CONFIGURE_CMDS --target-os="linux" \ --disable-stripping \ --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \ - $(SHARED_STATIC_LIBS_OPTS) \ $(FFMPEG_CONF_OPTS) \ ) endef From b2b3876667e886606b3ba762c7f850a86eca1168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 8 Jun 2017 13:42:39 +0200 Subject: [PATCH 08/40] upgrade userland and firmware + new directories for machinery + removal of big (unused) dependencies in web --- board/common/overlay/etc/init.d/S85machinery | 6 ++++-- .../kerberosio-machinery.mk | 14 ++++++++------ package/kerberosio-web/kerberosio-web.mk | 17 ++++++++++------- package/rpi-firmware/rpi-firmware.mk | 2 +- package/rpi-userland/rpi-userland.mk | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/board/common/overlay/etc/init.d/S85machinery b/board/common/overlay/etc/init.d/S85machinery index 01c2d814c3..b141ab233c 100755 --- a/board/common/overlay/etc/init.d/S85machinery +++ b/board/common/overlay/etc/init.d/S85machinery @@ -14,12 +14,14 @@ if [ -f $sys_conf ] && ! [ -f $conf ]; then chmod -R 777 /data/machinery/logs mkdir -p /data/machinery/capture chmod -R 777 /data/machinery/capture + mkdir -p /data/machinery/h264 + chmod -R 777 /data/machinery/h264 fi watch() { while true; do sleep 3 - + pid=$(pgrep -l kerberosio | cut -d ' ' -f 1) if [ "$pid" = "" ]; then echo "Starting kerberos.io machinery" @@ -27,7 +29,7 @@ watch() { pkill -f kerberosio kerberosio --config $conf & fi - + if [[ $(df -h | grep /dev/mmcblk0p3 | head -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]]; then echo "Cleaning disk" diff --git a/package/kerberosio-machinery/kerberosio-machinery.mk b/package/kerberosio-machinery/kerberosio-machinery.mk index eb6b424a26..05bed5f5e1 100644 --- a/package/kerberosio-machinery/kerberosio-machinery.mk +++ b/package/kerberosio-machinery/kerberosio-machinery.mk @@ -32,14 +32,16 @@ define KERBEROSIO_MACHINERY_BIND_DIRS_TO_DATA # Link directories to data folder rm -rf $(TARGET_DIR)/etc/opt/kerberosio/capture - ln -s /data/machinery/capture $(TARGET_DIR)/etc/opt/kerberosio/capture - rm -rf $(TARGET_DIR)/etc/opt/kerberosio/logs - ln -s /data/machinery/logs $(TARGET_DIR)/etc/opt/kerberosio/logs - rm -rf $(TARGET_DIR)/etc/opt/kerberosio/symbols - ln -s /data/machinery/symbols $(TARGET_DIR)/etc/opt/kerberosio/symbols + ln -s /data/machinery/capture $(TARGET_DIR)/etc/opt/kerberosio/capture + rm -rf $(TARGET_DIR)/etc/opt/kerberosio/logs + ln -s /data/machinery/logs $(TARGET_DIR)/etc/opt/kerberosio/logs + rm -rf $(TARGET_DIR)/etc/opt/kerberosio/symbols + ln -s /data/machinery/symbols $(TARGET_DIR)/etc/opt/kerberosio/symbols + rm -rf $(TARGET_DIR)/etc/opt/kerberosio/h264 + ln -s /data/machinery/symbols $(TARGET_DIR)/etc/opt/kerberosio/h264 endef KERBEROSIO_MACHINERY_POST_INSTALL_TARGET_HOOKS += KERBEROSIO_MACHINERY_BIND_DIRS_TO_DATA -$(eval $(cmake-package)) \ No newline at end of file +$(eval $(cmake-package)) diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 8ae57cb9c3..138b4b78ec 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -12,7 +12,7 @@ KERBEROSIO_WEB_DEPENDENCIES = kerberosio-machinery nginx php ########################################################################## # -# The configuration requires to have PHP (+ curl and mcrypt extension) and +# The configuration requires to have PHP (+ curl and mcrypt extension) and # nodejs/bower installed on the build machine. # @@ -24,8 +24,11 @@ define KERBEROSIO_WEB_BUILD_CMDS php composer.phar install; \ cd public; \ bower install --allow-root; \ + npm install grunt-contrib-watch grunt-contrib-less grunt-contrib-cssmin grunt-contrib-clean; \ + grunt cleanUpJS; \ + rm -rf node_modules; \ ) -endef +endef ########################################################################## # @@ -33,7 +36,7 @@ endef # define KERBEROSIO_WEB_INSTALL_TARGET_CMDS - + rm -rf $(TARGET_DIR)/var/www/web mkdir -p $(TARGET_DIR)/var/www/web cp -R $(@D)/* $(TARGET_DIR)/var/www/web @@ -41,10 +44,10 @@ define KERBEROSIO_WEB_INSTALL_TARGET_CMDS sed -i "s#__DIR__.'/../app/storage'#'/data/web/app/storage'#g" $(TARGET_DIR)/var/www/web/bootstrap/paths.php sed -i "s#app_path() . '/config'#'/data/web/app/config'#g" $(TARGET_DIR)/var/www/web/app/controllers/UserController.php sed -i "s#app_path() . '/config'#'/data/web/app/config'#g" $(TARGET_DIR)/var/www/web/app/controllers/SettingsController.php - + # enable memcached cat $(TARGET_DIR)/etc/php.ini | grep -q extension=memcached.so || echo "extension=memcached.so" >> $(TARGET_DIR)/etc/php.ini - -endef -$(eval $(generic-package)) \ No newline at end of file +endef + +$(eval $(generic-package)) diff --git a/package/rpi-firmware/rpi-firmware.mk b/package/rpi-firmware/rpi-firmware.mk index 9685f403e8..b8e90f103d 100644 --- a/package/rpi-firmware/rpi-firmware.mk +++ b/package/rpi-firmware/rpi-firmware.mk @@ -4,7 +4,7 @@ # ################################################################################ -RPI_FIRMWARE_VERSION = b51046a2b2bb69771579a549d157205d9982f858 +RPI_FIRMWARE_VERSION = 0f315f88ac91f9be93544bfd757f8d55ca4cf099 RPI_FIRMWARE_SITE = $(call github,raspberrypi,firmware,$(RPI_FIRMWARE_VERSION)) RPI_FIRMWARE_LICENSE = BSD-3c RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom diff --git a/package/rpi-userland/rpi-userland.mk b/package/rpi-userland/rpi-userland.mk index 362bf918c8..0d72a21ae3 100644 --- a/package/rpi-userland/rpi-userland.mk +++ b/package/rpi-userland/rpi-userland.mk @@ -4,7 +4,7 @@ # ################################################################################ -RPI_USERLAND_VERSION = cdb5da59f939eb4078e90ed0e3c231c498ba9957 +RPI_USERLAND_VERSION = 126f3de96f1c7d477a02d703fc285528cbce0540 RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION)) RPI_USERLAND_LICENSE = BSD-3c RPI_USERLAND_LICENSE_FILES = LICENCE From 8ba309b4f40ceafecfab69b4b7f170420dd2dbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Sun, 11 Jun 2017 22:54:42 +0200 Subject: [PATCH 09/40] fix patch for machinery --- ...m-support-to-cmake-external-projects.patch | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/package/kerberosio-machinery/0001-add-arm-support-to-cmake-external-projects.patch b/package/kerberosio-machinery/0001-add-arm-support-to-cmake-external-projects.patch index 7dadd5ddaf..54f6a3ae57 100644 --- a/package/kerberosio-machinery/0001-add-arm-support-to-cmake-external-projects.patch +++ b/package/kerberosio-machinery/0001-add-arm-support-to-cmake-external-projects.patch @@ -1,17 +1,22 @@ -From 079fe3c129bafccfe6a31508ea626b8c7aad7586 Mon Sep 17 00:00:00 2001 -From: cedricve -Date: Mon, 30 Jan 2017 19:34:16 +0100 -Subject: [PATCH] add arm support to cmake - external projects +From 99be82354aa868c3fe2be3be4bba6ab1d57dc422 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= +Date: Sun, 11 Jun 2017 16:23:44 +0200 +Subject: [PATCH 1/1] update openmax +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Signed-off-by: Cédric Verstraeten --- cmake/External-Googletest.cmake | 3 ++- cmake/External-OpenCV.cmake | 13 +++++++------ + cmake/External-OpenMax.cmake | 3 ++- cmake/External-RaspiCam.cmake | 3 ++- cmake/External-Restclient.cmake | 4 ++-- - 4 files changed, 13 insertions(+), 10 deletions(-) + 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cmake/External-Googletest.cmake b/cmake/External-Googletest.cmake -index 926e637..c0fb3ed 100644 +index 926e637..c0fb3ed 100755 --- a/cmake/External-Googletest.cmake +++ b/cmake/External-Googletest.cmake @@ -10,6 +10,7 @@ ExternalProject_Add(googletest @@ -30,7 +35,7 @@ index 926e637..c0fb3ed 100644 \ No newline at end of file +set(GOOGLETEST_LIBRARIES "${GOOGLETEST_LIBRARY_DIR}googlemock/libgmock.a" "${GOOGLETEST_LIBRARY_DIR}googlemock/libgmock_main.a") diff --git a/cmake/External-OpenCV.cmake b/cmake/External-OpenCV.cmake -index 1a1c739..c155349 100644 +index 2020e5c..715bda0 100755 --- a/cmake/External-OpenCV.cmake +++ b/cmake/External-OpenCV.cmake @@ -48,12 +48,13 @@ ExternalProject_Add(opencv @@ -64,8 +69,22 @@ index 1a1c739..c155349 100644 -endif() \ No newline at end of file +endif() +diff --git a/cmake/External-OpenMax.cmake b/cmake/External-OpenMax.cmake +index c9638a0..e5211dd 100755 +--- a/cmake/External-OpenMax.cmake ++++ b/cmake/External-OpenMax.cmake +@@ -24,7 +24,8 @@ ExternalProject_Add(openmax + INSTALL_COMMAND "" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/thirdparty +- -DBUILD_SHARED_LIBS=OFF ++ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/../../host/usr/share/buildroot/toolchainfile.cmake ++ -DBUILD_SHARED_LIBS=OFF + ) + + set(OPENMAX_INCLUDE_DIR ${CMAKE_BINARY_DIR}/openmax/include/) diff --git a/cmake/External-RaspiCam.cmake b/cmake/External-RaspiCam.cmake -index 36e7d1f..c9ef1a2 100644 +index 36e7d1f..c9ef1a2 100755 --- a/cmake/External-RaspiCam.cmake +++ b/cmake/External-RaspiCam.cmake @@ -24,6 +24,7 @@ ExternalProject_Add(raspicamera @@ -84,7 +103,7 @@ index 36e7d1f..c9ef1a2 100644 \ No newline at end of file +link_directories(${RASPBERRYPI_LIBRARY_DIR}) diff --git a/cmake/External-Restclient.cmake b/cmake/External-Restclient.cmake -index 34eb211..b192d58 100644 +index 34eb211..b67d0ff 100755 --- a/cmake/External-Restclient.cmake +++ b/cmake/External-Restclient.cmake @@ -7,7 +7,7 @@ ExternalProject_Add(restclient @@ -92,7 +111,7 @@ index 34eb211..b192d58 100644 UPDATE_COMMAND "" PATCH_COMMAND "" - CONFIGURE_COMMAND ./autogen.sh && ./configure -+ CONFIGURE_COMMAND ./autogen.sh && ./configure --host=arm-buildroot-linux-gnueabihf ++ CONFIGURE_COMMAND CONFIGURE_COMMAND ./autogen.sh && ./configure --host=arm-buildroot-linux-gnueabihf BUILD_COMMAND make && mkdir -p ../thirdparty/lib/ && cp .libs/librestclient-cpp.a ../thirdparty/lib/ INSTALL_COMMAND "" ) @@ -104,5 +123,5 @@ index 34eb211..b192d58 100644 \ No newline at end of file +link_directories(${RESTCLIENT_LIBRARY_DIR}) -- -2.5.0 +2.12.0 From c489a411e5b6ed5c9a9e93c3a6abcc573cbc34c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 17:41:20 +0200 Subject: [PATCH 10/40] new upgrade file for 2.4.0 and procedure to install web --- board/common/overlay/etc/init.d/S86web | 17 ++-- .../overlay/usr/share/post-upgrade/2.4.0.sh | 77 +++++++++++++++++++ package/kerberosio-web/kerberosio-web.mk | 4 - 3 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 board/common/overlay/usr/share/post-upgrade/2.4.0.sh diff --git a/board/common/overlay/etc/init.d/S86web b/board/common/overlay/etc/init.d/S86web index fee86ce6b1..273d8eeb13 100755 --- a/board/common/overlay/etc/init.d/S86web +++ b/board/common/overlay/etc/init.d/S86web @@ -5,13 +5,18 @@ conf="/data/web/app" start() { echo "Configuring kerberos.io web" - + if [ -d $sys_conf ] && ! [ -d $conf ]; then - mkdir -p /data/web/app - cp -R /var/www/web/app/storage /data/web/app - cp -R /var/www/web/app/config /data/web/app - sed -i "s#__DIR__.'/../views'#'/var/www/web/app/views'#g" /data/web/app/config/view.php - chmod -R 777 /data/web/app + mkdir -p /data/web/ + + cp -R /var/www/web/storage /data/web/ + chmod -R 777 /data/web/storage + + cp -R /var/www/web/config /data/web/ + chmod -R 777 /data/web/config/kerberos.php + + cp -R /var/www/web/bootstrap /data/web/ + chmod -R 777 /data/web/bootstrap/cache fi } diff --git a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh new file mode 100644 index 0000000000..f0ab44ba93 --- /dev/null +++ b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +########################################## +# +# Update configuration files for machinery +# + +KERBEROS_CONFIG_DIR="/etc/opt/kerberosio/config" +DATA_CONFIG_DIR="/data/machinery/config" +TEMP_CONFIG_DIR="/tmp/config" + +# Copy files to tmp folder and overwrite data config files + +rm -rf $TEMP_CONFIG_DIR +mkdir -p $TEMP_CONFIG_DIR +cp -r $DATA_CONFIG_DIR/* $TEMP_CONFIG_DIR +cp -r $KERBEROS_CONFIG_DIR/* $DATA_CONFIG_DIR + +# Loop over old config files and adjust new configuration +# with previous values. + +for oldfile in $TEMP_CONFIG_DIR/* +do + for newfile in $DATA_CONFIG_DIR/* + do + if [ ${oldfile#$TEMP_CONFIG_DIR} == ${newfile#$DATA_CONFIG_DIR} ] + then + lineNumber=1 + + while read p + do + name=`echo $p | grep -E "\<(.*?)\>(.*?)<(.*?)\>" | cut -d ">" -f1 | cut -d "<" -f2 | cut -d " " -f1` + value=`echo $p | grep -E "\<(.*?)\>(.*?)<(.*?)\>" | cut -d ">" -f2 | cut -d "<" -f1` + + if [ -n "$name" ] + then + #echo "looking for " $name " in " $newfile " with old value " $value + + while read -r line ; do + number=`echo $line | cut -d ':' -f1` + if [[ $lineNumber -le $number ]] + then + newvalue=`echo $line | sed -e "s/^$number:[ \t]*//"` + if [[ "$p" != "$newvalue" ]] + then + sed $number"s#$newvalue#$p#" $newfile > $newfile"_" + mv $newfile"_" $newfile + fi + lineNumber=$number + break + fi + done <<< "$(grep -n "$name " $newfile)" + fi + + done < $oldfile + fi + done +done + +chmod -R 777 $DATA_CONFIG_DIR + +########################################## +# +# Update configuration files for web +# + +cp -R /var/www/web/storage /data/web/ +chmod -R 777 /data/web/storage + +cp -R /var/www/web/config /data/web/ +mv /data/web/app/config/kerberos.php /data/web/config/kerberos.php +chmod 777 /data/web/config/kerberos.php + +cp -R /var/www/web/bootstrap /data/web/ +chmod -R 777 /data/web/bootstrap/cache + +rm -rf /data/web/app diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 138b4b78ec..9c9d7546a0 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -40,10 +40,6 @@ define KERBEROSIO_WEB_INSTALL_TARGET_CMDS rm -rf $(TARGET_DIR)/var/www/web mkdir -p $(TARGET_DIR)/var/www/web cp -R $(@D)/* $(TARGET_DIR)/var/www/web - sed -i "s#\$$this\['path'\] . '/config'#'/data/web/app/config'#g" $(TARGET_DIR)/var/www/web/bootstrap/compiled.php - sed -i "s#__DIR__.'/../app/storage'#'/data/web/app/storage'#g" $(TARGET_DIR)/var/www/web/bootstrap/paths.php - sed -i "s#app_path() . '/config'#'/data/web/app/config'#g" $(TARGET_DIR)/var/www/web/app/controllers/UserController.php - sed -i "s#app_path() . '/config'#'/data/web/app/config'#g" $(TARGET_DIR)/var/www/web/app/controllers/SettingsController.php # enable memcached cat $(TARGET_DIR)/etc/php.ini | grep -q extension=memcached.so || echo "extension=memcached.so" >> $(TARGET_DIR)/etc/php.ini From 1e6a57d750a4b7c2a2b1a7058e84411c4bc0108e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 17:44:25 +0200 Subject: [PATCH 11/40] try new branches --- package/kerberosio-machinery/kerberosio-machinery.mk | 2 +- package/kerberosio-web/kerberosio-web.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kerberosio-machinery/kerberosio-machinery.mk b/package/kerberosio-machinery/kerberosio-machinery.mk index 05bed5f5e1..1ef9b22a80 100644 --- a/package/kerberosio-machinery/kerberosio-machinery.mk +++ b/package/kerberosio-machinery/kerberosio-machinery.mk @@ -4,7 +4,7 @@ # ############################################################# -KERBEROSIO_MACHINERY_VERSION = develop +KERBEROSIO_MACHINERY_VERSION = openmax-il KERBEROSIO_MACHINERY_SITE = https://github.com/kerberos-io/machinery KERBEROSIO_MACHINERY_SITE_METHOD = git KERBEROSIO_MACHINERY_INSTALL_TARGET = YES diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 9c9d7546a0..04c94f26c5 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -4,7 +4,7 @@ # ############################################################# -KERBEROSIO_WEB_VERSION = develop +KERBEROSIO_WEB_VERSION = upgrade-to-5-4 KERBEROSIO_WEB_SITE = https://github.com/kerberos-io/web KERBEROSIO_WEB_SITE_METHOD = git KERBEROSIO_WEB_INSTALL_TARGET = YES From cdff1f5a57177e3f2401899d2d42723d88823480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 17:53:43 +0200 Subject: [PATCH 12/40] change config --- .../0001-change-config-path.patch | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/package/kerberosio-web/0001-change-config-path.patch b/package/kerberosio-web/0001-change-config-path.patch index 663f2bec4c..f55d95fd6e 100644 --- a/package/kerberosio-web/0001-change-config-path.patch +++ b/package/kerberosio-web/0001-change-config-path.patch @@ -1,26 +1,25 @@ -From fd8c7cee3e228f976aa42c8bd820136a47bfa438 Mon Sep 17 00:00:00 2001 -From: cedricve -Date: Sat, 19 Mar 2016 18:00:18 -0400 +From e43f0f461f3e0caa6ecdcf897771fd76687cb289 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= +Date: Wed, 21 Jun 2017 17:53:14 +0200 Subject: [PATCH 1/1] change config path -Signed-off-by: cedricve --- - app/config/app.php | 2 +- + config/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/app/config/app.php b/app/config/app.php -index b1832f3..a5e8dfe 100644 ---- a/app/config/app.php -+++ b/app/config/app.php -@@ -35,7 +35,7 @@ return array( - - 'version' => '2.0.0', - -- 'config' => '/etc/opt/kerberosio/config', -+ 'config' => '/data/machinery/config', +diff --git a/config/app.php b/config/app.php +index 65b65eb..275996c 100644 +--- a/config/app.php ++++ b/config/app.php +@@ -15,7 +15,7 @@ return [ - 'filesystem' => [ + 'version' => '2.2.1', + +- 'config' => '/etc/opt/kerberosio/config', ++ 'config' => '/data/machinery/config', + + 'filesystem' => [ -- -1.9.1 +2.12.0 From a2a3a9a589593e98fbe9d6484a8cd4daf2e74caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 20:19:23 +0200 Subject: [PATCH 13/40] ignore dev --- package/kerberosio-web/kerberosio-web.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 04c94f26c5..a74c50530b 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -21,7 +21,7 @@ define KERBEROSIO_WEB_BUILD_CMDS php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php; \ php composer-setup.php; \ php -r "unlink('composer-setup.php');"; \ - php composer.phar install; \ + php composer.phar install --no-dev; \ cd public; \ bower install --allow-root; \ npm install grunt-contrib-watch grunt-contrib-less grunt-contrib-cssmin grunt-contrib-clean; \ From af9062a730c580ef65527edb7620fac713c764c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 20:32:05 +0200 Subject: [PATCH 14/40] increase version + fix mkrelease --- board/common/overlay/etc/version | 2 +- mkrelease.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/board/common/overlay/etc/version b/board/common/overlay/etc/version index 41344c5006..a206e2ff07 100644 --- a/board/common/overlay/etc/version +++ b/board/common/overlay/etc/version @@ -1,4 +1,4 @@ os_name="Kerberos.io OS" os_short_name="kios" os_prefix="kios" -os_version="2.3.1" +os_version="2.4.0" diff --git a/mkrelease.sh b/mkrelease.sh index e5f23c1ff0..d1416cc67e 100755 --- a/mkrelease.sh +++ b/mkrelease.sh @@ -23,18 +23,18 @@ echo "Preparing release for Raspberry Pi board" mkdir -p $DIR/releases/rpi/$DATE cp $DIR/kios-raspberrypi-* $DIR/releases/rpi/$DATE for file in $DIR/output/raspberrypi/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi/$DATE/rpi1-machinery-${file##*/}"; done -cd $DIR/output/raspberrypi/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi/$DATE/web.tar.gz . +cd $DIR/output/raspberrypi/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi/$DATE/web.tar.gz . echo "Preparing release for Raspberry Pi2 board" mkdir -p $DIR/releases/rpi2/$DATE cp $DIR/kios-raspberrypi2-* $DIR/releases/rpi2/$DATE for file in $DIR/output/raspberrypi2/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi2/$DATE/rpi2-machinery-${file##*/}"; done -cd $DIR/output/raspberrypi2/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi2/$DATE/web.tar.gz . +cd $DIR/output/raspberrypi2/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi2/$DATE/web.tar.gz . echo "Preparing release for Raspberry Pi3 board" mkdir -p $DIR/releases/rpi3/$DATE cp $DIR/kios-raspberrypi3-* $DIR/releases/rpi3/$DATE for file in $DIR/output/raspberrypi3/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi3/$DATE/rpi3-machinery-${file##*/}"; done -cd $DIR/output/raspberrypi3/target/var/www/web && rm -rf app/storage && mkdir -p app/storage/cache && mkdir -p app/storage/logs && mkdir -p app/storage/meta && mkdir -p app/storage/sessions && mkdir -p app/storage/views && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' app/config/app.php && sed -i "s#'/data/web/app/config'#\$this\['path'\] . '/config'#g" bootstrap/compiled.php && sed -i "s#'/data/web/app/storage'#__DIR__.'/../app/storage'#g" bootstrap/paths.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/UserController.php && sed -i "s#'/data/web/app/config'#app_path() . '/config'#g" app/controllers/SettingsController.php && tar czf $DIR/releases/rpi3/$DATE/web.tar.gz . \ No newline at end of file +cd $DIR/output/raspberrypi3/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi3/$DATE/web.tar.gz . From b0ccabac73daa53e24f010472b324b8def59581a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 21 Jun 2017 23:31:20 +0200 Subject: [PATCH 15/40] enable PCRE utf --- configs/raspberrypi2_defconfig | 1 + configs/raspberrypi3_defconfig | 1 + configs/raspberrypi_defconfig | 1 + 3 files changed, 3 insertions(+) diff --git a/configs/raspberrypi2_defconfig b/configs/raspberrypi2_defconfig index 2409ced9ee..d7c3ea03a5 100644 --- a/configs/raspberrypi2_defconfig +++ b/configs/raspberrypi2_defconfig @@ -83,6 +83,7 @@ BR2_PACKAGE_LIBCURL=y BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y +BR2_PACKAGE_PCRE_UTF=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y diff --git a/configs/raspberrypi3_defconfig b/configs/raspberrypi3_defconfig index af9ce74a00..ad44fbe966 100644 --- a/configs/raspberrypi3_defconfig +++ b/configs/raspberrypi3_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_LIBCURL=y BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y +BR2_PACKAGE_PCRE_UTF=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y diff --git a/configs/raspberrypi_defconfig b/configs/raspberrypi_defconfig index 9c016c26e6..b581deb263 100644 --- a/configs/raspberrypi_defconfig +++ b/configs/raspberrypi_defconfig @@ -83,6 +83,7 @@ BR2_PACKAGE_LIBCURL=y BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y +BR2_PACKAGE_PCRE_UTF=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y From 56eb636839d06100cd6af2b520a672895c902bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 22 Jun 2017 08:24:54 +0200 Subject: [PATCH 16/40] fix upgrade script + x, activate pure unicode and fix php.mk file (delete /var/log) --- board/common/overlay/usr/share/post-upgrade/2.4.0.sh | 0 configs/raspberrypi2_defconfig | 1 + configs/raspberrypi3_defconfig | 1 + configs/raspberrypi_defconfig | 1 + package/php/php.mk | 5 +++-- 5 files changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 board/common/overlay/usr/share/post-upgrade/2.4.0.sh diff --git a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh old mode 100644 new mode 100755 diff --git a/configs/raspberrypi2_defconfig b/configs/raspberrypi2_defconfig index d7c3ea03a5..652e859a0b 100644 --- a/configs/raspberrypi2_defconfig +++ b/configs/raspberrypi2_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y BR2_PACKAGE_PCRE_UTF=y +BR2_PACKAGE_PCRE_UCP=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y diff --git a/configs/raspberrypi3_defconfig b/configs/raspberrypi3_defconfig index ad44fbe966..e121eee6ea 100644 --- a/configs/raspberrypi3_defconfig +++ b/configs/raspberrypi3_defconfig @@ -85,6 +85,7 @@ BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y BR2_PACKAGE_PCRE_UTF=y +BR2_PACKAGE_PCRE_UCP=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y diff --git a/configs/raspberrypi_defconfig b/configs/raspberrypi_defconfig index b581deb263..d0edbf5a1c 100644 --- a/configs/raspberrypi_defconfig +++ b/configs/raspberrypi_defconfig @@ -84,6 +84,7 @@ BR2_PACKAGE_CURL=y BR2_PACKAGE_LIBCAP=y BR2_PACKAGE_PCRE=y BR2_PACKAGE_PCRE_UTF=y +BR2_PACKAGE_PCRE_UCP=y BR2_PACKAGE_CRDA=y BR2_PACKAGE_DHCP=y BR2_PACKAGE_DHCP_CLIENT=y diff --git a/package/php/php.mk b/package/php/php.mk index 072ee4563a..d120fd9200 100644 --- a/package/php/php.mk +++ b/package/php/php.mk @@ -22,7 +22,7 @@ PHP_CONF_OPTS = \ --with-config-file-path=/etc \ --disable-rpath \ --enable-fpm - + PHP_CONF_ENV = \ ac_cv_func_strcasestr=yes \ EXTRA_LIBS="$(PHP_EXTRA_LIBS)" @@ -315,6 +315,7 @@ endef PHP_POST_INSTALL_TARGET_HOOKS += PHP_EXTENSIONS_FIXUP define PHP_INSTALL_FIXUP + rm -rf $(TARGET_DIR)/var/log rm -rf $(TARGET_DIR)/usr/lib/php/build rm -f $(TARGET_DIR)/usr/bin/phpize $(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \ @@ -330,4 +331,4 @@ PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP PHP_CONF_ENV += CFLAGS="$(PHP_CFLAGS)" -$(eval $(autotools-package)) \ No newline at end of file +$(eval $(autotools-package)) From fe0cdb6776012afaa217f42472650050e6520cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 22 Jun 2017 08:27:32 +0200 Subject: [PATCH 17/40] generate a key --- package/kerberosio-web/kerberosio-web.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index a74c50530b..0e6192a693 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -22,6 +22,7 @@ define KERBEROSIO_WEB_BUILD_CMDS php composer-setup.php; \ php -r "unlink('composer-setup.php');"; \ php composer.phar install --no-dev; \ + php artisan key:generate; \ cd public; \ bower install --allow-root; \ npm install grunt-contrib-watch grunt-contrib-less grunt-contrib-cssmin grunt-contrib-clean; \ From c90da189b15ce5b207967181367bcbb680c3f269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 22 Jun 2017 11:50:05 +0200 Subject: [PATCH 18/40] add pre install --- package/php/php.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/php/php.mk b/package/php/php.mk index d120fd9200..ade650ef49 100644 --- a/package/php/php.mk +++ b/package/php/php.mk @@ -329,6 +329,12 @@ endef PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP +define PHP_PRE_INSTALL_FIXUP + rm -rf $(TARGET_DIR)/var/log +endef + +PHP_PRE_INSTALL_TARGET_HOOKS += PHP_PRE_INSTALL_FIXUP + PHP_CONF_ENV += CFLAGS="$(PHP_CFLAGS)" $(eval $(autotools-package)) From 2eba66f4bafb21fa4d04cc26789d36b79c9424d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 22 Jun 2017 21:33:37 +0200 Subject: [PATCH 19/40] enable unicode properties explicit --- package/pcre/pcre.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/pcre/pcre.mk b/package/pcre/pcre.mk index fd339edeec..d1571a23fa 100644 --- a/package/pcre/pcre.mk +++ b/package/pcre/pcre.mk @@ -21,7 +21,7 @@ PCRE_CONF_OPTS += --enable-pcre8 PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_16),--enable-pcre16,--disable-pcre16) PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_32),--enable-pcre32,--disable-pcre32) PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_UTF),--enable-utf,--disable-utf) -PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_UCP),--enable-unicode-properties,--disable-unicode-properties) +PCRE_CONF_OPTS += --enable-unicode-properties $(eval $(autotools-package)) $(eval $(host-autotools-package)) From 21d19d944f4c3f231384cc304354a478092835fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 22 Jun 2017 23:58:53 +0200 Subject: [PATCH 20/40] fix for copying hidden files --- package/kerberosio-web/kerberosio-web.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 0e6192a693..6737a815dc 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -39,8 +39,8 @@ endef define KERBEROSIO_WEB_INSTALL_TARGET_CMDS rm -rf $(TARGET_DIR)/var/www/web - mkdir -p $(TARGET_DIR)/var/www/web - cp -R $(@D)/* $(TARGET_DIR)/var/www/web + mkdir -p $(TARGET_DIR)/var/www + cp -R $(@D) $(TARGET_DIR)/var/www/web # enable memcached cat $(TARGET_DIR)/etc/php.ini | grep -q extension=memcached.so || echo "extension=memcached.so" >> $(TARGET_DIR)/etc/php.ini From 57166db222749fe216e8cc0216293f2cdff8e04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 28 Jun 2017 18:52:08 +0200 Subject: [PATCH 21/40] add network less mode --- board/common/overlay/etc/conf | 28 ++++++ board/common/overlay/etc/init.d/S01mountall | 50 +++++----- board/common/overlay/etc/init.d/S35wifi | 60 +++++++----- board/common/overlay/etc/init.d/S36ppp | 58 +++++------ board/common/overlay/etc/init.d/S40network | 98 +++++++++++-------- board/common/overlay/etc/init.d/S41netwatch | 7 +- board/common/overlay/etc/init.d/S50date | 50 ++++++++-- board/common/overlay/etc/init.d/S99showinfo | 13 +-- board/common/overlay/etc/os.conf | 6 +- board/common/overlay/etc/watch.conf | 6 +- .../overlay/usr/share/post-upgrade/2.4.0.sh | 9 ++ 11 files changed, 246 insertions(+), 139 deletions(-) create mode 100755 board/common/overlay/etc/conf diff --git a/board/common/overlay/etc/conf b/board/common/overlay/etc/conf new file mode 100755 index 0000000000..a304931696 --- /dev/null +++ b/board/common/overlay/etc/conf @@ -0,0 +1,28 @@ +#!/bin/bash + +_sys_conf="/etc/os.conf" +_boot_conf="/boot/os.conf" +_conf="/data/etc/os.conf" + +if ! [ -f $_conf ]; then + if [ -f $_boot_conf ]; then + cp $_boot_conf $_conf + elif [ -f $_sys_conf ]; then + cp $_sys_conf $_conf + fi +fi + +source $_conf + +has_net_conn() { + test "$os_networkless" == "true" && return 1 + + addr_eth=$(ip addr show dev $os_eth 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2) + addr_wlan=$(ip addr show dev $os_wlan 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2) + + if [ -n "$addr_eth" ] || [ -n "$addr_wlan" ]; then + return 0 + else + return 1 + fi +} diff --git a/board/common/overlay/etc/init.d/S01mountall b/board/common/overlay/etc/init.d/S01mountall index 46557f602f..743fed6343 100755 --- a/board/common/overlay/etc/init.d/S01mountall +++ b/board/common/overlay/etc/init.d/S01mountall @@ -1,33 +1,34 @@ #!/bin/bash -sys_conf="/etc/os.conf" -conf="/data/etc/os.conf" - test -n "$os_version" || source /etc/init.d/base +mount_fs() { + msg_begin "Mounting filesystems" + /bin/mount -a + test $? == 0 && msg_done || msg_fail +} + +remount_rw() { + msg_begin "Remounting boot partition read-write" + mount -o remount,rw /boot + test $? == 0 && msg_done || msg_fail + + msg_begin "Remounting root partition read-write" + mount -o remount,rw / + test $? == 0 && msg_done || msg_fail +} + +mk_tty_login() { + test -z "$os_tty_login" && os_tty_login=tty1 + ln -sf /dev/$os_tty_login /dev/ttylogin +} + case "$1" in start) - msg_begin "Mounting filesystems" - /bin/mount -a - test $? == 0 && msg_done || msg_fail - - if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf - fi - - if [ -f $conf ]; then - source $conf - fi - - if [ "$os_debug" == "true" ]; then - msg_begin "Remounting boot partition read-write" - mount -o remount,rw /boot - test $? == 0 && msg_done || msg_fail - - msg_begin "Remounting root partition read-write" - mount -o remount,rw / - test $? == 0 && msg_done || msg_fail - fi + mount_fs + test -n "$os_debug" || source /etc/init.d/conf + test "$os_debug" == "true" && remount_rw + mk_tty_login ;; stop) @@ -40,4 +41,3 @@ case "$1" in esac exit $? - diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index fcd2619817..ec5a1a5031 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -1,27 +1,33 @@ #!/bin/bash sys_conf="/etc/wpa_supplicant.conf" -conf="/etc/wpa_supplicant.conf" +boot_conf="/boot/wpa_supplicant.conf" +conf="/data/etc/wpa_supplicant.conf" log="/var/log/wpa_supplicant.log" prog="/usr/sbin/wpa_supplicant" -iface=wlan0 -driver=wext +driver=nl80211,wext sys_watch_conf="/etc/watch.conf" -watch_conf="/etc/watch.conf" - -link_watch=no -link_watch_timeout=20 - -if [ -f $sys_watch_conf ] && ! [ -f $watch_conf ]; then - cp $sys_watch_conf $watch_conf +boot_watch_conf="/boot/watch.conf" +watch_conf="/data/etc/watch.conf" + +if ! [ -f $watch_conf ]; then + if [ -f $boot_watch_conf ]; then + cp $boot_watch_conf $watch_conf + elif [ -f $sys_watch_conf ]; then + cp $sys_watch_conf $watch_conf + fi fi -test -f $watch_conf && source $watch_conf +source $watch_conf -if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf +if ! [ -f $conf ]; then + if [ -f $boot_conf ]; then + cp $boot_conf $conf + elif [ -f $sys_conf ]; then + cp $sys_conf $conf + fi fi test -f $conf || exit 0 @@ -30,9 +36,12 @@ ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) test -n "$ssid" || exit 0 test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf + +test "$os_networkless" == "true" && exit 0 connected() { - ip link show dev $iface 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1 + ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1 } watch() { @@ -54,11 +63,13 @@ watch() { } start() { + test -n "$os_country" && iw reg set $os_country + msg_begin "Starting wpa_supplicant" # wait up to 5 seconds for interface count=0 - while ! ifconfig $iface >/dev/null 2>&1; do + while ! ifconfig $os_wlan >/dev/null 2>&1; do sleep 1 count=$(($count + 1)) if [ $count -ge 5 ]; then @@ -66,11 +77,12 @@ start() { return 1 fi done - - module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null) - iwconfig $iface power off &> /dev/null - $prog -i$iface -c$conf -D$driver -B &> $log + module=$(basename $(readlink /sys/class/net/$os_wlan/device/driver/module 2>/dev/null) 2>/dev/null) + + iwconfig $os_wlan power off &> /dev/null + iw $os_wlan set power_save off &> /dev/null + $prog -i$os_wlan -c$conf -D$driver -B &> $log count=0 while true; do sleep 1 @@ -87,7 +99,7 @@ start() { count=$(($count + 1)) done - if [ "$link_watch" == "yes" ]; then + if [ "$link_watch" == "true" ]; then watch & fi @@ -105,16 +117,16 @@ case "$1" in start) start ;; - + stop) stop ;; - + restart) stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 @@ -122,4 +134,4 @@ esac # continue after an unsuccessfull wifi start # as we may still have an ethernet connection available -exit 0 \ No newline at end of file +exit 0 diff --git a/board/common/overlay/etc/init.d/S36ppp b/board/common/overlay/etc/init.d/S36ppp index 002419dfab..43e9920637 100755 --- a/board/common/overlay/etc/init.d/S36ppp +++ b/board/common/overlay/etc/init.d/S36ppp @@ -1,26 +1,34 @@ #!/bin/bash sys_conf="/etc/ppp/default" +boot_conf="/boot/ppp" conf="/data/etc/ppp" prog="/usr/sbin/pppd" -dev="ppp0" provider="mobile" watch_conf="/data/etc/watch.conf" test -f $watch_conf && source $watch_conf -if [ -d $sys_conf ] && ! [ -d $conf ]; then - cp -r $sys_conf $conf +if ! [ -d $conf ]; then + if [ -d $boot_conf ]; then + cp -r $boot_conf $conf + elif [ -d $sys_conf ]; then + cp -r $sys_conf $conf + fi fi -test -f $conf/modem || exit 0 +test -e $conf/modem || exit 0 +test -e $conf/apn || exit 0 test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf + +test "$os_networkless" == "true" && exit 0 connected() { - ifconfig | grep $dev &>/dev/null 2>&1 && return 0 || return 1 + ifconfig | grep $os_ppp &>/dev/null 2>&1 && return 0 || return 1 } watch() { @@ -41,32 +49,26 @@ watch() { done } +udev_trigger_add() { + for ((i = 0; i < $1; i++)); do + /sbin/udevadm trigger --type=devices --action=add + done +} + start() { - if [ -s $conf/usb_modeswitch ]; then - IFS=: venprod=($(cat $conf/usb_modeswitch)) - vendor=${venprod[0]} - product=${venprod[1]} - # wait for usb device - if [ -n "$vendor" ] && [ -n "$product" ]; then - msg_begin "Starting usb_modeswitch" - count=0 - while true; do - if lsusb | grep $vendor:$product >/dev/null 2>&1 || [ $count -gt $link_watch_timeout ]; then - break - fi - - count=$(($count + 1)) - sleep 1 - done - /usr/sbin/usb_modeswitch -c /etc/usb_modeswitch.conf -v $vendor -p $product > /var/log/usb_modeswitch.log 2>&1 - msg_done - fi - fi + test -e $conf/auth || touch $conf/auth + test -e $conf/extra || touch $conf/extra + test -e $conf/pin || touch $conf/pin + mknod /dev/ppp c 108 0 &>/dev/null msg_begin "Starting pppd" # wait for modem modem=$(head -n 1 $conf/modem) + if ! [ -e /dev/$modem ]; then + udev_trigger_add 4 & + fi + count=0 while true; do if [ -e /dev/$modem ] || [ $count -gt $link_watch_timeout ]; then @@ -79,7 +81,7 @@ start() { if ! [ -e /dev/$modem ]; then msg_fail "modem /dev/$modem not present" - return 1 + return fi $prog call $provider @@ -93,8 +95,7 @@ start() { if [ $count -gt $link_watch_timeout ] || ! pidof pppd > /dev/null; then msg_fail - reboot - return 1 + return fi count=$(($count + 1)) @@ -134,4 +135,3 @@ case "$1" in esac exit $? - diff --git a/board/common/overlay/etc/init.d/S40network b/board/common/overlay/etc/init.d/S40network index 57e6103ca1..a8e8d4b649 100755 --- a/board/common/overlay/etc/init.d/S40network +++ b/board/common/overlay/etc/init.d/S40network @@ -3,33 +3,32 @@ mkdir -p /var/lib/dhcp dh_conf="/var/cache/dhclient.conf" sys_static_conf="/etc/static_ip.conf" -static_conf="/etc/static_ip.conf" -watch_conf="/etc/watch.conf" - -link_watch=no -link_watch_timeout=20 -ip_watch=no -ip_watch_timeout=40 +boot_static_conf="/boot/static_ip.conf" +static_conf="/data/etc/static_ip.conf" +watch_conf="/data/etc/watch.conf" link_nego_timeout=10 -eth=eth0 -wlan=wlan0 -test -r $watch_conf && source $watch_conf +source $watch_conf -if [ -f $sys_static_conf ] && ! [ -f $static_conf ]; then - cp $sys_static_conf $static_conf +if ! [ -f $static_conf ]; then + if [ -f $boot_static_conf ]; then + cp $boot_static_conf $static_conf + elif [ -f $sys_static_conf ]; then + cp $sys_static_conf $static_conf + fi fi test -r $static_conf && source $static_conf test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf watch_eth() { count=0 while true; do sleep 5 - if mii-tool $eth 2>&1 | grep "link ok" > /dev/null; then + if [ "$(cat /sys/class/net/$os_eth/operstate 2>/dev/null)" == "up" ]; then count=0 else if [ $count -lt $link_watch_timeout ]; then @@ -68,61 +67,68 @@ start_lo() { start_wlan() { msg_begin "Configuring wireless network" - if ! ifconfig $wlan &>/dev/null; then + if ! ifconfig $os_wlan &>/dev/null; then msg_fail "no device" return 1 fi - if [ "$(cat /sys/class/net/$wlan/carrier 2>/dev/null)" != "1" ]; then + if [ "$(cat /sys/class/net/$os_wlan/carrier 2>/dev/null)" != "1" ]; then msg_fail "no link" return 1 fi + if [ -n "$mtu" ]; then + ip link set mtu $mtu dev $os_wlan + fi + if [ -n "$static_ip" ]; then msg_done $static_ip - ifconfig $wlan $static_ip up + ifconfig $os_wlan $static_ip up static_ip="" # won't be used again else msg_done dhcp - dhclient -cf "$dh_conf" $wlan + dhclient -cf "$dh_conf" $os_wlan fi - if [ "$ip_watch" == "yes" ]; then - watch_ip $wlan & + if [ "$ip_watch" == "true" ] && ip addr show dev $os_wlan | grep inet &>/dev/null; then + watch_ip $os_wlan & fi } start_eth() { msg_begin "Configuring wired network" - # wait up to 3 seconds for driver + # wait for driver + w=3 count=0 - while ! ifconfig $eth >/dev/null 2>&1; do + while ! ifconfig $os_eth >/dev/null 2>&1; do sleep 1 count=$(($count + 1)) - if [ $count -ge 3 ]; then + if [ $count -ge $w ]; then msg_done "no device" return 1 fi done # bring it up - ifconfig $eth up + ifconfig $os_eth up - # wait up to 3 seconds for operstate + # wait for operstate + w=3 count=0 - while [ "$(cat /sys/class/net/$eth/operstate 2>&1)" == "unknown" ]; do + while [ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]; do sleep 1 count=$(($count + 1)) - if [ $count -ge 3 ]; then + if [ $count -ge $w ]; then msg_done "no link" return 1 fi done - # wait up to link_nego_timeout seconds for link + # wait for link + test "$link_watch" == "true" || link_nego_timeout=5 count=0 - while [ "$(cat /sys/class/net/$eth/carrier 2>&1)" != "1" ]; do + while [ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]; do sleep 1 count=$(($count + 1)) if [ $count -ge $link_nego_timeout ]; then @@ -131,21 +137,25 @@ start_eth() { fi done + if [ -n "$mtu" ]; then + ip link set mtu $mtu dev $os_eth + fi + if [ -n "$static_ip" ]; then msg_done $static_ip - ifconfig $eth $static_ip up + ifconfig $os_eth $static_ip up static_ip="" # won't be used again else msg_done dhcp - dhclient -cf "$dh_conf" $eth + dhclient -cf "$dh_conf" $os_eth fi - if [ "$link_watch" == "yes" ]; then + if [ "$link_watch" == "true" ]; then watch_eth & fi - if [ "$ip_watch" == "yes" ]; then - watch_ip $eth & + if [ "$ip_watch" == "true" ] && ip addr show dev $os_eth | grep inet &>/dev/null; then + watch_ip $os_eth & fi } @@ -153,23 +163,31 @@ start() { hostname=$(hostname) echo "send host-name = \"$hostname\";" > /var/cache/dhclient.conf - ssid=$(cat /etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) - start_lo + test "$os_networkless" == "true" && return 0 + + ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) test -n "$ssid" && start_wlan && wlan_ok="ok" - + test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link - + # if wifi or ppp link ok, start eth in background if [ "$wlan_ok" == "ok" ] || [ "$ppp_ok" == "ok" ]; then start_eth &>/dev/null & else start_eth && eth_ok="ok" fi - + if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then - return 1 + if [ "$link_watch" == "true" ]; then + logger -t ethernet -s "no network connection available, rebooting" + reboot + return 1 + else + logger -t ethernet -s "no network connection available" + return 0 + fi fi if [ -n "$static_gw" ]; then @@ -211,4 +229,4 @@ case "$1" in exit 1 esac -exit $? \ No newline at end of file +exit $? diff --git a/board/common/overlay/etc/init.d/S41netwatch b/board/common/overlay/etc/init.d/S41netwatch index 72502ce8d8..dc1d0b3836 100755 --- a/board/common/overlay/etc/init.d/S41netwatch +++ b/board/common/overlay/etc/init.d/S41netwatch @@ -10,6 +10,9 @@ test -f $watch_conf && source $watch_conf || exit 0 test -z "$netwatch_host" || -z "$netwatch_port" && exit 0 test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf + +test "$os_networkless" == "true" && exit 0 watch() { count=0 @@ -23,6 +26,7 @@ watch() { continue else logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, rebooting" + reboot fi fi sleep $netwatch_interval @@ -46,11 +50,10 @@ case "$1" in stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? - diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index e2a565399e..615a803869 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -1,15 +1,35 @@ #!/bin/bash sys_conf="/etc/date.conf" +boot_conf="/boot/date.conf" conf="/data/etc/date.conf" -if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf +sys_ntp_conf="/etc/ntp.conf" +boot_ntp_conf="/boot/ntp.conf" +ntp_conf="/data/etc/ntp.conf" + +if ! [ -f $conf ]; then + if [ -f $boot_conf ]; then + cp $boot_conf $conf + elif [ -f $sys_conf ]; then + cp $sys_conf $conf + fi +fi + +if ! [ -f $ntp_conf ]; then + if [ -f $boot_ntp_conf ]; then + cp $boot_ntp_conf $ntp_conf + elif [ -f $sys_ntp_conf ]; then + cp $sys_ntp_conf $ntp_conf + fi fi test -f $conf || exit 0 test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf + +has_net_conn || exit 0 date_timeout=10 date_method=http @@ -28,7 +48,7 @@ set_current_date_http() { timestamp=$(python -c "import calendar, httplib, email.utils; conn = httplib.HTTPConnection('$date_host'); conn.request('HEAD', '/'); \ print calendar.timegm(email.utils.parsedate(conn.getresponse().getheader('date')))") - + if [ -n "$timestamp" ]; then date +%s -s @$timestamp > /dev/null else @@ -37,14 +57,14 @@ set_current_date_http() { } set_current_date_ntp() { - cat /etc/ntp.conf | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t $date_timeout -s + cat $ntp_conf | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t $date_timeout -s } start_http() { msg_begin "Setting current date using http" set_current_date_http test $? == 0 && msg_done "$(date)" || msg_fail - + msg_begin "Starting http date updater" while true; do sleep $date_interval @@ -55,13 +75,24 @@ start_http() { start_ntp() { mkdir -p /var/lib/ntp - + + cat $ntp_conf | grep -v iburst > ${ntp_conf}.tmp + + if [ -n "$date_ntp_server" ]; then + echo "server $date_ntp_server iburst" > $ntp_conf + else + cat $sys_ntp_conf | grep iburst > $ntp_conf + fi + + cat ${ntp_conf}.tmp >> $ntp_conf + rm ${ntp_conf}.tmp + msg_begin "Setting current date using ntp" set_current_date_ntp test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting ntpd" - ntpd -g -c /etc/ntp.conf + ntpd -g -c $ntp_conf test $? == 0 && msg_done || msg_fail } @@ -83,6 +114,8 @@ start() { else start_ntp fi + + echo "system date is $(date '+%Y-%m-%d %H:%M:%S')" > /dev/kmsg } stop() { @@ -90,7 +123,7 @@ stop() { stop_http else stop_ntp - fi + fi } case "$1" in @@ -113,4 +146,3 @@ case "$1" in esac exit $? - diff --git a/board/common/overlay/etc/init.d/S99showinfo b/board/common/overlay/etc/init.d/S99showinfo index 98da17c4e4..36c68b7883 100755 --- a/board/common/overlay/etc/init.d/S99showinfo +++ b/board/common/overlay/etc/init.d/S99showinfo @@ -1,6 +1,7 @@ #!/bin/bash test -n "$os_version" || source /etc/init.d/base +test -n "$os_debug" || source /etc/init.d/conf msg_info() { echo " # $1" @@ -17,15 +18,16 @@ show_gateway() { } show_dns() { - dns=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2) - test -n "$gateway" && msg_info "DNS server address is $dns" + test -r /etc/resolv.conf || return + dns=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d ' ' -f 2) + test -n "$dns" && msg_info "DNS server address is $dns" } case "$1" in start) - show_iface_ip_addr eth0 - show_iface_ip_addr wlan0 - show_iface_ip_addr ppp0 + show_iface_ip_addr $os_eth + show_iface_ip_addr $os_wlan + show_iface_ip_addr $os_ppp show_gateway show_dns ;; @@ -40,4 +42,3 @@ case "$1" in esac exit $? - diff --git a/board/common/overlay/etc/os.conf b/board/common/overlay/etc/os.conf index a89e0973ba..b4b9fa016f 100644 --- a/board/common/overlay/etc/os.conf +++ b/board/common/overlay/etc/os.conf @@ -1,3 +1,7 @@ os_debug="false" os_prereleases="false" - +os_tty_login="tty1" +os_eth="eth0" +os_wlan="wlan0" +os_ppp="ppp0" +os_networkless="false" diff --git a/board/common/overlay/etc/watch.conf b/board/common/overlay/etc/watch.conf index 0bdce4a371..b686172716 100644 --- a/board/common/overlay/etc/watch.conf +++ b/board/common/overlay/etc/watch.conf @@ -1,11 +1,11 @@ -link_watch=no +link_watch="false" link_watch_timeout=20 -ip_watch=no +ip_watch="false" ip_watch_timeout=40 #netwatch_host=www.google.com #netwatch_port=80 netwatch_retries=3 netwatch_timeout=5 -netwatch_interval=20 \ No newline at end of file +netwatch_interval=20 diff --git a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh index f0ab44ba93..ff717cafa4 100755 --- a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh +++ b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh @@ -59,6 +59,15 @@ done chmod -R 777 $DATA_CONFIG_DIR +########################################## +# +# more settings have been added to /data/etc/os.conf + +echo 'os_networkless="false"' >> /data/etc/os.conf +echo 'os_eth="eth0"' >> /data/etc/os.conf +echo 'os_wlan="wlan0"' >> /data/etc/os.conf +echo 'os_ppp="ppp0"' >> /data/etc/os.conf + ########################################## # # Update configuration files for web From 43c3ff71c357ee9cf9f1fe6dc7e414eaec8c23bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 28 Jun 2017 18:58:51 +0200 Subject: [PATCH 22/40] fixes --- board/common/overlay/etc/init.d/S35wifi | 2 +- board/common/overlay/etc/init.d/S50date | 25 +++++++------------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index ec5a1a5031..ae305603a3 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -6,7 +6,7 @@ conf="/data/etc/wpa_supplicant.conf" log="/var/log/wpa_supplicant.log" prog="/usr/sbin/wpa_supplicant" -driver=nl80211,wext +driver=wext sys_watch_conf="/etc/watch.conf" boot_watch_conf="/boot/watch.conf" diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index 615a803869..f64e6b4724 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -29,7 +29,7 @@ test -f $conf || exit 0 test -n "$os_version" || source /etc/init.d/base test -n "$os_debug" || source /etc/init.d/conf -has_net_conn || exit 0 +test "$os_networkless" == "true" && exit 0 date_timeout=10 date_method=http @@ -38,22 +38,11 @@ date_interval="900" source $conf -kill_after_timeout() { - sleep $date_timeout - ps aux | grep httplib | grep -v grep | tr -s ' ' | cut -d ' ' -f 2 | xargs -r kill -} - set_current_date_http() { - kill_after_timeout & - - timestamp=$(python -c "import calendar, httplib, email.utils; conn = httplib.HTTPConnection('$date_host'); conn.request('HEAD', '/'); \ - print calendar.timegm(email.utils.parsedate(conn.getresponse().getheader('date')))") - - if [ -n "$timestamp" ]; then - date +%s -s @$timestamp > /dev/null - else - return 1 - fi + date_str=$(curl -v -s -m $date_timeout -X GET http://$date_host 2>&1 | grep Date | sed -e 's/< Date: //') + test -z "$date_str" && return 1 + date -u -D "%a, %d %b %Y %H:%M:%S" -s "$date_str" > /dev/null + return $? } set_current_date_ntp() { @@ -62,7 +51,7 @@ set_current_date_ntp() { start_http() { msg_begin "Setting current date using http" - set_current_date_http + set_current_date_http || set_current_date_http test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting http date updater" @@ -88,7 +77,7 @@ start_ntp() { rm ${ntp_conf}.tmp msg_begin "Setting current date using ntp" - set_current_date_ntp + set_current_date_ntp || set_current_date_ntp test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting ntpd" From b2eeb0106c91d26737b5ac4dc3c14821c8aab578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 28 Jun 2017 20:59:22 +0200 Subject: [PATCH 23/40] Revert "fixes" This reverts commit 43c3ff71c357ee9cf9f1fe6dc7e414eaec8c23bd. --- board/common/overlay/etc/init.d/S35wifi | 2 +- board/common/overlay/etc/init.d/S50date | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index ae305603a3..ec5a1a5031 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -6,7 +6,7 @@ conf="/data/etc/wpa_supplicant.conf" log="/var/log/wpa_supplicant.log" prog="/usr/sbin/wpa_supplicant" -driver=wext +driver=nl80211,wext sys_watch_conf="/etc/watch.conf" boot_watch_conf="/boot/watch.conf" diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index f64e6b4724..615a803869 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -29,7 +29,7 @@ test -f $conf || exit 0 test -n "$os_version" || source /etc/init.d/base test -n "$os_debug" || source /etc/init.d/conf -test "$os_networkless" == "true" && exit 0 +has_net_conn || exit 0 date_timeout=10 date_method=http @@ -38,11 +38,22 @@ date_interval="900" source $conf +kill_after_timeout() { + sleep $date_timeout + ps aux | grep httplib | grep -v grep | tr -s ' ' | cut -d ' ' -f 2 | xargs -r kill +} + set_current_date_http() { - date_str=$(curl -v -s -m $date_timeout -X GET http://$date_host 2>&1 | grep Date | sed -e 's/< Date: //') - test -z "$date_str" && return 1 - date -u -D "%a, %d %b %Y %H:%M:%S" -s "$date_str" > /dev/null - return $? + kill_after_timeout & + + timestamp=$(python -c "import calendar, httplib, email.utils; conn = httplib.HTTPConnection('$date_host'); conn.request('HEAD', '/'); \ + print calendar.timegm(email.utils.parsedate(conn.getresponse().getheader('date')))") + + if [ -n "$timestamp" ]; then + date +%s -s @$timestamp > /dev/null + else + return 1 + fi } set_current_date_ntp() { @@ -51,7 +62,7 @@ set_current_date_ntp() { start_http() { msg_begin "Setting current date using http" - set_current_date_http || set_current_date_http + set_current_date_http test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting http date updater" @@ -77,7 +88,7 @@ start_ntp() { rm ${ntp_conf}.tmp msg_begin "Setting current date using ntp" - set_current_date_ntp || set_current_date_ntp + set_current_date_ntp test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting ntpd" From 8194fded291e499ae2862f00b18a7653eb874bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 28 Jun 2017 20:59:31 +0200 Subject: [PATCH 24/40] Revert "add network less mode" This reverts commit 57166db222749fe216e8cc0216293f2cdff8e04f. --- board/common/overlay/etc/conf | 28 ------ board/common/overlay/etc/init.d/S01mountall | 50 +++++----- board/common/overlay/etc/init.d/S35wifi | 60 +++++------- board/common/overlay/etc/init.d/S36ppp | 58 +++++------ board/common/overlay/etc/init.d/S40network | 98 ++++++++----------- board/common/overlay/etc/init.d/S41netwatch | 7 +- board/common/overlay/etc/init.d/S50date | 50 ++-------- board/common/overlay/etc/init.d/S99showinfo | 13 ++- board/common/overlay/etc/os.conf | 6 +- board/common/overlay/etc/watch.conf | 6 +- .../overlay/usr/share/post-upgrade/2.4.0.sh | 9 -- 11 files changed, 139 insertions(+), 246 deletions(-) delete mode 100755 board/common/overlay/etc/conf diff --git a/board/common/overlay/etc/conf b/board/common/overlay/etc/conf deleted file mode 100755 index a304931696..0000000000 --- a/board/common/overlay/etc/conf +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -_sys_conf="/etc/os.conf" -_boot_conf="/boot/os.conf" -_conf="/data/etc/os.conf" - -if ! [ -f $_conf ]; then - if [ -f $_boot_conf ]; then - cp $_boot_conf $_conf - elif [ -f $_sys_conf ]; then - cp $_sys_conf $_conf - fi -fi - -source $_conf - -has_net_conn() { - test "$os_networkless" == "true" && return 1 - - addr_eth=$(ip addr show dev $os_eth 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2) - addr_wlan=$(ip addr show dev $os_wlan 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2) - - if [ -n "$addr_eth" ] || [ -n "$addr_wlan" ]; then - return 0 - else - return 1 - fi -} diff --git a/board/common/overlay/etc/init.d/S01mountall b/board/common/overlay/etc/init.d/S01mountall index 743fed6343..46557f602f 100755 --- a/board/common/overlay/etc/init.d/S01mountall +++ b/board/common/overlay/etc/init.d/S01mountall @@ -1,34 +1,33 @@ #!/bin/bash -test -n "$os_version" || source /etc/init.d/base - -mount_fs() { - msg_begin "Mounting filesystems" - /bin/mount -a - test $? == 0 && msg_done || msg_fail -} - -remount_rw() { - msg_begin "Remounting boot partition read-write" - mount -o remount,rw /boot - test $? == 0 && msg_done || msg_fail +sys_conf="/etc/os.conf" +conf="/data/etc/os.conf" - msg_begin "Remounting root partition read-write" - mount -o remount,rw / - test $? == 0 && msg_done || msg_fail -} - -mk_tty_login() { - test -z "$os_tty_login" && os_tty_login=tty1 - ln -sf /dev/$os_tty_login /dev/ttylogin -} +test -n "$os_version" || source /etc/init.d/base case "$1" in start) - mount_fs - test -n "$os_debug" || source /etc/init.d/conf - test "$os_debug" == "true" && remount_rw - mk_tty_login + msg_begin "Mounting filesystems" + /bin/mount -a + test $? == 0 && msg_done || msg_fail + + if [ -f $sys_conf ] && ! [ -f $conf ]; then + cp $sys_conf $conf + fi + + if [ -f $conf ]; then + source $conf + fi + + if [ "$os_debug" == "true" ]; then + msg_begin "Remounting boot partition read-write" + mount -o remount,rw /boot + test $? == 0 && msg_done || msg_fail + + msg_begin "Remounting root partition read-write" + mount -o remount,rw / + test $? == 0 && msg_done || msg_fail + fi ;; stop) @@ -41,3 +40,4 @@ case "$1" in esac exit $? + diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index ec5a1a5031..fcd2619817 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -1,33 +1,27 @@ #!/bin/bash sys_conf="/etc/wpa_supplicant.conf" -boot_conf="/boot/wpa_supplicant.conf" -conf="/data/etc/wpa_supplicant.conf" +conf="/etc/wpa_supplicant.conf" log="/var/log/wpa_supplicant.log" prog="/usr/sbin/wpa_supplicant" -driver=nl80211,wext +iface=wlan0 +driver=wext sys_watch_conf="/etc/watch.conf" -boot_watch_conf="/boot/watch.conf" -watch_conf="/data/etc/watch.conf" - -if ! [ -f $watch_conf ]; then - if [ -f $boot_watch_conf ]; then - cp $boot_watch_conf $watch_conf - elif [ -f $sys_watch_conf ]; then - cp $sys_watch_conf $watch_conf - fi +watch_conf="/etc/watch.conf" + +link_watch=no +link_watch_timeout=20 + +if [ -f $sys_watch_conf ] && ! [ -f $watch_conf ]; then + cp $sys_watch_conf $watch_conf fi -source $watch_conf +test -f $watch_conf && source $watch_conf -if ! [ -f $conf ]; then - if [ -f $boot_conf ]; then - cp $boot_conf $conf - elif [ -f $sys_conf ]; then - cp $sys_conf $conf - fi +if [ -f $sys_conf ] && ! [ -f $conf ]; then + cp $sys_conf $conf fi test -f $conf || exit 0 @@ -36,12 +30,9 @@ ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) test -n "$ssid" || exit 0 test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf - -test "$os_networkless" == "true" && exit 0 connected() { - ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1 + ip link show dev $iface 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1 } watch() { @@ -63,13 +54,11 @@ watch() { } start() { - test -n "$os_country" && iw reg set $os_country - msg_begin "Starting wpa_supplicant" # wait up to 5 seconds for interface count=0 - while ! ifconfig $os_wlan >/dev/null 2>&1; do + while ! ifconfig $iface >/dev/null 2>&1; do sleep 1 count=$(($count + 1)) if [ $count -ge 5 ]; then @@ -77,12 +66,11 @@ start() { return 1 fi done + + module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null) - module=$(basename $(readlink /sys/class/net/$os_wlan/device/driver/module 2>/dev/null) 2>/dev/null) - - iwconfig $os_wlan power off &> /dev/null - iw $os_wlan set power_save off &> /dev/null - $prog -i$os_wlan -c$conf -D$driver -B &> $log + iwconfig $iface power off &> /dev/null + $prog -i$iface -c$conf -D$driver -B &> $log count=0 while true; do sleep 1 @@ -99,7 +87,7 @@ start() { count=$(($count + 1)) done - if [ "$link_watch" == "true" ]; then + if [ "$link_watch" == "yes" ]; then watch & fi @@ -117,16 +105,16 @@ case "$1" in start) start ;; - + stop) stop ;; - + restart) stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 @@ -134,4 +122,4 @@ esac # continue after an unsuccessfull wifi start # as we may still have an ethernet connection available -exit 0 +exit 0 \ No newline at end of file diff --git a/board/common/overlay/etc/init.d/S36ppp b/board/common/overlay/etc/init.d/S36ppp index 43e9920637..002419dfab 100755 --- a/board/common/overlay/etc/init.d/S36ppp +++ b/board/common/overlay/etc/init.d/S36ppp @@ -1,34 +1,26 @@ #!/bin/bash sys_conf="/etc/ppp/default" -boot_conf="/boot/ppp" conf="/data/etc/ppp" prog="/usr/sbin/pppd" +dev="ppp0" provider="mobile" watch_conf="/data/etc/watch.conf" test -f $watch_conf && source $watch_conf -if ! [ -d $conf ]; then - if [ -d $boot_conf ]; then - cp -r $boot_conf $conf - elif [ -d $sys_conf ]; then - cp -r $sys_conf $conf - fi +if [ -d $sys_conf ] && ! [ -d $conf ]; then + cp -r $sys_conf $conf fi -test -e $conf/modem || exit 0 -test -e $conf/apn || exit 0 +test -f $conf/modem || exit 0 test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf - -test "$os_networkless" == "true" && exit 0 connected() { - ifconfig | grep $os_ppp &>/dev/null 2>&1 && return 0 || return 1 + ifconfig | grep $dev &>/dev/null 2>&1 && return 0 || return 1 } watch() { @@ -49,26 +41,32 @@ watch() { done } -udev_trigger_add() { - for ((i = 0; i < $1; i++)); do - /sbin/udevadm trigger --type=devices --action=add - done -} - start() { - test -e $conf/auth || touch $conf/auth - test -e $conf/extra || touch $conf/extra - test -e $conf/pin || touch $conf/pin - mknod /dev/ppp c 108 0 &>/dev/null + if [ -s $conf/usb_modeswitch ]; then + IFS=: venprod=($(cat $conf/usb_modeswitch)) + vendor=${venprod[0]} + product=${venprod[1]} + # wait for usb device + if [ -n "$vendor" ] && [ -n "$product" ]; then + msg_begin "Starting usb_modeswitch" + count=0 + while true; do + if lsusb | grep $vendor:$product >/dev/null 2>&1 || [ $count -gt $link_watch_timeout ]; then + break + fi + + count=$(($count + 1)) + sleep 1 + done + /usr/sbin/usb_modeswitch -c /etc/usb_modeswitch.conf -v $vendor -p $product > /var/log/usb_modeswitch.log 2>&1 + msg_done + fi + fi msg_begin "Starting pppd" # wait for modem modem=$(head -n 1 $conf/modem) - if ! [ -e /dev/$modem ]; then - udev_trigger_add 4 & - fi - count=0 while true; do if [ -e /dev/$modem ] || [ $count -gt $link_watch_timeout ]; then @@ -81,7 +79,7 @@ start() { if ! [ -e /dev/$modem ]; then msg_fail "modem /dev/$modem not present" - return + return 1 fi $prog call $provider @@ -95,7 +93,8 @@ start() { if [ $count -gt $link_watch_timeout ] || ! pidof pppd > /dev/null; then msg_fail - return + reboot + return 1 fi count=$(($count + 1)) @@ -135,3 +134,4 @@ case "$1" in esac exit $? + diff --git a/board/common/overlay/etc/init.d/S40network b/board/common/overlay/etc/init.d/S40network index a8e8d4b649..57e6103ca1 100755 --- a/board/common/overlay/etc/init.d/S40network +++ b/board/common/overlay/etc/init.d/S40network @@ -3,32 +3,33 @@ mkdir -p /var/lib/dhcp dh_conf="/var/cache/dhclient.conf" sys_static_conf="/etc/static_ip.conf" -boot_static_conf="/boot/static_ip.conf" -static_conf="/data/etc/static_ip.conf" -watch_conf="/data/etc/watch.conf" +static_conf="/etc/static_ip.conf" +watch_conf="/etc/watch.conf" + +link_watch=no +link_watch_timeout=20 +ip_watch=no +ip_watch_timeout=40 link_nego_timeout=10 +eth=eth0 +wlan=wlan0 -source $watch_conf +test -r $watch_conf && source $watch_conf -if ! [ -f $static_conf ]; then - if [ -f $boot_static_conf ]; then - cp $boot_static_conf $static_conf - elif [ -f $sys_static_conf ]; then - cp $sys_static_conf $static_conf - fi +if [ -f $sys_static_conf ] && ! [ -f $static_conf ]; then + cp $sys_static_conf $static_conf fi test -r $static_conf && source $static_conf test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf watch_eth() { count=0 while true; do sleep 5 - if [ "$(cat /sys/class/net/$os_eth/operstate 2>/dev/null)" == "up" ]; then + if mii-tool $eth 2>&1 | grep "link ok" > /dev/null; then count=0 else if [ $count -lt $link_watch_timeout ]; then @@ -67,68 +68,61 @@ start_lo() { start_wlan() { msg_begin "Configuring wireless network" - if ! ifconfig $os_wlan &>/dev/null; then + if ! ifconfig $wlan &>/dev/null; then msg_fail "no device" return 1 fi - if [ "$(cat /sys/class/net/$os_wlan/carrier 2>/dev/null)" != "1" ]; then + if [ "$(cat /sys/class/net/$wlan/carrier 2>/dev/null)" != "1" ]; then msg_fail "no link" return 1 fi - if [ -n "$mtu" ]; then - ip link set mtu $mtu dev $os_wlan - fi - if [ -n "$static_ip" ]; then msg_done $static_ip - ifconfig $os_wlan $static_ip up + ifconfig $wlan $static_ip up static_ip="" # won't be used again else msg_done dhcp - dhclient -cf "$dh_conf" $os_wlan + dhclient -cf "$dh_conf" $wlan fi - if [ "$ip_watch" == "true" ] && ip addr show dev $os_wlan | grep inet &>/dev/null; then - watch_ip $os_wlan & + if [ "$ip_watch" == "yes" ]; then + watch_ip $wlan & fi } start_eth() { msg_begin "Configuring wired network" - # wait for driver - w=3 + # wait up to 3 seconds for driver count=0 - while ! ifconfig $os_eth >/dev/null 2>&1; do + while ! ifconfig $eth >/dev/null 2>&1; do sleep 1 count=$(($count + 1)) - if [ $count -ge $w ]; then + if [ $count -ge 3 ]; then msg_done "no device" return 1 fi done # bring it up - ifconfig $os_eth up + ifconfig $eth up - # wait for operstate - w=3 + # wait up to 3 seconds for operstate count=0 - while [ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]; do + while [ "$(cat /sys/class/net/$eth/operstate 2>&1)" == "unknown" ]; do sleep 1 count=$(($count + 1)) - if [ $count -ge $w ]; then + if [ $count -ge 3 ]; then msg_done "no link" return 1 fi done - # wait for link - test "$link_watch" == "true" || link_nego_timeout=5 + # wait up to link_nego_timeout seconds for link count=0 - while [ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]; do + while [ "$(cat /sys/class/net/$eth/carrier 2>&1)" != "1" ]; do sleep 1 count=$(($count + 1)) if [ $count -ge $link_nego_timeout ]; then @@ -137,25 +131,21 @@ start_eth() { fi done - if [ -n "$mtu" ]; then - ip link set mtu $mtu dev $os_eth - fi - if [ -n "$static_ip" ]; then msg_done $static_ip - ifconfig $os_eth $static_ip up + ifconfig $eth $static_ip up static_ip="" # won't be used again else msg_done dhcp - dhclient -cf "$dh_conf" $os_eth + dhclient -cf "$dh_conf" $eth fi - if [ "$link_watch" == "true" ]; then + if [ "$link_watch" == "yes" ]; then watch_eth & fi - if [ "$ip_watch" == "true" ] && ip addr show dev $os_eth | grep inet &>/dev/null; then - watch_ip $os_eth & + if [ "$ip_watch" == "yes" ]; then + watch_ip $eth & fi } @@ -163,31 +153,23 @@ start() { hostname=$(hostname) echo "send host-name = \"$hostname\";" > /var/cache/dhclient.conf - start_lo + ssid=$(cat /etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) - test "$os_networkless" == "true" && return 0 + start_lo - ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) test -n "$ssid" && start_wlan && wlan_ok="ok" - + test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link - + # if wifi or ppp link ok, start eth in background if [ "$wlan_ok" == "ok" ] || [ "$ppp_ok" == "ok" ]; then start_eth &>/dev/null & else start_eth && eth_ok="ok" fi - + if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then - if [ "$link_watch" == "true" ]; then - logger -t ethernet -s "no network connection available, rebooting" - reboot - return 1 - else - logger -t ethernet -s "no network connection available" - return 0 - fi + return 1 fi if [ -n "$static_gw" ]; then @@ -229,4 +211,4 @@ case "$1" in exit 1 esac -exit $? +exit $? \ No newline at end of file diff --git a/board/common/overlay/etc/init.d/S41netwatch b/board/common/overlay/etc/init.d/S41netwatch index dc1d0b3836..72502ce8d8 100755 --- a/board/common/overlay/etc/init.d/S41netwatch +++ b/board/common/overlay/etc/init.d/S41netwatch @@ -10,9 +10,6 @@ test -f $watch_conf && source $watch_conf || exit 0 test -z "$netwatch_host" || -z "$netwatch_port" && exit 0 test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf - -test "$os_networkless" == "true" && exit 0 watch() { count=0 @@ -26,7 +23,6 @@ watch() { continue else logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, rebooting" - reboot fi fi sleep $netwatch_interval @@ -50,10 +46,11 @@ case "$1" in stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? + diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index 615a803869..e2a565399e 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -1,35 +1,15 @@ #!/bin/bash sys_conf="/etc/date.conf" -boot_conf="/boot/date.conf" conf="/data/etc/date.conf" -sys_ntp_conf="/etc/ntp.conf" -boot_ntp_conf="/boot/ntp.conf" -ntp_conf="/data/etc/ntp.conf" - -if ! [ -f $conf ]; then - if [ -f $boot_conf ]; then - cp $boot_conf $conf - elif [ -f $sys_conf ]; then - cp $sys_conf $conf - fi -fi - -if ! [ -f $ntp_conf ]; then - if [ -f $boot_ntp_conf ]; then - cp $boot_ntp_conf $ntp_conf - elif [ -f $sys_ntp_conf ]; then - cp $sys_ntp_conf $ntp_conf - fi +if [ -f $sys_conf ] && ! [ -f $conf ]; then + cp $sys_conf $conf fi test -f $conf || exit 0 test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf - -has_net_conn || exit 0 date_timeout=10 date_method=http @@ -48,7 +28,7 @@ set_current_date_http() { timestamp=$(python -c "import calendar, httplib, email.utils; conn = httplib.HTTPConnection('$date_host'); conn.request('HEAD', '/'); \ print calendar.timegm(email.utils.parsedate(conn.getresponse().getheader('date')))") - + if [ -n "$timestamp" ]; then date +%s -s @$timestamp > /dev/null else @@ -57,14 +37,14 @@ set_current_date_http() { } set_current_date_ntp() { - cat $ntp_conf | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t $date_timeout -s + cat /etc/ntp.conf | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t $date_timeout -s } start_http() { msg_begin "Setting current date using http" set_current_date_http test $? == 0 && msg_done "$(date)" || msg_fail - + msg_begin "Starting http date updater" while true; do sleep $date_interval @@ -75,24 +55,13 @@ start_http() { start_ntp() { mkdir -p /var/lib/ntp - - cat $ntp_conf | grep -v iburst > ${ntp_conf}.tmp - - if [ -n "$date_ntp_server" ]; then - echo "server $date_ntp_server iburst" > $ntp_conf - else - cat $sys_ntp_conf | grep iburst > $ntp_conf - fi - - cat ${ntp_conf}.tmp >> $ntp_conf - rm ${ntp_conf}.tmp - + msg_begin "Setting current date using ntp" set_current_date_ntp test $? == 0 && msg_done "$(date)" || msg_fail msg_begin "Starting ntpd" - ntpd -g -c $ntp_conf + ntpd -g -c /etc/ntp.conf test $? == 0 && msg_done || msg_fail } @@ -114,8 +83,6 @@ start() { else start_ntp fi - - echo "system date is $(date '+%Y-%m-%d %H:%M:%S')" > /dev/kmsg } stop() { @@ -123,7 +90,7 @@ stop() { stop_http else stop_ntp - fi + fi } case "$1" in @@ -146,3 +113,4 @@ case "$1" in esac exit $? + diff --git a/board/common/overlay/etc/init.d/S99showinfo b/board/common/overlay/etc/init.d/S99showinfo index 36c68b7883..98da17c4e4 100755 --- a/board/common/overlay/etc/init.d/S99showinfo +++ b/board/common/overlay/etc/init.d/S99showinfo @@ -1,7 +1,6 @@ #!/bin/bash test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf msg_info() { echo " # $1" @@ -18,16 +17,15 @@ show_gateway() { } show_dns() { - test -r /etc/resolv.conf || return - dns=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d ' ' -f 2) - test -n "$dns" && msg_info "DNS server address is $dns" + dns=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2) + test -n "$gateway" && msg_info "DNS server address is $dns" } case "$1" in start) - show_iface_ip_addr $os_eth - show_iface_ip_addr $os_wlan - show_iface_ip_addr $os_ppp + show_iface_ip_addr eth0 + show_iface_ip_addr wlan0 + show_iface_ip_addr ppp0 show_gateway show_dns ;; @@ -42,3 +40,4 @@ case "$1" in esac exit $? + diff --git a/board/common/overlay/etc/os.conf b/board/common/overlay/etc/os.conf index b4b9fa016f..a89e0973ba 100644 --- a/board/common/overlay/etc/os.conf +++ b/board/common/overlay/etc/os.conf @@ -1,7 +1,3 @@ os_debug="false" os_prereleases="false" -os_tty_login="tty1" -os_eth="eth0" -os_wlan="wlan0" -os_ppp="ppp0" -os_networkless="false" + diff --git a/board/common/overlay/etc/watch.conf b/board/common/overlay/etc/watch.conf index b686172716..0bdce4a371 100644 --- a/board/common/overlay/etc/watch.conf +++ b/board/common/overlay/etc/watch.conf @@ -1,11 +1,11 @@ -link_watch="false" +link_watch=no link_watch_timeout=20 -ip_watch="false" +ip_watch=no ip_watch_timeout=40 #netwatch_host=www.google.com #netwatch_port=80 netwatch_retries=3 netwatch_timeout=5 -netwatch_interval=20 +netwatch_interval=20 \ No newline at end of file diff --git a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh index ff717cafa4..f0ab44ba93 100755 --- a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh +++ b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh @@ -59,15 +59,6 @@ done chmod -R 777 $DATA_CONFIG_DIR -########################################## -# -# more settings have been added to /data/etc/os.conf - -echo 'os_networkless="false"' >> /data/etc/os.conf -echo 'os_eth="eth0"' >> /data/etc/os.conf -echo 'os_wlan="wlan0"' >> /data/etc/os.conf -echo 'os_ppp="ppp0"' >> /data/etc/os.conf - ########################################## # # Update configuration files for web From 2ffa3a87cdbe8772bb664da89997f26d3808aaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 28 Jun 2017 23:42:17 +0200 Subject: [PATCH 25/40] fix netwatch, reboot system after 5mins no connection --- board/common/overlay/etc/init.d/S35wifi | 12 ++++----- board/common/overlay/etc/init.d/S41netwatch | 29 ++++++++++++++------- board/common/overlay/etc/watch.conf | 9 ++++--- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index fcd2619817..25fbcfc1fe 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -9,7 +9,7 @@ iface=wlan0 driver=wext sys_watch_conf="/etc/watch.conf" -watch_conf="/etc/watch.conf" +watch_conf="/data/etc/watch.conf" link_watch=no link_watch_timeout=20 @@ -66,7 +66,7 @@ start() { return 1 fi done - + module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null) iwconfig $iface power off &> /dev/null @@ -105,16 +105,16 @@ case "$1" in start) start ;; - + stop) stop ;; - + restart) stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 @@ -122,4 +122,4 @@ esac # continue after an unsuccessfull wifi start # as we may still have an ethernet connection available -exit 0 \ No newline at end of file +exit 0 diff --git a/board/common/overlay/etc/init.d/S41netwatch b/board/common/overlay/etc/init.d/S41netwatch index 72502ce8d8..ed0f2cc503 100755 --- a/board/common/overlay/etc/init.d/S41netwatch +++ b/board/common/overlay/etc/init.d/S41netwatch @@ -7,32 +7,44 @@ netwatch_interval=20 test -f $watch_conf && source $watch_conf || exit 0 -test -z "$netwatch_host" || -z "$netwatch_port" && exit 0 - -test -n "$os_version" || source /etc/init.d/base +if [ -z "$netwatch_host" ] || [ -z "$netwatch_port" ]; then + exit 0 +fi watch() { count=0 netwatch_retries=$(($netwatch_retries - 1)) while true; do - if nc -z -w $netwatch_timeout $netwatch_host $netwatch_port /dev/null 2>&1; then + sleep $netwatch_interval + + haveInternet=true + case "$(curl -s --max-time 2 -I $netwatch_host | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in + [23]) haveInternet=true;; + 5) haveInternet=true;; + *) haveInternet=false;; + esac + + if [ "$haveInternet" = "true" ] ; then count=0 else if [ $count -lt $netwatch_retries ]; then + logger -t netwatch -s "cannot connect to $netwatch_host" count=$(($count + 1)) continue else - logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, rebooting" + logger -t netwatch -s "cannot connect to $netwatch_host, rebooting" + reboot fi fi - sleep $netwatch_interval done } case "$1" in start) msg_begin "Starting netwatch" - watch & + if [ "$netwatch_enable" == "yes" ]; then + watch & + fi msg_done ;; @@ -46,11 +58,10 @@ case "$1" in stop start ;; - + *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? - diff --git a/board/common/overlay/etc/watch.conf b/board/common/overlay/etc/watch.conf index 0bdce4a371..d7ffb26a87 100644 --- a/board/common/overlay/etc/watch.conf +++ b/board/common/overlay/etc/watch.conf @@ -4,8 +4,9 @@ link_watch_timeout=20 ip_watch=no ip_watch_timeout=40 -#netwatch_host=www.google.com -#netwatch_port=80 -netwatch_retries=3 +netwatch_host=www.google.com +netwatch_port=80 +netwatch_retries=10 netwatch_timeout=5 -netwatch_interval=20 \ No newline at end of file +netwatch_interval=30 +netwatch_enable=no From 1f02cc2ef5af3ffb4a8c59ba2ad8c6f0b5e75b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 29 Jun 2017 22:24:13 +0200 Subject: [PATCH 26/40] add option for auto removal --- board/common/overlay/etc/init.d/S85machinery | 13 +++++++++++++ board/common/overlay/etc/watch.conf | 2 ++ 2 files changed, 15 insertions(+) diff --git a/board/common/overlay/etc/init.d/S85machinery b/board/common/overlay/etc/init.d/S85machinery index b141ab233c..75aab21acb 100755 --- a/board/common/overlay/etc/init.d/S85machinery +++ b/board/common/overlay/etc/init.d/S85machinery @@ -2,6 +2,7 @@ sys_conf="/etc/opt/kerberosio/config/config.xml" conf="/data/machinery/config/config.xml" +watch_conf="/data/etc/watch.conf" if [ -f $sys_conf ] && ! [ -f $conf ]; then mkdir -p /data/machinery/config @@ -18,6 +19,8 @@ if [ -f $sys_conf ] && ! [ -f $conf ]; then chmod -R 777 /data/machinery/h264 fi +test -f $watch_conf && source $watch_conf || exit 0 + watch() { while true; do sleep 3 @@ -29,6 +32,12 @@ watch() { pkill -f kerberosio kerberosio --config $conf & fi + done +} + +autoremoval() { + while true; do + sleep 60 if [[ $(df -h | grep /dev/mmcblk0p3 | head -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]]; then @@ -41,6 +50,10 @@ watch() { start() { echo "Starting kerberos.io machinery" watch & + + if [ "$autoremoval" == "yes" ]; then + autoremoval & + fi } stop() { diff --git a/board/common/overlay/etc/watch.conf b/board/common/overlay/etc/watch.conf index d7ffb26a87..0341f1af74 100644 --- a/board/common/overlay/etc/watch.conf +++ b/board/common/overlay/etc/watch.conf @@ -10,3 +10,5 @@ netwatch_retries=10 netwatch_timeout=5 netwatch_interval=30 netwatch_enable=no + +autoremoval=yes From 2c3893c6ee064cadb67507f7ce18fdfd9192d657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 08:32:13 +0200 Subject: [PATCH 27/40] add upload Github release script --- uploadrelease.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 uploadrelease.py diff --git a/uploadrelease.py b/uploadrelease.py new file mode 100644 index 0000000000..b90b8296a7 --- /dev/null +++ b/uploadrelease.py @@ -0,0 +1,61 @@ +from os import walk +import requests +from requests.auth import HTTPBasicAuth + +path = "./releases" +releaseID = "" +token = "" + +# Get list of assets from dev branch + +r = requests.get('https://api.github.com/repos/cedricve/kios/releases/%s/assets' % releaseID) +releases = r.json() + +for release in releases: + headers = { + 'content-type': 'application/json', + 'Authorization': 'token %s' % token + } + url = "https://api.github.com/repos/cedricve/kios/releases/assets/%s" % str(release['id']) + response = requests.delete(url, headers=headers) + print response + +# Get last release + +dates = [] +for (dirpath, dirnames, filenames) in walk(path): + dirParts = dirpath.split('/') + if len(dirParts) > 3 : + if dirParts[3] not in dates: + dates.append(dirParts[3]) + +lastRelease = dates[-1] + +# Get files from last release and take only the web.tar.gz +# from the rpi3 release (no need to upload the different ones). + +filesToUpload = [] +for (dirpath, dirnames, filenames) in walk(path): + for filename in filenames: + fullPath = dirpath + "/" + filename + pathParts = fullPath.split("/") + if len(pathParts) > 4 and pathParts[3] == lastRelease: + if (pathParts[2] != "rpi3" and pathParts[4] == "web.tar.gz") or pathParts[4] == ".DS_Store" : + continue + else: + filesToUpload.append(fullPath) + +print filesToUpload + +# Upload assets (files) to develop release +# POST https:///repos/:owner/:repo/releases/:id/assets?name=foo.zip + +for file in filesToUpload: + headers = { + 'content-type': 'application/octet-stream', + 'Authorization': 'token %s' % token + } + pathParts = fullPath.split("/") + url = "https://uploads.github.com/repos/cedricve/kios/releases/%s/assets?name=%s" % (releaseID, pathParts[4]) + response = requests.post(url, data=open(file,'rb'), headers=headers) + print response From 18138853fe2afb7fcee340da143976e06f9e36be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 08:35:16 +0200 Subject: [PATCH 28/40] integrate upload script in make release script --- mkrelease.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkrelease.sh b/mkrelease.sh index d1416cc67e..3b048961ab 100755 --- a/mkrelease.sh +++ b/mkrelease.sh @@ -38,3 +38,7 @@ mkdir -p $DIR/releases/rpi3/$DATE cp $DIR/kios-raspberrypi3-* $DIR/releases/rpi3/$DATE for file in $DIR/output/raspberrypi3/build/kerberosio-machinery*/kerberosio*; do cp -v -- "$file" "$DIR/releases/rpi3/$DATE/rpi3-machinery-${file##*/}"; done cd $DIR/output/raspberrypi3/target/var/www/web && sed -i 's/\/data\/machinery\/config/\/\etc\/opt\/kerberosio\/config/g' config/app.php && tar czf $DIR/releases/rpi3/$DATE/web.tar.gz . + +echo "Uploading last release to Github (cedricve/kios)" + +python uploadrelease.py From 6201688a839208bcea775ec29cbf389a3769c363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 13:24:13 +0200 Subject: [PATCH 29/40] sort releases pick last --- uploadrelease.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uploadrelease.py b/uploadrelease.py index b90b8296a7..3911643f62 100644 --- a/uploadrelease.py +++ b/uploadrelease.py @@ -29,6 +29,7 @@ if dirParts[3] not in dates: dates.append(dirParts[3]) +dates.sort(key=int) lastRelease = dates[-1] # Get files from last release and take only the web.tar.gz @@ -55,7 +56,7 @@ 'content-type': 'application/octet-stream', 'Authorization': 'token %s' % token } - pathParts = fullPath.split("/") + pathParts = file.split("/") url = "https://uploads.github.com/repos/cedricve/kios/releases/%s/assets?name=%s" % (releaseID, pathParts[4]) response = requests.post(url, data=open(file,'rb'), headers=headers) print response From 1632df3db2633a287bbe98695195f3dbe236b3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 17:48:37 +0200 Subject: [PATCH 30/40] change working directory --- mkrelease.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/mkrelease.sh b/mkrelease.sh index 3b048961ab..4e7398eb7c 100755 --- a/mkrelease.sh +++ b/mkrelease.sh @@ -41,4 +41,5 @@ cd $DIR/output/raspberrypi3/target/var/www/web && sed -i 's/\/data\/machinery\/c echo "Uploading last release to Github (cedricve/kios)" +cd $DIR python uploadrelease.py From b3e89e6cc99e2cbdcfe7b221599be662717860e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 20:21:57 +0200 Subject: [PATCH 31/40] wrong config path --- board/common/overlay/etc/init.d/S86web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/common/overlay/etc/init.d/S86web b/board/common/overlay/etc/init.d/S86web index 273d8eeb13..b8216a7896 100755 --- a/board/common/overlay/etc/init.d/S86web +++ b/board/common/overlay/etc/init.d/S86web @@ -1,7 +1,7 @@ #!/bin/bash sys_conf="/var/www/web" -conf="/data/web/app" +conf="/data/web" start() { echo "Configuring kerberos.io web" @@ -14,7 +14,7 @@ start() { cp -R /var/www/web/config /data/web/ chmod -R 777 /data/web/config/kerberos.php - + cp -R /var/www/web/bootstrap /data/web/ chmod -R 777 /data/web/bootstrap/cache fi From 0c871ea035c63637e6471449ba5094b4fc8b7393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Mon, 3 Jul 2017 21:31:20 +0200 Subject: [PATCH 32/40] upgrade machinery version deb --- package/kerberosio-machinery/CPackConfig.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kerberosio-machinery/CPackConfig.cmake b/package/kerberosio-machinery/CPackConfig.cmake index 2968101227..1d488a7c7b 100644 --- a/package/kerberosio-machinery/CPackConfig.cmake +++ b/package/kerberosio-machinery/CPackConfig.cmake @@ -6,10 +6,10 @@ SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Cédric Verstraeten") SET(CPACK_PACKAGE_DESCRIPTION "Kerberos is a low-budget surveillance solution, that uses computer vision algorithms to detect changes, and that can trigger other devices. Kerberos is open source so you, but also other people, can customize the source to your needs and share it with our community. It has a green footprint when deploying on the Raspberry Pi and it's easy to install, you only need to transfer the image to the SD card and you're done.") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_DESCRIPTION}") -SET(CPACK_PACKAGE_VERSION "2.2.2") +SET(CPACK_PACKAGE_VERSION "2.3.0") SET(CPACK_PACKAGE_VERSION_MAJOR "2") -SET(CPACK_PACKAGE_VERSION_MINOR "2") -SET(CPACK_PACKAGE_VERSION_PATCH "2") +SET(CPACK_PACKAGE_VERSION_MINOR "3") +SET(CPACK_PACKAGE_VERSION_PATCH "0") SET(CPACK_SYSTEM_NAME "armhf") SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf") From 012ff437fb603faa630dd19a05026c4b4eac434a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Tue, 4 Jul 2017 17:38:11 +0200 Subject: [PATCH 33/40] h264 incorrect symbol link --- package/kerberosio-machinery/kerberosio-machinery.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kerberosio-machinery/kerberosio-machinery.mk b/package/kerberosio-machinery/kerberosio-machinery.mk index 1ef9b22a80..90ff4978bb 100644 --- a/package/kerberosio-machinery/kerberosio-machinery.mk +++ b/package/kerberosio-machinery/kerberosio-machinery.mk @@ -38,7 +38,7 @@ define KERBEROSIO_MACHINERY_BIND_DIRS_TO_DATA rm -rf $(TARGET_DIR)/etc/opt/kerberosio/symbols ln -s /data/machinery/symbols $(TARGET_DIR)/etc/opt/kerberosio/symbols rm -rf $(TARGET_DIR)/etc/opt/kerberosio/h264 - ln -s /data/machinery/symbols $(TARGET_DIR)/etc/opt/kerberosio/h264 + ln -s /data/machinery/h264 $(TARGET_DIR)/etc/opt/kerberosio/h264 endef From 70ebdca555e5667372dcc900d45ada795d70b8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Tue, 4 Jul 2017 22:03:07 +0200 Subject: [PATCH 34/40] revert to develop branch after merge --- package/kerberosio-machinery/kerberosio-machinery.mk | 2 +- package/kerberosio-web/kerberosio-web.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kerberosio-machinery/kerberosio-machinery.mk b/package/kerberosio-machinery/kerberosio-machinery.mk index 90ff4978bb..0a8cc4d755 100644 --- a/package/kerberosio-machinery/kerberosio-machinery.mk +++ b/package/kerberosio-machinery/kerberosio-machinery.mk @@ -4,7 +4,7 @@ # ############################################################# -KERBEROSIO_MACHINERY_VERSION = openmax-il +KERBEROSIO_MACHINERY_VERSION = develop KERBEROSIO_MACHINERY_SITE = https://github.com/kerberos-io/machinery KERBEROSIO_MACHINERY_SITE_METHOD = git KERBEROSIO_MACHINERY_INSTALL_TARGET = YES diff --git a/package/kerberosio-web/kerberosio-web.mk b/package/kerberosio-web/kerberosio-web.mk index 6737a815dc..eb6066ae37 100644 --- a/package/kerberosio-web/kerberosio-web.mk +++ b/package/kerberosio-web/kerberosio-web.mk @@ -4,7 +4,7 @@ # ############################################################# -KERBEROSIO_WEB_VERSION = upgrade-to-5-4 +KERBEROSIO_WEB_VERSION = develop KERBEROSIO_WEB_SITE = https://github.com/kerberos-io/web KERBEROSIO_WEB_SITE_METHOD = git KERBEROSIO_WEB_INSTALL_TARGET = YES From 70628533b29303d557fe24d8a82303fcf0b8e05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 5 Jul 2017 21:57:48 +0200 Subject: [PATCH 35/40] create h264 directory in upgrade script --- board/common/overlay/usr/share/post-upgrade/2.4.0.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh index f0ab44ba93..22953192ad 100755 --- a/board/common/overlay/usr/share/post-upgrade/2.4.0.sh +++ b/board/common/overlay/usr/share/post-upgrade/2.4.0.sh @@ -59,6 +59,9 @@ done chmod -R 777 $DATA_CONFIG_DIR +mkdir -p /data/machinery/h264 +chmod -R 777 /data/machinery/h264 + ########################################## # # Update configuration files for web From e746d6212b0872e2ecd381f064e7826265d6905f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Wed, 5 Jul 2017 22:29:30 +0200 Subject: [PATCH 36/40] ffmpeg to target --- package/ffmpeg/ffmpeg.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 5a728092dd..437e3936f6 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -9,7 +9,7 @@ FFMPEG_VERSION = 3.2.3 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES -FFMPEG_INSTALL_TARGET = NO +FFMPEG_INSTALL_TARGET = YES FFMPEG_DEPENDENCIES = bellagio FFMPEG_LICENSE = LGPLv2.1+, libjpeg license From 3ac961ebd717cbc012dc96ef275405b41ebac23e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 6 Jul 2017 21:20:26 +0200 Subject: [PATCH 37/40] revert to ffmpeg 2.7 --- ...ub-palette-as-stored-on-normal-dvd-s.patch | 63 +++++++ .../0001-bfin-disable-optimization.patch | 26 --- ...t-returns-AVERROR_IO-we-are-done.-ff.patch | 32 ++++ ...7-TV-Teletext-support-for-DVB-EBU-Te.patch | 47 +++++ ...accept-mpegts-PMT-that-isn-t-current.patch | 46 +++++ ...-PMT-unless-it-s-version-has-changed.patch | 48 +++++ ...mps-as-well-as-PCR-timestamps-to-fin.patch | 105 +++++++++++ ...tream-durations-using-read_timestamp.patch | 74 ++++++++ ...second-skew-between-streams-in-mov-b.patch | 33 ++++ ...-mpegts-demuxer-on-some-malformed-mp.patch | 44 +++++ ...-Speed-up-mpegts-av_find_stream_info.patch | 30 +++ ...va-playback-of-streams-that-don-t-st.patch | 77 ++++++++ ...ublic-version-of-ff_read_frame_flush.patch | 53 ++++++ package/ffmpeg/0016-ranlib.patch | 35 ++++ package/ffmpeg/Config.in | 17 +- package/ffmpeg/ffmpeg.hash | 2 +- package/ffmpeg/ffmpeg.mk | 172 ++++-------------- 17 files changed, 731 insertions(+), 173 deletions(-) create mode 100644 package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch delete mode 100644 package/ffmpeg/0001-bfin-disable-optimization.patch create mode 100644 package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch create mode 100644 package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch create mode 100644 package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch create mode 100644 package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch create mode 100644 package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch create mode 100644 package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch create mode 100644 package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch create mode 100644 package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch create mode 100644 package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch create mode 100644 package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch create mode 100644 package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch create mode 100644 package/ffmpeg/0016-ranlib.patch diff --git a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch new file mode 100644 index 0000000000..a51a7d3c9c --- /dev/null +++ b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch @@ -0,0 +1,63 @@ +From 74f1c9b43b191a9d6b494e90a4a11677fca33c13 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 11 Sep 2011 19:04:51 +0200 +Subject: [PATCH 01/13] 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 +this way. + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c +index 39604f3..a711e16 100644 +--- a/libavcodec/dvdsubdec.c ++++ b/libavcodec/dvdsubdec.c +@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * + } + } + ++static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) ++{ ++ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; ++ uint8_t r, g, b; ++ int i, y, cb, cr, a; ++ int r_add, g_add, b_add; ++ ++ for (i = num_values; i > 0; i--) { ++ a = *ayvu++; ++ y = *ayvu++; ++ cr = *ayvu++; ++ cb = *ayvu++; ++ YUV_TO_RGB1_CCIR(cb, cr); ++ YUV_TO_RGB2_CCIR(r, g, b, y); ++ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; ++ } ++} ++ + static int decode_run_2bit(GetBitContext *gb, int *color) + { + unsigned int v, t; +@@ -697,6 +715,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) + parse_ifo_palette(ctx, ctx->ifo_str); + if (ctx->palette_str) + parse_palette(ctx, ctx->palette_str); ++ ++ if (!ctx->has_palette && avctx->extradata_size == 64) { ++ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); ++ ctx->has_palette = 1; ++ } ++ + if (ctx->has_palette) { + int i; + av_log(avctx, AV_LOG_DEBUG, "palette:"); +-- +2.1.0 + diff --git a/package/ffmpeg/0001-bfin-disable-optimization.patch b/package/ffmpeg/0001-bfin-disable-optimization.patch deleted file mode 100644 index 1d8a4f015d..0000000000 --- a/package/ffmpeg/0001-bfin-disable-optimization.patch +++ /dev/null @@ -1,26 +0,0 @@ -Fix bfin compile error - -See gcc bug report: -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77311 - -Signed-off-by: Waldemar Brodkorb - -diff -Nur ffmpeg-2.8.7.orig/libavcodec/hevcdsp_template.c ffmpeg-2.8.7/libavcodec/hevcdsp_template.c ---- ffmpeg-2.8.7.orig/libavcodec/hevcdsp_template.c 2016-03-29 04:25:16.000000000 +0200 -+++ ffmpeg-2.8.7/libavcodec/hevcdsp_template.c 2016-08-12 21:32:36.728178969 +0200 -@@ -1517,7 +1517,14 @@ - #define TQ2 pix[2 * xstride + 3 * ystride] - #define TQ3 pix[3 * xstride + 3 * ystride] - --static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, -+// Blackfin gcc 6.1.x fails with -+// unable to find a register to spill in class CCREGS -+#if defined(__bfin__) -+#define disable_opt __attribute__ ((optimize("O1"))) -+#else -+#define disable_opt -+#endif -+static void disable_opt FUNC(hevc_loop_filter_luma)(uint8_t *_pix, - ptrdiff_t _xstride, ptrdiff_t _ystride, - int beta, int *_tc, - uint8_t *_no_p, uint8_t *_no_q) diff --git a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch new file mode 100644 index 0000000000..034413405f --- /dev/null +++ b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch @@ -0,0 +1,32 @@ +From 54200b3e6009c6870e33c02c8bbcf023fcd92cac Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 01:55:31 -0400 +Subject: [PATCH 03/13] if av_read_packet returns AVERROR_IO, we are done. + ffmpeg's codecs might or might not handle returning any completed demuxed + packets correctly + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/utils.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index ae6347a..3e8af50 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -1304,6 +1304,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) + if (ret < 0) { + if (ret == AVERROR(EAGAIN)) + return ret; ++ if (ret == AVERROR(EIO)) ++ return ret; + /* flush the parsers */ + for (i = 0; i < s->nb_streams; i++) { + st = s->streams[i]; +-- +2.1.0 + diff --git a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch new file mode 100644 index 0000000000..bc6a2d456d --- /dev/null +++ b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch @@ -0,0 +1,47 @@ +From e9236f6fe3fae1ad4a3a2b6b63db493b083f0b21 Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Mon, 28 Jun 2010 02:10:50 -0400 +Subject: [PATCH 04/13] added: Ticket #7187, TV Teletext support for DVB EBU + Teletext streams + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/avcodec.h | 4 ++++ + libavformat/mpegts.c | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h +index dabae1b..dd6ef3f 100644 +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -520,6 +520,10 @@ enum AVCodecID { + AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), + AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska + ++ /* data codecs */ ++ AV_CODEC_ID_VBI_DATA= 0x17500, ++ AV_CODEC_ID_VBI_TELETEXT, ++ + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 97da0a3..5dd28f1 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -729,6 +729,8 @@ static const StreamType DESC_types[] = { + { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, + { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, + { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ ++ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ ++ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ + { 0 }, + }; + +-- +2.1.0 + diff --git a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch new file mode 100644 index 0000000000..feb58f7b25 --- /dev/null +++ b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch @@ -0,0 +1,46 @@ +From 1f48ee2290e9041b0371eb9a9cb742e9568930a1 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:16:34 +0200 +Subject: [PATCH 05/13] Don't accept mpegts PMT that isn't current + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 5dd28f1..9f85aed 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -572,6 +572,7 @@ typedef struct SectionHeader { + uint8_t tid; + uint16_t id; + uint8_t version; ++ uint8_t current; + uint8_t sec_num; + uint8_t last_sec_num; + } SectionHeader; +@@ -643,6 +644,7 @@ static int parse_section_header(SectionHeader *h, + val = get8(pp, p_end); + if (val < 0) + return val; ++ h->current = val & 0x1; + h->version = (val >> 1) & 0x1f; + val = get8(pp, p_end); + if (val < 0) +@@ -1968,6 +1970,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (ts->skip_changes) + return; ++ if (!h->current) ++ return; + + ts->stream->ts_id = h->id; + +-- +2.1.0 + diff --git a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch new file mode 100644 index 0000000000..0418f25eb1 --- /dev/null +++ b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch @@ -0,0 +1,48 @@ +From db98fbe37f2f7175ff03b8d582e940518ddf3642 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sun, 18 Sep 2011 19:17:23 +0200 +Subject: [PATCH 06/13] Don't reparse PMT unless it's version has changed + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 9f85aed..25007a6 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -88,6 +88,7 @@ struct MpegTSFilter { + int es_id; + int last_cc; /* last cc code (-1 if first packet) */ + int64_t last_pcr; ++ int last_version; /* last version of data on this pid */ + enum MpegTSFilterType type; + union { + MpegTSPESFilter pes_filter; +@@ -450,6 +451,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, + filter->es_id = -1; + filter->last_cc = -1; + filter->last_pcr= -1; ++ filter->last_version = -1; + + return filter; + } +@@ -1972,6 +1974,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len + return; + if (!h->current) + return; ++ if (h->version == filter->last_version) ++ return; ++ filter->last_version = h->version; ++ av_dlog(ts->stream, "version=%d\n", filter->last_version); + + ts->stream->ts_id = h->id; + +-- +2.1.0 + diff --git a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch new file mode 100644 index 0000000000..259b35939e --- /dev/null +++ b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch @@ -0,0 +1,105 @@ +From fdd8caea6535434a877587f5325e914ba50ed17f Mon Sep 17 00:00:00 2001 +From: Cory Fields +Date: Fri, 9 Jul 2010 16:43:31 -0400 +Subject: [PATCH 07/13] Read PID timestamps as well as PCR timestamps to find + location in mpegts stream + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 46 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 25007a6..d5a8a45 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -2459,6 +2459,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { + av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); + } + ++static int parse_timestamp(int64_t *ts, const uint8_t *buf) ++{ ++ int afc, flags; ++ const uint8_t *p; ++ ++ if(!(buf[1] & 0x40)) /* must be a start packet */ ++ return -1; ++ ++ afc = (buf[3] >> 4) & 3; ++ p = buf + 4; ++ if (afc == 0 || afc == 2) /* invalid or only adaption field */ ++ return -1; ++ if (afc == 3) ++ p += p[0] + 1; ++ if (p >= buf + TS_PACKET_SIZE) ++ return -1; ++ ++ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ ++ return -1; ++ ++ flags = p[3] | 0x100; /* stream type */ ++ if (!((flags >= 0x1c0 && flags <= 0x1df) || ++ (flags >= 0x1e0 && flags <= 0x1ef) || ++ (flags == 0x1bd) || (flags == 0x1fd))) ++ return -1; ++ ++ flags = p[7]; ++ if ((flags & 0xc0) == 0x80) { ++ *ts = ff_parse_pes_pts(p+9); ++ return 0; ++ } else if ((flags & 0xc0) == 0xc0) { ++ *ts = ff_parse_pes_pts(p+9+5); ++ return 0; ++ } ++ return -1; ++} ++ ++ + static int mpegts_read_header(AVFormatContext *s) + { + MpegTSContext *ts = s->priv_data; +@@ -2658,6 +2696,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + uint8_t buf[TS_PACKET_SIZE]; + int pcr_l, pcr_pid = + ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; ++ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; + int pos47 = ts->pos47_full % ts->raw_packet_size; + pos = + ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * +@@ -2679,6 +2718,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, + *ppos = pos; + return timestamp; + } ++ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && ++ parse_timestamp(×tamp, buf) == 0) { ++ *ppos = pos; ++ return timestamp; ++ } + pos += ts->raw_packet_size; + } + +@@ -2778,7 +2822,7 @@ AVInputFormat ff_mpegts_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegts_class, + }; +@@ -2790,7 +2834,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { + .read_header = mpegts_read_header, + .read_packet = mpegts_raw_read_packet, + .read_close = mpegts_read_close, +- .read_timestamp = mpegts_get_dts, ++ .read_timestamp = mpegts_get_pcr, + .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, + .priv_class = &mpegtsraw_class, + }; +-- +2.1.0 + diff --git a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch new file mode 100644 index 0000000000..0b80c113e1 --- /dev/null +++ b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch @@ -0,0 +1,74 @@ +From c57e5b8154f5fe1457f4c64e04885a2cdfb37f51 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Sat, 22 Oct 2011 19:01:38 +0200 +Subject: [PATCH 08/13] Get stream durations using read_timestamp + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/libavformat/utils.c b/libavformat/utils.c +index 3e8af50..f4fb172 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -2356,6 +2356,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) + #define DURATION_MAX_READ_SIZE 250000LL + #define DURATION_MAX_RETRY 4 + ++static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) ++{ ++ AVStream *st; ++ int i, step= 1024; ++ int64_t ts, pos; ++ ++ for(i=0;inb_streams;i++) { ++ st = ic->streams[i]; ++ ++ pos = 0; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) ++ st->start_time = ts; ++ ++ pos = avio_size(ic->pb) - 1; ++ do { ++ pos -= step; ++ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); ++ step += step; ++ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); ++ ++ if (ts == AV_NOPTS_VALUE) ++ continue; ++ ++ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) ++ st->duration = ts - st->start_time; ++ } ++ ++ fill_all_stream_timings(ic); ++ ++ avio_seek(ic->pb, old_offset, SEEK_SET); ++} ++ + /* only usable for MPEG-PS streams */ + static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) + { +@@ -2506,6 +2541,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; ++ } else if (ic->iformat->read_timestamp && ++ file_size && ic->pb->seekable) { ++ /* get accurate estimate from the PTSes */ ++ av_estimate_timings_from_pts2(ic, old_offset); + } else { + /* less precise: use bitrate info */ + estimate_timings_from_bit_rate(ic); +-- +2.1.0 + diff --git a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch new file mode 100644 index 0000000000..fb0aad1e13 --- /dev/null +++ b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch @@ -0,0 +1,33 @@ +From 4bcec3ef0042244b0ade00d132368d0872f73c72 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Wed, 8 Dec 2010 14:03:43 +0000 +Subject: [PATCH 09/13] changed: allow 4 second skew between streams in mov + before attempting to seek + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mov.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 8d66c0a..127ffd9 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -4028,8 +4028,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 && +- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || +- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { ++ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || ++ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { + sample = current_sample; + best_dts = dts; + *st = avst; +-- +2.1.0 + diff --git a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch new file mode 100644 index 0000000000..d13d0730b8 --- /dev/null +++ b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch @@ -0,0 +1,44 @@ +From cb7c19124165508ae5f38a385a14f9c13b096a27 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Fri, 26 Nov 2010 20:56:48 +0000 +Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??) + mpegts files with too large pes packets + +at-visions sample file brokenStream.mpg + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index d5a8a45..e070f1f 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -832,6 +832,10 @@ static void reset_pes_packet_state(PESContext *pes) + + static void new_pes_packet(PESContext *pes, AVPacket *pkt) + { ++ if(pkt->data) { ++ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); ++ av_free_packet(pkt); ++ } + av_init_packet(pkt); + + pkt->buf = pes->buffer; +@@ -2649,6 +2653,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) + + pkt->size = -1; + ts->pkt = pkt; ++ ts->pkt->data = NULL; ++ + ret = handle_packets(ts, 0); + if (ret < 0) { + av_free_packet(ts->pkt); +-- +2.1.0 + diff --git a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch new file mode 100644 index 0000000000..7c81f1d5fd --- /dev/null +++ b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch @@ -0,0 +1,30 @@ +From c315a758a292200c22925603682e259849d6d558 Mon Sep 17 00:00:00 2001 +From: Joakim Plate +Date: Mon, 28 Jun 2010 21:26:54 +0000 +Subject: [PATCH 11/13] Speed up mpegts av_find_stream_info + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavformat/mpegts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index e070f1f..dd9e129 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -994,7 +994,7 @@ static int mpegts_push_data(MpegTSFilter *filter, + goto skip; + + /* stream not present in PMT */ +- if (!pes->st) { ++ if (ts->auto_guess && !pes->st) { + if (ts->skip_changes) + goto skip; + +-- +2.1.0 + diff --git a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch new file mode 100644 index 0000000000..f346da131f --- /dev/null +++ b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch @@ -0,0 +1,77 @@ +From 939ebbbc46ca9995637415594f1815633587104f Mon Sep 17 00:00:00 2001 +From: marc +Date: Mon, 18 Feb 2013 17:18:18 +0000 +Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start + with an I-Frame. + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +Signed-off-by: Thomas Petazzoni +--- + libavcodec/dxva2_h264.c | 8 ++++++++ + libavcodec/h264.c | 1 + + libavcodec/h264.h | 2 ++ + libavcodec/h264_slice.c | 1 + + 4 files changed, 12 insertions(+) + +diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c +index 6deccc3..85b25fd 100644 +--- a/libavcodec/dxva2_h264.c ++++ b/libavcodec/dxva2_h264.c +@@ -451,6 +451,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) + + if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) + return -1; ++ ++ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs ++ if (!h->got_first_iframe) { ++ if (!(ctx_pic->pp.wBitFields & (1 << 15))) ++ return -1; ++ h->got_first_iframe = 1; ++ } ++ + ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, + &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 222bf58..ea2ec17 100644 +--- a/libavcodec/h264.c ++++ b/libavcodec/h264.c +@@ -1085,6 +1085,7 @@ void ff_h264_flush_change(H264Context *h) + h->mmco_reset = 1; + for (i = 0; i < h->nb_slice_ctx; i++) + h->slice_ctx[i].list_count = 0; ++ h->got_first_iframe = 0; + } + + /* forget old pics after a seek */ +diff --git a/libavcodec/h264.h b/libavcodec/h264.h +index b94f06b..bc9458b 100644 +--- a/libavcodec/h264.h ++++ b/libavcodec/h264.h +@@ -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 + ++ int got_first_iframe; ++ + // Timestamp stuff + 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 53f61ca..b171d78 100644 +--- a/libavcodec/h264_slice.c ++++ b/libavcodec/h264_slice.c +@@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) + ff_h264_free_tables(h, 0); + h->first_field = 0; + h->prev_interlaced_frame = 1; ++ h->got_first_iframe = 0; + + init_scan_tables(h); + ret = ff_h264_alloc_tables(h); +-- +2.1.0 + diff --git a/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch b/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch new file mode 100644 index 0000000000..58a91e2e74 --- /dev/null +++ b/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch @@ -0,0 +1,53 @@ +From 7d7ce18ff0d24b586634fa6e631fa0eec7865aae Mon Sep 17 00:00:00 2001 +From: elupus +Date: Tue, 1 Nov 2011 20:18:35 +0100 +Subject: [PATCH 13/13] add public version of ff_read_frame_flush + +We need this since we sometimes seek on the +input stream behind ffmpeg's back. After this +all data need to be flushed completely. + +Patch part of the XBMC patch set for ffmpeg, downloaded from +https://github.com/xbmc/FFmpeg/. + +Signed-off-by: Bernd Kuhls +--- + libavformat/avformat.h | 5 +++++ + libavformat/utils.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/libavformat/avformat.h b/libavformat/avformat.h +index 2e54ed1..3a9f292 100644 +--- a/libavformat/avformat.h ++++ b/libavformat/avformat.h +@@ -2121,6 +2121,11 @@ int av_find_best_stream(AVFormatContext *ic, + int av_read_frame(AVFormatContext *s, AVPacket *pkt); + + /** ++ * Clear out any buffered data in context ++ */ ++void av_read_frame_flush(AVFormatContext *s); ++ ++/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * +diff --git a/libavformat/utils.c b/libavformat/utils.c +index f4fb172..10dda18 100644 +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -1624,6 +1624,11 @@ void ff_read_frame_flush(AVFormatContext *s) + } + } + ++void av_read_frame_flush(AVFormatContext *s) ++{ ++ ff_read_frame_flush(s); ++} ++ + void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp) + { + int i; +-- +2.1.0 + diff --git a/package/ffmpeg/0016-ranlib.patch b/package/ffmpeg/0016-ranlib.patch new file mode 100644 index 0000000000..e88b25f1b4 --- /dev/null +++ b/package/ffmpeg/0016-ranlib.patch @@ -0,0 +1,35 @@ +Fix ranlib check when cross-compiling + +Without this patch /usr/bin/ranlib is tested for "-D", not ranlib from the +cross-compiler suite being in use. + +Signed-off-by: Bernd Kuhls + +diff -uNr ffmpeg-2.6.2.org/configure ffmpeg-2.6.2/configure +--- ffmpeg-2.6.2.org/configure 2015-04-12 00:47:55.000000000 +0200 ++++ ffmpeg-2.6.2/configure 2015-04-16 21:53:24.313202517 +0200 +@@ -2719,11 +2719,6 @@ + nm_default="nm -g" + objformat="elf" + pkg_config_default=pkg-config +-if ranlib 2>&1 | grep -q "\-D "; then +- ranlib_default="ranlib -D" +-else +- ranlib_default="ranlib" +-fi + strip_default="strip" + yasmexe_default="yasm" + windres_default="windres" +@@ -3001,6 +2996,12 @@ + die "Must specify target arch and OS when cross-compiling" + fi + ++if "${cross_prefix}ranlib" 2>&1 | grep -q "\-D "; then ++ ranlib_default="ranlib -D" ++else ++ ranlib_default="ranlib" ++fi ++ + test -n "$valgrind" && toolchain="valgrind-memcheck" + + case "$toolchain" in diff --git a/package/ffmpeg/Config.in b/package/ffmpeg/Config.in index b5850db722..e5981fee55 100644 --- a/package/ffmpeg/Config.in +++ b/package/ffmpeg/Config.in @@ -1,13 +1,8 @@ -config BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS - bool - # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW on nios2 - # No support for ARMv7-M in the ARM assembly logic - # Microblaze build affected by gcc PR71124 (infinite loop) - default y if !BR2_nios2 && !BR2_ARM_CPU_ARMV7M && !BR2_microblaze - menuconfig BR2_PACKAGE_FFMPEG bool "ffmpeg" - depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS + # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW + depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305 + depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201405 help FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. @@ -41,16 +36,12 @@ config BR2_PACKAGE_FFMPEG_FFMPEG config BR2_PACKAGE_FFMPEG_FFPLAY bool "Build ffplay" select BR2_PACKAGE_FFMPEG_SWSCALE - select BR2_PACKAGE_SDL2 - depends on !BR2_STATIC_LIBS # sdl2 + select BR2_PACKAGE_SDL help FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs. -comment "ffplay needs a toolchain w/ dynamic library" - depends on BR2_STATIC_LIBS - config BR2_PACKAGE_FFMPEG_FFSERVER bool "Build ffserver" depends on BR2_USE_MMU # fork() diff --git a/package/ffmpeg/ffmpeg.hash b/package/ffmpeg/ffmpeg.hash index 6adf7e440a..2e6b4137c1 100644 --- a/package/ffmpeg/ffmpeg.hash +++ b/package/ffmpeg/ffmpeg.hash @@ -1,2 +1,2 @@ # Locally calculated -sha256 54ce502aca10b7e6059f19220ea2f68fa0c9c4c4d255ae13e615f08f0c94dcc5 ffmpeg-3.2.3.tar.xz +sha256 7ceb7550ad628c526fa6c9ff23fdfb687a62f54d90c4a730998d8c2b417b9ef2 ffmpeg-2.7.2.tar.bz2 diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 437e3936f6..f993a04757 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -1,16 +1,14 @@ - ################################################################################ # # ffmpeg # ################################################################################ -FFMPEG_VERSION = 3.2.3 -FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz +FFMPEG_VERSION = 2.7.2 +FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.bz2 FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES FFMPEG_INSTALL_TARGET = YES -FFMPEG_DEPENDENCIES = bellagio FFMPEG_LICENSE = LGPLv2.1+, libjpeg license FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1 @@ -22,9 +20,7 @@ endif FFMPEG_CONF_OPTS = \ --prefix=/usr \ --enable-static \ - --disable-shared \ - --enable-omx \ - --enable-omx-rpi \ + --disable-shared \ --enable-avfilter \ --disable-version3 \ --enable-logging \ @@ -43,25 +39,29 @@ FFMPEG_CONF_OPTS = \ --enable-mdct \ --enable-rdft \ --disable-crystalhd \ + --disable-vdpau \ --disable-dxva2 \ --enable-runtime-cpudetect \ --disable-hardcoded-tables \ --disable-memalign-hack \ - --disable-mipsdsp \ - --disable-mipsdspr2 \ --disable-msa \ --enable-hwaccels \ --disable-avisynth \ --disable-frei0r \ --disable-libopencore-amrnb \ --disable-libopencore-amrwb \ - --disable-libcdio \ + --disable-libopencv \ --disable-libdc1394 \ + --disable-libfaac \ --disable-libgsm \ - --disable-libilbc \ + --disable-libmp3lame \ --disable-libnut \ --disable-libopenjpeg \ + --disable-librtmp \ --disable-libschroedinger \ + --disable-libspeex \ + --disable-libtheora \ + --disable-libvo-aacenc \ --disable-libvo-amrwbenc \ --disable-symver \ --disable-doc @@ -87,9 +87,9 @@ FFMPEG_CONF_OPTS += --disable-ffmpeg endif ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y) -FFMPEG_DEPENDENCIES += sdl2 +FFMPEG_DEPENDENCIES += sdl FFMPEG_CONF_OPTS += --enable-ffplay -FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config +FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config else FFMPEG_CONF_OPTS += --disable-ffplay endif @@ -196,18 +196,6 @@ else FFMPEG_CONF_OPTS += --disable-bzlib endif -ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy) -FFMPEG_CONF_OPTS += --enable-libfdk-aac -FFMPEG_DEPENDENCIES += fdk-aac -else -FFMPEG_CONF_OPTS += --disable-libfdk-aac -endif - -ifeq ($(BR2_PACKAGE_GNUTLS),y) -FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl -FFMPEG_DEPENDENCIES += gnutls -else -FFMPEG_CONF_OPTS += --disable-gnutls ifeq ($(BR2_PACKAGE_OPENSSL),y) # openssl isn't license compatible with GPL ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx) @@ -219,18 +207,6 @@ endif else FFMPEG_CONF_OPTS += --disable-openssl endif -endif - -ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy) -FFMPEG_DEPENDENCIES += libebur128 -endif - -ifeq ($(BR2_PACKAGE_LIBOPENH264),y) -FFMPEG_CONF_OPTS += --enable-libopenh264 -FFMPEG_DEPENDENCIES += libopenh264 -else -FFMPEG_CONF_OPTS += --disable-libopenh264 -endif ifeq ($(BR2_PACKAGE_LIBVORBIS),y) FFMPEG_DEPENDENCIES += libvorbis @@ -247,25 +223,6 @@ else FFMPEG_CONF_OPTS += --disable-vaapi endif -ifeq ($(BR2_PACKAGE_LIBVDPAU),y) -FFMPEG_CONF_OPTS += --enable-vdpau -FFMPEG_DEPENDENCIES += libvdpau -else -FFMPEG_CONF_OPTS += --disable-vdpau -endif - -# To avoid a circular dependency only use opencv if opencv itself does -# not depend on ffmpeg. -ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx) -FFMPEG_CONF_OPTS += --enable-libopencv -FFMPEG_DEPENDENCIES += opencv -else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx) -FFMPEG_CONF_OPTS += --enable-libopencv -FFMPEG_DEPENDENCIES += opencv3 -else -FFMPEG_CONF_OPTS += --disable-libopencv -endif - ifeq ($(BR2_PACKAGE_OPUS),y) FFMPEG_CONF_OPTS += --enable-libopus FFMPEG_DEPENDENCIES += opus @@ -280,62 +237,6 @@ else FFMPEG_CONF_OPTS += --disable-libvpx endif -ifeq ($(BR2_PACKAGE_LIBASS),y) -FFMPEG_CONF_OPTS += --enable-libass -FFMPEG_DEPENDENCIES += libass -else -FFMPEG_CONF_OPTS += --disable-libass -endif - -ifeq ($(BR2_PACKAGE_LIBBLURAY),y) -FFMPEG_CONF_OPTS += --enable-libbluray -FFMPEG_DEPENDENCIES += libbluray -else -FFMPEG_CONF_OPTS += --disable-libbluray -endif - -ifeq ($(BR2_PACKAGE_RTMPDUMP),y) -FFMPEG_CONF_OPTS += --enable-librtmp -FFMPEG_DEPENDENCIES += rtmpdump -else -FFMPEG_CONF_OPTS += --disable-librtmp -endif - -ifeq ($(BR2_PACKAGE_LAME),y) -FFMPEG_CONF_OPTS += --enable-libmp3lame -FFMPEG_DEPENDENCIES += lame -else -FFMPEG_CONF_OPTS += --disable-libmp3lame -endif - -ifeq ($(BR2_PACKAGE_LIBMODPLUG),y) -FFMPEG_CONF_OPTS += --enable-libmodplug -FFMPEG_DEPENDENCIES += libmodplug -else -FFMPEG_CONF_OPTS += --disable-libmodplug -endif - -ifeq ($(BR2_PACKAGE_SPEEX),y) -FFMPEG_CONF_OPTS += --enable-libspeex -FFMPEG_DEPENDENCIES += speex -else -FFMPEG_CONF_OPTS += --disable-libspeex -endif - -ifeq ($(BR2_PACKAGE_LIBTHEORA),y) -FFMPEG_CONF_OPTS += --enable-libtheora -FFMPEG_DEPENDENCIES += libtheora -else -FFMPEG_CONF_OPTS += --disable-libtheora -endif - -ifeq ($(BR2_PACKAGE_WAVPACK),y) -FFMPEG_CONF_OPTS += --enable-libwavpack -FFMPEG_DEPENDENCIES += wavpack -else -FFMPEG_CONF_OPTS += --disable-libwavpack -endif - # ffmpeg freetype support require fenv.h which is only # available/working on glibc. # The microblaze variant doesn't provide the needed exceptions @@ -360,13 +261,6 @@ else FFMPEG_CONF_OPTS += --disable-libx264 endif -ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy) -FFMPEG_CONF_OPTS += --enable-libx265 -FFMPEG_DEPENDENCIES += x265 -else -FFMPEG_CONF_OPTS += --disable-libx265 -endif - ifeq ($(BR2_X86_CPU_HAS_MMX),y) FFMPEG_CONF_OPTS += --enable-yasm FFMPEG_DEPENDENCIES += host-yasm @@ -446,17 +340,33 @@ FFMPEG_CONF_OPTS += --disable-vfp endif ifeq ($(BR2_ARM_CPU_HAS_NEON),y) FFMPEG_CONF_OPTS += --enable-neon -else -FFMPEG_CONF_OPTS += --disable-neon endif -ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) ifeq ($(BR2_MIPS_SOFT_FLOAT),y) -FFMPEG_CONF_OPTS += --disable-mipsfpu +FFMPEG_CONF_OPTS += \ + --disable-mipsfpu else -FFMPEG_CONF_OPTS += --enable-mipsfpu +FFMPEG_CONF_OPTS += \ + --enable-mipsfpu +endif + +ifeq ($(BR2_mips_32r2),y) +FFMPEG_CONF_OPTS += \ + --enable-mips32r2 +else +FFMPEG_CONF_OPTS += \ + --disable-mips32r2 +endif + +ifeq ($(BR2_mips_64r2),y) +FFMPEG_CONF_OPTS += \ + --enable-mipsdspr1 \ + --enable-mipsdspr2 +else +FFMPEG_CONF_OPTS += \ + --disable-mipsdspr1 \ + --disable-mipsdspr2 endif -endif # MIPS ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y) FFMPEG_CONF_OPTS += --enable-altivec @@ -470,19 +380,14 @@ else FFMPEG_CONF_OPTS += --disable-pic endif -# Default to --cpu=generic for MIPS architecture, in order to avoid a -# warning from ffmpeg's configure script. -ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) -FFMPEG_CONF_OPTS += --cpu=generic -else ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) +FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) + +ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU) else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH) endif - -FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) - # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others define FFMPEG_CONFIGURE_CMDS (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \ @@ -498,6 +403,7 @@ define FFMPEG_CONFIGURE_CMDS --target-os="linux" \ --disable-stripping \ --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \ + $(SHARED_STATIC_LIBS_OPTS) \ $(FFMPEG_CONF_OPTS) \ ) endef From 9fe2ebdda8fdec9c00bf687da99673a323be9b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Fri, 7 Jul 2017 07:56:37 +0200 Subject: [PATCH 38/40] Revert "revert to ffmpeg 2.7" This reverts commit 3ac961ebd717cbc012dc96ef275405b41ebac23e. --- ...ub-palette-as-stored-on-normal-dvd-s.patch | 63 ------- .../0001-bfin-disable-optimization.patch | 26 +++ ...t-returns-AVERROR_IO-we-are-done.-ff.patch | 32 ---- ...7-TV-Teletext-support-for-DVB-EBU-Te.patch | 47 ----- ...accept-mpegts-PMT-that-isn-t-current.patch | 46 ----- ...-PMT-unless-it-s-version-has-changed.patch | 48 ----- ...mps-as-well-as-PCR-timestamps-to-fin.patch | 105 ----------- ...tream-durations-using-read_timestamp.patch | 74 -------- ...second-skew-between-streams-in-mov-b.patch | 33 ---- ...-mpegts-demuxer-on-some-malformed-mp.patch | 44 ----- ...-Speed-up-mpegts-av_find_stream_info.patch | 30 --- ...va-playback-of-streams-that-don-t-st.patch | 77 -------- ...ublic-version-of-ff_read_frame_flush.patch | 53 ------ package/ffmpeg/0016-ranlib.patch | 35 ---- package/ffmpeg/Config.in | 17 +- package/ffmpeg/ffmpeg.hash | 2 +- package/ffmpeg/ffmpeg.mk | 172 ++++++++++++++---- 17 files changed, 173 insertions(+), 731 deletions(-) delete mode 100644 package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch create mode 100644 package/ffmpeg/0001-bfin-disable-optimization.patch delete mode 100644 package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch delete mode 100644 package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch delete mode 100644 package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch delete mode 100644 package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch delete mode 100644 package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch delete mode 100644 package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch delete mode 100644 package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch delete mode 100644 package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch delete mode 100644 package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch delete mode 100644 package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch delete mode 100644 package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch delete mode 100644 package/ffmpeg/0016-ranlib.patch diff --git a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch b/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch deleted file mode 100644 index a51a7d3c9c..0000000000 --- a/package/ffmpeg/0001-Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 74f1c9b43b191a9d6b494e90a4a11677fca33c13 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 11 Sep 2011 19:04:51 +0200 -Subject: [PATCH 01/13] 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 -this way. - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c -index 39604f3..a711e16 100644 ---- a/libavcodec/dvdsubdec.c -+++ b/libavcodec/dvdsubdec.c -@@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * - } - } - -+static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values) -+{ -+ uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; -+ uint8_t r, g, b; -+ int i, y, cb, cr, a; -+ int r_add, g_add, b_add; -+ -+ for (i = num_values; i > 0; i--) { -+ a = *ayvu++; -+ y = *ayvu++; -+ cr = *ayvu++; -+ cb = *ayvu++; -+ YUV_TO_RGB1_CCIR(cb, cr); -+ YUV_TO_RGB2_CCIR(r, g, b, y); -+ *argb++ = (a << 24) | (r << 16) | (g << 8) | b; -+ } -+} -+ - static int decode_run_2bit(GetBitContext *gb, int *color) - { - unsigned int v, t; -@@ -697,6 +715,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) - parse_ifo_palette(ctx, ctx->ifo_str); - if (ctx->palette_str) - parse_palette(ctx, ctx->palette_str); -+ -+ if (!ctx->has_palette && avctx->extradata_size == 64) { -+ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16); -+ ctx->has_palette = 1; -+ } -+ - if (ctx->has_palette) { - int i; - av_log(avctx, AV_LOG_DEBUG, "palette:"); --- -2.1.0 - diff --git a/package/ffmpeg/0001-bfin-disable-optimization.patch b/package/ffmpeg/0001-bfin-disable-optimization.patch new file mode 100644 index 0000000000..1d8a4f015d --- /dev/null +++ b/package/ffmpeg/0001-bfin-disable-optimization.patch @@ -0,0 +1,26 @@ +Fix bfin compile error + +See gcc bug report: +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77311 + +Signed-off-by: Waldemar Brodkorb + +diff -Nur ffmpeg-2.8.7.orig/libavcodec/hevcdsp_template.c ffmpeg-2.8.7/libavcodec/hevcdsp_template.c +--- ffmpeg-2.8.7.orig/libavcodec/hevcdsp_template.c 2016-03-29 04:25:16.000000000 +0200 ++++ ffmpeg-2.8.7/libavcodec/hevcdsp_template.c 2016-08-12 21:32:36.728178969 +0200 +@@ -1517,7 +1517,14 @@ + #define TQ2 pix[2 * xstride + 3 * ystride] + #define TQ3 pix[3 * xstride + 3 * ystride] + +-static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, ++// Blackfin gcc 6.1.x fails with ++// unable to find a register to spill in class CCREGS ++#if defined(__bfin__) ++#define disable_opt __attribute__ ((optimize("O1"))) ++#else ++#define disable_opt ++#endif ++static void disable_opt FUNC(hevc_loop_filter_luma)(uint8_t *_pix, + ptrdiff_t _xstride, ptrdiff_t _ystride, + int beta, int *_tc, + uint8_t *_no_p, uint8_t *_no_q) diff --git a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch b/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch deleted file mode 100644 index 034413405f..0000000000 --- a/package/ffmpeg/0003-if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 54200b3e6009c6870e33c02c8bbcf023fcd92cac Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Mon, 28 Jun 2010 01:55:31 -0400 -Subject: [PATCH 03/13] if av_read_packet returns AVERROR_IO, we are done. - ffmpeg's codecs might or might not handle returning any completed demuxed - packets correctly - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/utils.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index ae6347a..3e8af50 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -1304,6 +1304,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) - if (ret < 0) { - if (ret == AVERROR(EAGAIN)) - return ret; -+ if (ret == AVERROR(EIO)) -+ return ret; - /* flush the parsers */ - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; --- -2.1.0 - diff --git a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch b/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch deleted file mode 100644 index bc6a2d456d..0000000000 --- a/package/ffmpeg/0004-added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e9236f6fe3fae1ad4a3a2b6b63db493b083f0b21 Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Mon, 28 Jun 2010 02:10:50 -0400 -Subject: [PATCH 04/13] added: Ticket #7187, TV Teletext support for DVB EBU - Teletext streams - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/avcodec.h | 4 ++++ - libavformat/mpegts.c | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index dabae1b..dd6ef3f 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -520,6 +520,10 @@ enum AVCodecID { - AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), - AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska - -+ /* data codecs */ -+ AV_CODEC_ID_VBI_DATA= 0x17500, -+ AV_CODEC_ID_VBI_TELETEXT, -+ - /* other specific kind of codecs (generally used for attachments) */ - AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. - AV_CODEC_ID_TTF = 0x18000, -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 97da0a3..5dd28f1 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -729,6 +729,8 @@ static const StreamType DESC_types[] = { - { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, - { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, - { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ -+ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */ -+ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */ - { 0 }, - }; - --- -2.1.0 - diff --git a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch b/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch deleted file mode 100644 index feb58f7b25..0000000000 --- a/package/ffmpeg/0005-Don-t-accept-mpegts-PMT-that-isn-t-current.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 1f48ee2290e9041b0371eb9a9cb742e9568930a1 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 18 Sep 2011 19:16:34 +0200 -Subject: [PATCH 05/13] Don't accept mpegts PMT that isn't current - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 5dd28f1..9f85aed 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -572,6 +572,7 @@ typedef struct SectionHeader { - uint8_t tid; - uint16_t id; - uint8_t version; -+ uint8_t current; - uint8_t sec_num; - uint8_t last_sec_num; - } SectionHeader; -@@ -643,6 +644,7 @@ static int parse_section_header(SectionHeader *h, - val = get8(pp, p_end); - if (val < 0) - return val; -+ h->current = val & 0x1; - h->version = (val >> 1) & 0x1f; - val = get8(pp, p_end); - if (val < 0) -@@ -1968,6 +1970,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (ts->skip_changes) - return; -+ if (!h->current) -+ return; - - ts->stream->ts_id = h->id; - --- -2.1.0 - diff --git a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch b/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch deleted file mode 100644 index 0418f25eb1..0000000000 --- a/package/ffmpeg/0006-Don-t-reparse-PMT-unless-it-s-version-has-changed.patch +++ /dev/null @@ -1,48 +0,0 @@ -From db98fbe37f2f7175ff03b8d582e940518ddf3642 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sun, 18 Sep 2011 19:17:23 +0200 -Subject: [PATCH 06/13] Don't reparse PMT unless it's version has changed - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 9f85aed..25007a6 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -88,6 +88,7 @@ struct MpegTSFilter { - int es_id; - int last_cc; /* last cc code (-1 if first packet) */ - int64_t last_pcr; -+ int last_version; /* last version of data on this pid */ - enum MpegTSFilterType type; - union { - MpegTSPESFilter pes_filter; -@@ -450,6 +451,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, - filter->es_id = -1; - filter->last_cc = -1; - filter->last_pcr= -1; -+ filter->last_version = -1; - - return filter; - } -@@ -1972,6 +1974,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len - return; - if (!h->current) - return; -+ if (h->version == filter->last_version) -+ return; -+ filter->last_version = h->version; -+ av_dlog(ts->stream, "version=%d\n", filter->last_version); - - ts->stream->ts_id = h->id; - --- -2.1.0 - diff --git a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch b/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch deleted file mode 100644 index 259b35939e..0000000000 --- a/package/ffmpeg/0007-Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin.patch +++ /dev/null @@ -1,105 +0,0 @@ -From fdd8caea6535434a877587f5325e914ba50ed17f Mon Sep 17 00:00:00 2001 -From: Cory Fields -Date: Fri, 9 Jul 2010 16:43:31 -0400 -Subject: [PATCH 07/13] Read PID timestamps as well as PCR timestamps to find - location in mpegts stream - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 46 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 25007a6..d5a8a45 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -2459,6 +2459,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { - av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); - } - -+static int parse_timestamp(int64_t *ts, const uint8_t *buf) -+{ -+ int afc, flags; -+ const uint8_t *p; -+ -+ if(!(buf[1] & 0x40)) /* must be a start packet */ -+ return -1; -+ -+ afc = (buf[3] >> 4) & 3; -+ p = buf + 4; -+ if (afc == 0 || afc == 2) /* invalid or only adaption field */ -+ return -1; -+ if (afc == 3) -+ p += p[0] + 1; -+ if (p >= buf + TS_PACKET_SIZE) -+ return -1; -+ -+ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */ -+ return -1; -+ -+ flags = p[3] | 0x100; /* stream type */ -+ if (!((flags >= 0x1c0 && flags <= 0x1df) || -+ (flags >= 0x1e0 && flags <= 0x1ef) || -+ (flags == 0x1bd) || (flags == 0x1fd))) -+ return -1; -+ -+ flags = p[7]; -+ if ((flags & 0xc0) == 0x80) { -+ *ts = ff_parse_pes_pts(p+9); -+ return 0; -+ } else if ((flags & 0xc0) == 0xc0) { -+ *ts = ff_parse_pes_pts(p+9+5); -+ return 0; -+ } -+ return -1; -+} -+ -+ - static int mpegts_read_header(AVFormatContext *s) - { - MpegTSContext *ts = s->priv_data; -@@ -2658,6 +2696,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - uint8_t buf[TS_PACKET_SIZE]; - int pcr_l, pcr_pid = - ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; -+ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid; - int pos47 = ts->pos47_full % ts->raw_packet_size; - pos = - ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * -@@ -2679,6 +2718,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, - *ppos = pos; - return timestamp; - } -+ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) && -+ parse_timestamp(×tamp, buf) == 0) { -+ *ppos = pos; -+ return timestamp; -+ } - pos += ts->raw_packet_size; - } - -@@ -2778,7 +2822,7 @@ AVInputFormat ff_mpegts_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegts_class, - }; -@@ -2790,7 +2834,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { - .read_header = mpegts_read_header, - .read_packet = mpegts_raw_read_packet, - .read_close = mpegts_read_close, -- .read_timestamp = mpegts_get_dts, -+ .read_timestamp = mpegts_get_pcr, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, - .priv_class = &mpegtsraw_class, - }; --- -2.1.0 - diff --git a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch b/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch deleted file mode 100644 index 0b80c113e1..0000000000 --- a/package/ffmpeg/0008-Get-stream-durations-using-read_timestamp.patch +++ /dev/null @@ -1,74 +0,0 @@ -From c57e5b8154f5fe1457f4c64e04885a2cdfb37f51 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Sat, 22 Oct 2011 19:01:38 +0200 -Subject: [PATCH 08/13] Get stream durations using read_timestamp - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - -diff --git a/libavformat/utils.c b/libavformat/utils.c -index 3e8af50..f4fb172 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -2356,6 +2356,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) - #define DURATION_MAX_READ_SIZE 250000LL - #define DURATION_MAX_RETRY 4 - -+static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset) -+{ -+ AVStream *st; -+ int i, step= 1024; -+ int64_t ts, pos; -+ -+ for(i=0;inb_streams;i++) { -+ st = ic->streams[i]; -+ -+ pos = 0; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE); -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE) -+ st->start_time = ts; -+ -+ pos = avio_size(ic->pb) - 1; -+ do { -+ pos -= step; -+ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step); -+ step += step; -+ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE); -+ -+ if (ts == AV_NOPTS_VALUE) -+ continue; -+ -+ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE) -+ st->duration = ts - st->start_time; -+ } -+ -+ fill_all_stream_timings(ic); -+ -+ avio_seek(ic->pb, old_offset, SEEK_SET); -+} -+ - /* only usable for MPEG-PS streams */ - static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) - { -@@ -2506,6 +2541,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; -+ } else if (ic->iformat->read_timestamp && -+ file_size && ic->pb->seekable) { -+ /* get accurate estimate from the PTSes */ -+ av_estimate_timings_from_pts2(ic, old_offset); - } else { - /* less precise: use bitrate info */ - estimate_timings_from_bit_rate(ic); --- -2.1.0 - diff --git a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch b/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch deleted file mode 100644 index fb0aad1e13..0000000000 --- a/package/ffmpeg/0009-changed-allow-4-second-skew-between-streams-in-mov-b.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 4bcec3ef0042244b0ade00d132368d0872f73c72 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Wed, 8 Dec 2010 14:03:43 +0000 -Subject: [PATCH 09/13] changed: allow 4 second skew between streams in mov - before attempting to seek - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mov.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 8d66c0a..127ffd9 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -4028,8 +4028,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 && -- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || -- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { -+ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) || -+ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) { - sample = current_sample; - best_dts = dts; - *st = avst; --- -2.1.0 - diff --git a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch b/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch deleted file mode 100644 index d13d0730b8..0000000000 --- a/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch +++ /dev/null @@ -1,44 +0,0 @@ -From cb7c19124165508ae5f38a385a14f9c13b096a27 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Fri, 26 Nov 2010 20:56:48 +0000 -Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??) - mpegts files with too large pes packets - -at-visions sample file brokenStream.mpg - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index d5a8a45..e070f1f 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -832,6 +832,10 @@ static void reset_pes_packet_state(PESContext *pes) - - static void new_pes_packet(PESContext *pes, AVPacket *pkt) - { -+ if(pkt->data) { -+ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index); -+ av_free_packet(pkt); -+ } - av_init_packet(pkt); - - pkt->buf = pes->buffer; -@@ -2649,6 +2653,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) - - pkt->size = -1; - ts->pkt = pkt; -+ ts->pkt->data = NULL; -+ - ret = handle_packets(ts, 0); - if (ret < 0) { - av_free_packet(ts->pkt); --- -2.1.0 - diff --git a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch b/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch deleted file mode 100644 index 7c81f1d5fd..0000000000 --- a/package/ffmpeg/0011-Speed-up-mpegts-av_find_stream_info.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c315a758a292200c22925603682e259849d6d558 Mon Sep 17 00:00:00 2001 -From: Joakim Plate -Date: Mon, 28 Jun 2010 21:26:54 +0000 -Subject: [PATCH 11/13] Speed up mpegts av_find_stream_info - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavformat/mpegts.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index e070f1f..dd9e129 100644 ---- a/libavformat/mpegts.c -+++ b/libavformat/mpegts.c -@@ -994,7 +994,7 @@ static int mpegts_push_data(MpegTSFilter *filter, - goto skip; - - /* stream not present in PMT */ -- if (!pes->st) { -+ if (ts->auto_guess && !pes->st) { - if (ts->skip_changes) - goto skip; - --- -2.1.0 - diff --git a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch b/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch deleted file mode 100644 index f346da131f..0000000000 --- a/package/ffmpeg/0012-dxva-h264-Fix-dxva-playback-of-streams-that-don-t-st.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 939ebbbc46ca9995637415594f1815633587104f Mon Sep 17 00:00:00 2001 -From: marc -Date: Mon, 18 Feb 2013 17:18:18 +0000 -Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start - with an I-Frame. - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls -Signed-off-by: Thomas Petazzoni ---- - libavcodec/dxva2_h264.c | 8 ++++++++ - libavcodec/h264.c | 1 + - libavcodec/h264.h | 2 ++ - libavcodec/h264_slice.c | 1 + - 4 files changed, 12 insertions(+) - -diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c -index 6deccc3..85b25fd 100644 ---- a/libavcodec/dxva2_h264.c -+++ b/libavcodec/dxva2_h264.c -@@ -451,6 +451,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx) - - if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) - return -1; -+ -+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs -+ if (!h->got_first_iframe) { -+ if (!(ctx_pic->pp.wBitFields & (1 << 15))) -+ return -1; -+ h->got_first_iframe = 1; -+ } -+ - ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, - &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 222bf58..ea2ec17 100644 ---- a/libavcodec/h264.c -+++ b/libavcodec/h264.c -@@ -1085,6 +1085,7 @@ void ff_h264_flush_change(H264Context *h) - h->mmco_reset = 1; - for (i = 0; i < h->nb_slice_ctx; i++) - h->slice_ctx[i].list_count = 0; -+ h->got_first_iframe = 0; - } - - /* forget old pics after a seek */ -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index b94f06b..bc9458b 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -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 - -+ int got_first_iframe; -+ - // Timestamp stuff - 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 53f61ca..b171d78 100644 ---- a/libavcodec/h264_slice.c -+++ b/libavcodec/h264_slice.c -@@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) - ff_h264_free_tables(h, 0); - h->first_field = 0; - h->prev_interlaced_frame = 1; -+ h->got_first_iframe = 0; - - init_scan_tables(h); - ret = ff_h264_alloc_tables(h); --- -2.1.0 - diff --git a/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch b/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch deleted file mode 100644 index 58a91e2e74..0000000000 --- a/package/ffmpeg/0013-add-public-version-of-ff_read_frame_flush.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 7d7ce18ff0d24b586634fa6e631fa0eec7865aae Mon Sep 17 00:00:00 2001 -From: elupus -Date: Tue, 1 Nov 2011 20:18:35 +0100 -Subject: [PATCH 13/13] add public version of ff_read_frame_flush - -We need this since we sometimes seek on the -input stream behind ffmpeg's back. After this -all data need to be flushed completely. - -Patch part of the XBMC patch set for ffmpeg, downloaded from -https://github.com/xbmc/FFmpeg/. - -Signed-off-by: Bernd Kuhls ---- - libavformat/avformat.h | 5 +++++ - libavformat/utils.c | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/libavformat/avformat.h b/libavformat/avformat.h -index 2e54ed1..3a9f292 100644 ---- a/libavformat/avformat.h -+++ b/libavformat/avformat.h -@@ -2121,6 +2121,11 @@ int av_find_best_stream(AVFormatContext *ic, - int av_read_frame(AVFormatContext *s, AVPacket *pkt); - - /** -+ * Clear out any buffered data in context -+ */ -+void av_read_frame_flush(AVFormatContext *s); -+ -+/** - * Seek to the keyframe at timestamp. - * 'timestamp' in 'stream_index'. - * -diff --git a/libavformat/utils.c b/libavformat/utils.c -index f4fb172..10dda18 100644 ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -1624,6 +1624,11 @@ void ff_read_frame_flush(AVFormatContext *s) - } - } - -+void av_read_frame_flush(AVFormatContext *s) -+{ -+ ff_read_frame_flush(s); -+} -+ - void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp) - { - int i; --- -2.1.0 - diff --git a/package/ffmpeg/0016-ranlib.patch b/package/ffmpeg/0016-ranlib.patch deleted file mode 100644 index e88b25f1b4..0000000000 --- a/package/ffmpeg/0016-ranlib.patch +++ /dev/null @@ -1,35 +0,0 @@ -Fix ranlib check when cross-compiling - -Without this patch /usr/bin/ranlib is tested for "-D", not ranlib from the -cross-compiler suite being in use. - -Signed-off-by: Bernd Kuhls - -diff -uNr ffmpeg-2.6.2.org/configure ffmpeg-2.6.2/configure ---- ffmpeg-2.6.2.org/configure 2015-04-12 00:47:55.000000000 +0200 -+++ ffmpeg-2.6.2/configure 2015-04-16 21:53:24.313202517 +0200 -@@ -2719,11 +2719,6 @@ - nm_default="nm -g" - objformat="elf" - pkg_config_default=pkg-config --if ranlib 2>&1 | grep -q "\-D "; then -- ranlib_default="ranlib -D" --else -- ranlib_default="ranlib" --fi - strip_default="strip" - yasmexe_default="yasm" - windres_default="windres" -@@ -3001,6 +2996,12 @@ - die "Must specify target arch and OS when cross-compiling" - fi - -+if "${cross_prefix}ranlib" 2>&1 | grep -q "\-D "; then -+ ranlib_default="ranlib -D" -+else -+ ranlib_default="ranlib" -+fi -+ - test -n "$valgrind" && toolchain="valgrind-memcheck" - - case "$toolchain" in diff --git a/package/ffmpeg/Config.in b/package/ffmpeg/Config.in index e5981fee55..b5850db722 100644 --- a/package/ffmpeg/Config.in +++ b/package/ffmpeg/Config.in @@ -1,8 +1,13 @@ +config BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS + bool + # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW on nios2 + # No support for ARMv7-M in the ARM assembly logic + # Microblaze build affected by gcc PR71124 (infinite loop) + default y if !BR2_nios2 && !BR2_ARM_CPU_ARMV7M && !BR2_microblaze + menuconfig BR2_PACKAGE_FFMPEG bool "ffmpeg" - # fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW - depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305 - depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201405 + depends on BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS help FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. @@ -36,12 +41,16 @@ config BR2_PACKAGE_FFMPEG_FFMPEG config BR2_PACKAGE_FFMPEG_FFPLAY bool "Build ffplay" select BR2_PACKAGE_FFMPEG_SWSCALE - select BR2_PACKAGE_SDL + select BR2_PACKAGE_SDL2 + depends on !BR2_STATIC_LIBS # sdl2 help FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs. +comment "ffplay needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS + config BR2_PACKAGE_FFMPEG_FFSERVER bool "Build ffserver" depends on BR2_USE_MMU # fork() diff --git a/package/ffmpeg/ffmpeg.hash b/package/ffmpeg/ffmpeg.hash index 2e6b4137c1..6adf7e440a 100644 --- a/package/ffmpeg/ffmpeg.hash +++ b/package/ffmpeg/ffmpeg.hash @@ -1,2 +1,2 @@ # Locally calculated -sha256 7ceb7550ad628c526fa6c9ff23fdfb687a62f54d90c4a730998d8c2b417b9ef2 ffmpeg-2.7.2.tar.bz2 +sha256 54ce502aca10b7e6059f19220ea2f68fa0c9c4c4d255ae13e615f08f0c94dcc5 ffmpeg-3.2.3.tar.xz diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index f993a04757..437e3936f6 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -1,14 +1,16 @@ + ################################################################################ # # ffmpeg # ################################################################################ -FFMPEG_VERSION = 2.7.2 -FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.bz2 +FFMPEG_VERSION = 3.2.3 +FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES FFMPEG_INSTALL_TARGET = YES +FFMPEG_DEPENDENCIES = bellagio FFMPEG_LICENSE = LGPLv2.1+, libjpeg license FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1 @@ -20,7 +22,9 @@ endif FFMPEG_CONF_OPTS = \ --prefix=/usr \ --enable-static \ - --disable-shared \ + --disable-shared \ + --enable-omx \ + --enable-omx-rpi \ --enable-avfilter \ --disable-version3 \ --enable-logging \ @@ -39,29 +43,25 @@ FFMPEG_CONF_OPTS = \ --enable-mdct \ --enable-rdft \ --disable-crystalhd \ - --disable-vdpau \ --disable-dxva2 \ --enable-runtime-cpudetect \ --disable-hardcoded-tables \ --disable-memalign-hack \ + --disable-mipsdsp \ + --disable-mipsdspr2 \ --disable-msa \ --enable-hwaccels \ --disable-avisynth \ --disable-frei0r \ --disable-libopencore-amrnb \ --disable-libopencore-amrwb \ - --disable-libopencv \ + --disable-libcdio \ --disable-libdc1394 \ - --disable-libfaac \ --disable-libgsm \ - --disable-libmp3lame \ + --disable-libilbc \ --disable-libnut \ --disable-libopenjpeg \ - --disable-librtmp \ --disable-libschroedinger \ - --disable-libspeex \ - --disable-libtheora \ - --disable-libvo-aacenc \ --disable-libvo-amrwbenc \ --disable-symver \ --disable-doc @@ -87,9 +87,9 @@ FFMPEG_CONF_OPTS += --disable-ffmpeg endif ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y) -FFMPEG_DEPENDENCIES += sdl +FFMPEG_DEPENDENCIES += sdl2 FFMPEG_CONF_OPTS += --enable-ffplay -FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl-config +FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config else FFMPEG_CONF_OPTS += --disable-ffplay endif @@ -196,6 +196,18 @@ else FFMPEG_CONF_OPTS += --disable-bzlib endif +ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy) +FFMPEG_CONF_OPTS += --enable-libfdk-aac +FFMPEG_DEPENDENCIES += fdk-aac +else +FFMPEG_CONF_OPTS += --disable-libfdk-aac +endif + +ifeq ($(BR2_PACKAGE_GNUTLS),y) +FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl +FFMPEG_DEPENDENCIES += gnutls +else +FFMPEG_CONF_OPTS += --disable-gnutls ifeq ($(BR2_PACKAGE_OPENSSL),y) # openssl isn't license compatible with GPL ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx) @@ -207,6 +219,18 @@ endif else FFMPEG_CONF_OPTS += --disable-openssl endif +endif + +ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBEBUR128),yy) +FFMPEG_DEPENDENCIES += libebur128 +endif + +ifeq ($(BR2_PACKAGE_LIBOPENH264),y) +FFMPEG_CONF_OPTS += --enable-libopenh264 +FFMPEG_DEPENDENCIES += libopenh264 +else +FFMPEG_CONF_OPTS += --disable-libopenh264 +endif ifeq ($(BR2_PACKAGE_LIBVORBIS),y) FFMPEG_DEPENDENCIES += libvorbis @@ -223,6 +247,25 @@ else FFMPEG_CONF_OPTS += --disable-vaapi endif +ifeq ($(BR2_PACKAGE_LIBVDPAU),y) +FFMPEG_CONF_OPTS += --enable-vdpau +FFMPEG_DEPENDENCIES += libvdpau +else +FFMPEG_CONF_OPTS += --disable-vdpau +endif + +# To avoid a circular dependency only use opencv if opencv itself does +# not depend on ffmpeg. +ifeq ($(BR2_PACKAGE_OPENCV_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV_WITH_FFMPEG),yx) +FFMPEG_CONF_OPTS += --enable-libopencv +FFMPEG_DEPENDENCIES += opencv +else ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx) +FFMPEG_CONF_OPTS += --enable-libopencv +FFMPEG_DEPENDENCIES += opencv3 +else +FFMPEG_CONF_OPTS += --disable-libopencv +endif + ifeq ($(BR2_PACKAGE_OPUS),y) FFMPEG_CONF_OPTS += --enable-libopus FFMPEG_DEPENDENCIES += opus @@ -237,6 +280,62 @@ else FFMPEG_CONF_OPTS += --disable-libvpx endif +ifeq ($(BR2_PACKAGE_LIBASS),y) +FFMPEG_CONF_OPTS += --enable-libass +FFMPEG_DEPENDENCIES += libass +else +FFMPEG_CONF_OPTS += --disable-libass +endif + +ifeq ($(BR2_PACKAGE_LIBBLURAY),y) +FFMPEG_CONF_OPTS += --enable-libbluray +FFMPEG_DEPENDENCIES += libbluray +else +FFMPEG_CONF_OPTS += --disable-libbluray +endif + +ifeq ($(BR2_PACKAGE_RTMPDUMP),y) +FFMPEG_CONF_OPTS += --enable-librtmp +FFMPEG_DEPENDENCIES += rtmpdump +else +FFMPEG_CONF_OPTS += --disable-librtmp +endif + +ifeq ($(BR2_PACKAGE_LAME),y) +FFMPEG_CONF_OPTS += --enable-libmp3lame +FFMPEG_DEPENDENCIES += lame +else +FFMPEG_CONF_OPTS += --disable-libmp3lame +endif + +ifeq ($(BR2_PACKAGE_LIBMODPLUG),y) +FFMPEG_CONF_OPTS += --enable-libmodplug +FFMPEG_DEPENDENCIES += libmodplug +else +FFMPEG_CONF_OPTS += --disable-libmodplug +endif + +ifeq ($(BR2_PACKAGE_SPEEX),y) +FFMPEG_CONF_OPTS += --enable-libspeex +FFMPEG_DEPENDENCIES += speex +else +FFMPEG_CONF_OPTS += --disable-libspeex +endif + +ifeq ($(BR2_PACKAGE_LIBTHEORA),y) +FFMPEG_CONF_OPTS += --enable-libtheora +FFMPEG_DEPENDENCIES += libtheora +else +FFMPEG_CONF_OPTS += --disable-libtheora +endif + +ifeq ($(BR2_PACKAGE_WAVPACK),y) +FFMPEG_CONF_OPTS += --enable-libwavpack +FFMPEG_DEPENDENCIES += wavpack +else +FFMPEG_CONF_OPTS += --disable-libwavpack +endif + # ffmpeg freetype support require fenv.h which is only # available/working on glibc. # The microblaze variant doesn't provide the needed exceptions @@ -261,6 +360,13 @@ else FFMPEG_CONF_OPTS += --disable-libx264 endif +ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy) +FFMPEG_CONF_OPTS += --enable-libx265 +FFMPEG_DEPENDENCIES += x265 +else +FFMPEG_CONF_OPTS += --disable-libx265 +endif + ifeq ($(BR2_X86_CPU_HAS_MMX),y) FFMPEG_CONF_OPTS += --enable-yasm FFMPEG_DEPENDENCIES += host-yasm @@ -340,33 +446,17 @@ FFMPEG_CONF_OPTS += --disable-vfp endif ifeq ($(BR2_ARM_CPU_HAS_NEON),y) FFMPEG_CONF_OPTS += --enable-neon -endif - -ifeq ($(BR2_MIPS_SOFT_FLOAT),y) -FFMPEG_CONF_OPTS += \ - --disable-mipsfpu -else -FFMPEG_CONF_OPTS += \ - --enable-mipsfpu -endif - -ifeq ($(BR2_mips_32r2),y) -FFMPEG_CONF_OPTS += \ - --enable-mips32r2 else -FFMPEG_CONF_OPTS += \ - --disable-mips32r2 +FFMPEG_CONF_OPTS += --disable-neon endif -ifeq ($(BR2_mips_64r2),y) -FFMPEG_CONF_OPTS += \ - --enable-mipsdspr1 \ - --enable-mipsdspr2 +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +ifeq ($(BR2_MIPS_SOFT_FLOAT),y) +FFMPEG_CONF_OPTS += --disable-mipsfpu else -FFMPEG_CONF_OPTS += \ - --disable-mipsdspr1 \ - --disable-mipsdspr2 +FFMPEG_CONF_OPTS += --enable-mipsfpu endif +endif # MIPS ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y) FFMPEG_CONF_OPTS += --enable-altivec @@ -380,14 +470,19 @@ else FFMPEG_CONF_OPTS += --disable-pic endif -FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) - -ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) +# Default to --cpu=generic for MIPS architecture, in order to avoid a +# warning from ffmpeg's configure script. +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y) +FFMPEG_CONF_OPTS += --cpu=generic +else ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_CPU) else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),) FFMPEG_CONF_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH) endif + +FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF)) + # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others define FFMPEG_CONFIGURE_CMDS (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \ @@ -403,7 +498,6 @@ define FFMPEG_CONFIGURE_CMDS --target-os="linux" \ --disable-stripping \ --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \ - $(SHARED_STATIC_LIBS_OPTS) \ $(FFMPEG_CONF_OPTS) \ ) endef From 64b777322bac3fe0a01126df9cb287ddcf454c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Fri, 7 Jul 2017 08:05:29 +0200 Subject: [PATCH 39/40] upgrade rpi3 kernel + rever x264 issues on recording at rpi3 --- configs/raspberrypi3_defconfig | 2 +- package/x264/x264.mk | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/configs/raspberrypi3_defconfig b/configs/raspberrypi3_defconfig index e121eee6ea..98f04f5830 100644 --- a/configs/raspberrypi3_defconfig +++ b/configs/raspberrypi3_defconfig @@ -24,7 +24,7 @@ BR2_ROOTFS_OVERLAY="board/common/overlay board/raspberrypi3/overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/common/postscript.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_TARBALL=y -BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/a59ca8f1e8e068dd58bc453dc88295e7045dafcf.tar.gz" +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/04c8e47067d4873c584395e5cb260b4f170a99ea.tar.gz" BR2_LINUX_KERNEL_DEFCONFIG="bcm2709" BR2_LINUX_KERNEL_ZIMAGE=y BR2_LINUX_KERNEL_DTS_SUPPORT=y diff --git a/package/x264/x264.mk b/package/x264/x264.mk index fde976d58b..66b327f4e0 100644 --- a/package/x264/x264.mk +++ b/package/x264/x264.mk @@ -4,7 +4,7 @@ # ################################################################################ -X264_VERSION = 97eaef2ab82a46d13ea5e00270712d6475fbe42b +X264_VERSION = stable X264_SITE = git://git.videolan.org/x264.git X264_LICENSE = GPLv2+ X264_DEPENDENCIES = host-pkgconf @@ -13,10 +13,8 @@ X264_INSTALL_STAGING = YES X264_CONF_OPTS = --disable-avs ifeq ($(BR2_i386)$(BR2_x86_64),y) -# yasm needed for assembly files X264_DEPENDENCIES += host-yasm -X264_CONF_ENV += AS="$(HOST_DIR)/usr/bin/yasm" -else ifeq ($(BR2_ARM_CPU_ARMV7A)$(BR2_aarch64),y) +else ifeq ($(BR2_ARM_CPU_ARMV7A),y) # We need to pass gcc as AS, because the ARM assembly files have to be # preprocessed X264_CONF_ENV += AS="$(TARGET_CC)" From 1c3bd1e2a9f80c7f2247db5f1d7b61af5e96f6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Thu, 13 Jul 2017 22:25:57 +0200 Subject: [PATCH 40/40] fix bug not creating web directories --- board/common/overlay/etc/init.d/S86web | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/board/common/overlay/etc/init.d/S86web b/board/common/overlay/etc/init.d/S86web index b8216a7896..d407a49859 100755 --- a/board/common/overlay/etc/init.d/S86web +++ b/board/common/overlay/etc/init.d/S86web @@ -1,14 +1,13 @@ #!/bin/bash sys_conf="/var/www/web" -conf="/data/web" +conf="/data/web/storage" start() { echo "Configuring kerberos.io web" if [ -d $sys_conf ] && ! [ -d $conf ]; then - mkdir -p /data/web/ - + cp -R /var/www/web/storage /data/web/ chmod -R 777 /data/web/storage