mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
demux: Move demuxer help to new standard mechanism
Previously, demux help was handled as a special case in main.c and this is no longer necessary.
This commit is contained in:
parent
3f006eced4
commit
c8f474e3e5
@ -2827,7 +2827,7 @@ done:
|
|||||||
return out_pkt;
|
return out_pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void demuxer_help(struct mp_log *log)
|
int demuxer_help(struct mp_log *log, const m_option_t *opt, struct bstr name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -2837,6 +2837,9 @@ void demuxer_help(struct mp_log *log)
|
|||||||
mp_info(log, "%10s %s\n",
|
mp_info(log, "%10s %s\n",
|
||||||
demuxer_list[i]->name, demuxer_list[i]->desc);
|
demuxer_list[i]->name, demuxer_list[i]->desc);
|
||||||
}
|
}
|
||||||
|
mp_info(log, "\n");
|
||||||
|
|
||||||
|
return M_OPT_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *d_level(enum demux_check level)
|
static const char *d_level(enum demux_check level)
|
||||||
|
@ -293,7 +293,7 @@ void demuxer_select_track(struct demuxer *demuxer, struct sh_stream *stream,
|
|||||||
void demuxer_refresh_track(struct demuxer *demuxer, struct sh_stream *stream,
|
void demuxer_refresh_track(struct demuxer *demuxer, struct sh_stream *stream,
|
||||||
double ref_pts);
|
double ref_pts);
|
||||||
|
|
||||||
void demuxer_help(struct mp_log *log);
|
int demuxer_help(struct mp_log *log, const m_option_t *opt, struct bstr name);
|
||||||
|
|
||||||
int demuxer_add_attachment(struct demuxer *demuxer, char *name,
|
int demuxer_add_attachment(struct demuxer *demuxer, char *name,
|
||||||
char *type, void *data, size_t data_size);
|
char *type, void *data, size_t data_size);
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "player/core.h"
|
#include "player/core.h"
|
||||||
#include "player/command.h"
|
#include "player/command.h"
|
||||||
#include "stream/stream.h"
|
#include "stream/stream.h"
|
||||||
|
#include "demux/demux.h"
|
||||||
|
|
||||||
#if HAVE_DRM
|
#if HAVE_DRM
|
||||||
#include "video/out/drm_common.h"
|
#include "video/out/drm_common.h"
|
||||||
@ -514,9 +515,9 @@ static const m_option_t mp_opts[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// demuxer.c - select audio/sub file/demuxer
|
// demuxer.c - select audio/sub file/demuxer
|
||||||
{"demuxer", OPT_STRING(demuxer_name)},
|
{"demuxer", OPT_STRING(demuxer_name), .help = demuxer_help},
|
||||||
{"audio-demuxer", OPT_STRING(audio_demuxer_name)},
|
{"audio-demuxer", OPT_STRING(audio_demuxer_name), .help = demuxer_help},
|
||||||
{"sub-demuxer", OPT_STRING(sub_demuxer_name)},
|
{"sub-demuxer", OPT_STRING(sub_demuxer_name), .help = demuxer_help},
|
||||||
{"demuxer-thread", OPT_FLAG(demuxer_thread)},
|
{"demuxer-thread", OPT_FLAG(demuxer_thread)},
|
||||||
{"demuxer-termination-timeout", OPT_DOUBLE(demux_termination_timeout)},
|
{"demuxer-termination-timeout", OPT_DOUBLE(demux_termination_timeout)},
|
||||||
{"demuxer-cache-wait", OPT_FLAG(demuxer_cache_wait)},
|
{"demuxer-cache-wait", OPT_FLAG(demuxer_cache_wait)},
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
|
|
||||||
#include "audio/out/ao.h"
|
#include "audio/out/ao.h"
|
||||||
#include "demux/demux.h"
|
|
||||||
#include "misc/thread_tools.h"
|
#include "misc/thread_tools.h"
|
||||||
#include "sub/osd.h"
|
#include "sub/osd.h"
|
||||||
#include "test/tests.h"
|
#include "test/tests.h"
|
||||||
@ -202,13 +201,6 @@ static bool handle_help_options(struct MPContext *mpctx)
|
|||||||
{
|
{
|
||||||
struct MPOpts *opts = mpctx->opts;
|
struct MPOpts *opts = mpctx->opts;
|
||||||
struct mp_log *log = mpctx->log;
|
struct mp_log *log = mpctx->log;
|
||||||
if ((opts->demuxer_name && strcmp(opts->demuxer_name, "help") == 0) ||
|
|
||||||
(opts->audio_demuxer_name && strcmp(opts->audio_demuxer_name, "help") == 0) ||
|
|
||||||
(opts->sub_demuxer_name && strcmp(opts->sub_demuxer_name, "help") == 0)) {
|
|
||||||
demuxer_help(log);
|
|
||||||
MP_INFO(mpctx, "\n");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (opts->ao_opts->audio_device &&
|
if (opts->ao_opts->audio_device &&
|
||||||
strcmp(opts->ao_opts->audio_device, "help") == 0)
|
strcmp(opts->ao_opts->audio_device, "help") == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user