Commit Graph

1452 Commits

Author SHA1 Message Date
wm4 b78d11d328 stream: split out pthread helper function
Also split the function itself into 3.
2013-11-17 16:42:57 +01:00
wm4 e91edf9aed demux: use talloc for certain stream headers
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.
2013-11-14 19:52:18 +01:00
wm4 2b39c5d87c tvi_v4l2: remove VBI stuff
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.)
2013-11-13 21:21:00 +01:00
bugmen0t 35d7ed7bf1 tvi_v4l2: let libv4l2 convert to a known pixel format
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.
2013-11-13 21:15:59 +01:00
wm4 05e2b1f513 stream: don't include linux/types.h in some files
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.
2013-11-13 20:59:50 +01:00
wm4 53d3827843 Remove sh_audio->samplesize
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.
2013-11-09 23:32:58 +01:00
wm4 91626b1c06 audio: replace af_fmt2str_short -> af_fmt_to_str
Also, remove all af_fmt2str usages.
2013-11-07 22:12:36 +01:00
wm4 859964e0db stream_lavf: don't duplicate list of rtmp protocols
Assume a rtmp prefix means rtmp instead.
2013-11-04 19:57:39 +01:00
wm4 41fedab2d9 stream_lavf: support more libavformat protocols 2013-11-04 19:57:13 +01:00
wm4 f7b2d644ef Merge branch 'master' into have_configure
Conflicts:
	configure
2013-11-04 00:43:06 +01:00
Stefano Pigozzi 37388ebb0e configure: uniform the defines to #define HAVE_xxx (0|1)
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
2013-11-03 21:59:54 +01:00
wm4 22274f7982 stream: more consistent checks for whether stream is seekable
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.
2013-11-03 17:46:36 +01:00
wm4 84f7e213ab stream: reconnecting doesn't make sense if stream is not seekable
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
2013-11-03 17:30:34 +01:00
wm4 e0b6fdeb8d Fix some more -Wshadow warnings
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.
2013-11-01 17:35:38 +01:00
wm4 dd344b43e8 Enable -Wshadow
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.
2013-11-01 13:00:15 +01:00
wm4 d8896f0dba ao_alsa: don't include alloca.h
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).
2013-10-25 21:25:54 +02:00
wm4 fbd932410a tv: simplify ifdeffery
Too ugly to leave it be.
2013-10-17 23:13:55 +02:00
wm4 a550731209 Copyright, LICENSE: switch to GPL version 2 or later
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.
2013-10-13 01:36:10 +02:00
Christian Neukirchen 3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +02:00
wm4 ef9c5300ef cosmetics: replace "CTRL" defines by enums
Because why not.
2013-10-02 21:19:16 +02:00
wm4 b7f01957ec network: add options to control TLS verification 2013-09-27 18:09:30 +02:00
wm4 cc7f8ee620 mplayer: attempt to make playback resume work with DVD/BD
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.
2013-09-22 03:31:25 +02:00
wm4 b0f7a26f1a network: fix rtsp playback
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.
2013-09-22 02:40:29 +02:00
wm4 ce861c9f33 stream_lavf: print lavf options that could not be set
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.
2013-09-22 02:20:18 +02:00
Stefano Pigozzi 855b705980 stream_dvd: prevent segmentation fault with some broken files
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.
2013-09-14 20:49:55 +02:00
wm4 c9a740fccd stream_bluray: return number of titles
So that the "titles" property returns the number of titles.
2013-09-10 15:39:48 +02:00
wm4 316dfb93d7 stream: force demuxer of cached stream, fixes cdda:// + cache 2013-09-10 15:23:27 +02:00
wm4 efc5ac17bf path: add a common mp_is_url() function
Remove the duplicated code.
2013-09-04 16:15:08 +02:00
wm4 266ce242c3 tv: attempt to support mjpeg streams
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.)
2013-09-04 00:46:23 +02:00
wm4 792844f873 stream: read at least a full buffer with stream_peek()
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.)
2013-08-28 23:08:08 +02:00
wm4 3fc3bf70f9 stream: add uncompressed rar support
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.
2013-08-26 10:09:46 +02:00
wm4 74b846e2f7 stream: change open code, add stream filter concept
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.
2013-08-26 10:09:45 +02:00
wm4 f3a7849ba6 stream: don't drop buffer when creating the cache
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.
2013-08-26 10:09:45 +02:00
wm4 971e8456fc stream: fix url_options field, make protocols field not fixed length
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.
2013-08-26 10:09:45 +02:00
wm4 8be9c49fcd core: add a playlist demuxer
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.
2013-08-26 10:09:45 +02:00
wm4 cd7ec016e7 stream: allow potentially faster skipping
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.)
2013-08-22 19:14:26 +02:00
wm4 f806e268c6 stream: don't require streams to set s->pos in seek callback
Instead, set s->pos depending on the success of the seek callback.
2013-08-22 19:14:26 +02:00
wm4 a790f2133b stream: move file forward skipping to common stream implementation
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.
2013-08-22 18:33:19 +02:00
wm4 28eac7dfb3 stream_avdevice: remove redundant dummy callback 2013-08-22 18:20:49 +02:00
wm4 974250b60c stream_file: uncrustify 2013-08-22 18:20:49 +02:00
Noble Huang 1ef239a499 stream_bluray: fix bd:// url segfault introduced by commit bc1d61 2013-08-12 19:00:39 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
wm4 3be39ed76c stream_radio: fix some things
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.
2013-08-05 19:18:22 +02:00
wm4 44d6ac06ae stream: parse URL escapes for file://
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.
2013-08-02 17:05:26 +02:00
wm4 bc1d61cf42 stream: redo URL parsing, replace m_struct usage with m_config
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.)
2013-08-02 17:02:34 +02:00
wm4 1848be363e stream: remove inactive URL option fields
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.
2013-07-30 16:15:36 +02:00
wm4 06996810bf stream_dvd: fix .ifo redirection
This was blatantly broken after stream->url was changed to talloc.
2013-07-30 16:15:36 +02:00
wm4 e83cbde1a4 Fix some -Wshadow warnings
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).
2013-07-23 00:45:23 +02:00
Diogo Franco (Kovensky) db9102765a stream_vcd.c: fix compilation on win32
The mp_vcd_priv_t struct doesn't have a file descriptor but a file
handle on win32.
2013-07-22 02:52:04 +02:00
wm4 cb1ee41cec cache: fix time check for printing warning
This actually waited 2 seconds, because CACHE_WAIT_TIME happened to
be 0.5.
2013-07-20 02:16:54 +02:00