summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
commit60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch)
tree1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /stream
parentAdding upstream version 0.37.0. (diff)
downloadmpv-upstream/0.38.0.tar.xz
mpv-upstream/0.38.0.zip
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c2
-rw-r--r--stream/stream.h3
-rw-r--r--stream/stream_dvb.c2
-rw-r--r--stream/stream_dvdnav.c2
-rw-r--r--stream/stream_file.c7
-rw-r--r--stream/stream_lavf.c2
6 files changed, 13 insertions, 5 deletions
diff --git a/stream/stream.c b/stream/stream.c
index dd67825..43a7f51 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -803,7 +803,7 @@ int stream_skip_bom(struct stream *s)
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
int max_size)
{
- if (max_size > 1000000000)
+ if (max_size <= 0 || max_size > STREAM_MAX_READ_SIZE)
abort();
int bufsize;
diff --git a/stream/stream.h b/stream/stream.h
index 423ba12..58b55e1 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -32,6 +32,9 @@
// it's guaranteed that you can seek back by <= of this size again.
#define STREAM_BUFFER_SIZE 2048
+// Maximum size of a complete read.
+#define STREAM_MAX_READ_SIZE (INT_MAX - 1)
+
// flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE)
// stream->mode
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index 215e82c..96590d2 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -114,7 +114,7 @@ static fe_code_rate_t parse_fec(const char *cr)
static fe_modulation_t parse_vdr_modulation(const char** modstring)
{
- const static struct { const char *s; fe_modulation_t v; } table[] = {
+ static const struct { const char *s; fe_modulation_t v; } table[] = {
{ "16", QAM_16 },
{ "32", QAM_32 },
{ "64", QAM_64 },
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index d858c51..5dba92a 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -497,7 +497,7 @@ static int control(stream_t *stream, int cmd, void *arg)
struct stream_dvd_info_req *req = arg;
memset(req, 0, sizeof(*req));
req->num_subs = mp_dvdnav_number_of_subs(stream);
- assert(sizeof(uint32_t) == sizeof(unsigned int));
+ static_assert(sizeof(uint32_t) == sizeof(unsigned int), "");
memcpy(req->palette, priv->spu_clut, sizeof(req->palette));
return STREAM_OK;
}
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 4895a83..89e7a2d 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -50,6 +50,7 @@
#ifdef _WIN32
#include <windows.h>
+#include <winioctl.h>
#include <winternl.h>
#include <io.h>
@@ -306,6 +307,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
}
struct stat st;
+ bool is_sock_or_fifo = false;
if (fstat(p->fd, &st) == 0) {
if (S_ISDIR(st.st_mode)) {
stream->is_directory = true;
@@ -319,6 +321,9 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
fcntl(p->fd, F_SETFL, val);
#endif
} else {
+#ifndef __MINGW32__
+ is_sock_or_fifo = S_ISSOCK(st.st_mode) || S_ISFIFO(st.st_mode);
+#endif
p->use_poll = true;
}
}
@@ -340,7 +345,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
stream->get_size = get_size;
stream->close = s_close;
- if (check_stream_network(p->fd)) {
+ if (is_sock_or_fifo || check_stream_network(p->fd)) {
stream->streaming = true;
#if HAVE_COCOA
if (fcntl(p->fd, F_RDAHEAD, 0) < 0) {
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index c153ddd..a471c08 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -324,7 +324,7 @@ static int open_f(stream_t *stream)
if (err < 0) {
if (err == AVERROR_PROTOCOL_NOT_FOUND)
MP_ERR(stream, "Protocol not found. Make sure"
- " ffmpeg/Libav is compiled with networking support.\n");
+ " FFmpeg is compiled with networking support.\n");
goto out;
}