summaryrefslogtreecommitdiffstats
path: root/stream
Commit message (Collapse)AuthorAgeFilesLines
* stream: use libavformat interrupt callbackwm42014-04-251-1/+12
| | | | | | This will allow to cancel opening slow/stuck network streams faster. How well his work probably depends on the protocol implementation in libavformat.
* stream: remove interrupt callback global variableswm42014-04-253-28/+8
| | | | | | | | | | | | This used global variables for the asynchronous interrupt callback. Pick the simple and dumb solution and stuff the callback into mpv_global. Do this because interrupt checking should also work in the connect phase, and currently stream creation equates connecting. Ideally, this would be passed to the stream on creation instead, or connecting would be separated from creation. But since I don't know yet which is better, and since moving stream/demuxer into their own thread is something that will happen later, go with the mpv_global solution.
* stream: use uninterruptible sleep on reconnectingwm42014-04-251-2/+8
| | | | | | | | | | This is the only function which actually used the time argument of stream_check_interrupt(). Considering that the whole player freezes anyway, this is not worth the complication. Also generally reduce the maximum wait time due to timeout. Introduce exponential backoff, which makes the first reconnect retries faster, but still waits up to 500ms in the later retries.
* stream: remove unused functionswm42014-04-251-25/+0
| | | | | | | Interestingly, their last use was removed with commit bbbea793, over 4 months ago. Also remove a stray struct demux_stream forward declaration.
* cache: remove redundant log prefixwm42014-04-231-1/+1
|
* threads: fix function namewm42014-04-231-2/+2
| | | | Closer to the corresponding standard function pthread_cond_timedwait.
* Fix some libav* include statementswm42014-04-192-2/+1
| | | | | | | | | | | | | Fix all include statements of the form: #include "libav.../..." These come from MPlayer times, when FFmpeg was somehow part of the MPlayer build tree, and this form was needed to prefer the local files over system FFmpeg. In some cases, the include statement wasn't needed or could be replaced with mpv defined symbols.
* stream_dvdnav: print more debugging infowm42014-04-171-1/+6
|
* stream_dvd: fix seeking regressionwm42014-04-171-8/+48
| | | | | | | | | | | | This was accidentally completely destroyed with commit 24f1878e. I didn't notice it when testing, because forward seeking still worked mostly. The issue was that dvd_seek_to_time() actually called stream_seek(), which was supposed to call the byte-level seek function dvd_seek(). So we have to restore this function, and replace all generic stream calls with stream_dvd.c internal ones. This also affects stream->pos (now a random number as far as stream_dvd.c is concerned) and stream_skip().
* Remove radio://wm42014-04-133-1040/+0
| | | | | It was disabled by default, works only for analogue radio, and I bet nobody uses it.
* Kill all tabswm42014-04-1323-2382/+2382
| | | | | | | | | | | 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_dvd, cache: hack seeking with --cache + dvd:// back into workingwm42014-04-092-41/+1
| | | | | | | | | | | | | | | | | | | This was broken at some unknown point (even before the recent cache changes). There are several problems: - stream_dvd returning a random stream position, confusing the cache layer (cached data and stream data lost their 1:1 corrospondence by position) - this also confused the mechanism added with commit a9671524, which basically triggered random seeking (although this was not the only problem) - demux_lavf requesting seeks in the stream layer, which resulted in seeks in the cache or the real stream Fix this by completely removing byte-based seeking from stream_dvd. This already works fine for stream_dvdnav and stream_bluray. Now all these streams do time-based seeks, and pretend to be infinite streams of data, and the rest of the player simply doesn't care about the stream byte positions.
* cache: fix description of the offset fieldwm42014-04-091-1/+3
| | | | This field sure is a bit strange. I hope the description is correct now.
* cache: change a define to an enumwm42014-04-091-3/+3
| | | | More consistent.
* cache: fix checks/output on initializationwm42014-04-091-8/+3
| | | | | | | resize_cache() checks the size itself and clamps the size to the valid range if necessary, so we don't need these checks. In fact, the checks are different. Also, output the cache size after clamping, instead of before.
* stream_file: Check the handle for network streamsJames Ross-Gowan2014-04-091-9/+34
| | | | | | | | | | | | | | | | | | | Use NtQueryVolumeInformationFile instead of GetDriveType for detecting remote filesystems on Windows. This has the advantage of working directly on the file handle instead of needing a path and it works unmodified in Cygwin where the previous code wouldn't understand Cygwin paths or symlinks. There is some risk in using NtQueryVolumeInformationFile, since it's an internal function and its behaviour could change at any time or it could be removed in a future version of Windows, however it's documented[1] in the WDK and it's used successfully by Cygwin, so it should be fine. If it's removed, the code should fail gracefully by treating all files as local. [1]: http://msdn.microsoft.com/en-us/library/windows/hardware/ff567070.aspx Signed-off-by: wm4 <wm4@nowhere>
* cache: simplifywm42014-04-091-25/+17
| | | | | | | Merge the cache_read function into cache_fill_buffer, since there's not much reason to keep them separate. Also, simply call read_buffer() to see if there's any readable data, instead of checking for the condition manually.
* cache: allow resizing at runtimewm42014-04-092-21/+78
| | | | | | | | | | | The only tricky part is keeping the cache contents, which is made simple by allocating the new cache while still keeping the old cache around, and then copying the old data. To explain the "Don't use this when playing DVD or Bluray." comment: the cache also associates timestamps to blocks of bytes, but throws away the timestamps on seek. Thus you will experience strange behavior after resizing the cache until the old cached region is exhausted.
* cache: minor simplificationwm42014-04-091-11/+7
| | | | | | | | The only difference is that the MP_DBG message is not printed anymore if the current user read position is outside of the current cache range. (In order to handle seek_limit==0 gracefully in the normal case of linear reading, change the comparison from ">=" to ">".)
* cache: adjust stream position if necessarywm42014-04-091-1/+6
| | | | | | | | | Until now, this could never happen, because new data was simply always appended to the end of the cache. But for making stream cache resizing easier, doing it this way seems advantageous. It also makes it harder to make the internal state inconsistent. (Before this change it could happen that cache and stream position went out of sync if the read position was adjusted "inappropriately".)
* cache: no short reads in read_bufferwm42014-04-091-16/+21
| | | | | | | Until now, cache_read() (which calls read_buffer()) could return short reads. This was a simplification allowed by the stream interface. But for cache resizing, it will be more practical to make read_buffer() do a full read.
* cache: move ringbuffer read into a separate functionwm42014-04-091-17/+32
| | | | No functional changes yet.
* cache: fix typo in commentwm42014-04-091-1/+1
|
* cache: always update cached controls after running a stream controlwm42014-04-091-0/+1
| | | | | | | Seems like a good idea. One possible bad effect would be slowing down uncached controls, but they're already slow. The good thing is that many controls make intrusive changes to the stream (at least controls which do write accesses), so the cached parameters should be updated.
* stream_bluray: move lookup of AACS error codes into a functionwm42014-03-301-30/+16
| | | | Mostly a cosmetic change. Makes the code a little bit shorter.
* stream_bluray: check AACS and BD+ protectionsxylosper2014-03-301-5/+80
| | | | | | | There are two kind of encryption for Blu-ray disc, AACS and BD+, and both of them can be checked through BLURAY_DISC_INFO object. This commit makes the bluray and bdnav streams refuse playback if AACS/BD+ is detected and decryption is failed.
* player: rename dvdnav to discnavxylosper2014-03-303-2/+2
| | | | | Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore, rename all 'dvdnav' strings which are not DVD specific to 'discnav'
* stream_bluray: cosmetic refactoringxylosper2014-03-301-74/+33
| | | | | Remove unused variables. Declare variables when they are needed. Adjust brackets for mpv's convention. Clean up too many empty lines.
* stream_bluray: select initial angle only if peeking title succeededxylosper2014-03-301-39/+52
| | | | | | The angles should be set and queried only if a valid title is selected. Also, in navigation mode, there are some limitations which make it impossible to query current title/angle.
* stream_bluray: use more proper error code for stream controlxylosper2014-03-301-7/+7
| | | | | | Use STREAM_OK instead of hardcoded value 1. Handle failure of setting title as an unsupported behaviour rather than an error.
* stream_bluray: implement navigation interface for Blu-ray streamxylosper2014-03-293-62/+447
| | | | | | | | | | | | | | This commit introduces new stream protocols: bdnav(and others). bdnav stream shares lots of codes with original bluray stream, so it's not separated in different source file. Major difference from bluray is that bdnav does not support longest title because there is no way to query that information. bdnav://menu and bdnav://first correspond to top menu title and first play title respectively, though they often point same title. Also, binary position based seeking has been removed, because it didn't have no point.
* stream_bluray: remove BD_EVENT_IDLEwm42014-03-261-3/+0
| | | | | | | | This was actually supposed to be removed with pull reuqest #671, but I accidentally re-added it with a rebasing mistake. This probably also coincidentally fixes compilation with older libbluray (issue #672).
* stream_bluray: use bd_get_playlist_info()xylosper2014-03-261-4/+10
| | | | | | | | Use bd_get_playlist_info() instead of bd_get_title_info(). The previous implementation couldn't query current playlist and this made it impossible to call bd_get_playlist_info() which is more desirable than bd_get_title_info() because, for Blu-rays, playlist is the unit of playback not title. This commit fixes that.
* stream_bluray: cache current playback informationsxylosper2014-03-261-20/+34
| | | | | | | | The cost of calling bd_get_title_info() is quite expensive and requires lots of CPU usage. Using BD_EVENT_PLAYLIST and BD_EVENT_TITLE, it's possible to cache BLURAY_TITLE_INFO object for current title and BD_EVENT_ANGLE handler caches current angle. In my test case, with this commit, CPU usage can be saved about 15-20%.
* stream_bluray: implement event handler for libblurayxylosper2014-03-261-0/+16
| | | | | | This commit brings libbluray's event queue into stream_bluray. Signed-off-by: wm4 <wm4@nowhere>
* mf: fix operation with --cachewm42014-03-261-0/+1
| | | | | | | | | | | | demux_mf.c explicitly checks for the stream type to check whether images are opened via pattern (mf://..., i.e. stream_mf.c) or directly. Of course the stream type is not set to STREAMTYPE_MF if the stream is wrapped through the cache, so it tried to open the pattern directly as file, which failed. Fix this by disabling caching for mf://. The cache doesn't make sense here anyway, because each file is opened and closed every frame (perhaps to avoid memory bloat).
* stream_cdda: print cd text header only if there are any cd text fieldswm42014-03-261-2/+6
|
* stream_cdda: remove unused stuffwm42014-03-263-251/+2
| | | | | | This cd_info_t struct was practically unused. The only thing it did was storing the track name of the form "Track %d" in a very roundabout way. Remove it. (It made more sense when there was still CDDB support.)
* stream_cdda: fix track time accuracywm42014-03-261-2/+2
| | | | | | | | | | Don't use an integer division to get the time, since that would round on second boundaries. Also round up the time by sector size. Seeking rounds down due to alignment constraints, but if we round up the time, we can make it land on the exact destination sector. This fixes that the track change code printed the previous track when seeking by chapter.
* dvdnav: make MP_NAV_EVENT_RESET_ALL handled properlyxylosper2014-03-251-30/+37
| | | | | | | | | | | dvdnav.c did not handle event in regular sequence. Usually this does not make any trouble except around MP_NAV_EVENT_RESET_ALL. Those events should be handled in regular sequence. If they're mixed, it can make wrong result. For instance, MP_NAV_EVENT_HIGHLIGHT right after MP_NAV_EVENT_RESET_ALL should not be ignored but it might be because MP_NAV_EVENT_RESET_ALL makes the demuxer reloaded and osd hidden.
* stream: remove old chapter handling codewm42014-03-255-103/+0
| | | | | | | | Stream-level chapters (like DVD etc.) did potentially not have timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've switched everything to use timestamps and that seems to work, so we can simplify the code and remove this old mechanism.
* stream_cdda: report track timeswm42014-03-251-27/+8
| | | | | | | | | Report the time for each chapter (tracks are treated as chapters). This allows us to get rid of the "old" chapter mechanism, and also behaves better with the frontend. This makes assumptions about the audio formats, but that format is hardcoded anyway in the rawaudio demuxer defaults (and always was).
* stream_bluray: fix for significant memory leakxylosper2014-03-241-0/+1
| | | | | It's obvious but, since STREAM_CTRL_GET_TIME_LENGTH is called frequently, the amount of leaked memory here is quite big.
* stream_bluray: fix for zero-based title index for Blu-rayxylosper2014-03-181-7/+11
| | | | | | | | | | The title for stream_bluray DID start from 1 and I misunderstood that it started from 0 because mpv accepted bd://0 as a proper argument. In fact, 0 title was an alias for the longest title but it was not handled as a special value. This commit fixes these behavious. 'disc-title' property for Blu-ray now starts from 0 and the default title can be specified by 'longest' title just like stream_dvdnav: bd://longest. Of course, 'longest' can be omitted.
* command: make 'disc-title' property writablexylosper2014-03-181-1/+8
| | | | | | | | This commit makes 'disc-title' property writable using STREAM_CTRL_SET_CURRENT_TITLE. This commit also contains implementation of STREAM_CTRL_SET_CURRENT_TITLE for stream_bluray. Currently, 'disc-title' is writable only for stream_dvdnav and stream_bluray and stream_dvd is not supported.
* stream_dvd/stream_dvdnav: make disc-title for DVDs start from 0xylosper2014-03-172-27/+35
| | | | | | | | This commit makes 'disc-title' properties for DVDs start from 0. There was an inconsistency around 'disc-title' property between DVDs (from 1) and Blu-rays (from 0). This fixes #648. Signed-off-by: wm4 <wm4@nowhere>
* Remove some more unneeded version checkswm42014-03-161-11/+2
| | | | | All of these check against things that happened before the latest supported FFmpeg/Libav release.
* stream_dvdnav: implement STREAM_CTRL_GET_NUM_TITLES for dvdnavxylosper2014-03-151-0/+7
| | | | | | This commit provides impelmentation of STREAM_CTRL_GET_NUM_TITLES for dvdnav stream. Other streams for DVD or Blu-ray are already provide STREAM_CTRL_GET_NUM_TITLES.
* command: set 'media-title' property for bluray disc with meta-dataxylosper2014-03-135-11/+19
|
* stream_file: network file system detection for LinuxPhilip Sequeira2014-03-121-0/+28
| | | | | | Addresses issue #558 on Linux systems. Signed-off-by: wm4 <wm4@nowhere>
* dvd: treat missing volume ID as "unsupported", not errorwm42014-02-232-4/+4
| | | | | This is probably better and more consistent with the rest of the code, although it doesn't change any currently existing behavior in this case.
* cache: cache DVD volume IDwm42014-02-231-0/+13
| | | | | Since this might be queried every frame or so, it's important not to stall the cache by doing a synchronous stream_control().
* dvd: check for empty DVD volume IDwm42014-02-232-3/+7
| | | | | The only DVD sample I have just returns an empty string for this. Let command.c use the filename if the ID is empty.
* command: use DVD volume ID for media-title propertyxylosper2014-02-233-0/+17
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Closes #582.
* stream_file: cache remote files on WindowsJames Ross-Gowan2014-02-181-0/+17
| | | | Same as 6896469 but for Windows.
* stream_file: activate cache with files on network file systemsStefano Pigozzi2014-02-171-0/+28
| | | | | | | | Detected 'protocols' are AFP, nfs, smb and webdav. This can be extended on request. This is currently only implemented for BSD systems (using fstatfs). This addresses issue #558 on the above platforms.
* stream_lavf: prefix icy metadata with "icy-"wm42014-02-061-1/+1
| | | | | ICY metadata is not always of good quality, and especially if there are proper tags. We don't want the ICY metadata override the tags.
* cache: refuse to seek outside of cache boundarieswm42014-01-311-4/+18
| | | | | | | | | | | | | | | | | Note that this still happens in the stream level, so we can't have nice highlevel behavior restricting seeking. Instead, if a seek leads to the demuxer requesting data outside of the cached range, the seek will simply fail. This might confuse the demuxer, and the resulting behavior is not necessarily useful. Note that this also doesn't try to skip data on a forward seek. This would just freeze the stream with slow unseekable streams. One nice thing is that stream.h has a separate function for merely skipping data (separate from seeking forward), which is pretty useful in this case: we want skipping of data to work, even if we reject seeking forward by skipping data as too expensive. This probably is or will be useful for demux_mkv.c.
* stream_pvr: Fix fd check, -1 indicates invalid, not 0.reimar2014-01-231-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36677 b3059339-0415-0410-9bf9-f77b7e298cf2
* stream: print stream_read_line warnings by defaultwm42014-01-191-1/+1
| | | | | | | | This is probably ok. Probing could hit this case very often, since it'll mean running this function on potentially binary data, but on the other hand, probing usually uses a memory stream (to limit the amount of data read), and memory streams have s->log silenced (details see open_memory_stream()).
* stream: treat embedded 0 bytes as error in stream_read_linewm42014-01-191-1/+1
| | | | Text files should never contain these.
* stream: redo stream_read_line()wm42014-01-191-114/+54
| | | | | | | | | This simplifies the implementation and should make it more robust. For example, we return an error if a line is longer than the provided buffer (instead of splitting the line). The code is much shorter, because now finding the new line and reading characters is done in one go.
* cookies.c: cols must (and does) have 7 elements.reimar2014-01-191-1/+1
| | | | | | | Doesn't affect the generated code, but avoids confusion in both humans and newer Coverity versions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36623 b3059339-0415-0410-9bf9-f77b7e298cf2
* vcd_read: Fix sizeof argument.reimar2014-01-191-1/+1
| | | | | | | | | The struct we need to copy is actually a cdrom_msf0, not cdrom_msf. Even though the kernel for no good reason reads it in as a cdrom_msf struct, but only