mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 01:22:30 +00:00
options: remove deprecated --record-file option
No wonder wm4 wanted to get rid of this. This option requires touching a bunch of crap in the core player code. --stream-record works perfectly fine and is a lot nicer so there's no need for this to exist anymore.
This commit is contained in:
parent
1b68c5d22f
commit
fb46666395
@ -83,6 +83,7 @@ Interface changes
|
||||
`playlist-play-index` instead)
|
||||
- remove deprecated `--oaoffset`, `--oafirst`, `--ovoffset`, `--ovfirst`,
|
||||
`--demuxer-force-retry-on-eof`, `--fit-border` options
|
||||
- remove deprecated `--record-file` option
|
||||
--- mpv 0.36.0 ---
|
||||
- add `--target-contrast`
|
||||
- Target luminance value is now also applied when ICC profile is used.
|
||||
|
@ -7205,16 +7205,6 @@ Miscellaneous
|
||||
This does not affect playlist expansion, redirection, or other loading of
|
||||
referenced files like with ordered chapters.
|
||||
|
||||
``--record-file=<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=<file>``
|
||||
Write received/read data from the demuxer to the given output file. The
|
||||
output file will always be overwritten without asking. The output format
|
||||
|
@ -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)},
|
||||
|
@ -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;
|
||||
|
@ -7041,9 +7041,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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 @@ terminate_playback:
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user