diff options
author | wm4 <wm4@nowhere> | 2015-07-02 14:02:32 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-07-02 14:02:37 +0200 |
commit | 899dfa957f23bc92c2fa54bda9b856435639fd8c (patch) | |
tree | dd30ae9da01aff363e822ee0deb2a005d08cd7a5 /player/misc.c | |
parent | ff25c0ad7d7c3d1ca6f147a689884afc24e4b250 (diff) | |
download | mpv-899dfa957f23bc92c2fa54bda9b856435639fd8c.tar.bz2 mpv-899dfa957f23bc92c2fa54bda9b856435639fd8c.tar.xz |
player: unentangle --stream-dump
The final goal is making opening the demuxer and opening the stream the
same operation.
Stream dumping is a rather uninteresting feature, but has a small
number of vocal users, and it's easy to keep.
Diffstat (limited to 'player/misc.c')
-rw-r--r-- | player/misc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/player/misc.c b/player/misc.c index f3d9214828..613b475365 100644 --- a/player/misc.c +++ b/player/misc.c @@ -200,17 +200,17 @@ void error_on_track(struct MPContext *mpctx, struct track *track) } } -void stream_dump(struct MPContext *mpctx) +int stream_dump(struct MPContext *mpctx, const char *source_filename) { struct MPOpts *opts = mpctx->opts; - char *filename = opts->stream_dump; - stream_t *stream = mpctx->stream; - assert(stream && filename); + stream_t *stream = stream_open(source_filename, mpctx->global); + if (!stream) + return -1; int64_t size = 0; stream_control(stream, STREAM_CTRL_GET_SIZE, &size); - stream_set_capture_file(stream, filename); + stream_set_capture_file(stream, opts->stream_dump); while (mpctx->stop_play == KEEP_PLAYING && !stream->eof) { if (!opts->quiet && ((stream->pos / (1024 * 1024)) % 2) == 1) { @@ -221,6 +221,9 @@ void stream_dump(struct MPContext *mpctx) stream_fill_buffer(stream); mp_process_input(mpctx); } + + free_stream(stream); + return 0; } void merge_playlist_files(struct playlist *pl) |