Commit Graph

1411 Commits

Author SHA1 Message Date
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
wm4 2599729e96 stream: remove unused vcd functions
Gets rid of warnings.
2013-07-15 21:29:25 +02:00
wm4 e18ffd6b99 Merge branch 'remove_old_demuxers'
The merged branch doesn't actually just remove old demuxers, but also
includes a branch of cleanups and some refactoring.

Conflicts:
	stream/stream.c
2013-07-14 17:59:26 +02:00
James Ross-Gowan ea7e54cb34 w32: silence some warnings 2013-07-13 14:43:54 +02:00
Jonathan Yong dc4dcf34e5 stream_vcd: use intptr_t cast for _open_osfhandle in accordance to MSDN 2013-07-13 04:08:04 +02:00
wm4 6c414f8c7a demux: remove useless author/comment fields
Same deal as with previous commit.
2013-07-12 22:16:27 +02:00
wm4 f406482d84 stream: remove useless author/comment fields
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.
2013-07-12 22:16:27 +02:00
wm4 6d8f8fc4f0 stream: remove unused functions
These were used by old demuxers.
2013-07-12 22:16:27 +02:00
wm4 f63193f58f stream: remove fd member
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.
2013-07-12 22:16:26 +02:00
wm4 b66c609b48 stream: use talloc for some string members
Minor simplification.
2013-07-12 22:16:26 +02:00
wm4 5c1b8d4aa1 stream: don't require streams to set a type
Set the type only for streams that have special treatment in other parts
of the code.
2013-07-12 22:16:26 +02:00
wm4 cb45b1c65b Cleanup some include statements 2013-07-12 22:16:26 +02:00
wm4 3269bd1780 demux: rewrite probing and demuxer initialization
Get rid of the strange and messy reliance on DEMUXER_TYPE_ constants.
Instead of having two open functions for the demuxer callbacks (which
somehow are both optional, but you can also decide to implement both...),
just have one function. This function takes a parameter that tells the
demuxer how strictly it should check for the file headers. This is a
nice simplification and allows more flexibility.

Remove the file extension code. This literally did nothing (anymore).

Change demux_lavf so that we check our other builtin demuxers first
before libavformat tries to guess by file extension.
2013-07-12 22:16:26 +02:00
wm4 52c3eb6976 core: change open_stream and demux_open signature
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.
2013-07-12 21:56:40 +02:00
wm4 aa3b8c8fe7 stream: remove some more forgotten network stuff
Was not cleanly removed with internal network code removal.
2013-07-12 18:34:17 +02:00
wm4 d17d2fdc7c demux: change signature of open functions, cleanups
Preparation for redoing the open functions.
2013-07-11 21:09:39 +02:00
wm4 a6706c41d8 video: eliminate frametime variable 2013-07-11 19:21:45 +02:00
wm4 6ede485e4b core: don't access demux_stream outside of demux.c, make it private
Generally remove all accesses to demux_stream from all the code, except
inside of demux.c. Make it completely private to demux.c.

This simplifies the code because it removes an extra concept. In demux.c
it is reduced to a simple packet queue. There were other uses of
demux_stream, but they were removed or are removed with this commit.

Remove the extra "ds" argument to demux fill_buffer callback. It was
used by demux_avi and the TV pseudo-demuxer only.

Remove usage of d_video->last_pts from the no-correct-pts code. This
field contains the last PTS retrieved after a packet that is not NOPTS.
We can easily get this value manually because we read the packets
ourselves. Reuse sh_video->last_pts to store the packet PTS values. It
was used only by the correct-pts code before, and like d_video->last_pts,
it is reset on seek. The behavior should be exactly the same.
2013-07-11 19:17:51 +02:00
wm4 fa74be880c tv: add hack in preparation of demux_stream removal
Currently, all demuxer fill_buffer functions have a demux_stream
parameter. We want to remove that, but the TV code still depends on
it. Add a hack to remove that dependency.

The problem with the TV code is that reading video and audio frames
blocks, so in order to avoid a deadlock, you should read either of
them only if the decoder actually requests new data.
2013-07-11 19:17:05 +02:00
wm4 23e303859a mplayer: fix incorrect audio sync after format changes
This is not directly related to the handling of format changes itself,
but playing audio normally after the change. This was broken: the output
byte rate was not recalculated, so audio-video sync was simply broken.
Fix this by calculating the byte rate on the fly, instead of storing it
in sh_audio.

Format changes are relatively common (switches between stereo and 5.1
in TV recordings), so this fixes a somewhat critical bug.
2013-07-11 19:15:09 +02:00
wm4 175cd3cb57 options: add --cache-default option
Add this option, which lets users set the cache size without forcing it
even when playing from the local filesystem.

Also document the default value explicitly.

The Matroska linked segments case is slightly simplified: they can
never come from network (mostly because it'd be insane, and we can't
even list files from network sources), so the cache will never be
enabled automatically.
2013-07-10 15:05:24 +02:00
wm4 31f685040b Merge branch 'master' into remove_old_demuxers
Conflicts:
	DOCS/man/en/changes.rst
	DOCS/man/en/options.rst
2013-07-08 21:55:44 +02:00
Stefano Pigozzi 846f46ec1d cache: fix compilation without posix timers
This is a regression caused by 854303a. This commit removed the include of
`sys/time.h` which was included in `cache.c` through a chain of recurvive
includes.
2013-07-08 20:04:07 +02:00
Martin Herkt 1a8ab1d6ad stream/tv: remove unused dshow-specific options 2013-07-08 18:02:46 +02:00
wm4 f2ad12a819 stream_radio: fix build
This was accidentally broken with 37c5c11 and has been nroken for
5 months.

Does anyone (want to) use this at all?
2013-07-08 03:19:46 +02:00
wm4 05ae5afd62 demux: remove separate arrays for audio/video/sub streams, simplify
These separate arrays were used by the old demuxers and are not needed
anymore. We can simplify track switching as well.

One interesting thing is that stream/tv.c (which is a demuxer) won't
respect --no-audio anymore. It will probably work as expected, but it
will still open an audio device etc. - this is because track selection
is now always done with the runtime track switching mechanism. Maybe
the TV code could be updated to do proper runtime switching, but I
can't test this stuff.
2013-07-08 01:36:02 +02:00
wm4 c4f33d784a demux: remove some old stream header functions 2013-07-08 00:35:04 +02:00
wm4 af0c41e162 Remove old demuxers
Delete demux_avi, demux_asf, demux_mpg, demux_ts. libavformat does
better than them (except in rare corner cases), and the demuxers have
a bad influence on the rest of the code. Often they don't output
proper packets, and require additional audio and video parsing. Most
work only in --no-correct-pts mode.

Remove them to facilitate further cleanups.
2013-07-07 23:54:11 +02:00
wm4 8781e5a55c stream: unbreak streams with large sector sizes (stream_cdda)
Commit 7b16d4b changed some stream implementations to check the buffer
size passed to them. This made stream_cdda stop working, because the
default buffer size is smaller than the CDIO frame size. So pass the
sector size instead of the (arbitrary) default buffer size.
2013-07-07 21:58:48 +02:00
wm4 441b684fc8 stream: don't treat position 0 specially
Seeking to position 0 meant to try reconnecting with some streams,
actually just the internal http implementation. This has been removed,
so we don't need the special handling anymore.

This means we don't have to be stuck in a retry loop if the stream
doesn't even support reconnect.
2013-07-07 21:10:44 +02:00
wm4 4caa3356b2 Remove some leftovers from network removal
stream_vstream.c in particular was actually dependent on the network
code, and didn't compile anymore.

Cleanup the protocol list in mpv.rst, and add some missing ones
supported by libavformat to stream_lavf.c.
2013-07-07 21:10:44 +02:00
wm4 c4f83ac6e9 stream: remove weird STREAMTYPE_STREAM special handling
This was an old leftover from an earlier cleanup (which happened in
2003), and which used "special" stuff for streams that could be only
forward-seeked.

Also, don't add mode flags to s->flags; they're supposed to be in
s->mode instead.
2013-07-07 21:10:44 +02:00
wm4 dbf2a6f7d0 stream: re-add accidentally removed seek call
This was under CONFIG_NETWORKING, so in theory it should have been save
to remove. But actually this disables forward skipping when reading
from a pipe. (Still a questionable feature, because it doesn't behave
well with libavformat - but it was not supposed to be changed.)
2013-07-07 21:10:44 +02:00
wm4 854303ad49 Remove internal network support
This commit removes the "old" networking code in favor of libavformat's
code.

The code was still used for mp_http, udp, ftp, cddb. http has been
mapped to libavformat's http support since approximately 6 months ago.
udp and ftp have support in ffmpeg (though ftp was added only last
month). cddb support is removed with this commit - it's probably not
important and rarely used if at all, so we don't care about it.
2013-07-07 19:42:38 +02:00
wm4 feaa721916 core: make network options available even if old net code is disabled
Preparation for removing the old network code.
2013-07-07 19:40:35 +02:00
wm4 50274ca3b0 stream: make eof flag more consistent
When reading something successfully, the eof flag should never be 1, so
clear it in these situations. The eof flag will be set properly on the
next read call.
2013-07-04 17:58:48 +02:00
wm4 0b77649c0b stream_lavf: request and read streamcast/ICY metadata
Requires recent ffmpeg git, otherwise will do nothing.
2013-07-02 12:23:34 +02:00
wm4 3f3ffd0de4 core: update metadata during playback, allow streams to export metadata
STREAM_CTRL_GET_METADATA will be used to poll for streamcast metadata.
Also add DEMUXER_CTRL_UPDATE_INFO, which could in theory be used by
demux_lavf.c. (Unfortunately, libavformat is too crappy to read metadata
mid-stream for mp3 or ogg, so we don't implement it.)
2013-07-02 12:19:16 +02:00
wm4 e00621ac46 cache: fix per-block metadata memory leak 2013-07-02 12:19:16 +02:00
wm4 1327eeb375 stream: redo memory streams
Make memory streams actual streams. This causes fewer weird corner cases
and actually allows using demuxers with them.
2013-06-28 15:40:15 +02:00
wm4 403a266d46 Merge branch 'sub_mess2'
...the return.
2013-06-25 00:43:04 +02:00
wm4 813591cb11 stream: remove stream_unread_buffer()
Replaced with stream_peek().
2013-06-25 00:11:55 +02:00