History

f_decoder_wrapper: allow changing --ad and --vd at runtime

Dudemanguy committed 1 year ago

Commit 0e03fdf1 parent 8d665ac3 files · +18 −1Browse files

Unified · Split

3 files
  1. filters/f_decoder_wrapper.c +2 −0
  2. options/m_option.h +3 −1
  3. player/command.c +13 −0
filters/f_decoder_wrapper.c+2−0
@@ -114,8 +114,10 @@ const struct m_sub_options dec_wrapper_conf = { · 113 unmodified lines
114114 {"correct-pts", OPT_BOOL(correct_pts)},
115115 {"container-fps-override", OPT_DOUBLE(fps_override), M_RANGE(0, DBL_MAX)},
116116 {"ad", OPT_STRING(audio_decoders),
117+ .flags = UPDATE_AD,
117118 .help = decoder_list_help},
118119 {"vd", OPT_STRING(video_decoders),
120+ .flags = UPDATE_VD,
119121 .help = decoder_list_help},
120122 {"audio-spdif", OPT_STRING(audio_spdif),
121123 .help = decoder_list_help},
options/m_option.h+3−1
@@ -444,7 +444,9 @@ char *format_file_size(int64_t size); · 443 unmodified lines
444444 #define UPDATE_VO (1 << 16) // reinit the VO
445445 #define UPDATE_CLIPBOARD (1 << 17) // reinit the clipboard
446446 #define UPDATE_DEMUXER (1 << 18) // invalidate --prefetch-playlist's data
447−#define UPDATE_OPT_LAST (1 << 18)
447+#define UPDATE_AD (1 << 19) // reinit audio chain and decoder
448+#define UPDATE_VD (1 << 20) // reinit video chain and decoder
449+#define UPDATE_OPT_LAST (1 << 20)
448450
449451 // All bits between of UPDATE_ flags
450452 #define UPDATE_OPTS_MASK ((UPDATE_OPT_LAST << 1) - 1)
player/command.c+13−0
@@ -7747,6 +7747,19 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, · 7746 unmodified lines
77477747 if (flags & UPDATE_DEMUXER)
77487748 mpctx->demuxer_changed = true;
77497749
7750+ if (flags & UPDATE_AD) {
7751+ uninit_audio_chain(mpctx);
7752+ reinit_audio_chain(mpctx);
7753+ }
7754+
7755+ if (flags & UPDATE_VD) {
7756+ struct track *track = mpctx->current_track[0][STREAM_VIDEO];
7757+ uninit_video_chain(mpctx);
7758+ reinit_video_chain(mpctx);
7759+ if (track)
7760+ queue_seek(mpctx, MPSEEK_RELATIVE, 0.0, MPSEEK_EXACT, 0);
7761+ }
7762+
77507763 if (opt_ptr == &opts->vo->android_surface_size) {
77517764 if (mpctx->video_out)
77527765 vo_control(mpctx->video_out, VOCTRL_EXTERNAL_RESIZE, NULL);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t