mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +00:00
mplayer: rip out --capture support
While this was an interesting idea, it wasn't actually useful. Basically it dumped the raw data (as requested by the demuxer) into a file. The result is only useful if the file format was raw or maybe some MPEG packet stream, but not with most modern file formats.
This commit is contained in:
parent
e48b21dd87
commit
7059c15f4a
@ -289,16 +289,6 @@
|
|||||||
filled to this position rather than performing a stream seek (default:
|
filled to this position rather than performing a stream seek (default:
|
||||||
50).
|
50).
|
||||||
|
|
||||||
--capture
|
|
||||||
Allows capturing the primary stream (not additional audio tracks or other
|
|
||||||
kind of streams) into the file specified by ``--dumpfile`` or by default.
|
|
||||||
If this option is given, capturing can be started and stopped by pressing
|
|
||||||
the key bound to this function (see section `INTERACTIVE CONTROL`_). Same
|
|
||||||
as for ``--dumpstream``, this will likely not produce usable results for
|
|
||||||
anything else than MPEG streams. Note that, due to cache latencies,
|
|
||||||
captured data may begin and end somewhat delayed compared to what you see
|
|
||||||
displayed.
|
|
||||||
|
|
||||||
--cdda=<option1:option2>
|
--cdda=<option1:option2>
|
||||||
This option can be used to tune the CD Audio reading feature of MPlayer.
|
This option can be used to tune the CD Audio reading feature of MPlayer.
|
||||||
|
|
||||||
@ -514,10 +504,6 @@
|
|||||||
double-click (default: 300). Set to 0 to let your windowing system decide
|
double-click (default: 300). Set to 0 to let your windowing system decide
|
||||||
what a double-click is (``--vo=directx`` only).
|
what a double-click is (``--vo=directx`` only).
|
||||||
|
|
||||||
--dumpfile=<filename>
|
|
||||||
Specify which file MPlayer should dump to. Should be used together with
|
|
||||||
``--dumpaudio`` / ``--dumpvideo`` / ``--dumpstream`` / ``--capture``.
|
|
||||||
|
|
||||||
--dvbin=<options>
|
--dvbin=<options>
|
||||||
Pass the following parameters to the DVB input module, in order to
|
Pass the following parameters to the DVB input module, in order to
|
||||||
override the default ones:
|
override the default ones:
|
||||||
|
@ -750,11 +750,6 @@ const m_option_t mplayer_opts[]={
|
|||||||
|
|
||||||
OPT_FLAG_ON("untimed", untimed, 0),
|
OPT_FLAG_ON("untimed", untimed, 0),
|
||||||
|
|
||||||
// dump some stream out instead of playing the file
|
|
||||||
OPT_STRING("dumpfile", stream_dump_name, 0, OPTDEF_STR("stream.dump")),
|
|
||||||
|
|
||||||
OPT_MAKE_FLAGS("capture", capture_dump, 0),
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIRC
|
#ifdef CONFIG_LIRC
|
||||||
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
|
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
|
||||||
#endif
|
#endif
|
||||||
|
38
command.c
38
command.c
@ -1240,40 +1240,6 @@ static int mp_property_colormatrix_output_range(m_option_t *prop, int action,
|
|||||||
prop, action, arg, mpctx);
|
prop, action, arg, mpctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mp_property_capture(m_option_t *prop, int action,
|
|
||||||
void *arg, MPContext *mpctx)
|
|
||||||
{
|
|
||||||
struct MPOpts *opts = &mpctx->opts;
|
|
||||||
|
|
||||||
if (!mpctx->stream)
|
|
||||||
return M_PROPERTY_UNAVAILABLE;
|
|
||||||
|
|
||||||
if (!opts->capture_dump) {
|
|
||||||
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
|
|
||||||
"Capturing not enabled (forgot -capture parameter?)\n");
|
|
||||||
return M_PROPERTY_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
int capturing = !!mpctx->stream->capture_file;
|
|
||||||
|
|
||||||
int ret = m_property_flag(prop, action, arg, &capturing);
|
|
||||||
if (ret == M_PROPERTY_OK && capturing != !!mpctx->stream->capture_file) {
|
|
||||||
if (capturing) {
|
|
||||||
mpctx->stream->capture_file = fopen(opts->stream_dump_name, "wb");
|
|
||||||
if (!mpctx->stream->capture_file) {
|
|
||||||
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
|
|
||||||
"Error opening capture file: %s\n", strerror(errno));
|
|
||||||
ret = M_PROPERTY_ERROR;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fclose(mpctx->stream->capture_file);
|
|
||||||
mpctx->stream->capture_file = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Panscan (RW)
|
/// Panscan (RW)
|
||||||
static int mp_property_panscan(m_option_t *prop, int action, void *arg,
|
static int mp_property_panscan(m_option_t *prop, int action, void *arg,
|
||||||
MPContext *mpctx)
|
MPContext *mpctx)
|
||||||
@ -2272,8 +2238,6 @@ static const m_option_t mp_properties[] = {
|
|||||||
0, 0, 0, NULL },
|
0, 0, 0, NULL },
|
||||||
{ "pause", mp_property_pause, CONF_TYPE_FLAG,
|
{ "pause", mp_property_pause, CONF_TYPE_FLAG,
|
||||||
M_OPT_RANGE, 0, 1, NULL },
|
M_OPT_RANGE, 0, 1, NULL },
|
||||||
{ "capturing", mp_property_capture, CONF_TYPE_FLAG,
|
|
||||||
M_OPT_RANGE, 0, 1, NULL },
|
|
||||||
{ "pts_association_mode", mp_property_generic_option, &m_option_type_choice,
|
{ "pts_association_mode", mp_property_generic_option, &m_option_type_choice,
|
||||||
0, 0, 0, "pts-association-mode" },
|
0, 0, 0, "pts-association-mode" },
|
||||||
{ "hr_seek", mp_property_generic_option, &m_option_type_choice,
|
{ "hr_seek", mp_property_generic_option, &m_option_type_choice,
|
||||||
@ -2454,7 +2418,6 @@ static struct property_osd_display {
|
|||||||
// general
|
// general
|
||||||
{ "loop", 0, -1, _("Loop: %s") },
|
{ "loop", 0, -1, _("Loop: %s") },
|
||||||
{ "chapter", -1, -1, NULL },
|
{ "chapter", -1, -1, NULL },
|
||||||
{ "capturing", 0, -1, _("Capturing: %s") },
|
|
||||||
{ "pts_association_mode", 0, -1, "PTS association mode: %s" },
|
{ "pts_association_mode", 0, -1, "PTS association mode: %s" },
|
||||||
{ "hr_seek", 0, -1, "hr-seek: %s" },
|
{ "hr_seek", 0, -1, "hr-seek: %s" },
|
||||||
{ "speed", 0, -1, _("Speed: x %6s") },
|
{ "speed", 0, -1, _("Speed: x %6s") },
|
||||||
@ -2585,7 +2548,6 @@ static struct {
|
|||||||
{ "chapter", MP_CMD_SEEK_CHAPTER, 0},
|
{ "chapter", MP_CMD_SEEK_CHAPTER, 0},
|
||||||
{ "angle", MP_CMD_SWITCH_ANGLE, 0},
|
{ "angle", MP_CMD_SWITCH_ANGLE, 0},
|
||||||
{ "pause", MP_CMD_PAUSE, 0},
|
{ "pause", MP_CMD_PAUSE, 0},
|
||||||
{ "capturing", MP_CMD_CAPTURING, 1},
|
|
||||||
// audio
|
// audio
|
||||||
{ "volume", MP_CMD_VOLUME, 0},
|
{ "volume", MP_CMD_VOLUME, 0},
|
||||||
{ "mute", MP_CMD_MUTE, 1},
|
{ "mute", MP_CMD_MUTE, 1},
|
||||||
|
@ -195,7 +195,6 @@ static const mp_cmd_t mp_cmds[] = {
|
|||||||
{ MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } },
|
{ MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } },
|
||||||
{ MP_CMD_PLAYLIST_CLEAR, "playlist_clear", },
|
{ MP_CMD_PLAYLIST_CLEAR, "playlist_clear", },
|
||||||
{ MP_CMD_RUN, "run", { ARG_STRING } },
|
{ MP_CMD_RUN, "run", { ARG_STRING } },
|
||||||
{ MP_CMD_CAPTURING, "capturing", },
|
|
||||||
{ MP_CMD_VF_CHANGE_RECTANGLE, "change_rectangle", { ARG_INT, ARG_INT } },
|
{ MP_CMD_VF_CHANGE_RECTANGLE, "change_rectangle", { ARG_INT, ARG_INT } },
|
||||||
{ MP_CMD_TV_TELETEXT_ADD_DEC, "teletext_add_dec", { ARG_STRING } },
|
{ MP_CMD_TV_TELETEXT_ADD_DEC, "teletext_add_dec", { ARG_STRING } },
|
||||||
{ MP_CMD_TV_TELETEXT_GO_LINK, "teletext_go_link", { ARG_INT } },
|
{ MP_CMD_TV_TELETEXT_GO_LINK, "teletext_go_link", { ARG_INT } },
|
||||||
|
@ -42,7 +42,6 @@ enum mp_command_type {
|
|||||||
MP_CMD_TV_STEP_CHANNEL,
|
MP_CMD_TV_STEP_CHANNEL,
|
||||||
MP_CMD_TV_STEP_NORM,
|
MP_CMD_TV_STEP_NORM,
|
||||||
MP_CMD_TV_STEP_CHANNEL_LIST,
|
MP_CMD_TV_STEP_CHANNEL_LIST,
|
||||||
MP_CMD_CAPTURING,
|
|
||||||
MP_CMD_VO_FULLSCREEN,
|
MP_CMD_VO_FULLSCREEN,
|
||||||
MP_CMD_SUB_POS,
|
MP_CMD_SUB_POS,
|
||||||
MP_CMD_DVDNAV,
|
MP_CMD_DVDNAV,
|
||||||
|
@ -43,8 +43,6 @@ typedef struct MPOpts {
|
|||||||
char *vobsub_name;
|
char *vobsub_name;
|
||||||
int auto_quality;
|
int auto_quality;
|
||||||
int untimed;
|
int untimed;
|
||||||
char *stream_dump_name;
|
|
||||||
int capture_dump;
|
|
||||||
int loop_times;
|
int loop_times;
|
||||||
int ordered_chapters;
|
int ordered_chapters;
|
||||||
int chapter_merge_threshold;
|
int chapter_merge_threshold;
|
||||||
|
@ -527,8 +527,6 @@ int cache_stream_fill_buffer(stream_t *s){
|
|||||||
s->buf_len=len;
|
s->buf_len=len;
|
||||||
s->pos+=len;
|
s->pos+=len;
|
||||||
// printf("[%d]",len);fflush(stdout);
|
// printf("[%d]",len);fflush(stdout);
|
||||||
if (s->capture_file)
|
|
||||||
stream_capture_do(s);
|
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -262,16 +262,6 @@ stream_t *open_output_stream(const char *filename, struct MPOpts *options)
|
|||||||
|
|
||||||
//=================== STREAMER =========================
|
//=================== STREAMER =========================
|
||||||
|
|
||||||
void stream_capture_do(stream_t *s)
|
|
||||||
{
|
|
||||||
if (fwrite(s->buffer, s->buf_len, 1, s->capture_file) < 1) {
|
|
||||||
mp_tmsg(MSGT_GLOBAL, MSGL_ERR, "Error writing capture file: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
fclose(s->capture_file);
|
|
||||||
s->capture_file = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int stream_read_internal(stream_t *s, void *buf, int len)
|
int stream_read_internal(stream_t *s, void *buf, int len)
|
||||||
{
|
{
|
||||||
int orig_len = len;
|
int orig_len = len;
|
||||||
@ -339,8 +329,6 @@ int stream_fill_buffer(stream_t *s){
|
|||||||
s->buf_pos=0;
|
s->buf_pos=0;
|
||||||
s->buf_len=len;
|
s->buf_len=len;
|
||||||
// printf("[%d]",len);fflush(stdout);
|
// printf("[%d]",len);fflush(stdout);
|
||||||
if (s->capture_file)
|
|
||||||
stream_capture_do(s);
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,10 +508,6 @@ void free_stream(stream_t *s){
|
|||||||
#ifdef CONFIG_STREAM_CACHE
|
#ifdef CONFIG_STREAM_CACHE
|
||||||
cache_uninit(s);
|
cache_uninit(s);
|
||||||
#endif
|
#endif
|
||||||
if (s->capture_file) {
|
|
||||||
fclose(s->capture_file);
|
|
||||||
s->capture_file = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s->close) s->close(s);
|
if(s->close) s->close(s);
|
||||||
if(s->fd>0){
|
if(s->fd>0){
|
||||||
|
@ -172,7 +172,6 @@ typedef struct stream {
|
|||||||
streaming_ctrl_t *streaming_ctrl;
|
streaming_ctrl_t *streaming_ctrl;
|
||||||
#endif
|
#endif
|
||||||
unsigned char buffer[STREAM_BUFFER_SIZE>STREAM_MAX_SECTOR_SIZE?STREAM_BUFFER_SIZE:STREAM_MAX_SECTOR_SIZE];
|
unsigned char buffer[STREAM_BUFFER_SIZE>STREAM_MAX_SECTOR_SIZE?STREAM_BUFFER_SIZE:STREAM_MAX_SECTOR_SIZE];
|
||||||
FILE *capture_file;
|
|
||||||
} stream_t;
|
} stream_t;
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORKING
|
#ifdef CONFIG_NETWORKING
|
||||||
@ -181,7 +180,6 @@ typedef struct stream {
|
|||||||
|
|
||||||
int stream_fill_buffer(stream_t *s);
|
int stream_fill_buffer(stream_t *s);
|
||||||
int stream_seek_long(stream_t *s, off_t pos);
|
int stream_seek_long(stream_t *s, off_t pos);
|
||||||
void stream_capture_do(stream_t *s);
|
|
||||||
|
|
||||||
#ifdef CONFIG_STREAM_CACHE
|
#ifdef CONFIG_STREAM_CACHE
|
||||||
int stream_enable_cache(stream_t *stream,int size,int min,int prefill);
|
int stream_enable_cache(stream_t *stream,int size,int min,int prefill);
|
||||||
|
Loading…
Reference in New Issue
Block a user