summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | OSX: fix compilation with 10.7 SDKStefano Pigozzi2013-06-194-1/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent work in the OS X parts of the code started using clang's support for Obj-C's support for Literals and Subscripting. These particular language features remove a lot of boilerplate code and allow to interact with collections as consicely as one would do in scripting languages like Ruby or Python. Even if these are compiler features, Subscripting needs some runtime support. This is provided with libarclite (coming with the compiler), but we need to add the proper method definitions since the 10.7 SDK headers do not include them. That is because 10.7 shipped before this language features. This will cause some warnings when compiling with the 10.7 SDK because the commit also redefines BOOL to make autoboxing/unboxing of BOOL literals to work. If you need to test this for whatever reason on 10.8, just pass in the correct SDK to configure's extra cflags: ./configure --extra-cflags='-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' Fixes #117
* | | | ao_wasapi0: add new wasapi event mode aoJonathan Yong2013-06-184-1/+892
| | | |
* | | | vo_lavc: remove unused variablewm42013-06-181-1/+1
| | | |
* | | | configure: remove redundant WINVER setJonathan Yong2013-06-181-1/+1
| | | |
* | | | cache: fix stream_pts cachingwm42013-06-181-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Or rather, keep hacking it until it somehow works. The problem here was that trying to avoid calling STREAM_CTRL_GET_CURRENT_TIME too often didn't really work, so the cache sometimes returned incorrect times. Also try to avoid the situation that looking up the time with an advanced read position doesn't really work, as well as when trying to look it up when EOF or cache end has been reached. In that case we have read_filepos == max_filepos, which is "outside" of the cache, but querying the time is still valid. Should also fix the issue that demuxing streams with demux_lavf and if STREAM_CTRL_GET_CURRENT_TIME is not supported messed up the reported playback position. This stuff is still not sane, but the way the player tries to fix the playback time and how the DVD/BD stream inputs return the current time based on the current byte position isn't sane to begin with. So, let's leave it at bad hacks. The two changes that touch s->eof are unrelated and basically of cosmetic nature (separate commit would be too noisy.)
* | | | sd_srt: handle '<font color="##FFA500">'wm42013-06-181-0/+2
| | | | | | | | | | | | | | | | Wow this is stupid.
* | | | osdep: remove shmem wrapperwm42013-06-186-170/+0
| | | | | | | | | | | | | | | | This is unused now that the cache is always threaded.
* | | | cache: actually use time instead of retry count for slow cache warningwm42013-06-181-9/+11
| | | | | | | | | | | | | | | | | | | | There's actually no reason to maintain a retry count, and this is more robust against spurious wakeups.
* | | | vo_lavc: do NOT fill pict_type from the mp_imageRudolf Polzer2013-06-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doing this makes the encoder force the same pict type as original, which is often not even possible. Rather let the codec decide! As there is no documented value to mean "decoder shall pick", I rather save/restore the default value filled by libavcodec.
* | | | vo_lavc: use mp_image_copy_fields_to_av_frameRudolf Polzer2013-06-171-4/+1
|/ / /
* | | cache: fix build on OSX (again)wm42013-06-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSX doesn't support the POSIX API we were using. We check for _POSIX_TIMERS. 0 or -1 means unsupported. See: http://pubs.opengroup.org/onlinepubs/009696699/functions/clock_getres.html http://pubs.opengroup.org/onlinepubs/009696699/basedefs/unistd.h.html The workaround of using gettimeofday() is suggested by Apple: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/pthread_cond_timedwait.3.html Thanks to AStorm for providing help here.
* | | cache: fix compilation on Libavwm42013-06-161-1/+8
| | | | | | | | | | | | Appears Libav doesn't have av_clip64(). So implement our own.
* | | cache: use correct header for clock_gettimewm42013-06-161-0/+1
| | | | | | | | | | | | Fixes compilation on OSX.
* | | ao_dsound: fix compilationwm42013-06-161-0/+2
| | |
* | | configure: make check for stream cache verbosewm42013-06-162-2/+5
| | | | | | | | | | | | | | | Also add a minor comment about the stream cache needing pthreads now to DOCS/crosscompile-mingw.txt.
* | | Merge branch 'cache_new'wm42013-06-1627-1049/+907
|\ \ \
| * | | stream: don't set sector size on cachewm42013-06-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useless on the cache side. The sector is needed only to deal with stream implementations which are not byte addressable, and the cache is always byte addressable. Also set a default read_chunk value. (This value is never used unless you chain multiple caches, but it's cleaner.)
| * | | cache: attempt to improve slow cache warningwm42013-06-161-26/+35
| | | | | | | | | | | | | | | | | | | | Still sucks. The old cache behavior (before removing the fork code) wasn't great either, though.
| * | | cache: report more precise stream timewm42013-06-161-9/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DVD and bluray packet streams carry (essentially) random timestamps, which don't start at 0, can wrap, etc. libdvdread and libbluray provide a linear timestamp additionally. This timestamp can be retrieved with STREAM_CTRL_GET_CURRENT_TIME. The problem is that this timestamp is bound to the current raw file position, and the stream cache can be ahead of playback by an arbitrary amount. This is a big problem for the user, because the displayed playback time and actual time don't match (depending on cache size), and relative seeking is broken completely. Attempt to fix this by saving the linear timestamp all N bytes (where N = BYTE_META_CHUNK_SIZE = 16 KB). This is a rather crappy hack, but also very effective. A proper solution would probably try to offset the playback time with the packet PTS, but that would require at least knowing how the PTS can wrap (e.g. how many bits is the PTS comprised of, and what are the maximum and reset values). Another solution would be putting the cache between libdvdread and the filesystem/DVD device, but that can't be done currently. (Also isn't that the operating system's responsibility?)
| * | | stream: don't align stream position if not neededwm42013-06-161-3/+1
| | | | | | | | | | | | | | | | | | | | This is pointless, and just increases latency on seeking. For streams that have a sector size set, this is still needed, though.
| * | | stream: don't adjust stream position if seek succeeds, but read failswm42013-06-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This was probably done this way to ensure that after a successful seek, the reported stream position is the same as the requested seek position. But it doesn't make too much sense, since both stream->pos and the stream implementation's internal position will go out of sync.
| * | | stream: fix some aspects of EOF handlingwm42013-06-162-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stream EOF flag should only be set when trying to read past the end of the file (relatively similar to unix files). Always clear the EOF flag on seeking. Trying to set it "properly" (depending whether data is available at seek destination or not) might be an ok idea, but would require attention to too many special cases. I suspect before this commit (and in MPlayer etc. too), the EOF flag wasn't handled consistently when the stream position was at the end of the file. Fix one special case in ebml.c and stream_skip(): this function couldn't distinguish between at-EOF and past-EOF either.
| * | | stream: don't set EOF flag in stream implementationswm42013-06-167-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: remove stream_reset()wm42013-06-168-25/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function was called in various places. Most time, it was used before a seek. In other cases, the purpose was apparently resetting the EOF flag. As far as I can see, this makes no sense anymore. At least the stream_reset() calls paired with stream_seek() are completely pointless. A seek will either seek inside the buffer (and reset the EOF flag), or do an actual seek and reset all state.
| * | | stream: check for interruption when trying to reconnect streamwm42013-06-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This happens with something like "mpv https://www.youtube.com/watch". The URL is obviously not valid, but the stream layer tries to reconnect. This commit at least allows to use the terminal to abort gracefully. (Other than killing the process.)
| * | | stream: cosmeticswm42013-06-162-26/+12
| | | |
| * | | stream: reset buffer even on EOF/errorwm42013-06-161-4/+2
| | | | | | | | | | | | | | | | This probably didn't matter anywhere, but it's more proper.
| * | | cache: use threads instead of fork()wm42013-06-166-553/+425
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically rewrite all the code supporting the cache (i.e. anything other than the ringbuffer logic). The underlying design is untouched. Note that the old cache2.c (on which this code is based) already had a threading implementation. This was mostly unused on Linux, and had some problems, such as using shared volatile variables for communication and uninterruptible timeouts, instead of using locks for synchronization. This commit does use proper locking, while still retaining the way the old cache worked. It's basically a big refactor. Simplify the code too. Since we don't need to copy stream ctrl args anymore (we're always guaranteed a shared address space now), lots of annoying code just goes away. Likewise, we don't need to care about sector sizes. The cache uses the high-level stream API to read from other streams, and sector sizes are handled transparently.
| * | | stream: add partial read functionwm42013-06-162-17/+28
| | | | | | | | | | | | | | | | | | | | This is a nice way to avoid an additional copy of the data when reading with stream_read().
| * | | demux_lavf: change probing, use stream_unread_buffer()wm42013-06-161-31/+33
| | | | | | | | | | | | | | | | | | | | This fixes a longstanding issue with demux_lavf probing. See previous commit.
| * | | stream: add stream_unread_buffer()wm42013-06-162-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | demux_lavf probes up to 2 MB of data in the worst case. When the ffmpeg demuxer is actually opened, the stream is seeked back to 0, and the previously read data is thrown away. This wasn't a problem for playback of local files, but it's less than ideal for playing from slow media (like web streams), and breaks completely if the media is not seekable (pipes, some web streams). This new function is intended to allow fixing this. demux_lavf will use it to put the read probe data back into the buffer. The simplest way of implementing this function is by making it transparently extend the normal stream buffer. This makes sure no existing code is broken by new weird special cases. For simplicity and to avoid possible performance loss due to extra dereferencing when accessing the buffer, we just extend the static buffer from 8 KB to 2 MB. Normally, most of these 2 MB will stay uncommitted, so there's no associated waste of memory. If demux_lavf really reads all 2 MB, the memory will be committed and stay unused, though.
| * | | cache: make the stream cache a proper stream that wraps other streamswm42013-06-168-352/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the cache wa