Commit Graph

2121 Commits

Author SHA1 Message Date
nanahi 9543426889 options: move dvd options to stream_dvdnav
The options and struct are only used in stream_dvdnav.c.
Also use dvd prefix for dvd_conf.
2024-11-18 17:22:02 +01:00
nanahi bd5e3c0261 stream: allow max_size of 0 for stream_read_complete
In this case, it returns a bstr of a length of 0 rather than
error.
2024-10-22 03:16:51 +03:00
nanahi dc0d99eaff stream: add STREAM_READ_FILE_FLAGS_DEFAULT
This is the default set of flags used by stream_read_file().
Useful for doing flag customization for stream_read_file2().
2024-10-22 03:16:51 +03:00
nanahi c2e71ceb07 stream: add STREAM_ALLOW_PARTIAL_READ flag
This allows stream_read_complete() to return partial result
instead of error if the file size is larger than the limit.
2024-10-22 03:16:51 +03:00
nanahi ac648d2e0b stream: delete extra newline 2024-10-20 19:31:49 +02:00
nanahi 7673c4e34a stream: add stream_read_file2
This is stream_read_file with the ability to specify flags.
2024-10-20 19:31:49 +02:00
Dudemanguy 63a81515ad stream_cdda: stop suppressing -Wscript-prototypes
This was fixed upstream* and in a new release, so it is no longer needed
for our CI.

*: 3ced3d72de
2024-10-12 15:56:51 +00:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
llyyr d84a7c5112 stream: don't mark stdin as a filesystem file
Also rename the field to appropriately reflect what it is supposed to be
used for. The only other use of this was to search for ordered chapter
sources, and that makes no sense for mkv files from stdin.

This also fixes autocreate-playlist loading in the current directory
when the input file is stdin.
2024-09-14 16:17:44 +02:00
llyyr daa6068d02 stream_bluray: check fread return value 2024-07-08 23:45:37 +02:00
Dudemanguy 111571bd05 options: remove some options with .deprecation_message
In both cases, setting these options did nothing other than give you a
warning that they may be removed in the future. Remove them now.
2024-06-25 02:18:58 +00:00
Kacper Michajłow df6b16c0ca stream: don't exit on first iteration if there is no match
Fixes: f921b64ed7
2024-06-16 01:22:30 +02:00
Kacper Michajłow 2e19420756 stream_cdda: suppress Wundef warning 2024-06-05 19:07:58 +02:00
Dudemanguy 7b77672794 stream_lavf: don't add ffmpeg bluray or dvd protocols
The naming of these conflict with existing mpv protocols, so skip if we
get them. Users can still use them via lavf://bluray: or lavf://dvd: if
they wish.
2024-05-22 20:10:52 +00:00
Dudemanguy f921b64ed7 stream: implement get_protocols method for stream_lavf
Previously, all stream protocols were a static list in mpv. This is okay
for own builtin stuff, but for protocols that depend on ffmpeg it's not
so great. Support for certain protocols may or may not be enabled in a
user's ffmpeg and the protocol list that mpv generates should ideally
match this. Fix this by implementing a get_protocols method for
stream_lavf that will have different results depending on the ffmpeg mpv
is built against. We keep the safe and unsafe protocols separation. The
former is essentially a whitelist. Any protocol that is found in ffmpeg
but is not in the safe whitelist is considered unsafe. In the stream
list, ffmpeg is moved to the bottom so any possible protocols that are
added in the future don't automatically take precedence over any builtin
mpv ones.
2024-05-22 20:10:52 +00:00
sfan5 03ca340835 stream: remove directory playlist hint
The stream layer is the wrong place to handle this and the benefit
seems dubious.
2024-05-15 22:45:18 +02:00
sfan5 553fb024d4 stream: check file descriptor passed to fd:// or fdclose:// 2024-05-15 22:45:18 +02:00
sfan5 54c755b08d various: add missing checks for directory streams
All of this code opens a stream and expects to read stuff from a file.
But streams can also be directories and that has to be handled.
2024-05-15 22:45:18 +02:00
sfan5 ae23556b6f stream: disallow reading or writing to directories
Reading an entire file is a common operation, meanwhile
stream_file will happily open a directory. This doesn't match well.

Analogously for open_output_stream().
2024-05-15 22:45:18 +02:00
sfan5 a33fd3b4cf Revert "stream: don't try to read from all-sparse/no-data files"
The stream layer is just not the right place to make this change
since it's also used for completely unrelated purposes such as reading
configs.

This reverts commit bb7a485c09.
2024-05-12 18:06:21 +02:00
Mohammad AlSaleh bb7a485c09 stream: don't try to read from all-sparse/no-data files
```
 dd if=/dev/zero of=/tmp/10g.empty bs=1 seek=10G count=0
 dd if=/dev/zero of=/tmp/10m.empty bs=1 seek=10M count=0
 time mpv /tmp/10{g,m}.empty
 ```

 I keep files with the name format `${name}-${hash}.${ext}.empty`
 around, where the original is removed, and a sparse file with
 the size of the original is created instead.

 A lot of time is wasted on such files when going through
 playlists/directories that include some of them.

 This admittedly may not be that common of a use-case.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-05-07 12:22:09 +02:00
nanahi 9f5edd4eed various: fix indentation 2024-05-07 11:23:08 +02:00
Kacper Michajłow 7f6bfab0d3 stream_file: declare structures available only in Windows DDK 2024-05-06 22:01:17 +02:00
Kacper Michajłow 86abbb89a7 win32: fix platform checks 2024-05-06 22:01:17 +02:00
Kacper Michajłow b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +02:00
Kacper Michajłow fffe723fc4 various: move strings.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow 18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
nanahi 82a186567e various: fix -Wold-style-declaration warning
warning: `static' is not at beginning of declaration
2024-03-19 08:58:18 +01:00
sfan5 ead9f892b3 various: use static assertions where appropriate 2024-03-17 20:04:04 +01:00
bptato 801306acdf stream: enable caching for sockets, pipes and FIFOs
This is useful e.g. when the caller dup2's a socket into stdin, or
passes a socket/pipe as /dev/fd/{fd}, because it is impossible to seek
on sockets and pipes.
2024-03-16 13:41:24 +01:00
Kacper Michajłow a59b8edb96 stream: increase max_size to INT_MAX minus padding
No need to magic number limit, we can support up to INT_MAX with current
code. Which should be more than enough.
2024-01-31 15:38:21 +00:00
llyyr 8fe2af09f1 common: stream: don't mention Libav in errors/warnings 2024-01-20 16:10:20 +00:00
Kacper Michajłow ed107c4116 meson: adjust win32 defines
- Don't define _GNU_SOURCE on Windows, no need
- Define WIN32_LEAN_AND_MEAN to strip some unneded headers from
  windows.h
- Define NOMINMAX and _USE_MATH_DEFINES as they are common for Windows
  headers
2023-11-25 12:38:20 +01:00
Kacper Michajłow 4449f38c17 various: add some missing error checks 2023-11-18 23:55:28 +00:00
Kacper Michajłow 56d35da180 mp_thread: add win32 implementation 2023-11-05 17:36:17 +00:00
Kacper Michajłow 174df99ffa ALL: use new mp_thread abstraction 2023-11-05 17:36:17 +00:00
sfan5 490af95c10 dvbin: do a big cleanup on code style and functions 2023-10-21 11:07:59 +02:00
sfan5 c78c33bf7c stream_dvb: avoid static function variable 2023-10-21 11:07:59 +02:00
sfan5 2569c69d92 dvb_tune: remove use of time() 2023-10-21 11:07:59 +02:00
sfan5 d7683ec4ac dvbin: revise many log lines 2023-10-21 11:07:59 +02:00
sfan5 e8e1466426 stream_dvb: use talloc 2023-10-21 11:07:59 +02:00
sfan5 a394e5cd1d stream_dvb: fix missing newlines on log messages 2023-10-21 11:07:59 +02:00
Dudemanguy 39247bd0b6 stream_cdda: deprecate --cdda-toc-bias and always check for offsets
I started going through the blame but once I got to mplayer commits from
20 years ago, I stopped bothering. This obscure option has always been
disabled by default, but there's zero reason, as far as I know, to not
just enable it today. Some CDs (particularly very old ones) have the
first sector shifted a bit and not starting exactly at 0. This makes the
logic that tries to get all the chapters completely fail and thus you
can't skip through tracks. However if you just enable this obscure
option, it just works. For anything that starts exactly at 0, the
calculated offset is just 0 anyway so it's a no-op and works exactly the
same. So basically, there's literally no reason to not just always try
to correct for the offset of the first sector by default.

Fixes #8777.
2023-10-19 12:10:53 -05:00
Dudemanguy 3504136d3f stream_cdda: remove printing track info in fill_buffer
It was completely wrong. mpv will buffer data ahead of where the CD
currently is playing. When enough data was buffered into the next track,
the track info is printed regardless of where the stream position
actually is. Depending on the user settings, you can get mpv to buffer
minutes ahead. Printing a message when the track changes might be nice,
but this isn't the right place to do it. Some other mechanism would need
to be leveraged, but I'm not going to bother figuring it out.
2023-10-19 12:10:53 -05:00
Dudemanguy d5e5c2ce98 stream_cdda: remove fallback for ancient libcdio versions
CDIO_API_VERSION 6 has been around since libcdio 0.90. That was release
over a decade ago. There's literally no reason to keep the ugly mess of
the old api around so remove it.
2023-10-19 12:10:53 -05:00
Kacper Michajłow 4e6325d012 stream_cdda: suppress -Wstrict-prototypes from cdio 2023-10-19 14:03:23 +00:00
Dudemanguy e22efe2d22 stream_lavf: use metadata-codepage option for codepage conversion
a343666ab5 made demux options public, so
we can take advantage of that here as well. This lets users guess the
codepage if the stream doesn't use UTF-8 characters. Fixes #8844.
2023-10-07 02:41:27 +00:00
Kacper Michajłow cdfd5c280a win32/pthread: define _POSIX_TIMERS to notify they are not supported 2023-09-29 20:48:58 +00:00
Dudemanguy 610faf705b stream: remove unneeded mp_read_option_raw call
We can get the group from demux_conf instead and use that.
2023-09-22 14:20:38 +00:00
Dudemanguy 8a7704ea89 stream_bluray: move --bluray-device to stream_bluray_opts
Similar to the previous commit. There's no reason for --bluray-device to
be in MPOpts. Make a specific subopt for stream_bluray and use that
instead so we can remove the mp_read_option_raw call.
2023-09-22 14:20:38 +00:00