[vlc-commits] rist: add missing translations

2021-04-12 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Apr 13 
03:01:33 2021 +0200| [dbb962e595fff46b5959ebbff4092580003deb9d] | committer: 
Pierre Ynard

rist: add missing translations

(cherry picked from commit eb6b8474f6cf2cc170c706d226aaeade2e8e55fc)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=dbb962e595fff46b5959ebbff4092580003deb9d
---

 modules/access/rist.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/access/rist.c b/modules/access/rist.c
index 1ce9e44477..5fdbb05ed9 100644
--- a/modules/access/rist.c
+++ b/modules/access/rist.c
@@ -1144,11 +1144,11 @@ vlc_module_begin ()
 add_integer( "nack-type", NACK_FMT_RANGE,
 N_("RIST nack type, 0 = range, 1 = bitmask. Default is range"), 
NULL, true )
 change_integer_list( nack_type, nack_type_names )
-add_bool( "disable-nacks", false, "Disable NACK output packets",
-"Use this to disable packet recovery", true )
-add_bool( "mcast-blind-nacks", false, "Do not check for a valid rtcp 
message from the encoder",
-"Send nack messages even when we have not confirmed that the encoder 
is on our local " \
-"network.", true )
+add_bool( "disable-nacks", false, N_("Disable NACK output packets"),
+N_("Use this to disable packet recovery"), true )
+add_bool( "mcast-blind-nacks", false, N_("Do not check for a valid rtcp 
message from the encoder"),
+N_("Send nack messages even when we have not confirmed that the 
encoder is on our local " \
+"network."), true )
 
 set_capability( "access", 0 )
 add_shortcut( "rist", "tr06" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] po: add missing dav1d.c

2021-04-12 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Apr 13 
03:00:54 2021 +0200| [64562f29edbbf368e95f7c3ebfa4a7ce1958c11e] | committer: 
Pierre Ynard

po: add missing dav1d.c

(cherry picked from commit 342edae7ecea3aa322890d098a70429c43b86711)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=64562f29edbbf368e95f7c3ebfa4a7ce1958c11e
---

 po/POTFILES.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 63022d2afd..d6c6f8ff34 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -307,6 +307,7 @@ modules/codec/cea708.h
 modules/codec/crystalhd.c
 modules/codec/cvdsub.c
 modules/codec/daala.c
+modules/codec/dav1d.c
 modules/codec/dca.c
 modules/codec/ddummy.c
 modules/codec/dmo/dmo.c

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Update MODULES_LIST

2021-04-12 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Apr 13 
03:07:39 2021 +0200| [cd5a4f5f9cb8bd58833cafd72086f01fa699fe02] | committer: 
Pierre Ynard

Update MODULES_LIST

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=cd5a4f5f9cb8bd58833cafd72086f01fa699fe02
---

 modules/MODULES_LIST | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/MODULES_LIST b/modules/MODULES_LIST
index 3775e45be0..994dd37b46 100644
--- a/modules/MODULES_LIST
+++ b/modules/MODULES_LIST
@@ -14,6 +14,7 @@ $Id$
  * access_output_file: File access_output module
  * access_output_http: HTTP Network access module
  * access_output_livehttp: Live HTTP stream output
+ * access_output_rist: RIST (Reliable Internet Stream Transport) access_output 
module
  * access_output_shout: Shoutcast access output
  * access_output_srt: SRT (Secure Reliable Transport) access_output module
  * access_output_udp: UDP Network access_output module
@@ -61,7 +62,6 @@ $Id$
  * avcodec: libavcodec audio/video decoder
  * avformat: libavformat demuxer
  * avi: AVI file stream demuxer
- * av1: AV1 packetizer
  * avio: Access and Stream output module using libavformat network
  * ball: Augmented reality ball video filter module
  * bandlimited_resampler: Bandlimited interpolation audio resampler
@@ -94,6 +94,7 @@ $Id$
  * cvpx: filter to copy from OS X accelerated surfaces to CPU
  * d3d11va: Direct3D11 hardware-accelerated decoding
  * daala: a daala video decoder/packetizer using libdaala
+ * dav1d: Dav1d decoder (AV1)
  * dbus: D-Bus control interface
  * dbus_screensaver: preventing the computer from suspending
  * dc1394: IIDC (DCAM) FireWire input module
@@ -290,6 +291,7 @@ $Id$
  * oss: audio output module using the OSS /dev/dsp interface
  * osx_notifications: announce currently playing stream to OS X/Growl
  * packetizer_a52: A/52 basic parser/packetizer
+ * packetizer_av1: AV1 packetizer
  * packetizer_avparser: libavcodec packetizer
  * packetizer_copy: Simple copy packetizer
  * packetizer_dirac: Dirac video packetizer
@@ -331,6 +333,7 @@ $Id$
  * remap: audio channel remapping filter
  * remoteosd: Remote-OSD over VNC
  * ripple: Ripple video effect
+ * rist: RIST (Reliable Internet Stream Transport) access module
  * rotate: Video rotation filter
  * rss: Display a RSS feed on the video output
  * rtp: rtp demux module
@@ -362,8 +365,8 @@ $Id$
  * simple_channel_mixer: channel mixer
  * skins2: Skinnable interface, new generation
  * skiptags: APE & ID3 tags-skipping stream filter
- * smb: SMB shares access module
  * smb2: SMB2/3 access module
+ * smb: SMB shares access module
  * smf: Standard MIDI file demuxer
  * sndio: OpenBSD sndio audio output
  * soxr: SoX Resampler library audio filter

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] po: add missing rist modules

2021-04-12 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Apr 13 
03:09:48 2021 +0200| [1c8ca5d9479b0111e1de6d92b349aa993f16b101] | committer: 
Pierre Ynard

po: add missing rist modules

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1c8ca5d9479b0111e1de6d92b349aa993f16b101
---

 po/POTFILES.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index d6c6f8ff34..0d03d2ba9e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -205,6 +205,7 @@ modules/access/nfs.c
 modules/access/oss.c
 modules/access/pulse.c
 modules/access/rdp.c
+modules/access/rist.c
 modules/access/rtp/rtp.c
 modules/access/rtsp/access.c
 modules/access/satip.c
@@ -229,6 +230,7 @@ modules/access_output/dummy.c
 modules/access_output/file.c
 modules/access_output/http.c
 modules/access_output/livehttp.c
+modules/access_output/rist.c
 modules/access_output/shout.c
 modules/access_output/srt.c
 modules/access_output/udp.c

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] rist: add missing translations

2021-04-12 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Apr 13 03:01:33 
2021 +0200| [eb6b8474f6cf2cc170c706d226aaeade2e8e55fc] | committer: Pierre Ynard

rist: add missing translations

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb6b8474f6cf2cc170c706d226aaeade2e8e55fc
---

 modules/access/rist.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/access/rist.c b/modules/access/rist.c
index 009c17790d..53373c3595 100644
--- a/modules/access/rist.c
+++ b/modules/access/rist.c
@@ -1142,11 +1142,11 @@ vlc_module_begin ()
 add_integer( "nack-type", NACK_FMT_RANGE,
 N_("RIST nack type, 0 = range, 1 = bitmask. Default is range"), 
NULL, true )
 change_integer_list( nack_type, nack_type_names )
-add_bool( "disable-nacks", false, "Disable NACK output packets",
-"Use this to disable packet recovery", true )
-add_bool( "mcast-blind-nacks", false, "Do not check for a valid rtcp 
message from the encoder",
-"Send nack messages even when we have not confirmed that the encoder 
is on our local " \
-"network.", true )
+add_bool( "disable-nacks", false, N_("Disable NACK output packets"),
+N_("Use this to disable packet recovery"), true )
+add_bool( "mcast-blind-nacks", false, N_("Do not check for a valid rtcp 
message from the encoder"),
+N_("Send nack messages even when we have not confirmed that the 
encoder is on our local " \
+"network."), true )
 
 set_capability( "access", 0 )
 add_shortcut( "rist", "tr06" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] po: add missing dav1d.c

2021-04-12 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Apr 13 03:00:54 
2021 +0200| [342edae7ecea3aa322890d098a70429c43b86711] | committer: Pierre Ynard

po: add missing dav1d.c

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=342edae7ecea3aa322890d098a70429c43b86711
---

 po/POTFILES.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3128f9f62a..6a97844082 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -295,6 +295,7 @@ modules/codec/cea708.c
 modules/codec/cea708.h
 modules/codec/cvdsub.c
 modules/codec/daala.c
+modules/codec/dav1d.c
 modules/codec/dca.c
 modules/codec/ddummy.c
 modules/codec/dmo/dmo.c

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: fix video resolution selection

2021-04-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Apr  3 
15:46:41 2021 +0200| [d58b7748a1ce997bc86f1c5619bd9276cf981bc1] | committer: 
Pierre Ynard

liveleak.lua: fix video resolution selection

(cherry picked from commit 55456d7c1e2892d430f93645972e389e7e8462a8)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d58b7748a1ce997bc86f1c5619bd9276cf981bc1
---

 share/lua/playlist/liveleak.lua | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 39ee92e98e..c6e7bf3fa7 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -59,18 +59,27 @@ function parse()
 end
 
 -- Try to find the video
-if not video and string.match( line, '') do
+local more = vlc.readline()
+if not more then break end
+line = line..more
+end
+
 -- Apparently the two formats are listed HD first, SD second
 local prefres = vlc.var.inherit( nil, 'preferred-resolution' )
-for src in string.gmatch( line, '' ) do
+local src = string.match( source, ' src="([^"]+)"' )
+if src then
+video = vlc.strings.resolve_xml_special_chars( src )
 
-if prefres < 0 then
-break
-end
-local height = tonumber( string.match( src, '_(%d+)p%.mp4' ) )
-if ( not height ) or height <= prefres then
-break
+if prefres < 0 then
+break
+end
+local height = tonumber( string.match( source, ' 
label="(%d+).-"' ) )
+if ( not height ) or height <= prefres then
+break
+end
 end
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: support new video URL format

2021-04-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Apr  3 
15:38:08 2021 +0200| [e70b376940ee664a8f4dabaff7ec661d9eb7e673] | committer: 
Pierre Ynard

liveleak.lua: support new video URL format

(cherry picked from commit 3f401932985fcbe8b006f14f3a845e0708ef87fd)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e70b376940ee664a8f4dabaff7ec661d9eb7e673
---

 share/lua/playlist/liveleak.lua | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 170f07714f..890d493c92 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -23,8 +23,10 @@
 
 -- Probe function.
 function probe()
-return ( vlc.access == "http" or vlc.access == "https" )
-and string.match( vlc.path, "^www%.liveleak%.com/view" )
+return ( vlc.access == "http" or vlc.access == "https" ) and (
+   string.match( vlc.path, "^www%.liveleak%.com/v%?" )
+or string.match( vlc.path, "^www%.liveleak%.com/view%?" )
+   )
 end
 
 -- Util function

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: fix title metadata parsing

2021-04-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Apr  3 
15:40:35 2021 +0200| [3fcc32fcddbbb67adb15c98626db9ba90c7144c5] | committer: 
Pierre Ynard

liveleak.lua: fix title metadata parsing

(cherry picked from commit e02e408c34bb5569fd1e139d10b696f3c03fa6c6)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3fcc32fcddbbb67adb15c98626db9ba90c7144c5
---

 share/lua/playlist/liveleak.lua | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 890d493c92..39ee92e98e 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2012, 2017 VideoLAN and AUTHORS
+ Copyright © 2012, 2017, 2021 VideoLAN and AUTHORS
 
  Authors: Ludovic Fauvet 
   Pierre Ynard
@@ -29,12 +29,6 @@ function probe()
)
 end
 
--- Util function
-function find( haystack, needle )
-local _,_,r = string.find( haystack, needle )
-return r
-end
-
 -- Parse function.
 function parse()
 local p = {}
@@ -47,9 +41,16 @@ function parse()
 if not line then break end
 
 -- Try to find the title
-if string.match( line, ']*>(.-)<' )
-title = vlc.strings.resolve_xml_special_chars( title )
+if not title then
+title = string.match( line, "shareTitle: *'(.-[^\\])'" )
+if title then
+if string.match( title, "^'" ) then
+title = nil
+else
+-- FIXME: do this properly (see #24958)
+title = string.gsub( title, "\\'", "'" )
+end
+end
 end
 
 -- Try to find the art

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: fix title metadata parsing

2021-04-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Apr  3 15:40:35 
2021 +0200| [e02e408c34bb5569fd1e139d10b696f3c03fa6c6] | committer: Pierre Ynard

liveleak.lua: fix title metadata parsing

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e02e408c34bb5569fd1e139d10b696f3c03fa6c6
---

 share/lua/playlist/liveleak.lua | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 890d493c92..39ee92e98e 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2012, 2017 VideoLAN and AUTHORS
+ Copyright © 2012, 2017, 2021 VideoLAN and AUTHORS
 
  Authors: Ludovic Fauvet 
   Pierre Ynard
@@ -29,12 +29,6 @@ function probe()
)
 end
 
--- Util function
-function find( haystack, needle )
-local _,_,r = string.find( haystack, needle )
-return r
-end
-
 -- Parse function.
 function parse()
 local p = {}
@@ -47,9 +41,16 @@ function parse()
 if not line then break end
 
 -- Try to find the title
-if string.match( line, ']*>(.-)<' )
-title = vlc.strings.resolve_xml_special_chars( title )
+if not title then
+title = string.match( line, "shareTitle: *'(.-[^\\])'" )
+if title then
+if string.match( title, "^'" ) then
+title = nil
+else
+-- FIXME: do this properly (see #24958)
+title = string.gsub( title, "\\'", "'" )
+end
+end
 end
 
 -- Try to find the art

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: fix video resolution selection

2021-04-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Apr  3 15:46:41 
2021 +0200| [55456d7c1e2892d430f93645972e389e7e8462a8] | committer: Pierre Ynard

liveleak.lua: fix video resolution selection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=55456d7c1e2892d430f93645972e389e7e8462a8
---

 share/lua/playlist/liveleak.lua | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 39ee92e98e..c6e7bf3fa7 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -59,18 +59,27 @@ function parse()
 end
 
 -- Try to find the video
-if not video and string.match( line, '') do
+local more = vlc.readline()
+if not more then break end
+line = line..more
+end
+
 -- Apparently the two formats are listed HD first, SD second
 local prefres = vlc.var.inherit( nil, 'preferred-resolution' )
-for src in string.gmatch( line, '' ) do
+local src = string.match( source, ' src="([^"]+)"' )
+if src then
+video = vlc.strings.resolve_xml_special_chars( src )
 
-if prefres < 0 then
-break
-end
-local height = tonumber( string.match( src, '_(%d+)p%.mp4' ) )
-if ( not height ) or height <= prefres then
-break
+if prefres < 0 then
+break
+end
+local height = tonumber( string.match( source, ' 
label="(%d+).-"' ) )
+if ( not height ) or height <= prefres then
+break
+end
 end
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] liveleak.lua: support new video URL format

2021-04-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Apr  3 15:38:08 
2021 +0200| [3f401932985fcbe8b006f14f3a845e0708ef87fd] | committer: Pierre Ynard

liveleak.lua: support new video URL format

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f401932985fcbe8b006f14f3a845e0708ef87fd
---

 share/lua/playlist/liveleak.lua | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 170f07714f..890d493c92 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -23,8 +23,10 @@
 
 -- Probe function.
 function probe()
-return ( vlc.access == "http" or vlc.access == "https" )
-and string.match( vlc.path, "^www%.liveleak%.com/view" )
+return ( vlc.access == "http" or vlc.access == "https" ) and (
+   string.match( vlc.path, "^www%.liveleak%.com/v%?" )
+or string.match( vlc.path, "^www%.liveleak%.com/view%?" )
+   )
 end
 
 -- Util function

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: disable cookies if redirected to consent page

2021-04-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Apr  3 
12:02:34 2021 +0200| [f26577f12c20f63bb698255ac03ffd3eaa4700cc] | committer: 
Pierre Ynard

youtube.lua: disable cookies if redirected to consent page

In the past few days, YouTube has started redirecting requests for video
pages to a cookie consent and preference prompt, on a whole separate
page and domain; which prevents playback. We are not interested in
YouTube cookies, nor in consenting to them on behalf of our users, so
this just retries with cookies disabled. YouTube gets the hint and
simply redirects back to the original video page.

Fixes #25616

(cherry picked from commit f21c063ea3b8050541e5c8f4430378dfec85f4a5)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f26577f12c20f63bb698255ac03ffd3eaa4700cc
---

 share/lua/playlist/youtube.lua | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f8a8937387..65c81514d1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -303,8 +303,8 @@ end
 
 -- Probe function.
 function probe()
-return ( ( vlc.access == "http" or vlc.access == "https" )
- and (
+return ( ( vlc.access == "http" or vlc.access == "https" ) and (
+((
string.match( vlc.path, "^www%.youtube%.com/" )
 or string.match( vlc.path, "^music%.youtube%.com/" )
 or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
@@ -315,14 +315,27 @@ function probe()
 or string.match( vlc.path, "/get_video_info%?" ) -- info API
 or string.match( vlc.path, "/v/" ) -- video in swf player
 or string.match( vlc.path, "/embed/" ) -- embedded player iframe
- ) )
+ )) or
+   string.match( vlc.path, "^consent%.youtube%.com/" )
+ ) )
 end
 
 -- Parse function.
 function parse()
-if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+if string.match( vlc.path, "^consent%.youtube%.com/" ) then
+-- Cookie consent redirection
+-- Location: 
https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXXX=FR=0=yt=23983172=fr=1
+-- Set-Cookie: CONSENT=PENDING+355; expires=Fri, 01-Jan-2038 00:00:00 
GMT; path=/; domain=.youtube.com
+local url = get_url_param( vlc.path, "continue" )
+if not url then
+vlc.msg.err( "Couldn't handle YouTube cookie consent redirection, 
please check for updates to this script or try disabling HTTP cookie 
forwarding" )
+return { }
+end
+return { { path = vlc.strings.decode_uri( url ), options = { 
":no-http-forward-cookies" } } }
+elseif not string.match( vlc.path, "^www%.youtube%.com/" ) then
 -- Skin subdomain
 return { { path = vlc.access.."://"..string.gsub( vlc.path, 
"^([^/]*)/", "www.youtube.com/" ) } }
+
 elseif string.match( vlc.path, "/watch%?" )
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: disable cookies if redirected to consent page

2021-04-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Apr  3 12:02:34 
2021 +0200| [f21c063ea3b8050541e5c8f4430378dfec85f4a5] | committer: Pierre Ynard

youtube.lua: disable cookies if redirected to consent page

In the past few days, YouTube has started redirecting requests for video
pages to a cookie consent and preference prompt, on a whole separate
page and domain; which prevents playback. We are not interested in
YouTube cookies, nor in consenting to them on behalf of our users, so
this just retries with cookies disabled. YouTube gets the hint and
simply redirects back to the original video page.

Fixes #25616

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f21c063ea3b8050541e5c8f4430378dfec85f4a5
---

 share/lua/playlist/youtube.lua | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f8a8937387..65c81514d1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -303,8 +303,8 @@ end
 
 -- Probe function.
 function probe()
-return ( ( vlc.access == "http" or vlc.access == "https" )
- and (
+return ( ( vlc.access == "http" or vlc.access == "https" ) and (
+((
string.match( vlc.path, "^www%.youtube%.com/" )
 or string.match( vlc.path, "^music%.youtube%.com/" )
 or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
@@ -315,14 +315,27 @@ function probe()
 or string.match( vlc.path, "/get_video_info%?" ) -- info API
 or string.match( vlc.path, "/v/" ) -- video in swf player
 or string.match( vlc.path, "/embed/" ) -- embedded player iframe
- ) )
+ )) or
+   string.match( vlc.path, "^consent%.youtube%.com/" )
+ ) )
 end
 
 -- Parse function.
 function parse()
-if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+if string.match( vlc.path, "^consent%.youtube%.com/" ) then
+-- Cookie consent redirection
+-- Location: 
https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXXX=FR=0=yt=23983172=fr=1
+-- Set-Cookie: CONSENT=PENDING+355; expires=Fri, 01-Jan-2038 00:00:00 
GMT; path=/; domain=.youtube.com
+local url = get_url_param( vlc.path, "continue" )
+if not url then
+vlc.msg.err( "Couldn't handle YouTube cookie consent redirection, 
please check for updates to this script or try disabling HTTP cookie 
forwarding" )
+return { }
+end
+return { { path = vlc.strings.decode_uri( url ), options = { 
":no-http-forward-cookies" } } }
+elseif not string.match( vlc.path, "^www%.youtube%.com/" ) then
 -- Skin subdomain
 return { { path = vlc.access.."://"..string.gsub( vlc.path, 
"^([^/]*)/", "www.youtube.com/" ) } }
+
 elseif string.match( vlc.path, "/watch%?" )
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] soundcloud.lua: don't treat JavaScript assets as line-based

2021-03-06 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Mar  7 
00:44:41 2021 +0100| [41c9c8538c360838356e29bb246955b42ed1472e] | committer: 
Pierre Ynard

soundcloud.lua: don't treat JavaScript assets as line-based

Following changes in the SoundCloud JavaScript web assets, the API
magic is only found anymore in assets with lines exceeding the VLC API
line-length limit of 200 kB, making it impossible to extract this way
and causing playback failure.

These JavaScript assets are minified into one-liners, so it makes no
sense anyway to attempt to read and parse them line by line. Instead,
this now reads up to 4 MB of text from them (the relevant asset
currently weighs 1 MB). This way is arguably better and also more
efficient to begin with.

Refs #24957
Fixes #25508

(cherry picked from commit 302d55967b127a3519b714f8cdabd0257fbb3b45)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=41c9c8538c360838356e29bb246955b42ed1472e
---

 share/lua/playlist/soundcloud.lua | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/share/lua/playlist/soundcloud.lua 
b/share/lua/playlist/soundcloud.lua
index 3860837fcf..b1d6dcec20 100644
--- a/share/lua/playlist/soundcloud.lua
+++ b/share/lua/playlist/soundcloud.lua
@@ -45,18 +45,18 @@ function extract_magic( url )
 return nil
 end
 
-while true do
-local line = s:readline()
-if not line then break end
+local line = s:read( 4096*1024 )
+if not line then
+return nil
+end
 
--- The API magic appears under a similar form several times
--- in one of the javascript assets
--- {client_id:"z21TN9SfM0GjGteSzk4ViM1KEwMRNWZF"}
-local client_id = string.match( line, '[{,]client_id:"(%w+)"[},]' )
-if client_id then
-vlc.msg.dbg( "Found soundcloud API magic" )
-return client_id
-end
+-- The API magic appears under a similar form several times
+-- in one of the javascript assets
+-- {client_id:"z21TN9SfM0GjGteSzk4ViM1KEwMRNWZF"}
+local client_id = string.match( line, '[{,]client_id:"(%w+)"[},]' )
+if client_id then
+vlc.msg.dbg( "Found soundcloud API magic" )
+return client_id
 end
 return nil
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] soundcloud.lua: don't treat JavaScript assets as line-based

2021-03-06 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sun Mar  7 00:44:41 
2021 +0100| [302d55967b127a3519b714f8cdabd0257fbb3b45] | committer: Pierre Ynard

soundcloud.lua: don't treat JavaScript assets as line-based

Following changes in the SoundCloud JavaScript web assets, the API
magic is only found anymore in assets with lines exceeding the VLC API
line-length limit of 200 kB, making it impossible to extract this way
and causing playback failure.

These JavaScript assets are minified into one-liners, so it makes no
sense anyway to attempt to read and parse them line by line. Instead,
this now reads up to 4 MB of text from them (the relevant asset
currently weighs 1 MB). This way is arguably better and also more
efficient to begin with.

Refs #24957
Fixes #25508

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=302d55967b127a3519b714f8cdabd0257fbb3b45
---

 share/lua/playlist/soundcloud.lua | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/share/lua/playlist/soundcloud.lua 
b/share/lua/playlist/soundcloud.lua
index 3860837fcf..b1d6dcec20 100644
--- a/share/lua/playlist/soundcloud.lua
+++ b/share/lua/playlist/soundcloud.lua
@@ -45,18 +45,18 @@ function extract_magic( url )
 return nil
 end
 
-while true do
-local line = s:readline()
-if not line then break end
+local line = s:read( 4096*1024 )
+if not line then
+return nil
+end
 
--- The API magic appears under a similar form several times
--- in one of the javascript assets
--- {client_id:"z21TN9SfM0GjGteSzk4ViM1KEwMRNWZF"}
-local client_id = string.match( line, '[{,]client_id:"(%w+)"[},]' )
-if client_id then
-vlc.msg.dbg( "Found soundcloud API magic" )
-return client_id
-end
+-- The API magic appears under a similar form several times
+-- in one of the javascript assets
+-- {client_id:"z21TN9SfM0GjGteSzk4ViM1KEwMRNWZF"}
+local client_id = string.match( line, '[{,]client_id:"(%w+)"[},]' )
+if client_id then
+vlc.msg.dbg( "Found soundcloud API magic" )
+return client_id
 end
 return nil
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] rist: remove problematic redundant header include

2020-12-15 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Dec 15 
10:53:29 2020 +0100| [76cc138bdb0e17e22007c04bbdf85359586c3c9f] | committer: 
Pierre Ynard

rist: remove problematic redundant header include

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=76cc138bdb0e17e22007c04bbdf85359586c3c9f
---

 modules/access_output/rist.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/modules/access_output/rist.c b/modules/access_output/rist.c
index 0aa82cb118..27fe6274ab 100644
--- a/modules/access_output/rist.c
+++ b/modules/access_output/rist.c
@@ -39,7 +39,6 @@
 #include 
 #endif
 #include 
-#include 
 
 #include "../access/rist.h"
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] l10n: French update

2020-12-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Nov 28 
07:43:23 2020 +0100| [bd93d7e9f27fdc61acaa970269737a11e659ff0b] | committer: 
David Fuhrmann

l10n: French update

InfoPlist.strings: 100% translated

Signed-off-by: David Fuhrmann 
(cherry picked from commit 959ce007f47f6cbbb3202ff13c07a8d26fa8a55f)
Signed-off-by: David Fuhrmann 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=bd93d7e9f27fdc61acaa970269737a11e659ff0b
---

 modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings 
b/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings
new file mode 100644
index 00..c1e1116d82
--- /dev/null
+++ b/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings
@@ -0,0 +1,10 @@
+/* Localized versions of Info.plist keys */
+
+"NSCameraUsageDescription" = "VLC souhaite accéder à la caméra à la demande de 
l’utilisateur.";
+"NSMicrophoneUsageDescription" = "VLC souhaite accéder au microphone à la 
demande de l’utilisateur.";
+"NSAppleEventsUsageDescription" = "VLC souhaite mettre en pause et reprendre 
des lecteurs multimédias externes.";
+"NSDesktopFolderUsageDescription" = "VLC souhaite accéder au dossier du bureau 
à la demande de l’utilisateur.";
+"NSDocumentsFolderUsageDescription" = "VLC souhaite accéder au dossier des 
documents à la demande de l’utilisateur.";
+"NSDownloadsFolderUsageDescription" = "VLC souhaite accéder au dossier des 
téléchargements à la demande de l’utilisateur.";
+"NSNetworkVolumesUsageDescription" = "VLC souhaite accéder à un volume réseau 
à la demande de l’utilisateur.";
+"NSRemovableVolumesUsageDescription" = "VLC souhaite accéder à un volume 
amovible à la demande de l’utilisateur.";

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] l10n: French update

2020-12-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Nov 28 07:43:23 
2020 +0100| [959ce007f47f6cbbb3202ff13c07a8d26fa8a55f] | committer: David 
Fuhrmann

l10n: French update

InfoPlist.strings: 100% translated

Signed-off-by: David Fuhrmann 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=959ce007f47f6cbbb3202ff13c07a8d26fa8a55f
---

 modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings 
b/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings
new file mode 100644
index 00..c1e1116d82
--- /dev/null
+++ b/modules/gui/macosx/Resources/fr.lproj/InfoPlist.strings
@@ -0,0 +1,10 @@
+/* Localized versions of Info.plist keys */
+
+"NSCameraUsageDescription" = "VLC souhaite accéder à la caméra à la demande de 
l’utilisateur.";
+"NSMicrophoneUsageDescription" = "VLC souhaite accéder au microphone à la 
demande de l’utilisateur.";
+"NSAppleEventsUsageDescription" = "VLC souhaite mettre en pause et reprendre 
des lecteurs multimédias externes.";
+"NSDesktopFolderUsageDescription" = "VLC souhaite accéder au dossier du bureau 
à la demande de l’utilisateur.";
+"NSDocumentsFolderUsageDescription" = "VLC souhaite accéder au dossier des 
documents à la demande de l’utilisateur.";
+"NSDownloadsFolderUsageDescription" = "VLC souhaite accéder au dossier des 
téléchargements à la demande de l’utilisateur.";
+"NSNetworkVolumesUsageDescription" = "VLC souhaite accéder à un volume réseau 
à la demande de l’utilisateur.";
+"NSRemovableVolumesUsageDescription" = "VLC souhaite accéder à un volume 
amovible à la demande de l’utilisateur.";

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Update NEWS

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
08:18:42 2020 +0100| [2017c67f92b5c010f3deed945f358078a775b681] | committer: 
Pierre Ynard

Update NEWS

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2017c67f92b5c010f3deed945f358078a775b681
---

 NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index 010399c40d..83e4dba3dc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 Changes between 3.0.11.1 and 3.0.12:
 --
 
+Demux:
+ * Fixed adaptive's handling of resolution settings
+
 Audio output:
  * Fix audio distortion on macOS during start of playback
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: look for javascript descrambling URL on any line

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
06:04:57 2020 +0100| [8611b6b5bd2a32a7f81f274b00abae848b0207da] | committer: 
Pierre Ynard

youtube.lua: look for javascript descrambling URL on any line

This URL is forwarded to the fallback API and the whole point of that is
in case the main stream configuration line can't be found and parsed,
so don't look for it only on that line. The URL can indeed be found in
several other places on the page.

(cherry picked from commit 8ea54417ba8edb06538d88ede381db0eb5f37e41)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8611b6b5bd2a32a7f81f274b00abae848b0207da
---

 share/lua/playlist/youtube.lua | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 4ee599c7b9..a94e6f881a 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -327,6 +327,7 @@ function parse()
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )
 then -- This is the HTML page's URL
+local js_url
 -- fmt is the format of the video
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
@@ -409,11 +410,10 @@ function parse()
 end
 end
 
--- JSON parameters, also formerly known as "swfConfig",
--- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
-if string.match( line, "ytplayer%.config" ) then
-
-local js_url = string.match( line, '"jsUrl":"(.-)"' )
+-- We need this when parsing the main stream configuration;
+-- it can indeed be found on that same line (among others).
+if not js_url then
+js_url = string.match( line, '"jsUrl":"(.-)"' )
 or string.match( line, "\"js\": *\"(.-)\"" )
 if js_url then
 js_url = string.gsub( js_url, "\\/", "/" )
@@ -424,6 +424,11 @@ function parse()
 end
 js_url = string.gsub( js_url, "^//", vlc.access.."://" )
 end
+end
+
+-- JSON parameters, also formerly known as "swfConfig",
+-- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
+if string.match( line, "ytplayer%.config" ) then
 
 -- Classic parameters - out of use since early 2020
 if not fmt then

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: forward javascript descrambling URL to alternate API

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
05:58:28 2020 +0100| [748d7478344da856643bacb249916951b57f8ce2] | committer: 
Pierre Ynard

youtube.lua: forward javascript descrambling URL to alternate API

This renders the fallback to the alternate video info API - which
doesn't provide the javascript URL itself - functional with many more
videos, and makes the script as a whole more resilient to future
failures.

(cherry picked from commit 2d0f63a61b038d5d379acb85844450b0a61c1047)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=748d7478344da856643bacb249916951b57f8ce2
---

 share/lua/playlist/youtube.lua | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 39b824f90a..4ee599c7b9 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -480,6 +480,16 @@ function parse()
 -- of "embedded" and "detailpage" have historically been
 -- wrong and failed for various restricted videos.
 path = 
vlc.access.."://www.youtube.com/get_video_info?video_id="..video_id..copy_url_param(
 vlc.path, "fmt" )
+
+-- The YouTube API output doesn't provide the URL to the
+-- javascript code necessary to descramble URL signatures,
+-- without which functionality can be seriously limited.
+-- #18801 prevents us from using a subrequest to the API,
+-- so we forward the URL this way.
+if js_url then
+path = path.."="..vlc.strings.encode_uri_component( 
js_url )
+end
+
 vlc.msg.warn( "Couldn't extract video URL, falling back to 
alternate youtube API" )
 end
 end
@@ -502,6 +512,11 @@ function parse()
 return { }
 end
 
+local js_url = get_url_param( vlc.path, "jsurl" )
+if js_url then
+js_url= vlc.strings.decode_uri( js_url )
+end
+
 -- Classic parameters - out of use since early 2020
 local fmt = get_url_param( vlc.path, "fmt" )
 if not fmt then
@@ -516,7 +531,7 @@ function parse()
 if url_map then
 vlc.msg.dbg( "Found classic parameters for youtube video stream, 
parsing..." )
 url_map = vlc.strings.decode_uri( url_map )
-path = pick_url( url_map, fmt )
+path = pick_url( url_map, fmt, js_url )
 end
 
 -- New-style parameters
@@ -527,7 +542,7 @@ function parse()
 stream_map = vlc.strings.decode_uri( stream_map )
 -- FIXME: do this properly (see #24958)
 stream_map = string.gsub( stream_map, "\\u0026", "&" )
-path = pick_stream( stream_map )
+path = pick_stream( stream_map, js_url )
 end
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: make gaming.youtube.com subdomain support more generic

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
05:42:59 2020 +0100| [8aaaf5696432d07feab5a379bdfd6042fb6d50cd] | committer: 
Pierre Ynard

youtube.lua: make gaming.youtube.com subdomain support more generic

And mark it as out of use: gaming.youtube.com URLs now get redirected to
the main domain.

(cherry picked from commit 77f19929db1bcbc0f3a73b6edfd8f63ffb6cc56e)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8aaaf5696432d07feab5a379bdfd6042fb6d50cd
---

 share/lua/playlist/youtube.lua | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 08947a86b0..77c3ae42ae 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -306,7 +306,7 @@ function probe()
 return ( ( vlc.access == "http" or vlc.access == "https" )
  and (
string.match( vlc.path, "^www%.youtube%.com/" )
-or string.match( vlc.path, "^gaming%.youtube%.com/" )
+or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
  ) and (
string.match( vlc.path, "/watch%?" ) -- the html page
 or string.match( vlc.path, "/live$" ) -- user live stream html page
@@ -319,11 +319,10 @@ end
 
 -- Parse function.
 function parse()
-if string.match( vlc.path, "^gaming%.youtube%.com/" ) then
-url = string.gsub( vlc.path, "^gaming%.youtube%.com", 
"www.youtube.com" )
-return { { path = vlc.access.."://"..url } }
-end
-if string.match( vlc.path, "/watch%?" )
+if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+-- Skin subdomain
+return { { path = vlc.access.."://"..string.gsub( vlc.path, 
"^([^/]*)/", "www.youtube.com/" ) } }
+elseif string.match( vlc.path, "/watch%?" )
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )
 then -- This is the HTML page's URL

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: retry alternate API fallback using either possible parameter

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
06:33:25 2020 +0100| [3a93ec6ae98b6203c691ff010704aabcb20395b7] | committer: 
Pierre Ynard

youtube.lua: retry alternate API fallback using either possible parameter

This improves the interoperability of the fallback mechanism and makes
the script more resilient as a whole.

(cherry picked from commit 6e0f4a28c6f82bef165473e2785ea2834f9f5563)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3a93ec6ae98b6203c691ff010704aabcb20395b7
---

 share/lua/playlist/youtube.lua | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index a94e6f881a..f8a8937387 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -561,6 +561,17 @@ function parse()
 end
 end
 
+if not path and get_url_param( vlc.path, "el" ) ~= "detailpage" then
+-- Retry with the other known value for the "el" parameter;
+-- either value has historically been wrong and failed for
+-- some videos but not others.
+local video_id = get_url_param( vlc.path, "video_id" )
+if video_id then
+path = 
vlc.access.."://www.youtube.com/get_video_info?video_id="..video_id.."=detailpage"..copy_url_param(
 vlc.path, "fmt" )..copy_url_param( vlc.path, "jsurl" )
+vlc.msg.warn( "Couldn't extract video URL, retrying with 
alternate YouTube API parameters" )
+end
+end
+
 if not path then
 vlc.msg.err( "Couldn't extract youtube video URL, please check for 
updates to this script" )
 return { }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: support music.youtube.com URLs

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
05:48:10 2020 +0100| [35d71d9df8c21df24f5b6edfd3dc535dc7223171] | committer: 
Pierre Ynard

youtube.lua: support music.youtube.com URLs

Simply redirect to the main domain

Fixes #25241

(cherry picked from commit 95cf2a33e984a58801e4423359dc691c1d1e0faa)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=35d71d9df8c21df24f5b6edfd3dc535dc7223171
---

 share/lua/playlist/youtube.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 77c3ae42ae..39b824f90a 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -306,6 +306,7 @@ function probe()
 return ( ( vlc.access == "http" or vlc.access == "https" )
  and (
string.match( vlc.path, "^www%.youtube%.com/" )
+or string.match( vlc.path, "^music%.youtube%.com/" )
 or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
  ) and (
string.match( vlc.path, "/watch%?" ) -- the html page

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: make gaming.youtube.com subdomain support more generic

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 05:42:59 
2020 +0100| [77f19929db1bcbc0f3a73b6edfd8f63ffb6cc56e] | committer: Pierre Ynard

youtube.lua: make gaming.youtube.com subdomain support more generic

And mark it as out of use: gaming.youtube.com URLs now get redirected to
the main domain.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=77f19929db1bcbc0f3a73b6edfd8f63ffb6cc56e
---

 share/lua/playlist/youtube.lua | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 08947a86b0..77c3ae42ae 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -306,7 +306,7 @@ function probe()
 return ( ( vlc.access == "http" or vlc.access == "https" )
  and (
string.match( vlc.path, "^www%.youtube%.com/" )
-or string.match( vlc.path, "^gaming%.youtube%.com/" )
+or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
  ) and (
string.match( vlc.path, "/watch%?" ) -- the html page
 or string.match( vlc.path, "/live$" ) -- user live stream html page
@@ -319,11 +319,10 @@ end
 
 -- Parse function.
 function parse()
-if string.match( vlc.path, "^gaming%.youtube%.com/" ) then
-url = string.gsub( vlc.path, "^gaming%.youtube%.com", 
"www.youtube.com" )
-return { { path = vlc.access.."://"..url } }
-end
-if string.match( vlc.path, "/watch%?" )
+if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+-- Skin subdomain
+return { { path = vlc.access.."://"..string.gsub( vlc.path, 
"^([^/]*)/", "www.youtube.com/" ) } }
+elseif string.match( vlc.path, "/watch%?" )
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )
 then -- This is the HTML page's URL

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: support music.youtube.com URLs

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 05:48:10 
2020 +0100| [95cf2a33e984a58801e4423359dc691c1d1e0faa] | committer: Pierre Ynard

youtube.lua: support music.youtube.com URLs

Simply redirect to the main domain

Fixes #25241

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=95cf2a33e984a58801e4423359dc691c1d1e0faa
---

 share/lua/playlist/youtube.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 77c3ae42ae..39b824f90a 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -306,6 +306,7 @@ function probe()
 return ( ( vlc.access == "http" or vlc.access == "https" )
  and (
string.match( vlc.path, "^www%.youtube%.com/" )
+or string.match( vlc.path, "^music%.youtube%.com/" )
 or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
  ) and (
string.match( vlc.path, "/watch%?" ) -- the html page

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: retry alternate API fallback using either possible parameter

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 06:33:25 
2020 +0100| [6e0f4a28c6f82bef165473e2785ea2834f9f5563] | committer: Pierre Ynard

youtube.lua: retry alternate API fallback using either possible parameter

This improves the interoperability of the fallback mechanism and makes
the script more resilient as a whole.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6e0f4a28c6f82bef165473e2785ea2834f9f5563
---

 share/lua/playlist/youtube.lua | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index a94e6f881a..f8a8937387 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -561,6 +561,17 @@ function parse()
 end
 end
 
+if not path and get_url_param( vlc.path, "el" ) ~= "detailpage" then
+-- Retry with the other known value for the "el" parameter;
+-- either value has historically been wrong and failed for
+-- some videos but not others.
+local video_id = get_url_param( vlc.path, "video_id" )
+if video_id then
+path = 
vlc.access.."://www.youtube.com/get_video_info?video_id="..video_id.."=detailpage"..copy_url_param(
 vlc.path, "fmt" )..copy_url_param( vlc.path, "jsurl" )
+vlc.msg.warn( "Couldn't extract video URL, retrying with 
alternate YouTube API parameters" )
+end
+end
+
 if not path then
 vlc.msg.err( "Couldn't extract youtube video URL, please check for 
updates to this script" )
 return { }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: forward javascript descrambling URL to alternate API

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 05:58:28 
2020 +0100| [2d0f63a61b038d5d379acb85844450b0a61c1047] | committer: Pierre Ynard

youtube.lua: forward javascript descrambling URL to alternate API

This renders the fallback to the alternate video info API - which
doesn't provide the javascript URL itself - functional with many more
videos, and makes the script as a whole more resilient to future
failures.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2d0f63a61b038d5d379acb85844450b0a61c1047
---

 share/lua/playlist/youtube.lua | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 39b824f90a..4ee599c7b9 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -480,6 +480,16 @@ function parse()
 -- of "embedded" and "detailpage" have historically been
 -- wrong and failed for various restricted videos.
 path = 
vlc.access.."://www.youtube.com/get_video_info?video_id="..video_id..copy_url_param(
 vlc.path, "fmt" )
+
+-- The YouTube API output doesn't provide the URL to the
+-- javascript code necessary to descramble URL signatures,
+-- without which functionality can be seriously limited.
+-- #18801 prevents us from using a subrequest to the API,
+-- so we forward the URL this way.
+if js_url then
+path = path.."="..vlc.strings.encode_uri_component( 
js_url )
+end
+
 vlc.msg.warn( "Couldn't extract video URL, falling back to 
alternate youtube API" )
 end
 end
@@ -502,6 +512,11 @@ function parse()
 return { }
 end
 
+local js_url = get_url_param( vlc.path, "jsurl" )
+if js_url then
+js_url= vlc.strings.decode_uri( js_url )
+end
+
 -- Classic parameters - out of use since early 2020
 local fmt = get_url_param( vlc.path, "fmt" )
 if not fmt then
@@ -516,7 +531,7 @@ function parse()
 if url_map then
 vlc.msg.dbg( "Found classic parameters for youtube video stream, 
parsing..." )
 url_map = vlc.strings.decode_uri( url_map )
-path = pick_url( url_map, fmt )
+path = pick_url( url_map, fmt, js_url )
 end
 
 -- New-style parameters
@@ -527,7 +542,7 @@ function parse()
 stream_map = vlc.strings.decode_uri( stream_map )
 -- FIXME: do this properly (see #24958)
 stream_map = string.gsub( stream_map, "\\u0026", "&" )
-path = pick_stream( stream_map )
+path = pick_stream( stream_map, js_url )
 end
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: look for javascript descrambling URL on any line

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 06:04:57 
2020 +0100| [8ea54417ba8edb06538d88ede381db0eb5f37e41] | committer: Pierre Ynard

youtube.lua: look for javascript descrambling URL on any line

This URL is forwarded to the fallback API and the whole point of that is
in case the main stream configuration line can't be found and parsed,
so don't look for it only on that line. The URL can indeed be found in
several other places on the page.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8ea54417ba8edb06538d88ede381db0eb5f37e41
---

 share/lua/playlist/youtube.lua | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 4ee599c7b9..a94e6f881a 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -327,6 +327,7 @@ function parse()
 or string.match( vlc.path, "/live$" )
 or string.match( vlc.path, "/live%?" )
 then -- This is the HTML page's URL
+local js_url
 -- fmt is the format of the video
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
@@ -409,11 +410,10 @@ function parse()
 end
 end
 
--- JSON parameters, also formerly known as "swfConfig",
--- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
-if string.match( line, "ytplayer%.config" ) then
-
-local js_url = string.match( line, '"jsUrl":"(.-)"' )
+-- We need this when parsing the main stream configuration;
+-- it can indeed be found on that same line (among others).
+if not js_url then
+js_url = string.match( line, '"jsUrl":"(.-)"' )
 or string.match( line, "\"js\": *\"(.-)\"" )
 if js_url then
 js_url = string.gsub( js_url, "\\/", "/" )
@@ -424,6 +424,11 @@ function parse()
 end
 js_url = string.gsub( js_url, "^//", vlc.access.."://" )
 end
+end
+
+-- JSON parameters, also formerly known as "swfConfig",
+-- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
+if string.match( line, "ytplayer%.config" ) then
 
 -- Classic parameters - out of use since early 2020
 if not fmt then

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped '\r' in metadata from alternate API

2020-11-11 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Nov 12 
03:38:58 2020 +0100| [ce0d76706f3123ae383c32eb18e7144ce9f9aa0e] | committer: 
Pierre Ynard

youtube.lua: fix escaped '\r' in metadata from alternate API

(cherry picked from commit 7b7eac146181342b1bf76c1914a74122962cf114)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=ce0d76706f3123ae383c32eb18e7144ce9f9aa0e
---

 share/lua/playlist/youtube.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index b17900fd2e..08947a86b0 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -561,6 +561,7 @@ function parse()
 -- FIXME: do this properly (see #24958)
 description = string.gsub( description, '\\(["\\/])', '%1' )
 description = string.gsub( description, '\\n', '\n' )
+description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
 end
 local artist = string.match( line, "%%22author%%22%%3A%%22(.-)%%22" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped '\r' in metadata from alternate API

2020-11-11 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Nov 12 03:38:58 
2020 +0100| [7b7eac146181342b1bf76c1914a74122962cf114] | committer: Pierre Ynard

youtube.lua: fix escaped '\r' in metadata from alternate API

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7b7eac146181342b1bf76c1914a74122962cf114
---

 share/lua/playlist/youtube.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index b17900fd2e..08947a86b0 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -561,6 +561,7 @@ function parse()
 -- FIXME: do this properly (see #24958)
 description = string.gsub( description, '\\(["\\/])', '%1' )
 description = string.gsub( description, '\\n', '\n' )
+description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
 end
 local artist = string.match( line, "%%22author%%22%%3A%%22(.-)%%22" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: remove no-op logic in selector

2020-11-09 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Nov  8 
01:06:36 2020 +0100| [0ae8853780667e4d3602c95625f4b62c6f7a5419] | committer: 
Francois Cartegnie

adaptive: remove no-op logic in selector

Leftovers from 458adc37a516f5c55e1e09608d0eab7ff84c8242

Signed-off-by: Francois Cartegnie 
(cherry picked from commit 1e0989819a4be70fd213900b4e2587d964c28096)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0ae8853780667e4d3602c95625f4b62c6f7a5419
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1d740f660a..1c2ac3473c 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -91,17 +91,8 @@ BaseRepresentation * 
RepresentationSelector::select(BaseAdaptationSet *adaptSet,
 if (adaptSet == NULL)
 return NULL;
 
-BaseRepresentation *best = NULL;
 std::vector reps = adaptSet->getRepresentations();
-BaseRepresentation *candidate = select(reps, 
(best)?best->getBandwidth():0, bitrate);
-if (candidate)
-{
-if (candidate->getBandwidth() > bitrate) /* none matched, returned 
lowest */
-return candidate;
-best = candidate;
-}
-
-return best;
+return select(reps, 0, bitrate);
 }
 
 BaseRepresentation * 
RepresentationSelector::select(std::vector& reps,

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: honor --preferred-resolution

2020-11-09 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Nov  8 
01:15:01 2020 +0100| [6f5aa2deb343f801efde4bfd67d000b5ce4f0110] | committer: 
Francois Cartegnie

adaptive: honor --preferred-resolution

--adaptive-maxheight still takes precedence if set.

Fixes #21828

Signed-off-by: Francois Cartegnie 
(cherry picked from commit 1d55df153a4e2ed5f3dcdb5c6cccbd9dbefe8b98)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=6f5aa2deb343f801efde4bfd67d000b5ce4f0110
---

 modules/demux/adaptive/PlaylistManager.cpp | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index e2d513c23d..302987813d 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -838,8 +838,19 @@ AbstractAdaptationLogic 
*PlaylistManager::createLogic(AbstractAdaptationLogic::L
 
 if(logic)
 {
-logic->setMaxDeviceResolution( var_InheritInteger(p_demux, 
"adaptive-maxwidth"),
-   var_InheritInteger(p_demux, 
"adaptive-maxheight") );
+int w = var_InheritInteger(p_demux, "adaptive-maxwidth");
+int h = var_InheritInteger(p_demux, "adaptive-maxheight");
+if(h == 0)
+{
+h = var_InheritInteger(p_demux, "preferred-resolution");
+/* Adapt for slightly different minimum/maximum semantics */
+if(h == -1)
+h = 0;
+else if(h == 0)
+h = 1;
+}
+
+logic->setMaxDeviceResolution(w, h);
 }
 
 return logic;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: don't fail if no suitable resolution matches constraints

2020-11-09 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Nov  8 
01:08:33 2020 +0100| [81991a47f579d0184ee16764f4d4b667dd7e2d28] | committer: 
Francois Cartegnie

adaptive: don't fail if no suitable resolution matches constraints

This changes the semantics of --adaptive-maxheight
and --adaptive-maxwidth and aligns them with those of
--preferred-resolution: the current behavior that strictly conforms to
resolution constraints and results in no playback at all, rather than
trying a best effort, is not terribly useful.

Signed-off-by: Francois Cartegnie 
(cherry picked from commit 927cf8821951113260ee14d210c35a257501032b)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=81991a47f579d0184ee16764f4d4b667dd7e2d28
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1c2ac3473c..5889b3f199 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -43,11 +43,7 @@ RepresentationSelector::~RepresentationSelector()
 BaseRepresentation * RepresentationSelector::lowest(BaseAdaptationSet 
*adaptSet) const
 {
 std::vector reps = adaptSet->getRepresentations();
-/* No maxsize check here */
-BaseRepresentation *rep = (reps.empty()) ? NULL : *(reps.begin());
-if(rep && rep->getWidth() <= maxwidth && rep->getHeight() <= maxheight)
-return rep;
-return NULL;
+return (reps.empty()) ? NULL : *(reps.begin());
 }
 
 BaseRepresentation * RepresentationSelector::highest(BaseAdaptationSet 
*adaptSet) const
@@ -60,7 +56,7 @@ BaseRepresentation * 
RepresentationSelector::highest(BaseAdaptationSet *adaptSet
 if( (*it)->getWidth() <= maxwidth && (*it)->getHeight() <= maxheight )
 return *it;
 }
-return NULL;
+return lowest(adaptSet);
 }
 
 BaseRepresentation * RepresentationSelector::higher(BaseAdaptationSet 
*adaptSet, BaseRepresentation *rep) const
@@ -102,12 +98,12 @@ BaseRepresentation * 
RepresentationSelector::select(std::vector::const_iterator repIt;
 for(repIt=reps.begin(); repIt!=reps.end(); ++repIt)
 {
-if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
-continue;
-
 if ( !lowest || (*repIt)->getBandwidth() < lowest->getBandwidth())
 lowest = *repIt;
 
+if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
+continue;
+
 if ( (*repIt)->getBandwidth() < maxbitrate &&
  (*repIt)->getBandwidth() > minbitrate )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: fix crash when selector returns no suitable representation

2020-11-09 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Nov  8 
01:04:56 2020 +0100| [fe838abf186942e564e9943f35b00fc82f120daf] | committer: 
Francois Cartegnie

adaptive: fix crash when selector returns no suitable representation

This happens in particular when requesting a resolution lower than
the lowest available one. It affects only the default, near optimal
adaptation logic; all other logics cope with this without crashing.

Signed-off-by: Francois Cartegnie 
(cherry picked from commit ccd7f295de88279770da6d8a8281b404c2b2f4ac)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=fe838abf186942e564e9943f35b00fc82f120daf
---

 modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp 
b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 84b19bbe20..5d8227275e 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -89,8 +89,13 @@ BaseRepresentation 
*NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
 {
 RepresentationSelector selector(maxwidth, maxheight);
 
-const float umin = getUtility(selector.lowest(adaptSet));
-const float umax = getUtility(selector.highest(adaptSet));
+BaseRepresentation *lowest = selector.lowest(adaptSet);
+BaseRepresentation *highest = selector.highest(adaptSet);
+if(lowest == NULL || highest == NULL)
+return NULL;
+
+const float umin = getUtility(lowest);
+const float umax = getUtility(highest);
 
 vlc_mutex_lock();
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: fix crash when selector returns no suitable representation

2020-11-09 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sun Nov  8 01:04:56 
2020 +0100| [ccd7f295de88279770da6d8a8281b404c2b2f4ac] | committer: Francois 
Cartegnie

adaptive: fix crash when selector returns no suitable representation

This happens in particular when requesting a resolution lower than
the lowest available one. It affects only the default, near optimal
adaptation logic; all other logics cope with this without crashing.

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ccd7f295de88279770da6d8a8281b404c2b2f4ac
---

 modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp 
b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 9afdead977..d31758b49c 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -87,8 +87,13 @@ BaseRepresentation 
*NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
 {
 RepresentationSelector selector(maxwidth, maxheight);
 
-const float umin = getUtility(selector.lowest(adaptSet));
-const float umax = getUtility(selector.highest(adaptSet));
+BaseRepresentation *lowest = selector.lowest(adaptSet);
+BaseRepresentation *highest = selector.highest(adaptSet);
+if(lowest == NULL || highest == NULL)
+return NULL;
+
+const float umin = getUtility(lowest);
+const float umax = getUtility(highest);
 
 vlc_mutex_lock();
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: don't fail if no suitable resolution matches constraints

2020-11-09 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sun Nov  8 01:08:33 
2020 +0100| [927cf8821951113260ee14d210c35a257501032b] | committer: Francois 
Cartegnie

adaptive: don't fail if no suitable resolution matches constraints

This changes the semantics of --adaptive-maxheight
and --adaptive-maxwidth and aligns them with those of
--preferred-resolution: the current behavior that strictly conforms to
resolution constraints and results in no playback at all, rather than
trying a best effort, is not terribly useful.

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=927cf8821951113260ee14d210c35a257501032b
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1c2ac3473c..5889b3f199 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -43,11 +43,7 @@ RepresentationSelector::~RepresentationSelector()
 BaseRepresentation * RepresentationSelector::lowest(BaseAdaptationSet 
*adaptSet) const
 {
 std::vector reps = adaptSet->getRepresentations();
-/* No maxsize check here */
-BaseRepresentation *rep = (reps.empty()) ? NULL : *(reps.begin());
-if(rep && rep->getWidth() <= maxwidth && rep->getHeight() <= maxheight)
-return rep;
-return NULL;
+return (reps.empty()) ? NULL : *(reps.begin());
 }
 
 BaseRepresentation * RepresentationSelector::highest(BaseAdaptationSet 
*adaptSet) const
@@ -60,7 +56,7 @@ BaseRepresentation * 
RepresentationSelector::highest(BaseAdaptationSet *adaptSet
 if( (*it)->getWidth() <= maxwidth && (*it)->getHeight() <= maxheight )
 return *it;
 }
-return NULL;
+return lowest(adaptSet);
 }
 
 BaseRepresentation * RepresentationSelector::higher(BaseAdaptationSet 
*adaptSet, BaseRepresentation *rep) const
@@ -102,12 +98,12 @@ BaseRepresentation * 
RepresentationSelector::select(std::vector::const_iterator repIt;
 for(repIt=reps.begin(); repIt!=reps.end(); ++repIt)
 {
-if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
-continue;
-
 if ( !lowest || (*repIt)->getBandwidth() < lowest->getBandwidth())
 lowest = *repIt;
 
+if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
+continue;
+
 if ( (*repIt)->getBandwidth() < maxbitrate &&
  (*repIt)->getBandwidth() > minbitrate )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: honor --preferred-resolution

2020-11-09 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sun Nov  8 01:15:01 
2020 +0100| [1d55df153a4e2ed5f3dcdb5c6cccbd9dbefe8b98] | committer: Francois 
Cartegnie

adaptive: honor --preferred-resolution

--adaptive-maxheight still takes precedence if set.

Fixes #21828

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1d55df153a4e2ed5f3dcdb5c6cccbd9dbefe8b98
---

 modules/demux/adaptive/PlaylistManager.cpp | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index 0e7b62a141..164ba0949e 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -847,8 +847,19 @@ AbstractAdaptationLogic 
*PlaylistManager::createLogic(AbstractAdaptationLogic::L
 
 if(logic)
 {
-logic->setMaxDeviceResolution( var_InheritInteger(p_demux, 
"adaptive-maxwidth"),
-   var_InheritInteger(p_demux, 
"adaptive-maxheight") );
+int w = var_InheritInteger(p_demux, "adaptive-maxwidth");
+int h = var_InheritInteger(p_demux, "adaptive-maxheight");
+if(h == 0)
+{
+h = var_InheritInteger(p_demux, "preferred-resolution");
+/* Adapt for slightly different minimum/maximum semantics */
+if(h == -1)
+h = 0;
+else if(h == 0)
+h = 1;
+}
+
+logic->setMaxDeviceResolution(w, h);
 }
 
 return logic;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: remove no-op logic in selector

2020-11-09 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sun Nov  8 01:06:36 
2020 +0100| [1e0989819a4be70fd213900b4e2587d964c28096] | committer: Francois 
Cartegnie

adaptive: remove no-op logic in selector

Leftovers from 458adc37a516f5c55e1e09608d0eab7ff84c8242

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e0989819a4be70fd213900b4e2587d964c28096
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1d740f660a..1c2ac3473c 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -91,17 +91,8 @@ BaseRepresentation * 
RepresentationSelector::select(BaseAdaptationSet *adaptSet,
 if (adaptSet == NULL)
 return NULL;
 
-BaseRepresentation *best = NULL;
 std::vector reps = adaptSet->getRepresentations();
-BaseRepresentation *candidate = select(reps, 
(best)?best->getBandwidth():0, bitrate);
-if (candidate)
-{
-if (candidate->getBandwidth() > bitrate) /* none matched, returned 
lowest */
-return candidate;
-best = candidate;
-}
-
-return best;
+return select(reps, 0, bitrate);
 }
 
 BaseRepresentation * 
RepresentationSelector::select(std::vector& reps,

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: fix crash when selector returns no suitable representation

2020-11-09 Thread Pierre Ynard via vlc-devel
vlc | branch: master | Pierre Ynard via vlc-devel  | 
Sun Nov  8 01:04:56 2020 +0100| [41c169de7aa8468c8f168d06debd3d01c9ffaec5] | 
committer: Francois Cartegnie

adaptive: fix crash when selector returns no suitable representation

This happens in particular when requesting a resolution lower than
the lowest available one. It affects only the default, near optimal
adaptation logic; all other logics cope with this without crashing.

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41c169de7aa8468c8f168d06debd3d01c9ffaec5
---

 modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp 
b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 9afdead977..d31758b49c 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -87,8 +87,13 @@ BaseRepresentation 
*NearOptimalAdaptationLogic::getNextRepresentation(BaseAdapta
 {
 RepresentationSelector selector(maxwidth, maxheight);
 
-const float umin = getUtility(selector.lowest(adaptSet));
-const float umax = getUtility(selector.highest(adaptSet));
+BaseRepresentation *lowest = selector.lowest(adaptSet);
+BaseRepresentation *highest = selector.highest(adaptSet);
+if(lowest == NULL || highest == NULL)
+return NULL;
+
+const float umin = getUtility(lowest);
+const float umax = getUtility(highest);
 
 vlc_mutex_lock();
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: don't fail if no suitable resolution matches constraints

2020-11-09 Thread Pierre Ynard via vlc-devel
vlc | branch: master | Pierre Ynard via vlc-devel  | 
Sun Nov  8 01:08:33 2020 +0100| [0f1131ea06f6cdfd0dc054ccca722417d30f95b6] | 
committer: Francois Cartegnie

adaptive: don't fail if no suitable resolution matches constraints

This changes the semantics of --adaptive-maxheight
and --adaptive-maxwidth and aligns them with those of
--preferred-resolution: the current behavior that strictly conforms to
resolution constraints and results in no playback at all, rather than
trying a best effort, is not terribly useful.

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0f1131ea06f6cdfd0dc054ccca722417d30f95b6
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1c2ac3473c..5889b3f199 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -43,11 +43,7 @@ RepresentationSelector::~RepresentationSelector()
 BaseRepresentation * RepresentationSelector::lowest(BaseAdaptationSet 
*adaptSet) const
 {
 std::vector reps = adaptSet->getRepresentations();
-/* No maxsize check here */
-BaseRepresentation *rep = (reps.empty()) ? NULL : *(reps.begin());
-if(rep && rep->getWidth() <= maxwidth && rep->getHeight() <= maxheight)
-return rep;
-return NULL;
+return (reps.empty()) ? NULL : *(reps.begin());
 }
 
 BaseRepresentation * RepresentationSelector::highest(BaseAdaptationSet 
*adaptSet) const
@@ -60,7 +56,7 @@ BaseRepresentation * 
RepresentationSelector::highest(BaseAdaptationSet *adaptSet
 if( (*it)->getWidth() <= maxwidth && (*it)->getHeight() <= maxheight )
 return *it;
 }
-return NULL;
+return lowest(adaptSet);
 }
 
 BaseRepresentation * RepresentationSelector::higher(BaseAdaptationSet 
*adaptSet, BaseRepresentation *rep) const
@@ -102,12 +98,12 @@ BaseRepresentation * 
RepresentationSelector::select(std::vector::const_iterator repIt;
 for(repIt=reps.begin(); repIt!=reps.end(); ++repIt)
 {
-if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
-continue;
-
 if ( !lowest || (*repIt)->getBandwidth() < lowest->getBandwidth())
 lowest = *repIt;
 
+if( (*repIt)->getWidth() > maxwidth || (*repIt)->getHeight() > 
maxheight )
+continue;
+
 if ( (*repIt)->getBandwidth() < maxbitrate &&
  (*repIt)->getBandwidth() > minbitrate )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: remove no-op logic in selector

2020-11-09 Thread Pierre Ynard via vlc-devel
vlc | branch: master | Pierre Ynard via vlc-devel  | 
Sun Nov  8 01:06:36 2020 +0100| [68c1e6fd99d82c01098a445be47f0b5750711497] | 
committer: Francois Cartegnie

adaptive: remove no-op logic in selector

Leftovers from 458adc37a516f5c55e1e09608d0eab7ff84c8242

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68c1e6fd99d82c01098a445be47f0b5750711497
---

 modules/demux/adaptive/logic/Representationselectors.cpp | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/modules/demux/adaptive/logic/Representationselectors.cpp 
b/modules/demux/adaptive/logic/Representationselectors.cpp
index 1d740f660a..1c2ac3473c 100644
--- a/modules/demux/adaptive/logic/Representationselectors.cpp
+++ b/modules/demux/adaptive/logic/Representationselectors.cpp
@@ -91,17 +91,8 @@ BaseRepresentation * 
RepresentationSelector::select(BaseAdaptationSet *adaptSet,
 if (adaptSet == NULL)
 return NULL;
 
-BaseRepresentation *best = NULL;
 std::vector reps = adaptSet->getRepresentations();
-BaseRepresentation *candidate = select(reps, 
(best)?best->getBandwidth():0, bitrate);
-if (candidate)
-{
-if (candidate->getBandwidth() > bitrate) /* none matched, returned 
lowest */
-return candidate;
-best = candidate;
-}
-
-return best;
+return select(reps, 0, bitrate);
 }
 
 BaseRepresentation * 
RepresentationSelector::select(std::vector& reps,

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] adaptive: honor --preferred-resolution

2020-11-09 Thread Pierre Ynard via vlc-devel
vlc | branch: master | Pierre Ynard via vlc-devel  | 
Sun Nov  8 01:15:01 2020 +0100| [f26398c16aadbbdd47e5e5805c7c1acd73911cab] | 
committer: Francois Cartegnie

adaptive: honor --preferred-resolution

--adaptive-maxheight still takes precedence if set.

Fixes #21828

Signed-off-by: Francois Cartegnie 

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f26398c16aadbbdd47e5e5805c7c1acd73911cab
---

 modules/demux/adaptive/PlaylistManager.cpp | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index 0e7b62a141..164ba0949e 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -847,8 +847,19 @@ AbstractAdaptationLogic 
*PlaylistManager::createLogic(AbstractAdaptationLogic::L
 
 if(logic)
 {
-logic->setMaxDeviceResolution( var_InheritInteger(p_demux, 
"adaptive-maxwidth"),
-   var_InheritInteger(p_demux, 
"adaptive-maxheight") );
+int w = var_InheritInteger(p_demux, "adaptive-maxwidth");
+int h = var_InheritInteger(p_demux, "adaptive-maxheight");
+if(h == 0)
+{
+h = var_InheritInteger(p_demux, "preferred-resolution");
+/* Adapt for slightly different minimum/maximum semantics */
+if(h == -1)
+h = 0;
+else if(h == 0)
+h = 1;
+}
+
+logic->setMaxDeviceResolution(w, h);
 }
 
 return logic;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Update NEWS

2020-11-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sun Nov  8 
02:26:12 2020 +0100| [05ea24925ad8c52228d591193a91b8e2997ae61d] | committer: 
Pierre Ynard

Update NEWS

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=05ea24925ad8c52228d591193a91b8e2997ae61d
---

 NEWS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NEWS b/NEWS
index 3b6114056c..010399c40d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ macOS:
 Misc:
  * Several fixes in the web interface, including privacy and security
improvements
+ * Update YouTube and Vocaroo scripts
 
 Changes between 3.0.11 and 3.0.11.1:
 --

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: split long line workaround into reusable helper

2020-11-04 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Wed Nov  4 
19:17:23 2020 +0100| [d4d6ad3b16510fc78a0859a7bc7c70c1fc3d71ad] | committer: 
Pierre Ynard

youtube.lua: split long line workaround into reusable helper

(cherry picked from commit c20877a8b494d823fc7d8201183ad903e3f4abbb)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d4d6ad3b16510fc78a0859a7bc7c70c1fc3d71ad
---

 share/lua/playlist/youtube.lua | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 7d5f31ef3d..68630e6ba0 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -62,6 +62,22 @@ function get_fmt( fmt_list )
 return fmt
 end
 
+-- Helper emulating vlc.readline() to work around its failure on
+-- very long lines (see #24957)
+function read_long_line()
+local eol
+local pos = 0
+local len = 32768
+repeat
+len = len * 2
+local line = vlc.peek( len )
+if not line then return nil end
+eol = string.find( line, "\n", pos + 1 )
+pos = len
+until eol or len >= 1024 * 1024 -- No EOF detection, loop until limit
+return vlc.read( eol or len )
+end
+
 -- Buffering iterator to parse through the HTTP stream several times
 -- without making several HTTP requests
 function buf_iter( s )
@@ -319,20 +335,10 @@ function parse()
 if not line then break end
 
 -- The next line is the major configuration line that we need.
--- It is very long and readline() is likely to fail on it due
--- to #24957, so we need this instead.
+-- It is very long so we need this workaround (see #24957).
 if string.match( line, '^ *' ) then
-if not vlc.peek( 1 ) then break end
-local eol
-local pos = 0
-local len = 32768
-repeat
-len = len * 2
-line = vlc.peek( len )
-eol = string.find( line, "\n", pos + 1 )
-pos = len
-until eol or len >= 1024 * 1024
-line = vlc.read( eol or len )
+line = read_long_line()
+if not line then break end
 end
 
 if not title then

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: always use long line workaround with new HTML code layout

2020-11-04 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Wed Nov  4 
19:22:10 2020 +0100| [196cb1b2296ab46e9e9558108ec91b645de7370f] | committer: 
Pierre Ynard

youtube.lua: always use long line workaround with new HTML code layout

This is required for the main configuration line, and possibly another
line before it. Until more is known, it seems more prudent to enable the
workaround unconditionally for now, than to try and guess what should
work correctly.

(cherry picked from commit 61b51a0dfdb785a042b370efbfd78be53a1814d4)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=196cb1b2296ab46e9e9558108ec91b645de7370f
---

 share/lua/playlist/youtube.lua | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 68630e6ba0..b17900fd2e 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -331,7 +331,9 @@ function parse()
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
 while true do
-local line = vlc.readline()
+-- The new HTML code layout has fewer and longer lines; always
+-- use the long line workaround until we get more visibility.
+local line = new_layout and read_long_line() or vlc.readline()
 if not line then break end
 
 -- The next line is the major configuration line that we need.
@@ -400,10 +402,10 @@ function parse()
 end
 end
 
-if not nonce then
+if not new_layout then
 if string.match( line, '

[vlc-commits] youtube.lua: always use long line workaround with new HTML code layout

2020-11-04 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Wed Nov  4 19:22:10 
2020 +0100| [61b51a0dfdb785a042b370efbfd78be53a1814d4] | committer: Pierre Ynard

youtube.lua: always use long line workaround with new HTML code layout

This is required for the main configuration line, and possibly another
line before it. Until more is known, it seems more prudent to enable the
workaround unconditionally for now, than to try and guess what should
work correctly.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=61b51a0dfdb785a042b370efbfd78be53a1814d4
---

 share/lua/playlist/youtube.lua | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 68630e6ba0..b17900fd2e 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -331,7 +331,9 @@ function parse()
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
 while true do
-local line = vlc.readline()
+-- The new HTML code layout has fewer and longer lines; always
+-- use the long line workaround until we get more visibility.
+local line = new_layout and read_long_line() or vlc.readline()
 if not line then break end
 
 -- The next line is the major configuration line that we need.
@@ -400,10 +402,10 @@ function parse()
 end
 end
 
-if not nonce then
+if not new_layout then
 if string.match( line, '

[vlc-commits] youtube.lua: split long line workaround into reusable helper

2020-11-04 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Wed Nov  4 19:17:23 
2020 +0100| [c20877a8b494d823fc7d8201183ad903e3f4abbb] | committer: Pierre Ynard

youtube.lua: split long line workaround into reusable helper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c20877a8b494d823fc7d8201183ad903e3f4abbb
---

 share/lua/playlist/youtube.lua | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 7d5f31ef3d..68630e6ba0 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -62,6 +62,22 @@ function get_fmt( fmt_list )
 return fmt
 end
 
+-- Helper emulating vlc.readline() to work around its failure on
+-- very long lines (see #24957)
+function read_long_line()
+local eol
+local pos = 0
+local len = 32768
+repeat
+len = len * 2
+local line = vlc.peek( len )
+if not line then return nil end
+eol = string.find( line, "\n", pos + 1 )
+pos = len
+until eol or len >= 1024 * 1024 -- No EOF detection, loop until limit
+return vlc.read( eol or len )
+end
+
 -- Buffering iterator to parse through the HTTP stream several times
 -- without making several HTTP requests
 function buf_iter( s )
@@ -319,20 +335,10 @@ function parse()
 if not line then break end
 
 -- The next line is the major configuration line that we need.
--- It is very long and readline() is likely to fail on it due
--- to #24957, so we need this instead.
+-- It is very long so we need this workaround (see #24957).
 if string.match( line, '^ *' ) then
-if not vlc.peek( 1 ) then break end
-local eol
-local pos = 0
-local len = 32768
-repeat
-len = len * 2
-line = vlc.peek( len )
-eol = string.find( line, "\n", pos + 1 )
-pos = len
-until eol or len >= 1024 * 1024
-line = vlc.read( eol or len )
+line = read_long_line()
+if not line then break end
 end
 
 if not title then

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: stricter check for applying peek() long line workaround

2020-11-02 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Nov  3 
00:46:46 2020 +0100| [36835fb8e5f643cebb2d71016f0d797ce13504cb] | committer: 
Pierre Ynard

youtube.lua: stricter check for applying peek() long line workaround

Required with a new HTML code layout apparently getting phased in

(cherry picked from commit 611ba98b65cce0ac0addb5e3e811d22601313323)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=36835fb8e5f643cebb2d71016f0d797ce13504cb
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 965e17142b..f45ea82edc 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -321,7 +321,7 @@ function parse()
 -- The next line is the major configuration line that we need.
 -- It is very long and readline() is likely to fail on it due
 -- to #24957, so we need this instead.
-if string.match( line, '' ) then
+if string.match( line, '^ *' ) then
 if not vlc.peek( 1 ) then break end
 local eol
 local pos = 0

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: support new HTML code layout

2020-11-02 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Nov  3 
01:20:21 2020 +0100| [7f98ed33e7c782c052d8462455be85cd3560a518] | committer: 
Pierre Ynard

youtube.lua: support new HTML code layout

This new layout is apparently getting phased in. As major differences,
line splitting is more erratic (with overall 10 times fewer lines for a
slightly bigger HTML document), and the main stream configuration isn't
subjected to double JSON string encoding anymore.

(cherry picked from commit 671afe05eb6109117a57d7ec9871caf9cdace382)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7f98ed33e7c782c052d8462455be85cd3560a518
---

 share/lua/playlist/youtube.lua | 29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f45ea82edc..7d5f31ef3d 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -351,14 +351,19 @@ function parse()
 -- unlikely to access it due to #24957
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
-if string.match( description, '^\\"' ) then
+-- FIXME: do this properly (see #24958)
+description = string.gsub( description, '\\(["\\/])', '%1' 
)
+else
+description = string.match( line, 
'"shortDescription":"(.-[^\\])"')
+end
+if description then
+if string.match( description, '^"' ) then
 description = ""
 end
 -- FIXME: do this properly (see #24958)
 -- This way of unescaping is technically wrong
 -- so as little as possible of it should be done
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
-description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\n', '\n' )
 description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
@@ -380,10 +385,22 @@ function parse()
 if artist then
 -- FIXME: do this properly (see #24958)
 artist = string.gsub( artist, '\\(["\\/])', '%1' )
+else
+artist = string.match( line, '"author":"(.-)"' )
+end
+if artist then
+-- FIXME: do this properly (see #24958)
 artist = string.gsub( artist, "\\u0026", "&" )
 end
 end
 
+if not nonce then
+if string.match( line, '

[vlc-commits] youtube.lua: stop trying to double XML-decode title metadata

2020-11-02 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Nov  3 
00:18:56 2020 +0100| [c101772ca9aeda1a5599f17eb753060a5e33d9e3] | committer: 
Pierre Ynard

youtube.lua: stop trying to double XML-decode title metadata

This attribute isn't double-encoded now, and so attempting this is not
just pointless but can theoretically lead to wrong output.

(cherry picked from commit ff8edf3493ee0b4be700160da2b56b9c041ebb75)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c101772ca9aeda1a5599f17eb753060a5e33d9e3
---

 share/lua/playlist/youtube.lua | 1 -
 1 file changed, 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 29e3f1e184..a34534d81c 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -339,7 +339,6 @@ function parse()
 if string.match( line, "https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: more robust meta tag metadata parsing

2020-11-02 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Nov  3 
00:38:49 2020 +0100| [c92448e7dd4f5a5bf05f723d7df9f190508d2fd8] | committer: 
Pierre Ynard

youtube.lua: more robust meta tag metadata parsing

Required for a new HTML code layout apparently getting phased in

(cherry picked from commit f3d206499bb45df4aef2f05770c8535e4cd8a4de)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c92448e7dd4f5a5bf05f723d7df9f190508d2fd8
---

 share/lua/playlist/youtube.lua | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index a34534d81c..965e17142b 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -335,10 +335,14 @@ function parse()
 line = vlc.read( eol or len )
 end
 
--- Try to find the video's title
-if string.match( line, "' )
+if meta then
+title = string.match( meta, ' content="(.-)"' )
+if title then
+title = vlc.strings.resolve_xml_special_chars( title )
+end
+end
 end
 
 if not description then
@@ -361,9 +365,14 @@ function parse()
 end
 end
 
-if string.match( line, "' )
+if meta then
+arturl = string.match( meta, ' content="(.-)"' )
+if arturl then
+arturl = vlc.strings.resolve_xml_special_chars( arturl 
)
+end
+end
 end
 
 if not artist then
@@ -453,7 +462,7 @@ function parse()
 arturl = get_arturl()
 end
 
-return { { path = path; name = name; description = description; artist 
= artist; arturl = arturl } }
+return { { path = path; name = title; description = description; 
artist = artist; arturl = arturl } }
 
 elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
 local line = vlc.read( 1024*1024 ) -- data is on one line only

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped characters issue in artist metadata

2020-11-02 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Nov  3 
00:14:45 2020 +0100| [c8f0549e8e19e517a0019ead4a55a7ddbe801800] | committer: 
Pierre Ynard

youtube.lua: fix escaped characters issue in artist metadata

The double encoding of \u0026 wasn't handled.

(cherry picked from commit 083059cd884b7720d2a319edde58699328ac4408)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c8f0549e8e19e517a0019ead4a55a7ddbe801800
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index d211e30951..29e3f1e184 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -371,7 +371,7 @@ function parse()
 artist = string.match(line, '\\"author\\":\\"(.-)\\"')
 if artist then
 -- FIXME: do this properly (see #24958)
-artist = string.gsub( artist, "\\/", "/" )
+artist = string.gsub( artist, '\\(["\\/])', '%1' )
 artist = string.gsub( artist, "\\u0026", "&" )
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: stop trying to double XML-decode title metadata

2020-11-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Nov  3 00:18:56 
2020 +0100| [ff8edf3493ee0b4be700160da2b56b9c041ebb75] | committer: Pierre Ynard

youtube.lua: stop trying to double XML-decode title metadata

This attribute isn't double-encoded now, and so attempting this is not
just pointless but can theoretically lead to wrong output.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff8edf3493ee0b4be700160da2b56b9c041ebb75
---

 share/lua/playlist/youtube.lua | 1 -
 1 file changed, 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 29e3f1e184..a34534d81c 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -339,7 +339,6 @@ function parse()
 if string.match( line, "https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: stricter check for applying peek() long line workaround

2020-11-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Nov  3 00:46:46 
2020 +0100| [611ba98b65cce0ac0addb5e3e811d22601313323] | committer: Pierre Ynard

youtube.lua: stricter check for applying peek() long line workaround

Required with a new HTML code layout apparently getting phased in

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=611ba98b65cce0ac0addb5e3e811d22601313323
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 965e17142b..f45ea82edc 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -321,7 +321,7 @@ function parse()
 -- The next line is the major configuration line that we need.
 -- It is very long and readline() is likely to fail on it due
 -- to #24957, so we need this instead.
-if string.match( line, '' ) then
+if string.match( line, '^ *' ) then
 if not vlc.peek( 1 ) then break end
 local eol
 local pos = 0

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped characters issue in artist metadata

2020-11-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Nov  3 00:14:45 
2020 +0100| [083059cd884b7720d2a319edde58699328ac4408] | committer: Pierre Ynard

youtube.lua: fix escaped characters issue in artist metadata

The double encoding of \u0026 wasn't handled.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=083059cd884b7720d2a319edde58699328ac4408
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index d211e30951..29e3f1e184 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -371,7 +371,7 @@ function parse()
 artist = string.match(line, '\\"author\\":\\"(.-)\\"')
 if artist then
 -- FIXME: do this properly (see #24958)
-artist = string.gsub( artist, "\\/", "/" )
+artist = string.gsub( artist, '\\(["\\/])', '%1' )
 artist = string.gsub( artist, "\\u0026", "&" )
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: more robust meta tag metadata parsing

2020-11-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Nov  3 00:38:49 
2020 +0100| [f3d206499bb45df4aef2f05770c8535e4cd8a4de] | committer: Pierre Ynard

youtube.lua: more robust meta tag metadata parsing

Required for a new HTML code layout apparently getting phased in

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3d206499bb45df4aef2f05770c8535e4cd8a4de
---

 share/lua/playlist/youtube.lua | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index a34534d81c..965e17142b 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -335,10 +335,14 @@ function parse()
 line = vlc.read( eol or len )
 end
 
--- Try to find the video's title
-if string.match( line, "' )
+if meta then
+title = string.match( meta, ' content="(.-)"' )
+if title then
+title = vlc.strings.resolve_xml_special_chars( title )
+end
+end
 end
 
 if not description then
@@ -361,9 +365,14 @@ function parse()
 end
 end
 
-if string.match( line, "' )
+if meta then
+arturl = string.match( meta, ' content="(.-)"' )
+if arturl then
+arturl = vlc.strings.resolve_xml_special_chars( arturl 
)
+end
+end
 end
 
 if not artist then
@@ -453,7 +462,7 @@ function parse()
 arturl = get_arturl()
 end
 
-return { { path = path; name = name; description = description; artist 
= artist; arturl = arturl } }
+return { { path = path; name = title; description = description; 
artist = artist; arturl = arturl } }
 
 elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
 local line = vlc.read( 1024*1024 ) -- data is on one line only

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: support new HTML code layout

2020-11-02 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Nov  3 01:20:21 
2020 +0100| [671afe05eb6109117a57d7ec9871caf9cdace382] | committer: Pierre Ynard

youtube.lua: support new HTML code layout

This new layout is apparently getting phased in. As major differences,
line splitting is more erratic (with overall 10 times fewer lines for a
slightly bigger HTML document), and the main stream configuration isn't
subjected to double JSON string encoding anymore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=671afe05eb6109117a57d7ec9871caf9cdace382
---

 share/lua/playlist/youtube.lua | 29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f45ea82edc..7d5f31ef3d 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -351,14 +351,19 @@ function parse()
 -- unlikely to access it due to #24957
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
-if string.match( description, '^\\"' ) then
+-- FIXME: do this properly (see #24958)
+description = string.gsub( description, '\\(["\\/])', '%1' 
)
+else
+description = string.match( line, 
'"shortDescription":"(.-[^\\])"')
+end
+if description then
+if string.match( description, '^"' ) then
 description = ""
 end
 -- FIXME: do this properly (see #24958)
 -- This way of unescaping is technically wrong
 -- so as little as possible of it should be done
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
-description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\n', '\n' )
 description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
@@ -380,10 +385,22 @@ function parse()
 if artist then
 -- FIXME: do this properly (see #24958)
 artist = string.gsub( artist, '\\(["\\/])', '%1' )
+else
+artist = string.match( line, '"author":"(.-)"' )
+end
+if artist then
+-- FIXME: do this properly (see #24958)
 artist = string.gsub( artist, "\\u0026", "&" )
 end
 end
 
+if not nonce then
+if string.match( line, '

[vlc-commits] vocaroo.lua: remove obsolete {old,beta}.vocaroo.com support

2020-10-30 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Fri Oct 30 
12:55:12 2020 +0100| [dea74fff739f534b1f7c60e3e2aadd638e09682d] | committer: 
Pierre Ynard

vocaroo.lua: remove obsolete {old,beta}.vocaroo.com support

These domains are now instead directly redirected to the main
vocaroo.com domain and platform.

(cherry picked from commit eb4ee4f6821588ba4fcd6fdf1b83379e0f05daa0)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=dea74fff739f534b1f7c60e3e2aadd638e09682d
---

 share/lua/playlist/vocaroo.lua | 29 ++---
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index 3fc16a3acc..b9c112ef9a 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2016, 2019 the VideoLAN team
+ Copyright © 2016, 2019-2020 the VideoLAN team
 
  Authors: Pierre Ynard
 
@@ -20,34 +20,17 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
--- Set to "mp3", "ogg", "flac" or "wav"
-local fmt = "mp3"
-
 -- Probe function.
 function probe()
 return ( vlc.access == "http" or vlc.access == "https" )
-and ( string.match( vlc.path, "^old%.vocaroo%.com/i/" )
-or string.match( vlc.path, "^beta%.vocaroo%.com/." )
-or string.match( vlc.path, "^vocaroo%.com/." ) )
+and string.match( vlc.path, "^vocaroo%.com/." )
 end
 
 -- Parse function.
 function parse()
--- At the moment, a new/beta platform coexists with the old one:
--- classic URLs for old media are redirected to the old platform,
--- while new media seems accessible only through the new platform.
-
--- With either platform, HTML pages contain no metadata and are not
--- worth parsing.
-
-if string.match( vlc.path, "^old%.vocaroo%.com/" ) then -- Old platform
-local id = string.match( vlc.path, "vocaroo%.com/i/([^?]*)" )
-local path = 
vlc.access.."://old.vocaroo.com/media_command.php?media="..id.."=download_"..fmt
-return { { path = path } }
-else -- New/beta platform
-local id = string.match( vlc.path, "vocaroo%.com/([^?]+)" )
-local path = vlc.access.."://media.vocaroo.com/mp3/"..id
-return { { path = path } }
-end
+-- The HTML page contains no metadata and is not worth parsing
+local id = string.match( vlc.path, "^vocaroo%.com/([^?]+)" )
+local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+return { { path = path } }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vocaroo.lua: dispatch to correct CDN server

2020-10-30 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Fri Oct 30 
13:05:16 2020 +0100| [783af06b68234faa6ac7e9967a7ef20f2823c2e3] | committer: 
Pierre Ynard

vocaroo.lua: dispatch to correct CDN server

Vocaroo has started using different server locations for different
media, and the client has to dispatch to the correct one based on the
media ID.

(cherry picked from commit 9d4c4d2fb9524b7709d2fdc1a7decc108602a445)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=783af06b68234faa6ac7e9967a7ef20f2823c2e3
---

 share/lua/playlist/vocaroo.lua | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index b9c112ef9a..4b392e3fb4 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -30,7 +30,15 @@ end
 function parse()
 -- The HTML page contains no metadata and is not worth parsing
 local id = string.match( vlc.path, "^vocaroo%.com/([^?]+)" )
-local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+
+-- Dispatch media to correct CDN server
+-- function Ic(e){return function(e){if(e.length){if(11==e.length)return 
ControlConfig.mediaMp3FileUrl;if(12==e.length&&"1"==e[0])return 
ControlConfig.mediaMp3FileUrl1;if(10==e.length)return 
ControlConfig.mediaMp3FileUrl1}return ControlConfig.mediaMp3FileUrl}(e)+e}
+local cdn = ( string.len( id ) == 10 or
+  ( string.len( id ) == 12 and string.match( id, "^1" ) ) )
+and "//media1.vocaroo.com/mp3/"
+or "//media.vocaroo.com/mp3/"
+
+local path = vlc.access..":"..cdn..id
 return { { path = path } }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vocaroo.lua: remove obsolete {old,beta}.vocaroo.com support

2020-10-30 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Fri Oct 30 12:55:12 
2020 +0100| [eb4ee4f6821588ba4fcd6fdf1b83379e0f05daa0] | committer: Pierre Ynard

vocaroo.lua: remove obsolete {old,beta}.vocaroo.com support

These domains are now instead directly redirected to the main
vocaroo.com domain and platform.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb4ee4f6821588ba4fcd6fdf1b83379e0f05daa0
---

 share/lua/playlist/vocaroo.lua | 29 ++---
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index 3fc16a3acc..b9c112ef9a 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2016, 2019 the VideoLAN team
+ Copyright © 2016, 2019-2020 the VideoLAN team
 
  Authors: Pierre Ynard
 
@@ -20,34 +20,17 @@
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 --]]
 
--- Set to "mp3", "ogg", "flac" or "wav"
-local fmt = "mp3"
-
 -- Probe function.
 function probe()
 return ( vlc.access == "http" or vlc.access == "https" )
-and ( string.match( vlc.path, "^old%.vocaroo%.com/i/" )
-or string.match( vlc.path, "^beta%.vocaroo%.com/." )
-or string.match( vlc.path, "^vocaroo%.com/." ) )
+and string.match( vlc.path, "^vocaroo%.com/." )
 end
 
 -- Parse function.
 function parse()
--- At the moment, a new/beta platform coexists with the old one:
--- classic URLs for old media are redirected to the old platform,
--- while new media seems accessible only through the new platform.
-
--- With either platform, HTML pages contain no metadata and are not
--- worth parsing.
-
-if string.match( vlc.path, "^old%.vocaroo%.com/" ) then -- Old platform
-local id = string.match( vlc.path, "vocaroo%.com/i/([^?]*)" )
-local path = 
vlc.access.."://old.vocaroo.com/media_command.php?media="..id.."=download_"..fmt
-return { { path = path } }
-else -- New/beta platform
-local id = string.match( vlc.path, "vocaroo%.com/([^?]+)" )
-local path = vlc.access.."://media.vocaroo.com/mp3/"..id
-return { { path = path } }
-end
+-- The HTML page contains no metadata and is not worth parsing
+local id = string.match( vlc.path, "^vocaroo%.com/([^?]+)" )
+local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+return { { path = path } }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vocaroo.lua: dispatch to correct CDN server

2020-10-30 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Fri Oct 30 13:05:16 
2020 +0100| [9d4c4d2fb9524b7709d2fdc1a7decc108602a445] | committer: Pierre Ynard

vocaroo.lua: dispatch to correct CDN server

Vocaroo has started using different server locations for different
media, and the client has to dispatch to the correct one based on the
media ID.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d4c4d2fb9524b7709d2fdc1a7decc108602a445
---

 share/lua/playlist/vocaroo.lua | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index b9c112ef9a..4b392e3fb4 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -30,7 +30,15 @@ end
 function parse()
 -- The HTML page contains no metadata and is not worth parsing
 local id = string.match( vlc.path, "^vocaroo%.com/([^?]+)" )
-local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+
+-- Dispatch media to correct CDN server
+-- function Ic(e){return function(e){if(e.length){if(11==e.length)return 
ControlConfig.mediaMp3FileUrl;if(12==e.length&&"1"==e[0])return 
ControlConfig.mediaMp3FileUrl1;if(10==e.length)return 
ControlConfig.mediaMp3FileUrl1}return ControlConfig.mediaMp3FileUrl}(e)+e}
+local cdn = ( string.len( id ) == 10 or
+  ( string.len( id ) == 12 and string.match( id, "^1" ) ) )
+and "//media1.vocaroo.com/mp3/"
+or "//media.vocaroo.com/mp3/"
+
+local path = vlc.access..":"..cdn..id
 return { { path = path } }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: don't gratuitiously close iconv handle on unrelated error

2020-10-27 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Oct 27 
08:44:29 2020 +0100| [a66f141b17e792bcc298c83496749ec93265ff14] | committer: 
Pierre Ynard

stream_ReadLine: don't gratuitiously close iconv handle on unrelated error

The only errors after which this was called were memory allocation
errors, lines too long, or failing to open the handle itself, so
obviously there is no reason to want to close it there; it already gets
closed in the proper place when the stream is destroyed.

Even worse, it left the handle missing if vlc_stream_ReadLine() was
called again, and would result in text conversion constantly failing and
no output getting returned anymore, rendering the rest of the stream
unusable through this API and precluding any error recovery.

(cherry picked from commit 520e79aa6e9d68de56352f701cd6eae7141cf20f)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a66f141b17e792bcc298c83496749ec93265ff14
---

 src/input/stream.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index bc8cc221df..b94279b431 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -355,13 +355,6 @@ char *vlc_stream_ReadLine( stream_t *s )
 error:
 /* We failed to read any data, probably EOF */
 free( p_line );
-
-/* */
-if( priv->text.conv != (vlc_iconv_t)(-1) )
-{
-vlc_iconv_close( priv->text.conv );
-priv->text.conv = (vlc_iconv_t)(-1);
-}
 return NULL;
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: reset iconv state on conversion error

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:48:23 
2020 +0100| [4a0c695ab38344822d2b4902e101e6a077ea0acb] | committer: Pierre Ynard

stream_ReadLine: reset iconv state on conversion error

Tested against UTF-16 lone surrogates, for which it seems to make no
difference

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a0c695ab38344822d2b4902e101e6a077ea0acb
---

 src/input/stream.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/input/stream.c b/src/input/stream.c
index 65e1e241f3..90278ea59d 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -350,6 +350,9 @@ char *vlc_stream_ReadLine( stream_t *s )
 {
 msg_Err( s, "conversion error: %s", vlc_strerror_c( errno ) );
 msg_Dbg( s, "original: %d, in %zu, out %zu", i_line, i_in, 
i_out );
+/* Reset state */
+size_t r = vlc_iconv( priv->text.conv, NULL, NULL, NULL, NULL 
);
+VLC_UNUSED( r );
 }
 free( p_line );
 p_line = psz_new_line;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: don't discard unreturned data on error

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:59:57 
2020 +0100| [a06be413dd16f396f3838fb805a536bf4ffc5831] | committer: Pierre Ynard

stream_ReadLine: don't discard unreturned data on error

Upon error, data already consumed from the stream could be discarded
and permanently lost for the caller. This was just bad, and notably
precluded recovery from errors. Instead, data is now preserved within
peek buffers until a line can be successfully returned.

Peak memory usage remains almost identical, while the number of
allocations is halved for long lines. For UTF-16 streams, memory usage
is reduced as needless buffer allocations and copies are eliminated.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a06be413dd16f396f3838fb805a536bf4ffc5831
---

 src/input/stream.c | 102 ++---
 1 file changed, 50 insertions(+), 52 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 4a737b921e..45a724afab 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -187,9 +187,6 @@ stream_t *(vlc_stream_NewMRL)(vlc_object_t* parent, const 
char* mrl )
 char *vlc_stream_ReadLine( stream_t *s )
 {
 stream_priv_t *priv = (stream_priv_t *)s;
-char *p_line = NULL;
-size_t i_line = 0;
-bool b_data = false;
 
 /* Let's fail quickly if this is a readdir access */
 if( s->pf_read == NULL && s->pf_block == NULL )
@@ -243,14 +240,16 @@ char *vlc_stream_ReadLine( stream_t *s )
 }
 }
 
+size_t i_line = 0;
+const uint8_t *p_data;
+
 for( ;; )
 {
-const uint8_t *p_data, *psz_eol;
-ssize_t i_data;
-
-/* Probe new data */
-i_data = vlc_stream_Peek( s, _data, STREAM_PROBE_LINE );
-if( i_data <= 0 ) break; /* No more data */
+/* Probe more data */
+ssize_t i_data = vlc_stream_Peek( s, _data,
+  i_line + STREAM_PROBE_LINE );
+if( i_data <= 0 )
+return NULL;
 
 /* Deal here with lone-byte incomplete UTF-16 sequences at EOF
that we won't be able to process anyway */
@@ -262,24 +261,31 @@ char *vlc_stream_ReadLine( stream_t *s )
 assert( i_inc == i_data );
 if( i_inc > 0 )
 msg_Err( s, "discarding incomplete UTF-16 sequence at EOF: 
0x%02x", inc );
-break;
+return NULL;
 }
 
 /* Keep to text encoding character width boundary */
 if( i_data % priv->text.char_width )
 i_data = i_data - ( i_data % priv->text.char_width );
 
-/* Check if there is an EOL */
+if( (size_t) i_data == i_line )
+break; /* No more data */
+
+assert( (size_t) i_data > i_line );
+
+/* Resume search for an EOL where we left off */
+const uint8_t *p_cur = p_data + i_line, *psz_eol;
+
 /* FIXME:  behavior varies depending on where buffer
boundaries happen to fall; a  across the boundary
creates a bogus empty line. */
 if( priv->text.char_width == 1 )
 {
 /* UTF-8: 0A  */
-psz_eol = memchr( p_data, '\n', i_data );
+psz_eol = memchr( p_cur, '\n', i_data - i_line );
 if( psz_eol == NULL )
 /* UTF-8: 0D  */
-psz_eol = memchr( p_data, '\r', i_data );
+psz_eol = memchr( p_cur, '\r', i_data - i_line );
 }
 else
 {
@@ -289,7 +295,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 assert( priv->text.char_width == 2 );
 psz_eol = NULL;
 /* UTF-16: 000A  */
-for( const uint8_t *p = p_data; p <= p_last; p += 2 )
+for( const uint8_t *p = p_cur; p <= p_last; p += 2 )
 {
 if( U16_AT( p ) == eol )
 {
@@ -301,7 +307,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( psz_eol == NULL )
 {   /* UTF-16: 000D  */
 eol = priv->text.little_endian ? 0x0D00 : 0x000D;
-for( const uint8_t *p = p_data; p <= p_last; p += 2 )
+for( const uint8_t *p = p_cur; p <= p_last; p += 2 )
 {
 if( U16_AT( p ) == eol )
 {
@@ -312,59 +318,39 @@ char *vlc_stream_ReadLine( stream_t *s )
 }
 }
 
-if( psz_eol )
-i_data = (psz_eol - p_data) + priv->text.char_width;
-
-/* Read data (+1 for easy \0 append) */
-p_line = realloc_or_free( p_line,
-i_line + i_data + priv->text.char_width );
-if( !p_line )
-return NULL;
-i_data = vlc_stream_Read( s, _line[i_line], i_data );
-if( i_data < priv->text.char_width ) break; /* Hmmm */
-i_line += i_data;
-b_data = true;
-
 if( psz_eol )
 {
-i_line -=

[vlc-commits] stream_ReadLine: simplify flow and variable types

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:58:02 
2020 +0100| [6da1ad526443d2712a28c3882d2d041bc3f44bb8] | committer: Pierre Ynard

stream_ReadLine: simplify flow and variable types

No functional change

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6da1ad526443d2712a28c3882d2d041bc3f44bb8
---

 src/input/stream.c | 128 ++---
 1 file changed, 62 insertions(+), 66 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 8900fad2dd..4a737b921e 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -188,7 +188,8 @@ char *vlc_stream_ReadLine( stream_t *s )
 {
 stream_priv_t *priv = (stream_priv_t *)s;
 char *p_line = NULL;
-int i_line = 0, i_read = 0;
+size_t i_line = 0;
+bool b_data = false;
 
 /* Let's fail quickly if this is a readdir access */
 if( s->pf_read == NULL && s->pf_block == NULL )
@@ -244,9 +245,8 @@ char *vlc_stream_ReadLine( stream_t *s )
 
 for( ;; )
 {
-char *psz_eol;
-const uint8_t *p_data;
-int i_data;
+const uint8_t *p_data, *psz_eol;
+ssize_t i_data;
 
 /* Probe new data */
 i_data = vlc_stream_Peek( s, _data, STREAM_PROBE_LINE );
@@ -270,6 +270,9 @@ char *vlc_stream_ReadLine( stream_t *s )
 i_data = i_data - ( i_data % priv->text.char_width );
 
 /* Check if there is an EOL */
+/* FIXME:  behavior varies depending on where buffer
+   boundaries happen to fall; a  across the boundary
+   creates a bogus empty line. */
 if( priv->text.char_width == 1 )
 {
 /* UTF-8: 0A  */
@@ -290,7 +293,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 {
 if( U16_AT( p ) == eol )
 {
- psz_eol = (char *)p + 1;
+ psz_eol = p;
  break;
 }
 }
@@ -302,7 +305,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 {
 if( U16_AT( p ) == eol )
 {
-psz_eol = (char *)p + 1;
+psz_eol = p;
 break;
 }
 }
@@ -310,88 +313,81 @@ char *vlc_stream_ReadLine( stream_t *s )
 }
 
 if( psz_eol )
-{
-i_data = (psz_eol - (char *)p_data) + 1;
-p_line = realloc_or_free( p_line,
-i_line + i_data + priv->text.char_width ); /* add \0 */
-if( !p_line )
-goto error;
-i_data = vlc_stream_Read( s, _line[i_line], i_data );
-if( i_data <= 0 ) break; /* Hmmm */
-i_line += i_data - priv->text.char_width; /* skip \n */;
-i_read += i_data;
-
-/* We have our line */
-break;
-}
+i_data = (psz_eol - p_data) + priv->text.char_width;
 
 /* Read data (+1 for easy \0 append) */
 p_line = realloc_or_free( p_line,
 i_line + i_data + priv->text.char_width );
 if( !p_line )
-goto error;
+return NULL;
 i_data = vlc_stream_Read( s, _line[i_line], i_data );
-if( i_data <= 0 ) break; /* Hmmm */
+if( i_data < priv->text.char_width ) break; /* Hmmm */
 i_line += i_data;
-i_read += i_data;
+b_data = true;
+
+if( psz_eol )
+{
+i_line -= priv->text.char_width; /* skip \n */;
+/* We have our line */
+break;
+}
 
-if( i_read >= STREAM_LINE_MAX )
+if( i_line >= STREAM_LINE_MAX )
 {
 msg_Err( s, "line too long, exceeding %zu bytes",
  (size_t) STREAM_LINE_MAX );
-goto error;
+free( p_line );
+return NULL;
 }
 }
 
-if( i_read > 0 )
+if( !b_data ) /* We failed to read any data, probably EOF */
+return NULL;
+
+if( priv->text.char_width > 1 )
 {
-if( priv->text.char_width > 1 )
+size_t i_new_line = 0;
+size_t i_in = 0, i_out = 0;
+const char * p_in = NULL;
+char * p_out = NULL;
+char * psz_new_line = NULL;
+
+/* iconv */
+/* UTF-8 needs at most 150% of the buffer as many as UTF-16 */
+i_new_line = i_line * 3 / 2 + 1;
+psz_new_line = malloc( i_new_line );
+if( psz_new_line == NULL )
 {
-int i_new_line = 0;
-size_t i_in = 0, i_out = 0;
-const char * p_in = NULL;
-char * p_out = NULL;
-char * psz_new_line = NULL;
-
-/* iconv */
-/* UTF-8 needs at most 150% of the buffer as many as UTF-16 */
-i_new_line = i_line * 3 / 2 + 1;
-psz_new_line = malloc( i_new_line );
-

[vlc-commits] stream_ReadLine: log error when failing on line too long

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:57:08 
2020 +0100| [4a0582e475d5f0d3427f2014ae51f47d6994dfd3] | committer: Pierre Ynard

stream_ReadLine: log error when failing on line too long

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a0582e475d5f0d3427f2014ae51f47d6994dfd3
---

 src/input/stream.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index b39e5bbd44..8900fad2dd 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -336,7 +336,11 @@ char *vlc_stream_ReadLine( stream_t *s )
 i_read += i_data;
 
 if( i_read >= STREAM_LINE_MAX )
-goto error; /* line too long */
+{
+msg_Err( s, "line too long, exceeding %zu bytes",
+ (size_t) STREAM_LINE_MAX );
+goto error;
+}
 }
 
 if( i_read > 0 )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: move BOM detection outside and before reading loop

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:56:06 
2020 +0100| [5cfcbd7c18abfe46cbddb2e5a5c287c14674b395] | committer: Pierre Ynard

stream_ReadLine: move BOM detection outside and before reading loop

No functional change

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5cfcbd7c18abfe46cbddb2e5a5c287c14674b395
---

 src/input/stream.c | 45 ++---
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 9cba64697f..b39e5bbd44 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -194,32 +194,28 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( s->pf_read == NULL && s->pf_block == NULL )
 return NULL;
 
-for( ;; )
+/* BOM detection */
+if( vlc_stream_Tell( s ) == 0 )
 {
-char *psz_eol;
 const uint8_t *p_data;
-int i_data;
-int64_t i_pos;
+ssize_t i_data = vlc_stream_Peek( s, _data, 2 );
 
-/* Probe new data */
-i_data = vlc_stream_Peek( s, _data, STREAM_PROBE_LINE );
-if( i_data <= 0 ) break; /* No more data */
+if( i_data <= 0 )
+return NULL;
+
+if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
+{   /* seek back to beginning? reset */
+vlc_iconv_close( priv->text.conv );
+priv->text.conv = (vlc_iconv_t)-1;
+}
+priv->text.char_width = 1;
+priv->text.little_endian = false;
 
-/* BOM detection */
-i_pos = vlc_stream_Tell( s );
-if( i_pos == 0 && i_data >= 2 )
+if( i_data >= 2 )
 {
 const char *psz_encoding = NULL;
 bool little_endian = false;
 
-if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
-{   /* seek back to beginning? reset */
-vlc_iconv_close( priv->text.conv );
-priv->text.conv = (vlc_iconv_t)-1;
-}
-priv->text.char_width = 1;
-priv->text.little_endian = false;
-
 if( !memcmp( p_data, "\xFF\xFE", 2 ) )
 {
 psz_encoding = "UTF-16LE";
@@ -238,12 +234,23 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( unlikely(priv->text.conv == (vlc_iconv_t)-1) )
 {
 msg_Err( s, "iconv_open failed" );
-goto error;
+return NULL;
 }
 priv->text.char_width = 2;
 priv->text.little_endian = little_endian;
 }
 }
+}
+
+for( ;; )
+{
+char *psz_eol;
+const uint8_t *p_data;
+int i_data;
+
+/* Probe new data */
+i_data = vlc_stream_Peek( s, _data, STREAM_PROBE_LINE );
+if( i_data <= 0 ) break; /* No more data */
 
 /* Deal here with lone-byte incomplete UTF-16 sequences at EOF
that we won't be able to process anyway */

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: don't gratuitiously close iconv handle on unrelated error

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:44:29 
2020 +0100| [520e79aa6e9d68de56352f701cd6eae7141cf20f] | committer: Pierre Ynard

stream_ReadLine: don't gratuitiously close iconv handle on unrelated error

The only errors after which this was called were memory allocation
errors, lines too long, or failing to open the handle itself, so
obviously there is no reason to want to close it there; it already gets
closed in the proper place when the stream is destroyed.

Even worse, it left the handle missing if vlc_stream_ReadLine() was
called again, and would result in text conversion constantly failing and
no output getting returned anymore, rendering the rest of the stream
unusable through this API and precluding any error recovery.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=520e79aa6e9d68de56352f701cd6eae7141cf20f
---

 src/input/stream.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 90651de058..65e1e241f3 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -370,13 +370,6 @@ char *vlc_stream_ReadLine( stream_t *s )
 error:
 /* We failed to read any data, probably EOF */
 free( p_line );
-
-/* */
-if( priv->text.conv != (vlc_iconv_t)(-1) )
-{
-vlc_iconv_close( priv->text.conv );
-priv->text.conv = (vlc_iconv_t)(-1);
-}
 return NULL;
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: properly discard incomplete UTF-16 sequences at EOF

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 08:54:24 
2020 +0100| [65f6b1b719fffcdc345cf45d8bce63675cccf3a4] | committer: Pierre Ynard

stream_ReadLine: properly discard incomplete UTF-16 sequences at EOF

Lone-byte incomplete UTF-16 sequences before EOF, in some cases such as
a final line consisting only of it, would never get actually consumed
from the stream, preventing it from ever properly reaching EOF.

This also avoids flooding the logs with one warning per stream line
towards the end of the stream, and then printing an unspecific
conversion error: those are replaced by one clear and explicit error
message.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=65f6b1b719fffcdc345cf45d8bce63675cccf3a4
---

 src/input/stream.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 90278ea59d..9cba64697f 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -245,15 +245,22 @@ char *vlc_stream_ReadLine( stream_t *s )
 }
 }
 
-if( i_data % priv->text.char_width )
+/* Deal here with lone-byte incomplete UTF-16 sequences at EOF
+   that we won't be able to process anyway */
+if( i_data < priv->text.char_width )
 {
-/* keep i_char_width boundary */
-i_data = i_data - ( i_data % priv->text.char_width );
-msg_Warn( s, "the read is not i_char_width compatible");
+assert( priv->text.char_width == 2 );
+uint8_t inc;
+ssize_t i_inc = vlc_stream_Read( s, , priv->text.char_width );
+assert( i_inc == i_data );
+if( i_inc > 0 )
+msg_Err( s, "discarding incomplete UTF-16 sequence at EOF: 
0x%02x", inc );
+break;
 }
 
-if( i_data == 0 )
-break;
+/* Keep to text encoding character width boundary */
+if( i_data % priv->text.char_width )
+i_data = i_data - ( i_data % priv->text.char_width );
 
 /* Check if there is an EOL */
 if( priv->text.char_width == 1 )
@@ -313,10 +320,10 @@ char *vlc_stream_ReadLine( stream_t *s )
 
 /* Read data (+1 for easy \0 append) */
 p_line = realloc_or_free( p_line,
-  i_line + STREAM_PROBE_LINE + priv->text.char_width );
+i_line + i_data + priv->text.char_width );
 if( !p_line )
 goto error;
-i_data = vlc_stream_Read( s, _line[i_line], STREAM_PROBE_LINE );
+i_data = vlc_stream_Read( s, _line[i_line], i_data );
 if( i_data <= 0 ) break; /* Hmmm */
 i_line += i_data;
 i_read += i_data;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: probe data exponentially instead of linearly

2020-10-27 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Oct 27 09:01:25 
2020 +0100| [aa4996021d00ee7fc5ce1516316511ee96005966] | committer: Pierre Ynard

stream_ReadLine: probe data exponentially instead of linearly

This reduces the number of buffer reallocations performed for long
lines, turning the function's complexity from quadratic to linear. The
line length limit remains unchanged.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa4996021d00ee7fc5ce1516316511ee96005966
---

 src/input/stream.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 45a724afab..77c8cf0e4c 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -245,9 +245,11 @@ char *vlc_stream_ReadLine( stream_t *s )
 
 for( ;; )
 {
+size_t i_peek = i_line == 0 ? STREAM_PROBE_LINE
+: __MIN( i_line * 2, STREAM_LINE_MAX );
+
 /* Probe more data */
-ssize_t i_data = vlc_stream_Peek( s, _data,
-  i_line + STREAM_PROBE_LINE );
+ssize_t i_data = vlc_stream_Peek( s, _data, i_peek );
 if( i_data <= 0 )
 return NULL;
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: new signature descrambling javascript URL parameter name

2020-10-26 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Mon Oct 26 
08:09:26 2020 +0100| [bccc58cf348cdc0f9d37973b8856ceade8f79eb8] | committer: 
Pierre Ynard

youtube.lua: new signature descrambling javascript URL parameter name

Apparently the old parameter has been replaced by a new one, and is now
getting phased out. The signature descrambling javascript URL is still
available in several other places in the HTML page either way.

Fixes #25223

(cherry picked from commit 43a5da94af1cdca9bf5ac9600508720550760668)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=bccc58cf348cdc0f9d37973b8856ceade8f79eb8
---

 share/lua/playlist/youtube.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 32b6972370..d211e30951 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -380,7 +380,8 @@ function parse()
 -- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
 if string.match( line, "ytplayer%.config" ) then
 
-local js_url = string.match( line, "\"js\": *\"(.-)\"" )
+local js_url = string.match( line, '"jsUrl":"(.-)"' )
+or string.match( line, "\"js\": *\"(.-)\"" )
 if js_url then
 js_url = string.gsub( js_url, "\\/", "/" )
 -- Resolve URL

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: new signature descrambling javascript URL parameter name

2020-10-26 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Oct 26 08:09:26 
2020 +0100| [43a5da94af1cdca9bf5ac9600508720550760668] | committer: Pierre Ynard

youtube.lua: new signature descrambling javascript URL parameter name

Apparently the old parameter has been replaced by a new one, and is now
getting phased out. The signature descrambling javascript URL is still
available in several other places in the HTML page either way.

Fixes #25223

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43a5da94af1cdca9bf5ac9600508720550760668
---

 share/lua/playlist/youtube.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 32b6972370..d211e30951 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -380,7 +380,8 @@ function parse()
 -- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG", "playerConfig" ...
 if string.match( line, "ytplayer%.config" ) then
 
-local js_url = string.match( line, "\"js\": *\"(.-)\"" )
+local js_url = string.match( line, '"jsUrl":"(.-)"' )
+or string.match( line, "\"js\": *\"(.-)\"" )
 if js_url then
 js_url = string.gsub( js_url, "\\/", "/" )
 -- Resolve URL

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: don't set inconsistent encoding parameters on error

2020-10-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Oct  3 
12:02:38 2020 +0200| [e10e7d92403d5fbd09a268aff5c89a1da340f58e] | committer: 
Pierre Ynard

stream_ReadLine: don't set inconsistent encoding parameters on error

(cherry picked from commit f21515fc1851d50900433ccd6998338ea35f5e2d)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e10e7d92403d5fbd09a268aff5c89a1da340f58e
---

 src/input/stream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index a191a1de40..929666fc69 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -195,6 +195,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( i_pos == 0 && i_data >= 2 )
 {
 const char *psz_encoding = NULL;
+bool little_endian = false;
 
 if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
 {   /* seek back to beginning? reset */
@@ -205,7 +206,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( !memcmp( p_data, "\xFF\xFE", 2 ) )
 {
 psz_encoding = "UTF-16LE";
-priv->text.little_endian = true;
+little_endian = true;
 }
 else if( !memcmp( p_data, "\xFE\xFF", 2 ) )
 {
@@ -223,6 +224,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 goto error;
 }
 priv->text.char_width = 2;
+priv->text.little_endian = little_endian;
 }
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vlm: print notice about upcoming VoD removal

2020-10-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Oct  3 
12:10:44 2020 +0200| [e10c226d8fa1d6da86e3b2de9cea863a39ec83e9] | committer: 
Pierre Ynard

vlm: print notice about upcoming VoD removal

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e10c226d8fa1d6da86e3b2de9cea863a39ec83e9
---

 src/input/vlm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/input/vlm.c b/src/input/vlm.c
index d001cdb86c..67b2fc1b34 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -754,6 +754,8 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t 
*p_cfg, int64_t *p_id
 /* Check if we need to load the VOD server */
 if( p_cfg->b_vod && !p_vlm->p_vod )
 {
+msg_Info( p_vlm, "VoD support will be removed from the VLM in the next 
major version of VLC." );
+
 p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ),
   "vod server" );
 p_vlm->p_vod->p_module = module_need( p_vlm->p_vod, "vod server", 
"$vod-server", false );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: properly reset text encoding parameters

2020-10-03 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Oct  3 
12:05:05 2020 +0200| [e94d1d752c328b2d7ea4a31212461529a0d9f615] | committer: 
Pierre Ynard

stream_ReadLine: properly reset text encoding parameters

Only the iconv handle was correctly reset, potentially leading again to
wrong or inconsistent parameters.

(cherry picked from commit 097f4e01696f55ae2497cfe32063e6741b7888f8)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e94d1d752c328b2d7ea4a31212461529a0d9f615
---

 src/input/stream.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/input/stream.c b/src/input/stream.c
index 929666fc69..bc8cc221df 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -202,6 +202,8 @@ char *vlc_stream_ReadLine( stream_t *s )
 vlc_iconv_close( priv->text.conv );
 priv->text.conv = (vlc_iconv_t)-1;
 }
+priv->text.char_width = 1;
+priv->text.little_endian = false;
 
 if( !memcmp( p_data, "\xFF\xFE", 2 ) )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: don't set inconsistent encoding parameters on error

2020-10-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Oct  3 12:02:38 
2020 +0200| [f21515fc1851d50900433ccd6998338ea35f5e2d] | committer: Pierre Ynard

stream_ReadLine: don't set inconsistent encoding parameters on error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f21515fc1851d50900433ccd6998338ea35f5e2d
---

 src/input/stream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index b26283e267..b7196894ea 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -210,6 +210,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( i_pos == 0 && i_data >= 2 )
 {
 const char *psz_encoding = NULL;
+bool little_endian = false;
 
 if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )
 {   /* seek back to beginning? reset */
@@ -220,7 +221,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 if( !memcmp( p_data, "\xFF\xFE", 2 ) )
 {
 psz_encoding = "UTF-16LE";
-priv->text.little_endian = true;
+little_endian = true;
 }
 else if( !memcmp( p_data, "\xFE\xFF", 2 ) )
 {
@@ -238,6 +239,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 goto error;
 }
 priv->text.char_width = 2;
+priv->text.little_endian = little_endian;
 }
 }
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: properly reset text encoding parameters

2020-10-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Oct  3 12:05:05 
2020 +0200| [097f4e01696f55ae2497cfe32063e6741b7888f8] | committer: Pierre Ynard

stream_ReadLine: properly reset text encoding parameters

Only the iconv handle was correctly reset, potentially leading again to
wrong or inconsistent parameters.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=097f4e01696f55ae2497cfe32063e6741b7888f8
---

 src/input/stream.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/input/stream.c b/src/input/stream.c
index b7196894ea..90651de058 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -217,6 +217,8 @@ char *vlc_stream_ReadLine( stream_t *s )
 vlc_iconv_close( priv->text.conv );
 priv->text.conv = (vlc_iconv_t)-1;
 }
+priv->text.char_width = 1;
+priv->text.little_endian = false;
 
 if( !memcmp( p_data, "\xFF\xFE", 2 ) )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vlm: print removal message when trying to create VoD media

2020-10-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Oct  3 11:58:23 
2020 +0200| [9056e8ad053efa8e650e14f370a75eacd0894d2a] | committer: Pierre Ynard

vlm: print removal message when trying to create VoD media

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9056e8ad053efa8e650e14f370a75eacd0894d2a
---

 src/input/vlmshell.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/input/vlmshell.c b/src/input/vlmshell.c
index cdb27bb9a9..54b3c209c8 100644
--- a/src/input/vlmshell.c
+++ b/src/input/vlmshell.c
@@ -799,6 +799,11 @@ static int ExecuteNew( vlm_t *p_vlm, const char *psz_name, 
const char *psz_type,
 vlm_media_Clean(  );
 return ExecuteMediaProperty( p_vlm, id, true, i_property, 
ppsz_property, pp_status );
 }
+else if( !strcmp( psz_type, "vod" ) )
+{
+*pp_status = vlm_MessageNew( "new", "VoD support was removed" );
+return VLC_EGENERIC;
+}
 else
 {
 *pp_status = vlm_MessageNew( "new", "%s: Choose between broadcast or 
schedule", psz_type );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vlm: print warning about schedule period usability

2020-10-03 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Oct  3 12:00:13 
2020 +0200| [de40362652611b9aeb80ed4589166f18c32ec600] | committer: Pierre Ynard

vlm: print warning about schedule period usability

Refs #25065

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de40362652611b9aeb80ed4589166f18c32ec600
---

 src/input/vlmshell.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/input/vlmshell.c b/src/input/vlmshell.c
index 54b3c209c8..2a55006e09 100644
--- a/src/input/vlmshell.c
+++ b/src/input/vlmshell.c
@@ -67,8 +67,8 @@ static char *Save( vlm_t * );
 static int Load( vlm_t *, char * );
 
 static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char *psz_name );
-static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char 
*psz_cmd,
-  const char *psz_value );
+static int vlm_ScheduleSetup( vlm_t *vlm, vlm_schedule_sys_t *schedule,
+  const char *psz_cmd, const char *psz_value );
 
 /* */
 static vlm_media_sys_t *vlm_MediaSearch( vlm_t *, const char *);
@@ -573,7 +573,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, 
vlm_schedule_sys_t *p_schedule
 if( !strcmp( ppsz_property[i], "enabled" ) ||
 !strcmp( ppsz_property[i], "disabled" ) )
 {
-if ( vlm_ScheduleSetup( p_schedule, ppsz_property[i], NULL ) )
+if ( vlm_ScheduleSetup( p_vlm, p_schedule, ppsz_property[i], NULL 
) )
 goto error;
 }
 else if( !strcmp( ppsz_property[i], "append" ) )
@@ -608,7 +608,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, 
vlm_schedule_sys_t *p_schedule
 }
 
 if( i_ret == VLC_SUCCESS )
-i_ret = vlm_ScheduleSetup( p_schedule, "append", psz_line );
+i_ret = vlm_ScheduleSetup( p_vlm, p_schedule, "append", 
psz_line );
 free( psz_line );
 
 if( i_ret )
@@ -624,7 +624,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, 
vlm_schedule_sys_t *p_schedule
 return ExecuteSyntaxError( psz_cmd, pp_status );
 }
 
-if( vlm_ScheduleSetup( p_schedule, ppsz_property[i], 
ppsz_property[i+1] ) )
+if( vlm_ScheduleSetup( p_vlm, p_schedule, ppsz_property[i], 
ppsz_property[i+1] ) )
 goto error;
 i++;
 }
@@ -1010,8 +1010,8 @@ static vlm_schedule_sys_t *vlm_ScheduleSearch( vlm_t 
*vlm, const char *psz_name
 }
 
 /* Ok, setup schedule command will be able to support only one (argument 
value) at a time  */
-static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char 
*psz_cmd,
-   const char *psz_value )
+static int vlm_ScheduleSetup( vlm_t *vlm, vlm_schedule_sys_t *schedule,
+  const char *psz_cmd, const char *psz_value )
 {
 if( !strcmp( psz_cmd, "enabled" ) )
 {
@@ -1164,6 +1164,12 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t 
*schedule, const char *psz_cmd,
 schedule->period = time.tm_year * 12 + time.tm_mon) * 30
 + time.tm_mday) * 24 + time.tm_hour) * 60 + time.tm_min) * 60
 + time.tm_sec;
+
+if( schedule->period >= 86400 || ( schedule->period > 0 &&
+86400 % schedule->period == 0 && 3600 % schedule->period != 0 ) )
+{
+msg_Warn( vlm, "Repeating VLM schedules neither adjust for DST nor 
properly count calendar months or years" );
+}
 }
 else if( !strcmp( psz_cmd, "repeat" ) )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: return title as name field from alternate API too

2020-09-19 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Sep 19 
08:18:13 2020 +0200| [3d41816e81b5ae33810bcff461cc19c2e5d45ed3] | committer: 
Pierre Ynard

youtube.lua: return title as name field from alternate API too

The name is used as fallback if the title is unset, but not conversely:
so setting the item title instead can have interesting side effects.
This was an odd one; like in most lua playlist scripts we really want to
set a name here.

Fixes #25124

(cherry picked from commit b42890f04ce0bd8e6cd383236ead8c82cb220323)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3d41816e81b5ae33810bcff461cc19c2e5d45ed3
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index b262d0ec64..32b6972370 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -535,7 +535,7 @@ function parse()
 arturl = vlc.strings.decode_uri( arturl )
 end
 
-return { { path = path, title = title, description = description, 
artist = artist, arturl = arturl } }
+return { { path = path, name = title, description = description, 
artist = artist, arturl = arturl } }
 
 else -- Other supported URL formats
 local video_id = string.match( vlc.path, "/[^/]+/([^?]*)" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: return title as name field from alternate API too

2020-09-19 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Sep 19 08:18:13 
2020 +0200| [b42890f04ce0bd8e6cd383236ead8c82cb220323] | committer: Pierre Ynard

youtube.lua: return title as name field from alternate API too

The name is used as fallback if the title is unset, but not conversely:
so setting the item title instead can have interesting side effects.
This was an odd one; like in most lua playlist scripts we really want to
set a name here.

Fixes #25124

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b42890f04ce0bd8e6cd383236ead8c82cb220323
---

 share/lua/playlist/youtube.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index b262d0ec64..32b6972370 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -535,7 +535,7 @@ function parse()
 arturl = vlc.strings.decode_uri( arturl )
 end
 
-return { { path = path, title = title, description = description, 
artist = artist, arturl = arturl } }
+return { { path = path, name = title, description = description, 
artist = artist, arturl = arturl } }
 
 else -- Other supported URL formats
 local video_id = string.match( vlc.path, "/[^/]+/([^?]*)" )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: fix end of line detection on big-endian UTF-16

2020-09-16 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Thu Sep 17 
06:09:06 2020 +0200| [40a42f6ad9d314d1027a9ec7351c60390be7bda9] | committer: 
Pierre Ynard

stream_ReadLine: fix end of line detection on big-endian UTF-16

Lines would be split on non-breaking spaces (0x00A0) instead of line
feeds (0x000A).

(cherry picked from commit 1a954775549e23a8e1c3051157d14436d4055679)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=40a42f6ad9d314d1027a9ec7351c60390be7bda9
---

 src/input/stream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 07f3f886f7..a191a1de40 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -248,7 +248,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 else
 {
 const uint8_t *p_last = p_data + i_data - priv->text.char_width;
-uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x00A0;
+uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x000A;
 
 assert( priv->text.char_width == 2 );
 psz_eol = NULL;
@@ -264,7 +264,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 
 if( psz_eol == NULL )
 {   /* UTF-16: 000D  */
-eol = priv->text.little_endian ? 0x0D00 : 0x00D0;
+eol = priv->text.little_endian ? 0x0D00 : 0x000D;
 for( const uint8_t *p = p_data; p <= p_last; p += 2 )
 {
 if( U16_AT( p ) == eol )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] stream_ReadLine: fix end of line detection on big-endian UTF-16

2020-09-16 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Thu Sep 17 06:09:06 
2020 +0200| [1a954775549e23a8e1c3051157d14436d4055679] | committer: Pierre Ynard

stream_ReadLine: fix end of line detection on big-endian UTF-16

Lines would be split on non-breaking spaces (0x00A0) instead of line
feeds (0x000A).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a954775549e23a8e1c3051157d14436d4055679
---

 src/input/stream.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 35c5a04870..b26283e267 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -263,7 +263,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 else
 {
 const uint8_t *p_last = p_data + i_data - priv->text.char_width;
-uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x00A0;
+uint16_t eol = priv->text.little_endian ? 0x0A00 : 0x000A;
 
 assert( priv->text.char_width == 2 );
 psz_eol = NULL;
@@ -279,7 +279,7 @@ char *vlc_stream_ReadLine( stream_t *s )
 
 if( psz_eol == NULL )
 {   /* UTF-16: 000D  */
-eol = priv->text.little_endian ? 0x0D00 : 0x00D0;
+eol = priv->text.little_endian ? 0x0D00 : 0x000D;
 for( const uint8_t *p = p_data; p <= p_last; p += 2 )
 {
 if( U16_AT( p ) == eol )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: work around VLC API limitations on very long lines

2020-09-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Sep  8 
06:30:54 2020 +0200| [19987b81fc65bc225bf242c499ba71f3ea4bb902] | committer: 
Pierre Ynard

youtube.lua: work around VLC API limitations on very long lines

The main configuration line is such a very long line, and has been
growing longer recently, frequently hitting the VLC core limit at
200 kB. This caused readline() to fail to return any data, and stop
parsing of the web page short, preventing playback as the stream URLs
were in that line that was never returned.

Instead this relies on peek() and sized read() calls to parse and
recover that line by hand. This effectively bumps things up to up to
1 MB of usable configuration data.

Fixes #24957

(cherry picked from commit e3378ac3a892728bb8775d1bd243b31fa721ba49)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=19987b81fc65bc225bf242c499ba71f3ea4bb902
---

 share/lua/playlist/youtube.lua | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 7b282bd6f1..b262d0ec64 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -314,11 +314,26 @@ function parse()
 -- fmt is the format of the video
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
-local lastline
 while true do
 local line = vlc.readline()
 if not line then break end
-lastline = line
+
+-- The next line is the major configuration line that we need.
+-- It is very long and readline() is likely to fail on it due
+-- to #24957, so we need this instead.
+if string.match( line, '' ) then
+if not vlc.peek( 1 ) then break end
+local eol
+local pos = 0
+local len = 32768
+repeat
+len = len * 2
+line = vlc.peek( len )
+eol = string.find( line, "\n", pos + 1 )
+pos = len
+until eol or len >= 1024 * 1024
+line = vlc.read( eol or len )
+end
 
 -- Try to find the video's title
 if string.match( line, "' ) then
-vlc.msg.err( "YouTube web page truncated at very long line, please 
check https://trac.videolan.org/vlc/ticket/24957 for updates to this issue" )
-end
-
 if not path then
 local video_id = get_url_param( vlc.path, "v" )
 if video_id then
@@ -445,9 +456,9 @@ function parse()
 return { { path = path; name = name; description = description; artist 
= artist; arturl = arturl } }
 
 elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
-local line = vlc.readline() -- data is on one line only
+local line = vlc.read( 1024*1024 ) -- data is on one line only
 if not line then
-vlc.msg.err( "YouTube API output missing: probably rejected as 
very long line, please check https://trac.videolan.org/vlc/ticket/24957 for 
updates to this issue" )
+vlc.msg.err( "YouTube API output missing" )
 return { }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: work around VLC API limitations on very long lines

2020-09-07 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Tue Sep  8 06:30:54 
2020 +0200| [e3378ac3a892728bb8775d1bd243b31fa721ba49] | committer: Pierre Ynard

youtube.lua: work around VLC API limitations on very long lines

The main configuration line is such a very long line, and has been
growing longer recently, frequently hitting the VLC core limit at
200 kB. This caused readline() to fail to return any data, and stop
parsing of the web page short, preventing playback as the stream URLs
were in that line that was never returned.

Instead this relies on peek() and sized read() calls to parse and
recover that line by hand. This effectively bumps things up to up to
1 MB of usable configuration data.

Fixes #24957

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3378ac3a892728bb8775d1bd243b31fa721ba49
---

 share/lua/playlist/youtube.lua | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 7b282bd6f1..b262d0ec64 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -314,11 +314,26 @@ function parse()
 -- fmt is the format of the video
 -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
 fmt = get_url_param( vlc.path, "fmt" )
-local lastline
 while true do
 local line = vlc.readline()
 if not line then break end
-lastline = line
+
+-- The next line is the major configuration line that we need.
+-- It is very long and readline() is likely to fail on it due
+-- to #24957, so we need this instead.
+if string.match( line, '' ) then
+if not vlc.peek( 1 ) then break end
+local eol
+local pos = 0
+local len = 32768
+repeat
+len = len * 2
+line = vlc.peek( len )
+eol = string.find( line, "\n", pos + 1 )
+pos = len
+until eol or len >= 1024 * 1024
+line = vlc.read( eol or len )
+end
 
 -- Try to find the video's title
 if string.match( line, "' ) then
-vlc.msg.err( "YouTube web page truncated at very long line, please 
check https://trac.videolan.org/vlc/ticket/24957 for updates to this issue" )
-end
-
 if not path then
 local video_id = get_url_param( vlc.path, "v" )
 if video_id then
@@ -445,9 +456,9 @@ function parse()
 return { { path = path; name = name; description = description; artist 
= artist; arturl = arturl } }
 
 elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
-local line = vlc.readline() -- data is on one line only
+local line = vlc.read( 1024*1024 ) -- data is on one line only
 if not line then
-vlc.msg.err( "YouTube API output missing: probably rejected as 
very long line, please check https://trac.videolan.org/vlc/ticket/24957 for 
updates to this issue" )
+vlc.msg.err( "YouTube API output missing" )
 return { }
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix parsing of empty description field

2020-09-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Mon Sep  7 
20:07:02 2020 +0200| [66c84ec7b825e67c821e437faf74a5d0a63aef11] | committer: 
Pierre Ynard

youtube.lua: fix parsing of empty description field

(cherry picked from commit 9ddd1b30f16431ce1f8f73eeec018d25a0221050)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=66c84ec7b825e67c821e437faf74a5d0a63aef11
---

 share/lua/playlist/youtube.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index e698974513..7b282bd6f1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -333,6 +333,9 @@ function parse()
 -- unlikely to access it due to #24957
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
+if string.match( description, '^\\"' ) then
+description = ""
+end
 -- FIXME: do this properly (see #24958)
 -- This way of unescaping is technically wrong
 -- so as little as possible of it should be done

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] lua/http: disable if password is unset

2020-09-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Mon Sep  7 
19:42:34 2020 +0200| [234bd4ed81eda9dc49672b770066fcff6148d10f] | committer: 
Pierre Ynard

lua/http: disable if password is unset

There is currently a feature doing this in the lua bindings, but it is
problematic for several reasons: it doesn't reject insecure requests,
but only masks their output, while actually still going ahead and
silently honoring them; the web interface still recurses through its
directory and registers all endpoints, and exposes their existence by
answering differently depending on the request URL; the lua bindings are
the wrong level to do this, as it precludes any other lua user of the
HTTPd than the web interface; and it hijacks the response body to inject
its own regardless of the declared content type, potentially resulting
in getting it wrongly displayed.

Instead, this simply loads a single notice handler, and prints helpful
messages, directly from within the web interface module.

(cherry picked from commit ab87d0a17baa980f132221f5c99a64b74c243c57)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=234bd4ed81eda9dc49672b770066fcff6148d10f
---

 share/lua/intf/http.lua | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index 391a333001..84ab2c58ff 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -105,6 +105,15 @@ function process(filename)
 end
 
 
+-- TODO: print localized error message
+-- For now this relies on lua bindings inappropriately doing so
+local function callback_nopassword()
+return [[Status: 403
+Content-Length: 0
+
+]]
+end
+
 function callback_error(path,url,msg)
 local url = url or "page unknown"
 return  [[http://www.w3.org/1999/xhtml;>
@@ -327,5 +336,11 @@ end
 password = vlc.var.inherit(nil,"http-password")
 
 h = vlc.httpd()
-load_dir( http_dir )
-a = h:handler("/art",nil,password,callback_art,nil)
+if password == "" then
+vlc.msg.err("Password unset, insecure web interface disabled")
+vlc.msg.info("Set --http-password on the command line if you want to 
enable the web interface.")
+p = h:handler("/",nil,nil,callback_nopassword,nil)
+else
+load_dir( http_dir )
+a = h:handler("/art",nil,password,callback_art,nil)
+end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped '\r' in description metadata

2020-09-07 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Mon Sep  7 
20:05:27 2020 +0200| [c552d4d64372d7fa5d0661748f4d1038345fe251] | committer: 
Pierre Ynard

youtube.lua: fix escaped '\r' in description metadata

The description field sometimes somehow even contains mixed LF and CRLF.

(cherry picked from commit ff152eafc353c5c974b98f5e2ff9f6947a67529f)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c552d4d64372d7fa5d0661748f4d1038345fe251
---

 share/lua/playlist/youtube.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 2b560ac9e1..e698974513 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -334,9 +334,12 @@ function parse()
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
 -- FIXME: do this properly (see #24958)
+-- This way of unescaping is technically wrong
+-- so as little as possible of it should be done
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\n', '\n' )
+description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix parsing of empty description field

2020-09-07 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Sep  7 20:07:02 
2020 +0200| [9ddd1b30f16431ce1f8f73eeec018d25a0221050] | committer: Pierre Ynard

youtube.lua: fix parsing of empty description field

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ddd1b30f16431ce1f8f73eeec018d25a0221050
---

 share/lua/playlist/youtube.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index e698974513..7b282bd6f1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -333,6 +333,9 @@ function parse()
 -- unlikely to access it due to #24957
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
+if string.match( description, '^\\"' ) then
+description = ""
+end
 -- FIXME: do this properly (see #24958)
 -- This way of unescaping is technically wrong
 -- so as little as possible of it should be done

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] youtube.lua: fix escaped '\r' in description metadata

2020-09-07 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Sep  7 20:05:27 
2020 +0200| [ff152eafc353c5c974b98f5e2ff9f6947a67529f] | committer: Pierre Ynard

youtube.lua: fix escaped '\r' in description metadata

The description field sometimes somehow even contains mixed LF and CRLF.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff152eafc353c5c974b98f5e2ff9f6947a67529f
---

 share/lua/playlist/youtube.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 2b560ac9e1..e698974513 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -334,9 +334,12 @@ function parse()
 description = string.match( line, 
'\\"shortDescription\\":\\"(.-[^\\])\\"')
 if description then
 -- FIXME: do this properly (see #24958)
+-- This way of unescaping is technically wrong
+-- so as little as possible of it should be done
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\(["\\/])', '%1' 
)
 description = string.gsub( description, '\\n', '\n' )
+description = string.gsub( description, '\\r', '\r' )
 description = string.gsub( description, "\\u0026", "&" )
 end
 end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] lua/http: disable if password is unset

2020-09-07 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Sep  7 19:42:34 
2020 +0200| [ab87d0a17baa980f132221f5c99a64b74c243c57] | committer: Pierre Ynard

lua/http: disable if password is unset

There is currently a feature doing this in the lua bindings, but it is
problematic for several reasons: it doesn't reject insecure requests,
but only masks their output, while actually still going ahead and
silently honoring them; the web interface still recurses through its
directory and registers all endpoints, and exposes their existence by
answering differently depending on the request URL; the lua bindings are
the wrong level to do this, as it precludes any other lua user of the
HTTPd than the web interface; and it hijacks the response body to inject
its own regardless of the declared content type, potentially resulting
in getting it wrongly displayed.

Instead, this simply loads a single notice handler, and prints helpful
messages, directly from within the web interface module.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab87d0a17baa980f132221f5c99a64b74c243c57
---

 share/lua/intf/http.lua | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index ed0c3583eb..29fa9dd6e4 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -105,6 +105,15 @@ function process(filename)
 end
 
 
+-- TODO: print localized error message
+-- For now this relies on lua bindings inappropriately doing so
+local function callback_nopassword()
+return [[Status: 403
+Content-Length: 0
+
+]]
+end
+
 function callback_error(path,url,msg)
 local url = url or "page unknown"
 return  [[http://www.w3.org/1999/xhtml;>
@@ -328,5 +337,11 @@ end
 password = vlc.var.inherit(nil,"http-password")
 
 h = vlc.httpd()
-load_dir( http_dir )
-a = h:handler("/art",nil,password,callback_art,nil)
+if password == "" then
+vlc.msg.err("Password unset, insecure web interface disabled")
+vlc.msg.info("Set --http-password on the command line if you want to 
enable the web interface.")
+p = h:handler("/",nil,nil,callback_nopassword,nil)
+else
+load_dir( http_dir )
+a = h:handler("/art",nil,password,callback_art,nil)
+end

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] lua httpd: use TLS if --http-cert is set

2020-09-04 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Sat Sep  5 06:31:55 
2020 +0200| [b33c2c3afe4535242f1cff4e555fa1131b50eb7e] | committer: Pierre Ynard

lua httpd: use TLS if --http-cert is set

This follows the same approach as oldhttp, and allows configuring the
web interface to use HTTPS.

Refs #19807

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b33c2c3afe4535242f1cff4e555fa1131b50eb7e
---

 modules/lua/libs/httpd.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
index 986f1e5564..9733df9a2b 100644
--- a/modules/lua/libs/httpd.c
+++ b/modules/lua/libs/httpd.c
@@ -81,7 +81,10 @@ static const char no_password_title[] = N_("VLC media 
player");
 static int vlclua_httpd_tls_host_new( lua_State *L )
 {
 vlc_object_t *p_this = vlclua_get_this( L );
-httpd_host_t *p_host = vlc_http_HostNew( p_this );
+char *psz_cert = var_InheritString( p_this, "http-cert" );
+httpd_host_t *p_host = psz_cert == NULL ? vlc_http_HostNew( p_this )
+: vlc_https_HostNew( p_this );
+free( psz_cert );
 if( !p_host )
 return luaL_error( L, "Failed to create HTTP host" );
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] lua/http: avoid diverging legacy code to print status.xml

2020-08-31 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Aug 31 20:44:40 
2020 +0200| [8c5ae08331c85d827c50d7733fbae43c5690f5ed] | committer: Pierre Ynard

lua/http: avoid diverging legacy code to print status.xml

The constraint with ES information was that it produced invalid XML,
but now that this is fixed, there is no reason to exclude standard data
from the output. In particular this adds support for chapter and title
information, and any future new field, while actually reducing the
amount of specific code.

Fixes #10443

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c5ae08331c85d827c50d7733fbae43c5690f5ed
---

 share/lua/http/requests/status.xml | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/share/lua/http/requests/status.xml 
b/share/lua/http/requests/status.xml
index fec2d9d383..67b8ddf944 100644
--- a/share/lua/http/requests/status.xml
+++ b/share/lua/http/requests/status.xml
@@ -33,17 +33,25 @@ require "httprequests"
 
 httprequests.processcommands()
 
-local statusTable=httprequests.getstatus(false)
+local statusTable=httprequests.getstatus(true)
+
+--In the information section, an extra copy of some data is presented
+--in a non-standard way to keep compatibility.
+local information = statusTable.information
+statusTable.information = nil
 
 print('\n')
 httprequests.printTableAsXml(statusTable,0)
 
 local item = vlc.player.item()
 
---data in the information section is presented in a non-standard way to keep 
compatibility.
-
 ?>
 
+  
 
 
   
-  
-  "..httprequests.xmlString(v).."\n")
-  end
-end
-  ?>
-  
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] httprequests.lua: handle fields unsuitable for XML tag names

2020-08-31 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Aug 31 20:43:24 
2020 +0200| [3fadb90cb312af1f8904c052317bad90b0db47cb] | committer: Pierre Ynard

httprequests.lua: handle fields unsuitable for XML tag names

Table keys that would be invalid as XML tag names are instead passed
as the name attribute. This is a bit of a breaking change as it was
possible instead to abuse the key field to set arbitrary XML attributes
on the tag (whose syntactic validity then wasn't checked), or even to
inject extra XML code; however no in-tree user did that.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3fadb90cb312af1f8904c052317bad90b0db47cb
---

 share/lua/intf/modules/httprequests.lua | 21 -
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/share/lua/intf/modules/httprequests.lua 
b/share/lua/intf/modules/httprequests.lua
index bff81f3464..db648b2c38 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -246,10 +246,14 @@ local printXmlKeyValue = function (k,v,indent)
 print("\n")
 for i=1,indent do print(" ") end
 if (k) then
-if not tonumber(k) then
-print("<"..k..">")
+--XML element naming rules: this is a bit more conservative
+--than it strictly needs to be
+if not string.match(k, "^[a-zA-Z_][a-zA-Z0-9_%-%.]*$")
+or string.match(k, "^[xX][mM][lL]") then
+print('')
+k = "element"
 else
-print("")
+print("<"..k..">")
 end
 end
 
@@ -260,16 +264,7 @@ local printXmlKeyValue = function (k,v,indent)
 end
 
 if (k) then
-xs=xmlString(k)
-space_loc=string.find(xs," ")
-if space_loc == nil then
-xs=string.sub(xs,1,space_loc)
-end
-if not tonumber(xs) then
-print("")
-else
-print("")
-end
+print("")
 end
 end
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Update NEWS

2020-08-24 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Tue Aug 25 
00:14:06 2020 +0200| [d54c8ededa054f43b39b4ef36441831b89d67c68] | committer: 
Pierre Ynard

Update NEWS

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d54c8ededa054f43b39b4ef36441831b89d67c68
---

 NEWS | 4 
 1 file changed, 4 insertions(+)

diff --git a/NEWS b/NEWS
index 827026b049..218eb9dc7e 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ macOS:
  * Fixed displaying EQ bands in the UI depending on which frequency
presets are set for the EQ in advanced preferences
 
+Misc:
+ * Several fixes in the web interface, including privacy and security
+   improvements
+
 Changes between 3.0.11 and 3.0.11.1:
 --
 

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] httprequests.lua: fix getbrowsetable() when no parameter is passed

2020-08-24 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Mon Aug 24 
12:41:07 2020 +0200| [5212f56ecd07aa51637c5a3704e7e4d7be5a3a49] | committer: 
Pierre Ynard

httprequests.lua: fix getbrowsetable() when no parameter is passed

(cherry picked from commit 5a4a4c7feba6924db2bed766f8dc18d50a4752a3)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5212f56ecd07aa51637c5a3704e7e4d7be5a3a49
---

 share/lua/intf/modules/httprequests.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/intf/modules/httprequests.lua 
b/share/lua/intf/modules/httprequests.lua
index 77fde2d866..e5002251e7 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -383,7 +383,7 @@ getbrowsetable = function ()
 end
 dir = vlc.strings.make_path(common.realpath(uri))
 end
-else
+elseif _GET["dir"] then
 dir = _GET["dir"]
 
 -- "" dir means listing all drive letters e.g. "A:\", "C:\"...

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] httprequests.lua: fix getbrowsetable() when no parameter is passed

2020-08-24 Thread Pierre Ynard
vlc | branch: master | Pierre Ynard  | Mon Aug 24 12:41:07 
2020 +0200| [5a4a4c7feba6924db2bed766f8dc18d50a4752a3] | committer: Pierre Ynard

httprequests.lua: fix getbrowsetable() when no parameter is passed

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5a4a4c7feba6924db2bed766f8dc18d50a4752a3
---

 share/lua/intf/modules/httprequests.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/intf/modules/httprequests.lua 
b/share/lua/intf/modules/httprequests.lua
index cdbc5a94b1..bff81f3464 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -362,7 +362,7 @@ getbrowsetable = function ()
 end
 dir = vlc.strings.make_path(common.realpath(uri))
 end
-else
+elseif _GET["dir"] then
 dir = _GET["dir"]
 
 -- "" dir means listing all drive letters e.g. "A:\", "C:\"...

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] lua/http: properly convert art URL to path in art handler

2020-08-22 Thread Pierre Ynard
vlc/vlc-3.0 | branch: master | Pierre Ynard  | Sat Aug 22 
14:42:19 2020 +0200| [f309e89d111ea3d99f9df619bae27a805f9d8a48] | committer: 
Pierre Ynard

lua/http: properly convert art URL to path in art handler

Processing URLs is not a mangling game

(cherry picked from commit 9ed406943232aa288ed154692a479f66aedb37db)
Signed-off-by: Pierre Ynard 

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f309e89d111ea3d99f9df619bae27a805f9d8a48
---

 share/lua/intf/http.lua | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index ba78b99d3a..391a333001 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -160,11 +160,7 @@ function callback_art(data, request, args)
 item = vlc.playlist.get(num).item
 end
 local metas = item:metas()
-local filename = 
vlc.strings.decode_uri(string.gsub(metas["artwork_url"],"file://",""))
-local windowsdrive = string.match(filename, "^/%a:/.+$")  --match 
windows drive letter
-if windowsdrive then
-filename = string.sub(filename, 2)  --remove starting forward 
slash before the drive letter
-end
+local filename = vlc.strings.make_path(metas["artwork_url"])
 local size = vlc.net.stat(filename).size
 local ext = string.match(filename,"%.([^%.]-)$")
 local raw = io.open(filename, 'rb'):read("*a")

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


  1   2   3   4   5   6   7   >