summaryrefslogtreecommitdiffstats
path: root/stream
Commit message (Collapse)AuthorAgeFilesLines
* player: load external subs for uncompressed rar archiveswm42013-12-062-0/+13
| | | | | | | | | | | | Uncompressed rar archives can be transparently opened, but the filename the player doesn't have the direct filename (but something starting with rar://... instead). This will lead to external subtitles not being loaded. This doesn't handle multi-volume rar files, but in that cases just use the --autosub-match=fuzzy option. Fixes #397 on github.
* Use O_CLOEXEC when creating FDswm42013-11-309-16/+32
| | | | | | | | | | | | | | This is needed so that new processes (created with fork+exec) don't inherit open files, which can be important for a number of reasons. Since O_CLOEXEC is relatively new (POSIX.1-2008, before that Linux specific), we #define it to 0 in io.h to prevent compilation errors on older/crappy systems. At least this is the plan. input.c creates a pipe. For that, add a mp_set_cloexec() function (which is based on Weston's code in vo_wayland.c, but more correct). We could use pipe2() instead, but that is Linux specific. Technically, we have a race condition, but it won't matter.
* build: make pthreads mandatorywm42013-11-281-6/+1
| | | | | | | | | | | pthreads should be available anywhere. Even if not, for environment without threads a pthread wrapper could be provided that can't actually start threads, thus disabling features that require threads. Make pthreads mandatory in order to simplify build dependencies and to reduce ifdeffery. (Admittedly, there wasn't much complexity, but maybe we will use pthreads more in the future, and then it'd become a real bother.)
* Reduce stheader.h includes, move stream types to mp_common.hwm42013-11-234-4/+0
|
* demux: remove gsh field from sh_audio/sh_video/sh_subwm42013-11-231-6/+6
| | | | | | | | | This used to be needed to access the generic stream header from the specific headers, which in turn was needed because the decoders had access only to the specific headers. This is not the case anymore, so this can finally be removed again. Also move the "format" field from the specific headers to sh_stream.
* stream_lavf: fix a small memory leakwm42013-11-211-1/+5
| | | | Also add an explanation why this special code path for rtsp is needed.
* timeline: add edl:// URIswm42013-11-193-0/+24
| | | | | Questionable change from user perspective, but internally needed to implement the next commit. Also useful for testing timeline stuff.
* stream_dvb: remove bogus free callswm42013-11-181-5/+0
| | | | | | The priv struct is now allocated by talloc in stream.c. It doesn't need to be manually freed, and using free() instead of talloc_free() probably crashes.
* stream: split out pthread helper functionwm42013-11-171-26/+3
| | | | Also split the function itself into 3.
* demux: use talloc for certain stream headerswm42013-11-141-1/+1
| | | | | | | Slightly simplifies memory management. This might make adding a demuxer cache wrapper easier at a later point, because you can just copy the complete stream header, without worrying that the wrapper will free the individual stream header fields.
* tvi_v4l2: remove VBI stuffwm42013-11-131-100/+0
| | | | | | | | This used to be needed for teletext support. Teletext commit has been removed (see commit ebaaa41f), and it appears this code is inactive. It was just forgotten with the removal. Get rid of it completely. Untested. (Like all changes to the TV code.)
* tvi_v4l2: let libv4l2 convert to a known pixel formatbugmen0t2013-11-131-47/+58
| | | | | | | | | | | Signed-off-by: wm4 <wm4@nowhere> Significant modifications over the original patch by not overriding syscalls with macros ("#define open v4l2open") for fallback, but the other way around ("#define v4l2open open"). As consequence, the calls have to be replaced throughout the file. Untested, although the original patch probably was tested.
* stream: don't include linux/types.h in some fileswm42013-11-133-4/+0
| | | | | | Apparently this is not portable to FreeBSD. It turns out that we (probably) don't use any symbols defined by this header directly, so the includes are not needed.
* Remove sh_audio->samplesizewm42013-11-093-14/+5
| | | | | | | | | This member was redundant. sh_audio->sample_format indicates the sample size already. The TV code is a bit strange: the redundant sample size was part of the internal TV interface. Assume it's really redundant and not something else. The PCM decoder ignores the sample size anyway.
* audio: replace af_fmt2str_short -> af_fmt_to_strwm42013-11-071-3/+2
| | | | Also, remove all af_fmt2str usages.
* stream_lavf: don't duplicate list of rtmp protocolswm42013-11-041-6/+4
| | | | Assume a rtmp prefix means rtmp instead.
* stream_lavf: support more libavformat protocolswm42013-11-041-1/+3
|
* Merge branch 'master' into have_configurewm42013-11-041-5/+11
|\ | | | | | | | | Conflicts: configure
| * stream: more consistent checks for whether stream is seekablewm42013-11-031-6/+10
| | | | | | | | | | | | | | | | | | Never check s->seek (except in init), because it'd have to check s->flags anyway. Also, for fast skippable streams (like pipes), don't set the bit that indicates support for seek forward. Make sure s->end_pos is always 0 for unseekable streams. Lots of code outside of stream.c uses this to check seeking support.
| * stream: reconnecting doesn't make sense if stream is not seekablewm42013-11-031-0/+2
| | | | | | | | | | | | | | This stops mpv from being stuck in reconnecting at the end of the file with some unseekable streams. Test URL: http://playerservices.streamtheworld.com/pls/CBC_R1_VCR_H.pls
* | configure: uniform the defines to #define HAVE_xxx (0|1)Stefano Pigozzi2013-11-037-72/+72
|/ | | | | | | | | | | | | | | | | | | | | The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1]. For an hypothetic feature 'hurr' you could have had: * #define HAVE_HURR 1 / #undef HAVE_DURR * #define HAVE_HURR / #undef HAVE_DURR * #define CONFIG_HURR 1 / #undef CONFIG_DURR * #define HAVE_HURR 1 / #define HAVE_DURR 0 * #define CONFIG_HURR 1 / #define CONFIG_DURR 0 All is now uniform and uses: * #define HAVE_HURR 1 * #define HAVE_DURR 0 We like definining to 0 as opposed to `undef` bcause it can help spot typos and is very helpful when doing big reorganizations in the code. [1]: http://xkcd.com/927/ related
* Fix some more -Wshadow warningswm42013-11-013-4/+4
| | | | | | These aren't printed with newer gcc or clang versions for some reason. All of them seem to be about local variables shadowing global functions.
* Enable -Wshadowwm42013-11-011-3/+3
| | | | | | | | | This one really did bite me hard (see previous commit), so enable it by default. Fix some cases of shadowing throughout the codebase. None of these change behavior, and all of these were correct code, and just tripped up the warning.
* ao_alsa: don't include alloca.hwm42013-10-251-1/+0
| | | | | | | | It's true that ALSA uses alloca() in some of its API functions, but since this is hidden behind macros in the ALSA headers, we have no reason to include alloca.h ourselves. Might help with portability (FreeBSD).
* tv: simplify ifdefferywm42013-10-171-8/+2
| | | | Too ugly to leave it be.
* Copyright, LICENSE: switch to GPL version 2 or laterwm42013-10-131-1/+2
| | | | | | | | | | | | | | | Now that talloc has been removed, the license can be switched back to GPLv2+. Actually, there never was a GPLv2+ licensed MPlayer (fork or not) until now, but removal of some GPLv2-only code makes this possible now. Rewrite the Copyright file to explain the reasons for the licenses MPlayer and forks use. The old Copyright file didn't contain anything interesting anymore, and all information it contained is available at other places in the source tree. The reason for the license change itself is that it should improve interoperability with differently licensed code in general. This essentially reverts commit 1752808.
* audio/out: add sndio supportChristian Neukirchen2013-10-033-0/+127
| | | | Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
* cosmetics: replace "CTRL" defines by enumswm42013-10-021-25/+27
| | | | Because why not.
* network: add options to control TLS verificationwm42013-09-271-0/+3
|
* mplayer: attempt to make playback resume work with DVD/BDwm42013-09-224-6/+3
| | | | | | | | | | | | | | | | The problem with DVD/BD and playback resume is that most often, the filename is just "dvd://", while the actual path to the DVD disk image is given with --dvd-device. But playback resume works on the filename only. Add a pretty bad hack that includes the path to the disk image if the filename starts with dvd://, and the same for BD respectively. (It's a bad hack, but I want to go to bed, so here we go. I might revert or improve it later, depending on user feedback.) We have to cleanup the global variable mess around the dvd_device. Ideally, this should go into MPOpts, but it isn't yet. Make the code paths in mplayer.c take MPOpts anyway.
* network: fix rtsp playbackwm42013-09-221-1/+1
| | | | | | | | | | | | | | By default, libavformat uses UDP for rtsp playback. This doesn't work very well. Apparently the reason is that the buffer sizes libavformat chooses for UDP are way too small, and switching to TCP gets rid of this issue entirely (thanks go to Reimar Döffinger for figuring this out). In theory, you can set buffer sizes as libavformat options, but that doesn't seem to help. Add an option to select the rtsp transport, and make TCP the default. Also remove an outdated comment from stream.c.
* stream_lavf: print lavf options that could not be setwm42013-09-221-0/+6
| | | | | | | | | Mainly for debugging. Usually, we just set options for all possible protocols, and we can't really know whether a certain protocol is used beforehand. That's also the reason why avio_open2() takes a dictionary, instead of letting the user set options directly with av_opt_set(). Or in other words, we don't know whether an option that could be set is an error or not, thus we print the messages only at verbose level.
* stream_dvd: prevent segmentation fault with some broken filesStefano Pigozzi2013-09-141-2/+2
| | | | | | | I have a sample where some final chapters are missing. This was causing a segmentation fault when trying to fetch chapter times for them. This makes the code ignore those chapters.
* stream_bluray: return number of titleswm42013-09-101-6/+11
| | | | So that the "titles" property returns the number of titles.
* stream: force demuxer of cached stream, fixes cdda:// + cachewm42013-09-101-0/+1
|
* path: add a common mp_is_url() functionwm42013-09-041-4/+3
| | | | Remove the duplicated code.
* tv: attempt to support mjpeg streamswm42013-09-041-2/+6
| | | | | | | | | | MPlayer handles this correctly, because MPlayer still has the FourCC codec dispatch (codecs.conf). We need to handle this case specially, because the libavformat rawvideo decoder will of course not eat mjpeg. mjpeg is the only supported format, though. (Even MPlayer needs to convert between V4L2 formats and MPlayer FourCCs, and mjpeg is the only non-raw format.)
* stream: read at least a full buffer with stream_peek()wm42013-08-281-1/+1
| | | | | | | | | | | | | Until now, stream_peek() read only the bare minimum it had to read from the stream. But this could cause problems, such as being very inefficient when peeking a lot, or conflicting with ability to seek back. (The latter issue can be caused by peeking a few bytes, and then doing a stream_read() with a size that is 1 byte longer: this would read the peeked data, then call stream_fill_buffer(), which throws away the previously peeked bytes - so you can't seek back anymore. This is mitigated by a hack in demux_open(): it peeks a full buffer, to avoid that peeking/reading during demuxer probing [or before that, in a stream filter] can cause the buffer to be dropped.)
* stream: add uncompressed rar supportwm42013-08-265-0/+747
| | | | | | | | | | | | | | | | | Apparently, it is popular to store large files in uncompressed rar archives. Extracting files is not practical, and some media players suport playing directly from uncompressed rar (at least VLC and some DirectShow components). Storing or accessing files this way is completely idiotic, but it is a common practice, and the ones subjected to this practice can't do much to change this (at least that's what I assume/hope). Also, it's a feature request, so we say yes. This code is mostly taken from VLC (commit f6e7240 from their git tree). We also copy the way this is done: opening a rar file by itself yields a playlist, which contains URLs to the actual entries in the rar file. Compressed entries are simply skipped.
* stream: change open code, add stream filter conceptwm42013-08-262-55/+83
| | | | | | | | | | Add a stream filter concept, in which streams can be opened on top of an underlying "source" stream. Change the open code to make this easier, and also to account for some mechanisms that will be needed for this. The following commit will add stream_rar, which contains such a stream filter.
* stream: don't drop buffer when creating the cachewm42013-08-261-3/+0
| | | | | | | | | This is really not needed. While we really can't take a loaded buffer over to the cache, there's no reason why the cache couldn't read this buffer normally. On the other hand, this code could cause trouble when probing from a stream before the cache has been enabled.
* stream: fix url_options field, make protocols field not fixed lengthwm42013-08-2617-77/+82
| | | | | | | | | | | | | | | | | | | | 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.
* core: add a playlist demuxerwm42013-08-262-0/+20
| | | | | | | | | Modeled after the old playlist_parser.c, but actually new code, and it works a bit differently. Demuxers (and sometimes streams) are the component that should be used to open files and to determine the file format. This was already done for subtitles, but playlists still use a separate code path.
* stream: allow potentially faster skippingwm42013-08-221-3/+12
| | | | | | | | | | Instead of always skipping in STREAM_BUFFER_SIZE blocks, allow an arbitrary size. This allows - in theory - faster forward seeking in pipes. (Maybe not a very significant change, but it reduces the number of things that depend on STREAM_BUFFER_SIZE for no good reason. Though we still use that value as minimum read size.)
* stream: don't require streams to set s->pos in seek callbackwm42013-08-229-22/+11
| | | | Instead, set s->pos depending on the success of the seek callback.
* stream: move file forward skipping to common stream implementationwm42013-08-223-52/+29
| | | | | | | | | | | stream_file.c contains some code meant for forward seeking with pipes. This simply reads data until the seek position is reached. Move this code to stream.c. This stops stream_file from doing strange things (messing with stream internals), and removes the code duplication too. We also make stream_seek_long() use the new skip code. This is shorter and much easier to follow than the old code, which basically did strange things.
* stream_avdevice: remove redundant dummy callbackwm42013-08-221-6/+0
|
* stream_file: uncrustifywm42013-08-221-132/+140
|
* stream_bluray: fix bd:// url segfault introduced by commit bc1d61Noble Huang2013-08-121-6/+2
|
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-0628-46/+46
| | | | Followup commit. Fixes all the files references.
* stream_radio: fix some thingswm42013-08-051-2/+2
| | | | | | | | | Using the radio set/step channel commands would have crashed (that was broken for about a year, nobody ever noticed). The "capture" part of a radio:// URI was incorrectly passed (this was broken quite recently). Still couldn't test it fully. I have no radio device. I suspect nobody uses this feature or will ever use it again.
* stream: parse URL escapes for file://wm42013-08-024-0/+41
| | | | | | | | | | | | | | | | | So for example "file:///file%20name.mkv" will open "file name.mkv". I'm not sure whether we want/need this. The old code didn't do it. Also, it's not really clear whether this is handled correctly. It seems the corresponding freedesktop.org "standard" allows a (useless) hostname part, which we should skip in theory. The number of slashes is not really clear either. We can open relative filenames (by removing one of the slashes from the example above), which is perhaps an unneeded feature. How does this even work with Windows paths? This issues can probably be corrected later. The URL unescape code is based on code from m_option.c removed with a recent commit.
* stream: redo URL parsing, replace m_struct usage with m_configwm42013-08-0219-362/+280
| | | | | | | | | | | | | 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 inactive URL option fieldswm42013-07-303-23/+0
| | | | | | | | | The URL option parser only accesses certain fields. Remove the fields that are not accessed, and thus are completely unused and inaccessible. Historically, these fields were supposed to be settable using an extra list of options passed to open_stream(). Commit f518cf7 removed these extra options. Apparently nothing ever actually used this facility.
* stream_dvd: fix .ifo redirectionwm42013-07-301-2/+1
| | | | This was blatantly broken after stream->url was changed to talloc.
* Fix some -Wshadow warningswm42013-07-233-8/+5
| | | | | | In general, this warning can hint to actual bugs. We don't enable it yet, because it would conflict with some unmerged code, and we should check with clang too (this commit was done by testing with gcc).
* stream_vcd.c: fix compilation on win32Diogo Franco (Kovensky)2013-07-222-3/+8
| | | | | The mp_vcd_priv_t struct doesn't have a file descriptor but a file handle on win32.
* cache: fix time check for printing warningwm42013-07-201-1/+1
| | | | | This actually waited 2 seconds, because CACHE_WAIT_TIME happened to be 0.5.
* stream: remove unused vcd functionswm42013-07-154-22/+0
| | | | Gets rid of warnings.
* Merge branch 'remove_old_demuxers'wm42013-07-1421-323/+190
|\ | | | | | | | | | | | | | | The merged branch doesn't actually just remove old demuxers, but also includes a branch of cleanups and some refactoring. Conflicts: stream/stream.c
| * demux: remove useless author/comment fieldswm42013-07-121-4/+1
| | | | | | | | Same deal as with previous commit.
| * stream: remove useless author/comment fieldswm42013-07-1217