summaryrefslogtreecommitdiffstats
path: root/stream/stream_smb.c
Commit message (Collapse)AuthorAgeFilesLines
* stream_smb: remove thiswm42020-03-051-155/+0
| | | | | | | | | | | This required libsmbclient, which is a heavy dependency, and as a library, has all kinds of problems. For one, the API requires completely unacceptable global state (in particular, leaks auth state), and is not thread-safe (meaning concurrent reads to multiple files block each other). There are better replacements: you can use the Linux kernel's builtin CIFS support, fusesmb, or contribute supoport for libdsm.
* stream, demux: redo origin policy thingwm42019-12-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv has a very weak and very annoying policy that determines whether a playlist should be used or not. For example, if you play a remote playlist, you usually don't want it to be able to read local filesystem entries. (Although for a media player the impact is small I guess.) It's weak and annoying as in that it does not prevent certain cases which could be interpreted as bad in some cases, such as allowing playlists on the local filesystem to reference remote URLs. It probably barely makes sense, but we just want to exclude some other "definitely not a good idea" things, all while playlists generally just work, so whatever. The policy is: - from the command line anything is played - local playlists can reference anything except "unsafe" streams ("unsafe" means special stream inputs like libavfilter graphs) - remote playlists can reference only remote URLs - things like "memory://" and archives are "transparent" to this This commit does... something. It replaces the weird stream flags with a slightly clearer "origin" value, which is now consequently passed down and used everywhere. It fixes some deviations from the described policy. I wanted to force archives to reference only content within them, but this would probably have been more complicated (or required different abstractions), and I'm too lazy to figure it out, so archives are now "transparent" (playlists within archives behave the same outside). There may be a lot of bugs in this. This is unfortunately a very noisy commit because: - every stream open call now needs to pass the origin - so does every demuxer open call (=> params param. gets mandatory) - most stream were changed to provide the "origin" value - the origin value needed to be passed along in a lot of places - I was too lazy to split the commit Fixes: #7274
* stream: remove unused read_chunk fieldwm42019-11-071-1/+0
| | | | | | | | | | | | | It was set, but its value was never used. The stream cache used to use it, but it was removed. It controlled how much data it tried to read from the underlying stream at once. The user can now control the buffer size with --stream-buffer-size, which achieves a similar effect, because the stream will in the common case read half of the buffer size at once. In fact, the new default size is 128KB, i.e. 64KB read size, which is as much as stream_file and stream_cb requested by default. stream_memory requested more, but it doesn't matter anyway. Only stream_smb set a larger size with 128KB.
* stream: replace STREAM_CTRL_GET_SIZE with a proper entrypointwm42019-11-071-16/+7
| | | | | This is overlay convoluted as a stream control, and important enough to warrant "first class" functionality.
* stream: change buffer argument types from char* to void*wm42019-11-071-2/+2
| | | | | | | This is slightly better, although not much, and ultimately doesn't matter. The public API in stream_cb.h also uses char*, but can't change that.
* stream_smb: remove unnecessary short write logicwm42019-09-141-11/+4
| | | | See previous commit. It compiles, but 100% untested.
* stream_smb: make sure the string is NULL-terminated after strncpypavelxdd2018-10-251-0/+1
| | | | strncpy does not guarantee that the string will be NULL-terminated.
* stream_smb/stream_file: fix `write_buffer`Yclept Nemo2018-07-291-8/+8
| | | | | | | Functions `write` and `smbc_write` are given a diminishing buffer of incorrect constant size. After partial writes, the code would do another write of the full original length, failing to subtract the amount already written.
* stream_smb: locking to bypass libsmbclient issuesYclept Nemo2018-07-291-1/+21
| | | | | | | | | | | | | | | | Thread-unsafe libsmbclient is likely to crash when used simultaneously across threads. For example, by: mpv "smb://...mkv" --sub-file "smb://...srt" Work around this by locking all calls to this library under a single global mutex. This is a temporary solution. When the libsmbclient bug [1] is fixed, switch to the code from branch [2] which uses a new api to create per-thread smb contexts. Fixes [3]. [1] https://bugzilla.samba.org/show_bug.cgi?id=11413 [2] https://github.com/orbisvicis/mpv/tree/smbclient_threaded_api [3] https://github.com/mpv-player/mpv/issues/5936
* Add checks for HAVE_GPL to various GPL-only source fileswm42017-10-101-0/+5
| | | | | | | | This should actually cover all of them, if you take into account that some unchanged GPL source files include header files with such checks. Also this was done already for the libaf derived code. This is only for "safety" and to avoid misunderstandings.
* stream_smb: disable by default, mark as GPLv3wm42017-05-111-1/+1
| | | | | | | | | | It seems libsmbclient has been GPLv3 for years. Also, it's certainly not LGPL (unlike some of its support libs like talloc). Thus, mpv built with Samba support is GPLv3. Disable it by default, so we don't have to go through the trouble to indicate the correct license in our output, and we don't trick people into distributing stuff under the wrong license.
* Update license headersMarcin Kurczewski2015-04-131-6/+5
| | | | Signed-off-by: wm4 <wm4@nowhere>
* stream/smb: mark as network stream for --cache=autoKevin Mitchell2015-03-091-0/+1
| | | | | | | This causes the cache to be enabled with --cache=auto. It was not done previously because the small cache size 320k actually led to worse performance. However, with the current default cache size of 25000kb, caching notably improves performance.
* Add more constwm42014-06-111-1/+1
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* stream_smb: fix compilationwm42014-05-241-4/+4
| | | | Accidentally forgotten in commit a4d487.
* stream: remove chaos related to writeable streamswm42014-05-241-10/+3
| | | | | | | | | | For some reason, we support writeable streams. (Only encoding uses that, and the use of it looks messy enough that I want to replace it with FILE or avio today.) It's a chaos: most streams do not actually check the mode parameter like they should. Simplify it, and let streams signal availability of write mode by setting a flag in the stream info struct.
* stream: don't use end_poswm42014-05-241-3/+3
| | | | | | | | | | | | | | | | | | | Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The advantage is that always the correct size will be used. There can be no doubt anymore whether the end_pos value is outdated (as it happens often with files that are being downloaded). Some streams still use end_pos. They don't change size, and it's easier to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a STREAM_CTRL_GET_SIZE implementation to these streams. Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was uint64_t before). Remove the seek flags mess, and replace them with a seekable flag. Every stream must set it consistently now, and an assertion in stream.c checks this. Don't distinguish between streams that can only be forward or backwards seeked, since we have no such stream types.
* stream_smb: increase to 128k read_chuuk from default 8kKevin Mitchell2014-05-121-0/+1
| | | | | | | | | | | | | | | | | Previous to this commit, read_chunk was not set in stream_smb. The cache was therefore filled in small 8K chunks. This resulted in poor performance when compared to, for example, smbnetfs on the same network. The value of 128k is chosen both because it is emperically the "levelling off point" for throughput into mpv's cache, and because it is the value chosen by smbnetfs when serving smb shares to mpv. Note that this change has no effect unless --cache is explicitly specified as smb:// streams do not activate cache by default. This is because the default cache size of 320K is so small it actually makes smb:// perfomance worse. For best results use at least --cache=1024.
* Kill all tabswm42014-04-131-1/+1
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* stream_smb: remove dead codewm42013-12-221-22/+1
| | | | | Yep, smb_username/password were unused since forever, even in MPlayer. Removal untested. (Does anyone even use smb://?)
* stream: mp_msg conversionswm42013-12-211-4/+4
| | | | We also drop some slave mode stuff from stream_vcd.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-1/+1
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgwm42013-12-161-2/+2
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* stream: fix url_options field, make protocols field not fixed lengthwm42013-08-261-3/+3
| | | | | | | | | | | | | | | | | | | | The way the url_options field was handled was not entirely sane: it's actually a flexible array member, so it points to garbage for streams which do not initialize this member (it just points to the data right after the struct, which is garbage in theory and practice). This was not actually a problem, since the field is only used if priv_size is set (due to how this stuff is used). But it doesn't allow setting priv_size only, which might be useful in some cases. Also, make the protocols array not a fixed size array. Most stream implementations have only 1 protocol prefix, but stream_lavf.c has over 10 (whitelists ffmpeg protocols). The high size of the fixed size protocol array wastes space, and it is _still_ annoying to add new prefixes to stream_lavf (have to bump the maximum length), so make it arbitrary length. The two changes (plus some more cosmetic changes) arte conflated into one, because it was annoying going over all the stream implementations.
* stream: don't require streams to set s->pos in seek callbackwm42013-08-221-2/+1
| | | | Instead, set s->pos depending on the success of the seek callback.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-2/+2
| | | | Followup commit. Fixes all the files references.
* stream: redo URL parsing, replace m_struct usage with m_configwm42013-08-021-26/+1
| | | | | | | | | | | | | Move the URL parsing code from m_option.c to stream.c, and simplify it dramatically. This code originates from times when http code used this, but now it's just relict from other stream implementations reusing this code. Remove the unused bits and simplify the rest. stream_vcd is insane, and the priv struct is different on every platform, so drop the URL parsing. This means you can't specify a track anymore, only the device. (Does anyone use stream_vcd? Not like this couldn't be fixed, but it doesn't seem worth the effort, especially because it'd require potentially touching platform specific code.)
* stream: remove useless author/comment fieldswm42013-07-121-3/+2
| | | | | | | | | These were printed only with -v. Most streams had them set to useless or redundant values, so it's just badly maintained bloat. Since we remove the "author" field too, and since this may have copyright implications, we add the contents of the author fields to the file headers, except if the name is already part of the file header.
* stream: remove fd memberwm42013-07-121-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | Stream implementations could set this to a unix file descriptor. The generic stream code could use it as fallback for a few things. This was confusing and insane. In most cases, the stream implementations defined all callbacks, so setting the fd member didn't have any advantages, other than avoiding defining a private struct to store it. It appears that even if the stream implementation used close() on the fd (or something equivalent), stream.c would close() it a second time (and on windows, even would call closesocket()), which should be proof for the insanity of this code. For stream_file.c, additionally make sure we don't close stdin or stdout if "-" is used as filename. For stream_vcd.c, remove the control() code. This code most likely didn't make the slightest sense, because it used a different type for stream->priv. It also leaked memory. Maybe it worked, but it's incorrect and insignificant anyway, so kill it. This code was added with commit 9521c19 (svn commit 31019). Untested for all protocols other than stream_file.c.
* stream: don't require streams to set a typewm42013-07-121-1/+0
| | | | | Set the type only for streams that have special treatment in other parts of the code.
* core: change open_stream and demux_open signaturewm42013-07-121-1/+2
| | | | | | | | | | | This removes the dependency on DEMUXER_TYPE_* and the file_format parameter from the stream open functions. Remove some of the playlist handling code. It looks like this was needed only for loading linked mov files with demux_mov (which was removed long ago). Delete a minor bit of dead network-related code from stream.c as well.
* stream: don't set EOF flag in stream implementationswm42013-06-161-1/+0
| | | | | | | | | | EOF should be set when reading more data fails. The stream implementations have nothing to say here and should behave correctly when trying to read when EOF was actually read. Even when seeking, a correct EOF flag should be guaranteed. stream_seek() (or actually stream_seek_long()) calls stream_fill_buffer() at least once, which also updates the EOF flag.
* stream, demux: replace off_t with int64_twm42012-11-201-2/+2
| | | | | | On reasonable systems, these types were the same anyway. Even on unreasonable systems (seriously, which?), this may reduce potential breakage.
* stream: change STREAM_CTRL_GET_SIZE argument type to uint64_treimar2012-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Update endpos each time libavformat asks for it. Fixes playback of still downloading files to not stop before we really reached the end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35107 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c Change STREAM_CTRL_GET_SIZE argument type from off_t to uint64_t. Also fix the incorrect type of the uint64_res variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35360 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c libmpdemux/muxer_lavf.c Note: also merges the "forgotten" cache support from r35107.
* Rename directories, move files (step 2 of 2)wm42012-11-121-3/+3
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* Merge branch 'mplayer1_changes'Uoti Urpala2011-05-021-2/+10
|\
| * stream: Make stream_write_buffer() check for short writesranma2011-04-121-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of the calling sites to stream_write_buffer were checking the return value to see if all bytes got written (nothing in current code actually calls it any more after MEncoder was removed). This was causing (very occasionally) problems with mencoder when using output pipes AND running under a sandbox or when being straced (ptrace is the culprit). Theoretically this problem can happen without pipes or ptrace. Only stream_file, stream_smb and stream_ffmpeg implement write_buffer and ffmpeg already handles this internally. Original patch by Sang-Uok Kum. Signed-off-by: Tobias Diedrich <ranma@google.com> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32881 b3059339-0415-0410-9bf9-f77b7e298cf2
* | cleanup: avoid various GCC warningsClément Bœsch2011-04-201-1/+0
|/
* Delete things related to old translation systemUoti Urpala2010-03-101-1/+0
| | | | | Remove the help/ subdirectory, configure code to create toplevel help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
* Merge svn changes up to r30475Uoti Urpala2010-03-091-0/+17
|\
| * Add license header to all files missing it in the stream subdirectory.diego2010-01-301-0/+17
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30468 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29962Uoti Urpala2009-11-231-1/+1
|\|
| * Finally rename the STREAM_SEEK define to MP_STREAM_SEEK, there are just too manyreimar2009-11-221-1/+1
| | | | | | | | | | | | | | name clashes, in particular with Windows headers (which define STREAM_SEEK as an enum type). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29962 b3059339-0415-0410-9bf9-f77b7e298cf2
| * whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-17/+17
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Remove trailing whitespace from most filesUoti Urpala2009-07-071-17/+17
| |
* | Translation system changes part 2: replace macros by stringsAmar Takhar2009-07-071-2/+2
| | | | | | | | | | Replace all MSGTR_ macros in the source by the corresponding English string.
* | Translation system changes part 1: wrap translated stringsAmar Takhar2009-07-071-2/+2
|/ | | | | Replace mp_msg() calls which have a translated string as the format argument with mp_tmsg and add _() around all other translated strings.
* stream_opts should be constreimar2008-01-131-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25719 b3059339-0415-0410-9bf9-f77b7e298cf2
* stream_opts arrays should be constreimar2007-12-021-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25270 b3059339-0415-0410-9bf9-f77b7e298cf2
* Mark all stream_info_t as constreimar2007-12-021-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25239 b3059339-0415-0410-9bf9-f77b7e298cf2
* cosmetics: typo fix UNSUPORTED --> UNSUPPORTEDdiego2007-08-281-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24277 b3059339-0415-0410-9bf9-f77b7e298cf2
* truncate mencoder's output file if it exists, instead of overwriting just ↵lorenm2007-03-051-1/+1
| | | | | | part of it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22469 b3059339-0415-0410-9bf9-f77b7e298cf2
* reindented after yesterday's commitnicodvb2006-12-201-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21704 b3059339-0415-0410-9bf9-f77b7e298cf2
* support for writing over smb sharesnicodvb2006-12-191-6/+23
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21690 b3059339-0415-0410-9bf9-f77b7e298cf2
* introduce new 'stream' directory for all stream layer related components and ↵ben2006-07-311-0/+148
split them from libmpdemux git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19277 b3059339-0415-0410-9bf9-f77b7e298cf2