From 00931c612237d423bc9a8fb696dfcedafa58623a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milien=20Devos?= Date: Mon, 11 Jul 2022 23:28:44 +0200 Subject: [PATCH] Remove PR patch 3162 --- patches/9-3162.patch | 357 ------------------------------------------- 1 file changed, 357 deletions(-) delete mode 100644 patches/9-3162.patch diff --git a/patches/9-3162.patch b/patches/9-3162.patch deleted file mode 100644 index 26b81d5..0000000 --- a/patches/9-3162.patch +++ /dev/null @@ -1,357 +0,0 @@ -From 140b6c1227754356145acd7b76820e3921745ef8 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Thu, 23 Jun 2022 02:13:22 +0800 -Subject: [PATCH 01/13] DASH playback force highest quality m4a - -Since VideoJS is unable to handle adaptive audio quality, the best audo quality is forced for every video quality. ---- - src/invidious/routes/api/manifest.cr | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index 8bc36946b..8b5bfc06c 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -61,7 +61,18 @@ module Invidious::Routes::API::Manifest - next if mime_streams.empty? - - xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do -+ # ignore the 64k m4a stream, only consider the 128k m4a stream -+ best_m4a_stream = mime_streams[0] -+ best_m4a_stream_bitrate = 0 - mime_streams.each do |fmt| -+ bandwidth = fmt["bitrate"].as_i -+ if (bandwidth > best_m4a_stream_bitrate) -+ best_m4a_stream_bitrate = bandwidth -+ best_m4a_stream = fmt -+ end -+ end -+ -+ [best_m4a_stream].each do |fmt| - # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) - next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - - -From 81abebd14493d4207a663d6f575d945a23b03170 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Thu, 23 Jun 2022 02:27:46 +0800 -Subject: [PATCH 02/13] Highest quality m4a on audio only mode as default - -Audio mode will automatically select highest quality m4a as default. ---- - src/invidious/views/components/player.ecr | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr -index fffefc9a3..a342097ef 100644 ---- a/src/invidious/views/components/player.ecr -+++ b/src/invidious/views/components/player.ecr -@@ -7,14 +7,25 @@ - - <% else %> - <% if params.listen %> -- <% audio_streams.each_with_index do |fmt, i| -+ <% # ignore the 64k m4a stream, only consider the 128k m4a stream -+ best_m4a_stream_index = 0 -+ best_m4a_stream_bitrate = 0 -+ audio_streams.each_with_index do |fmt, i| -+ bandwidth = fmt["bitrate"].as_i -+ if (fmt["mimeType"].as_s.starts_with?("audio/mp4") && bandwidth > best_m4a_stream_bitrate) -+ best_m4a_stream_bitrate = bandwidth -+ best_m4a_stream_index = i -+ end -+ end -+ -+ audio_streams.each_with_index do |fmt, i| - src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}" - src_url += "&local=true" if params.local - - bitrate = fmt["bitrate"] - mimetype = HTML.escape(fmt["mimeType"].as_s) - -- selected = i == 0 ? true : false -+ selected = i == best_m4a_stream_index ? true : false - %> - - <% if !params.local && !CONFIG.disabled?("local") %> - -From 3013782b7b39295b34c3f5a72274efc625748a7f Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Thu, 23 Jun 2022 03:03:54 +0800 -Subject: [PATCH 03/13] formatting - ---- - src/invidious/routes/api/manifest.cr | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index 8b5bfc06c..b8466df1e 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -71,7 +71,7 @@ module Invidious::Routes::API::Manifest - best_m4a_stream = fmt - end - end -- -+ - [best_m4a_stream].each do |fmt| - # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) - next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - -From c75bf35f59864c9f7e37816d657e913f29b40123 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Fri, 24 Jun 2022 17:26:30 +0800 -Subject: [PATCH 04/13] Update DASH format to serve 2 audio to player - -player.audioTracks() can successfully show -tracks_: Array(2) ---- - src/invidious/routes/api/manifest.cr | 20 ++++---------------- - 1 file changed, 4 insertions(+), 16 deletions(-) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index b8466df1e..476ff65a6 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -46,7 +46,7 @@ module Invidious::Routes::API::Manifest - end - end - -- audio_streams = video.audio_streams -+ audio_streams = video.audio_streams.sort_by { |stream| {stream["bitrate"].as_i} }.reverse! - video_streams = video.video_streams.sort_by { |stream| {stream["width"].as_i, stream["fps"].as_i} }.reverse! - - manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml| -@@ -60,19 +60,8 @@ module Invidious::Routes::API::Manifest - mime_streams = audio_streams.select { |stream| stream["mimeType"].as_s.starts_with? mime_type } - next if mime_streams.empty? - -- xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do -- # ignore the 64k m4a stream, only consider the 128k m4a stream -- best_m4a_stream = mime_streams[0] -- best_m4a_stream_bitrate = 0 -- mime_streams.each do |fmt| -- bandwidth = fmt["bitrate"].as_i -- if (bandwidth > best_m4a_stream_bitrate) -- best_m4a_stream_bitrate = bandwidth -- best_m4a_stream = fmt -- end -- end -- -- [best_m4a_stream].each do |fmt| -+ mime_streams.each do |fmt| -+ xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, lang: i.to_s) do - # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) - next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - -@@ -90,9 +79,8 @@ module Invidious::Routes::API::Manifest - end - end - end -+ i += 1 - end -- -- i += 1 - end - - potential_heights = {4320, 2160, 1440, 1080, 720, 480, 360, 240, 144} - -From a62adccd3d2e80377d200cb3890d00eea6dd5c8b Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sat, 25 Jun 2022 16:33:02 +0800 -Subject: [PATCH 05/13] change lang to label - -lang has to be BCP 47 standard. Using label also can let video.js know there are 2 audio tracks. ---- - src/invidious/routes/api/manifest.cr | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index 476ff65a6..b9f816225 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -61,7 +61,7 @@ module Invidious::Routes::API::Manifest - next if mime_streams.empty? - - mime_streams.each do |fmt| -- xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, lang: i.to_s) do -+ xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: i.to_s) do - # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) - next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - - -From 32ecf30c821bab26d4adb83714dedb4e01253f99 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sat, 25 Jun 2022 17:19:11 +0800 -Subject: [PATCH 06/13] Add audioTrackButton - ---- - assets/js/player.js | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/assets/js/player.js b/assets/js/player.js -index 7d099e663..c2a5f42e2 100644 ---- a/assets/js/player.js -+++ b/assets/js/player.js -@@ -17,6 +17,7 @@ var options = { - 'remainingTimeDisplay', - 'Spacer', - 'captionsButton', -+ 'audioTrackButton', - 'qualitySelector', - 'playbackRateMenuButton', - 'fullscreenToggle' - -From 09ff370ddca17aae9baf73af4c920c7790f1e70a Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sat, 25 Jun 2022 17:19:40 +0800 -Subject: [PATCH 07/13] Change player.css order - ---- - assets/css/player.css | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/assets/css/player.css b/assets/css/player.css -index 304375b54..8a7cfdabb 100644 ---- a/assets/css/player.css -+++ b/assets/css/player.css -@@ -101,21 +101,25 @@ ul.vjs-menu-content::-webkit-scrollbar { - order: 2; - } - -+.vjs-audio-button { -+ order: 3; -+} -+ - .vjs-quality-selector, - .video-js .vjs-http-source-selector { -- order: 3; -+ order: 4; - } - - .vjs-playback-rate { -- order: 4; -+ order: 5; - } - - .vjs-share-control { -- order: 5; -+ order: 6; - } - - .vjs-fullscreen-control { -- order: 6; -+ order: 7; - } - - .vjs-playback-rate > .vjs-menu { - -From e0f6988eb59b08341f781ffb2b6bf47f6ee6ab16 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sat, 25 Jun 2022 18:52:34 +0800 -Subject: [PATCH 08/13] DASH Default to high quality m4a - ---- - src/invidious/routes/api/manifest.cr | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index b9f816225..ca72be26f 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -61,7 +61,7 @@ module Invidious::Routes::API::Manifest - next if mime_streams.empty? - - mime_streams.each do |fmt| -- xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: i.to_s) do -+ xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: fmt["bitrate"].to_s + "k") do - # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) - next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - -@@ -70,6 +70,8 @@ module Invidious::Routes::API::Manifest - itag = fmt["itag"].as_i - url = fmt["url"].as_s - -+ xml.element("Role", schemeIdUri: "urn:mpeg:dash:role:2011", value: i == 0 ? "main" : "alternate") -+ - xml.element("Representation", id: fmt["itag"], codecs: codecs, bandwidth: bandwidth) do - xml.element("AudioChannelConfiguration", schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", - value: "2") - -From 3f1d88282ed2878608032ec605fe17e61197d8ed Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sat, 25 Jun 2022 19:26:14 +0800 -Subject: [PATCH 11/13] Update some comments - ---- - src/invidious/views/components/player.ecr | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr -index a342097ef..9f42ae778 100644 ---- a/src/invidious/views/components/player.ecr -+++ b/src/invidious/views/components/player.ecr -@@ -7,7 +7,7 @@ - - <% else %> - <% if params.listen %> -- <% # ignore the 64k m4a stream, only consider the 128k m4a stream -+ <% # default to 128k m4a stream - best_m4a_stream_index = 0 - best_m4a_stream_bitrate = 0 - audio_streams.each_with_index do |fmt, i| - -From b19beac5b40bd1efbef1882b2160252ebf9a3134 Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sun, 10 Jul 2022 16:29:50 +0800 -Subject: [PATCH 12/13] Update src/invidious/views/components/player.ecr - -better syntax - -Co-authored-by: Samantaz Fox ---- - src/invidious/views/components/player.ecr | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr -index 9f42ae778..c3c02df07 100644 ---- a/src/invidious/views/components/player.ecr -+++ b/src/invidious/views/components/player.ecr -@@ -25,7 +25,7 @@ - bitrate = fmt["bitrate"] - mimetype = HTML.escape(fmt["mimeType"].as_s) - -- selected = i == best_m4a_stream_index ? true : false -+ selected = (i == best_m4a_stream_index) - %> - - <% if !params.local && !CONFIG.disabled?("local") %> - -From cbcf31a4f98706ea675cafb7509b37dc2b0ceace Mon Sep 17 00:00:00 2001 -From: 138138138 <78271024+138138138@users.noreply.github.com> -Date: Sun, 10 Jul 2022 16:54:56 +0800 -Subject: [PATCH 13/13] Skip OTF streams in DASH audio - -Skip OTF streams, prevent creating empty AdaptationSet in DASH audio ---- - src/invidious/routes/api/manifest.cr | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr -index ca72be26f..52b941753 100644 ---- a/src/invidious/routes/api/manifest.cr -+++ b/src/invidious/routes/api/manifest.cr -@@ -61,10 +61,10 @@ module Invidious::Routes::API::Manifest - next if mime_streams.empty? - - mime_streams.each do |fmt| -- xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: fmt["bitrate"].to_s + "k") do -- # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) -- next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) -+ # OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415) -+ next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange")) - -+ xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: fmt["bitrate"].to_s + "k") do - codecs = fmt["mimeType"].as_s.split("codecs=")[1].strip('"') - bandwidth = fmt["bitrate"].as_i - itag = fmt["itag"].as_i