1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00
mpv/player
wm4 1cb9e7efb8 stream, demux: redo origin policy thing
mpv has a very weak and very annoying policy that determines whether a
playlist should be used or not. For example, if you play a remote
playlist, you usually don't want it to be able to read local filesystem
entries. (Although for a media player the impact is small I guess.)

It's weak and annoying as in that it does not prevent certain cases
which could be interpreted as bad in some cases, such as allowing
playlists on the local filesystem to reference remote URLs. It probably
barely makes sense, but we just want to exclude some other "definitely
not a good idea" things, all while playlists generally just work, so
whatever.

The policy is:
- from the command line anything is played
- local playlists can reference anything except "unsafe" streams
  ("unsafe" means special stream inputs like libavfilter graphs)
- remote playlists can reference only remote URLs
- things like "memory://" and archives are "transparent" to this

This commit does... something. It replaces the weird stream flags with a
slightly clearer "origin" value, which is now consequently passed down
and used everywhere. It fixes some deviations from the described policy.

I wanted to force archives to reference only content within them, but
this would probably have been more complicated (or required different
abstractions), and I'm too lazy to figure it out, so archives are now
"transparent" (playlists within archives behave the same outside).

There may be a lot of bugs in this.

This is unfortunately a very noisy commit because:
- every stream open call now needs to pass the origin
- so does every demuxer open call (=> params param. gets mandatory)
- most stream were changed to provide the "origin" value
- the origin value needed to be passed along in a lot of places
- I was too lazy to split the commit

Fixes: #7274
2019-12-20 13:00:39 +01:00
..
javascript js: support shared script properties (match 7e4819e7) 2019-12-19 16:23:19 +02:00
lua osc: fix a comment 2019-12-20 00:53:42 +01:00
audio.c command: shuffle some crap around 2019-11-25 00:26:36 +01:00
client.c client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
client.h client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
command.c command: reduce OSC/stats log spam 2019-12-19 12:52:13 +01:00
command.h player: change m_config to use new option handling mechanisms 2019-11-29 12:49:15 +01:00
configfiles.c player: Optionally validate st_mtime when restoring playback state 2019-11-20 15:11:33 +01:00
core.h player: avoid underrun wakeup loop 2019-12-16 01:15:43 +01:00
external_files.c external_files: add .lrc subtitle extension 2019-09-02 01:25:43 +03:00
external_files.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
javascript.c js: don't pre-filter log level argument in mp.enable_messages() 2019-11-19 18:13:39 +02:00
loadfile.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
lua.c console.lua: add this script 2019-12-08 02:46:44 +01:00
main.c player: add comment to clarify FFmpeg ABI handling 2019-12-13 13:22:46 +01:00
misc.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
osd.c player: format low cache duration with more decimals 2019-10-11 19:18:43 +02:00
playloop.c client API: rewrite property observation (again) 2019-12-19 11:11:51 +01:00
screenshot.c screenshot, vo_image: use global swscale/zimg parameters 2019-10-31 15:44:09 +01:00
screenshot.h screenshot, vo_image: use global swscale/zimg parameters 2019-10-31 15:44:09 +01:00
scripting.c console.lua: add this script 2019-12-08 02:46:44 +01:00
sub.c player: ensure backward playback state is propagated on track switching 2019-09-19 20:37:05 +02:00
video.c player: avoid underrun wakeup loop 2019-12-16 01:15:43 +01:00