diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 2c8cd07c2f3bf..97e7058a7bd58 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -7204,16 +7204,6 @@ Miscellaneous This does not affect playlist expansion, redirection, or other loading of referenced files like with ordered chapters. -``--record-file=`` - Deprecated, use ``--stream-record``, or the ``dump-cache`` command. - - Record the current stream to the given target file. The target file will - always be overwritten without asking. - - This was deprecated because it isn't very nice to use. For one, seeking - while this is enabled will be directly reflected in the output, which was - not useful and annoying. - ``--stream-record=`` Write received/read data from the demuxer to the given output file. The output file will always be overwritten without asking. The output format diff --git a/options/options.c b/options/options.c index 9667d666c99d6..f080657e00ff8 100644 --- a/options/options.c +++ b/options/options.c @@ -784,9 +784,6 @@ static const m_option_t mp_opts[] = { .flags = M_OPT_FILE}, {"screenshot-sw", OPT_BOOL(screenshot_sw)}, - {"record-file", OPT_STRING(record_file), .flags = M_OPT_FILE, - .deprecation_message = "use --stream-record or the dump-cache command"}, - {"", OPT_SUBSTRUCT(resample_opts, resample_conf)}, {"", OPT_SUBSTRUCT(input_opts, input_config)}, diff --git a/options/options.h b/options/options.h index 576649e090dcd..f820a0cbc0b7d 100644 --- a/options/options.h +++ b/options/options.h @@ -201,7 +201,6 @@ typedef struct MPOpts { bool untimed; char *stream_dump; - char *record_file; bool stop_playback_on_init_failure; int loop_times; int loop_file; diff --git a/player/command.c b/player/command.c index fda2be9d40108..b604eecb7122b 100644 --- a/player/command.c +++ b/player/command.c @@ -7042,9 +7042,6 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, mp_wakeup_core(mpctx); } - if (opt_ptr == &opts->record_file) - open_recorder(mpctx, false); - if (opt_ptr == &opts->vf_settings) set_filters(mpctx, STREAM_VIDEO, opts->vf_settings); diff --git a/player/core.h b/player/core.h index 0f63f13474fde..c8c6ee850b16c 100644 --- a/player/core.h +++ b/player/core.h @@ -145,9 +145,6 @@ struct track { struct vo_chain *vo_c; struct ao_chain *ao_c; struct mp_pin *sink; - - // For stream recording (remuxing mode). - struct mp_recorder_sink *remux_sink; }; // Summarizes video filtering and output. @@ -425,8 +422,6 @@ typedef struct MPContext { // playback rate. Used to avoid showing it multiple times. bool drop_message_shown; - struct mp_recorder *recorder; - struct screenshot_ctx *screenshot_ctx; struct command_ctx *command_ctx; struct encode_lavc_context *encode_lavc_ctx; @@ -539,9 +534,6 @@ void autoload_external_files(struct MPContext *mpctx, struct mp_cancel *cancel); struct track *select_default_track(struct MPContext *mpctx, int order, enum stream_type type); void prefetch_next(struct MPContext *mpctx); -void close_recorder(struct MPContext *mpctx); -void close_recorder_and_error(struct MPContext *mpctx); -void open_recorder(struct MPContext *mpctx, bool on_init); void update_lavfi_complex(struct MPContext *mpctx); // main.c diff --git a/player/loadfile.c b/player/loadfile.c index 6c39f8e03add3..7fe7284e772c2 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -44,7 +44,6 @@ #include "options/m_property.h" #include "common/common.h" #include "common/encode.h" -#include "common/recorder.h" #include "common/stats.h" #include "input/input.h" #include "misc/language.h" @@ -217,7 +216,6 @@ static void uninit_demuxer(struct MPContext *mpctx) assert(!track->dec && !track->d_sub); assert(!track->vo_c && !track->ao_c); assert(!track->sink); - assert(!track->remux_sink); // Demuxers can be added in any order (if they appear mid-stream), and // we can't know which tracks uses which, so here's some O(n^2) trash. @@ -797,8 +795,6 @@ void mp_switch_track_n(struct MPContext *mpctx, int order, enum stream_type type uninit_sub(mpctx, current); if (current) { - if (current->remux_sink) - close_recorder_and_error(mpctx); current->selected = false; reselect_demux_stream(mpctx, current, false); } @@ -1832,8 +1828,6 @@ static void play_current_file(struct MPContext *mpctx) update_internal_pause_state(mpctx); - open_recorder(mpctx, true); - playback_start = mp_time_sec(); mpctx->error_playing = 0; mpctx->in_playloop = true; @@ -1860,8 +1854,6 @@ static void play_current_file(struct MPContext *mpctx) process_hooks(mpctx, "on_unload"); - close_recorder(mpctx); - // time to uninit all, except global stuff: reinit_complex_filters(mpctx, true); uninit_audio_chain(mpctx); @@ -2073,94 +2065,3 @@ void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e) mpctx->stop_play = e ? PT_CURRENT_ENTRY : PT_STOP; mp_wakeup_core(mpctx); } - -static void set_track_recorder_sink(struct track *track, - struct mp_recorder_sink *sink) -{ - if (track->d_sub) - sub_set_recorder_sink(track->d_sub, sink); - if (track->dec) - track->dec->recorder_sink = sink; - track->remux_sink = sink; -} - -void close_recorder(struct MPContext *mpctx) -{ - if (!mpctx->recorder) - return; - - for (int n = 0; n < mpctx->num_tracks; n++) - set_track_recorder_sink(mpctx->tracks[n], NULL); - - mp_recorder_destroy(mpctx->recorder); - mpctx->recorder = NULL; -} - -// Like close_recorder(), but also unset the option. Intended for use on errors. -void close_recorder_and_error(struct MPContext *mpctx) -{ - close_recorder(mpctx); - talloc_free(mpctx->opts->record_file); - mpctx->opts->record_file = NULL; - m_config_notify_change_opt_ptr(mpctx->mconfig, &mpctx->opts->record_file); - MP_ERR(mpctx, "Disabling stream recording.\n"); -} - -void open_recorder(struct MPContext *mpctx, bool on_init) -{ - if (!mpctx->playback_initialized) - return; - - close_recorder(mpctx); - - char *target = mpctx->opts->record_file; - if (!target || !target[0]) - return; - - struct sh_stream **streams = NULL; - int num_streams = 0; - - for (int n = 0; n < mpctx->num_tracks; n++) { - struct track *track = mpctx->tracks[n]; - if (track->stream && track->selected && (track->d_sub || track->dec)) - MP_TARRAY_APPEND(NULL, streams, num_streams, track->stream); - } - - struct demux_attachment **attachments = talloc_array(NULL, struct demux_attachment*, mpctx->demuxer->num_attachments); - for (int n = 0; n < mpctx->demuxer->num_attachments; n++) { - attachments[n] = &mpctx->demuxer->attachments[n]; - } - - mpctx->recorder = mp_recorder_create(mpctx->global, mpctx->opts->record_file, - streams, num_streams, - attachments, mpctx->demuxer->num_attachments); - - if (!mpctx->recorder) { - talloc_free(streams); - talloc_free(attachments); - close_recorder_and_error(mpctx); - return; - } - - if (!on_init) - mp_recorder_mark_discontinuity(mpctx->recorder); - - int n_stream = 0; - for (int n = 0; n < mpctx->num_tracks; n++) { - struct track *track = mpctx->tracks[n]; - if (n_stream >= num_streams) - break; - // (We expect track->stream not to be reused on other tracks.) - if (track->stream == streams[n_stream]) { - struct mp_recorder_sink * sink = - mp_recorder_get_sink(mpctx->recorder, streams[n_stream]); - assert(sink); - set_track_recorder_sink(track, sink); - n_stream++; - } - } - - talloc_free(streams); - talloc_free(attachments); -} - diff --git a/player/playloop.c b/player/playloop.c index dc74e6b8493fa..b88f4426efdd0 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -32,7 +32,6 @@ #include "common/encode.h" #include "common/msg.h" #include "common/playlist.h" -#include "common/recorder.h" #include "common/stats.h" #include "demux/demux.h" #include "filters/f_decoder_wrapper.h" @@ -373,8 +372,6 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek) clear_audio_output_buffers(mpctx); reset_playback_state(mpctx); - if (mpctx->recorder) - mp_recorder_mark_discontinuity(mpctx->recorder); demux_block_reading(mpctx->demuxer, false); for (int t = 0; t < mpctx->num_tracks; t++) {