summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-21 17:19:01 +0100
committerwm4 <wm4@nowhere>2017-01-21 17:19:01 +0100
commit73858bb0ccac91b6a529c8dd4b825f47aa28c4b7 (patch)
tree2baf1e7a267976e51ecbb2a08e02b0c430ea8d59 /stream/stream.c
parent085dfdea3246e4d0e984f9f3ccba2959df89842d (diff)
downloadmpv-73858bb0ccac91b6a529c8dd4b825f47aa28c4b7.tar.bz2
mpv-73858bb0ccac91b6a529c8dd4b825f47aa28c4b7.tar.xz
player: remove --stream-capture option/property
This was excessively useless, and I want my time back that was needed to explain users why they don't want to use it. It captured the byte stream only, and even for types of streams it was designed for (like transport streams), it was rather questionable. As part of the removal, un-inline demux_run_on_thread() (which has only 1 call-site now), and sort of reimplement --stream-dump to write the data directly instead of using the removed capture code. (--stream-dump is also very useless, and I struggled coming up with an explanation for it in the manpage.)
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 4c7aa04844..d2c2917d56 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -353,37 +353,6 @@ static bool stream_reconnect(stream_t *s)
return false;
}
-static void stream_capture_write(stream_t *s, void *buf, size_t len)
-{
- if (s->capture_file && len > 0) {
- if (fwrite(buf, len, 1, s->capture_file) < 1) {
- MP_ERR(s, "Error writing capture file: %s\n", mp_strerror(errno));
- stream_set_capture_file(s, NULL);
- }
- }
-}
-
-void stream_set_capture_file(stream_t *s, const char *filename)
-{
- if (!bstr_equals(bstr0(s->capture_filename), bstr0(filename))) {
- if (s->capture_file)
- fclose(s->capture_file);
- talloc_free(s->capture_filename);
- s->capture_file = NULL;
- s->capture_filename = NULL;
- if (filename) {
- s->capture_file = fopen(filename, "ab");
- if (s->capture_file) {
- s->capture_filename = talloc_strdup(NULL, filename);
- if (s->buf_pos < s->buf_len)
- stream_capture_write(s, s->buffer, s->buf_len);
- } else {
- MP_ERR(s, "Error opening capture file: %s\n", mp_strerror(errno));
- }
- }
- }
-}
-
// Read function bypassing the local stream buffer. This will not write into
// s->buffer, but into buf[0..len] instead.
// Returns 0 on error or EOF, and length of bytes read on success.
@@ -412,7 +381,6 @@ static int stream_read_unbuffered(stream_t *s, void *buf, int len)
// When reading succeeded we are obviously not at eof.
s->eof = 0;
s->pos += len;
- stream_capture_write(s, buf, len);
return len;
}
@@ -647,8 +615,6 @@ void free_stream(stream_t *s)
if (!s)
return;
- stream_set_capture_file(s, NULL);
-
if (s->close)
s->close(s);
free_stream(s->uncached_stream);