diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/audio.c | 2 | ||||
-rw-r--r-- | player/command.c | 2 | ||||
-rw-r--r-- | player/core.h | 1 | ||||
-rw-r--r-- | player/loadfile.c | 19 | ||||
-rw-r--r-- | player/lua/osc.lua | 2 | ||||
-rw-r--r-- | player/lua/stats.lua | 4 | ||||
-rw-r--r-- | player/lua/ytdl_hook.lua | 34 |
7 files changed, 45 insertions, 19 deletions
diff --git a/player/audio.c b/player/audio.c index 28e7867ca1..62bc5405f1 100644 --- a/player/audio.c +++ b/player/audio.c @@ -403,7 +403,7 @@ static void reinit_audio_filters_and_output(struct MPContext *mpctx) mp_audio_buffer_reinit_fmt(ao_c->ao_buffer, ao_format, &ao_channels, ao_rate); - char tmp[80]; + char tmp[192]; MP_INFO(mpctx, "AO: [%s] %s\n", ao_get_name(mpctx->ao), audio_config_to_str_buf(tmp, sizeof(tmp), ao_rate, ao_format, ao_channels)); diff --git a/player/command.c b/player/command.c index ab9a09fcac..30629eae54 100644 --- a/player/command.c +++ b/player/command.c @@ -2133,6 +2133,8 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) {"default", SUB_PROP_FLAG(track->default_track)}, {"forced", SUB_PROP_FLAG(track->forced_track)}, {"dependent", SUB_PROP_FLAG(track->dependent_track)}, + {"visual-impaired", SUB_PROP_FLAG(track->visual_impaired_track)}, + {"hearing-impaired", SUB_PROP_FLAG(track->hearing_impaired_track)}, {"external", SUB_PROP_FLAG(track->is_external)}, {"selected", SUB_PROP_FLAG(track->selected)}, {"external-filename", SUB_PROP_STR(track->external_filename), diff --git a/player/core.h b/player/core.h index 7fab8776d7..f0a66ffdff 100644 --- a/player/core.h +++ b/player/core.h @@ -135,6 +135,7 @@ struct track { char *title; bool default_track, forced_track, dependent_track; + bool visual_impaired_track, hearing_impaired_track; bool attached_picture; char *lang; diff --git a/player/loadfile.c b/player/loadfile.c index 2fb69eb635..9d37c2ca21 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -410,6 +410,9 @@ static struct track *add_stream_track(struct MPContext *mpctx, .title = stream->title, .default_track = stream->default_track, .forced_track = stream->forced_track, + .dependent_track = stream->dependent_track, + .visual_impaired_track = stream->visual_impaired_track, + .hearing_impaired_track = stream->hearing_impaired_track, .attached_picture = stream->attached_picture != NULL, .lang = stream->lang, .demuxer = demuxer, @@ -1495,21 +1498,21 @@ static void play_current_file(struct MPContext *mpctx) update_demuxer_properties(mpctx); + update_playback_speed(mpctx); + + reinit_video_chain(mpctx); + reinit_audio_chain(mpctx); + reinit_sub_all(mpctx); + if (mpctx->encode_lavc_ctx) { - if (mpctx->current_track[0][STREAM_VIDEO]) + if (mpctx->vo_chain) encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_VIDEO); - if (mpctx->current_track[0][STREAM_AUDIO]) + if (mpctx->ao_chain) encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_AUDIO); encode_lavc_set_metadata(mpctx->encode_lavc_ctx, mpctx->demuxer->metadata); } - update_playback_speed(mpctx); - - reinit_video_chain(mpctx); - reinit_audio_chain(mpctx); - reinit_sub_all(mpctx); - if (!mpctx->vo_chain && !mpctx->ao_chain && opts->stream_auto_sel) { MP_FATAL(mpctx, "No video or audio streams selected.\n"); mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY; diff --git a/player/lua/osc.lua b/player/lua/osc.lua index d79891b8c0..de492152b1 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1538,6 +1538,8 @@ function osc_init() end osc_param.playresx = osc_param.playresy * osc_param.display_aspect + -- stop seeking with the slider to prevent skipping files + state.active_element = nil diff --git a/player/lua/stats.lua b/player/lua/stats.lua index f18f44af53..95a036d5c4 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -424,12 +424,14 @@ end local function add_file(s) - append(s, "", {prefix=o.nl .. o.nl .. "File:", nl="", indent=""}) + append(s, "", {prefix="File:", nl="", indent=""}) append_property(s, "filename", {prefix_sep="", nl="", indent=""}) if not (mp.get_property_osd("filename") == mp.get_property_osd("media-title")) then append_property(s, "media-title", {prefix="Title:"}) end + append_property(s, "file-format", {prefix="Format/Protocol:"}) + local ch_index = mp.get_property_number("chapter") if ch_index and ch_index >= 0 then append_property(s, "chapter-list/" .. tostring(ch_index) .. "/title", {prefix="Chapter:"}) diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index cd9b61adda..9dd1dc34c9 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -314,8 +314,8 @@ local function add_single_video(json) if track.vcodec and track.vcodec ~= "none" then -- video track streamurl = edl_track or track.url - elseif track.acodec and track.acodec ~= "none" and track.vcodec == "none" then - -- audio track + elseif track.vcodec == "none" then + -- according to ytdl, if vcodec is None, it's audio mp.commandv("audio-add", edl_track or track.url, "auto", track.format_note or "") @@ -429,12 +429,7 @@ local function add_single_video(json) mp.set_property_native("file-local-options/stream-lavf-o", stream_opts) end -mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function () - local url = mp.get_property("stream-open-filename", "") - if not (url:find("ytdl://") == 1) and - not ((url:find("https?://") == 1) and not is_blacklisted(url)) then - return - end +function run_ytdl_hook(url) local start_time = os.clock() -- check for youtube-dl in mpv's config dir @@ -655,8 +650,29 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function () add_single_video(json) end msg.debug('script running time: '..os.clock()-start_time..' seconds') -end) +end +if (not o.try_ytdl_first) then + mp.add_hook("on_load", 10, function () + msg.verbose('ytdl:// hook') + local url = mp.get_property("stream-open-filename", "") + if not (url:find("ytdl://") == 1) then + msg.verbose('not a ytdl:// url') + return + end + run_ytdl_hook(url) + end) +end + +mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function() + msg.verbose('full hook') + local url = mp.get_property("stream-open-filename", "") + if not (url:find("ytdl://") == 1) and + not ((url:find("https?://") == 1) and not is_blacklisted(url)) then + return + end + run_ytdl_hook(url) +end) mp.add_hook("on_preloaded", 10, function () if next(chapter_list) ~= nil then |