Commit Graph

103 Commits

Author SHA1 Message Date
wm4 35568f84f3 stream: remove unused new_ds_stream() 2013-05-03 21:08:35 +02:00
reimar daee1a04e7 stream_bluray: remove the broken -bluray-chapter option
Remove the broken -bluray-chapter option.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36175 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	DOCS/man/en/mplayer.1
	cfg-common.h
2013-04-27 15:28:57 +02:00
wm4 8a7b8c3dd6 stream: fix reconnecting on broken network connections
This didn't work properly for HTTP with libavformat. The builtin HTTP
implementation reconnects automatically on its own, while libavformat
doesn't. Fix this by adding explicit reconnection support to
stream_lavf.c, which simply destroys and recreates the AVIO context.

It mostly works, though sometimes it mysteriously fails, spamming crap
all over the terminal and feeding broken data to the decoders. This is
probably due to itneractions with the cache. Also, reconnecting to
unseekable HTTP streams will make it read the entire stream until the
previous playback position is reached again.

It's not known whether this change makes behavior with "strange"
protocols like RTP better or worse.
2013-01-24 18:56:02 +01:00
wm4 47cec75291 stream: uncrustify stream.c/.h
The formatting almost made me break out in tears.
2013-01-24 17:45:13 +01:00
wm4 180944fe28 stream_lavf/demux_lavf: export/use HTTP MIME type
This is a fix for web radio streams that send raw AAC [1]. libavformat's
AAC demuxer probe is picky enough to request hundreds of KBs data, which
makes for a slow startup. To speed up stream startup, try use the HTTP
MIME type to identify the format. The webstream in question sends an AAC
specific MIME type, for which demux_lavf will force the AAC demuxer,
without probing anything.

ffmpeg/ffplay do the same thing. Note that as of ffmpeg commit 76d851b,
av_probe_input_buffer() does the mapping from MIME type to demuxer. The
actual mapping is not publicly accessible, and can only be used by
calling that function. This will hopefully be rectified, and ideally
ffmpeg would provide a function like find_demuxer_from_mime_type().

[1] http://lr2mp0.latvijasradio.lv:8000
2012-12-11 00:37:54 +01:00
wm4 eb787267c8 stream: handle mms streaming with ffmpeg
Use ffmpeg (stream_lavf) instead of internal mms support (asf_streaming.c)
for mms://, mmsh://, mmst:// URLs.

The old implementation is available under mp_mms:// etc.

There are some caveats with this:
- mms:// now always maps to mmsh://. It won't try mmst://. (I'm not sure
  if mms:// URLs really can use the mmst protocol, though.)
- MMS streams under the http:// prefix are not handled. (ffmpeg ticket
  #2001.) (Was already broken in mpv since c02f25.)
- It downloads all video streams now. MMS streams often have redundant
  video streams, which encode the main stream at different quality. The
  client is supposed to select one according to its bandwidth
  requirements. (Explicit MMS stream selection has been broken in mpv
  for a while, because MPOpts.vid maps to the stream number, not the
  demuxer's stream ID - but the old logic doesn't work anyway when
  using demuxer_lavf as opposed to demux_asf.)
2012-12-11 00:37:54 +01:00
wm4 3486f59fe2 core: automatically pause on low cache
When the cache fill status goes below a certain threshold, automatically
pause the player. When the cache is filled again, unpause again.

This is intended to help with streaming from http. It's better to pause
a while, rather than exposing extremely crappy behavior when packet
reads during decoding block the entire player.

In theory, we should try to increase the cache if underruns happen too
often. Unfortunately, changing the cache implementation would be very
hard, because it's insane code (forks, uses shared memory and "volatile"
etc.). So for now, this just reduces the frequency of the stuttering if
the network is absolutely too slow to play the stream in realtime.
2012-12-03 21:08:52 +01:00
wm4 6294c78549 cache: simplify further
This commit is separate from the previous one to separate our own
changes from changes merged from mplayer2 (as far as that was possible).

Make it easier for stream implementations to request being cached. Set
a default cache size in stream.c, and remove them from various stream
implementations. Only MS streaming support sets a meaningful cache size.

Make querying cache size saner. This reduces the amount of #ifdefs
needed.
2012-12-03 21:08:51 +01:00
Uoti Urpala 2d58234c86 cache: refactor how cache enabling is done
Code enabling the cache by default for network streams did that by
modifying the value of the "cache" option. This wasn't sane, as
multiple streams may be created and all share the same options. Change
the code to not modify options but store data in the stream instance
instead.

Conflicts:
	core/mplayer.c
	demux/demux.c
	stream/cache2.c
	stream/network.c
	stream/network.h
	stream/pnm.c
	stream/stream.c
	stream/stream_rtp.c

Merged from mplayer2 commit e26070. Note that this doesn't solve any
actual bug, as the playlist crashing bug has been fixed before.

Since the global cache size option value is not overwritten anymore, the
option doesn't need to be restored on end of playback (M_OPT_LOCAL).
2012-12-03 21:08:51 +01:00
wm4 dd3260185a demux_lavf: add support for libavdevice
libavdevice supports various "special" video and audio inputs, such
as screen-capture or libavfilter filter graphs.

libavdevice inputs are implemented as demuxers. They don't use the
custom stream callbacks (in AVFormatContext.pb). Instead, input
parameters are passed as filename. This means the mpv stream layer has
to be disabled. Do this by adding the pseudo stream handler avdevice://,
whose only purpose is passing the filename to demux_lavf, without
actually doing anything.

Change the logic how the filename is passed to libavformat. Remove
handling of the filename from demux_open_lavf() and move it to
lavf_check_file(). (This also fixes a possible bug when skipping the
"lavf://" prefix.)

libavdevice now can be invoked by specifying demuxer and args as in:

    mpv avdevice://demuxer:args

The args are passed as filename to libavformat. When using libavdevice
demuxers, their actual meaning is highly implementation specific. They
don't refer to actual filenames.

Note:

libavdevice is disabled by default. There is one problem: libavdevice
pulls in libavfilter, which in turn causes symbol clashes with mpv
internals. The problem is that libavfilter includes a mplayer filter
bridge, which is used to interface with a set of nearly unmodified
mplayer filters copied into libavfilter. This filter bridge uses the
same symbol names as mplayer/mpv's filter chain, which results in symbol
clashes at link-time.

This can be prevented by building ffmpeg with --disable-filter=mp, but
unfortunately this is not the default.

This means linking to libavdevice (which in turn forces linking with
libavfilter by default) must be disabled. We try doing this by compiling
a test file that defines one of the clashing symbols (vf_mpi_clear).

To enable libavdevice input, ffmpeg should be built with the options:

    --disable-filter=mp

and mpv with:

    --enable-libavdevice

Originally, I tried to auto-detect it. But the resulting complications
in configure did't seem worth the trouble.
2012-12-03 21:08:51 +01:00
wm4 9085b85729 stream: fix dvd:// + cache crashing
The language string was dynamically allocated, which completely fails
if the cache is forked (which it usually is). Change it back to a fixed
length string, like the original code had it.
2012-11-20 18:00:15 +01:00
wm4 efaa73cc73 stream, demux_lavf: minor cleanup for stream size code 2012-11-20 18:00:15 +01:00
wm4 ddffcce678 stream, demux: replace off_t with int64_t
On reasonable systems, these types were the same anyway. Even on
unreasonable systems (seriously, which?), this may reduce potential
breakage.
2012-11-20 18:00:15 +01:00
wm4 4873b32c59 Rename directories, move files (step 2 of 2)
Finish renaming directories and moving files. Adjust all include
statements to make the previous commit compile.

The two commits are separate, because git is bad at tracking renames
and content changes at the same time.

Also take this as an opportunity to remove the separation between
"common" and "mplayer" sources in the Makefile. ("common" used to be
shared between mplayer and mencoder.)
2012-11-12 20:08:18 +01:00
ib 1215f0871c stream: add STREAM_CTRL_GET_CURRENT_TITLE
Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs.

This provides the current title (aka track) number of a DVD.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35263 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-10-30 19:50:20 +01:00
Stefano Pigozzi 70e7d63ba0 core, timeline: cache external ordered chapter files too
Previously, Matroska source files other than the initially opened one
were always accessed without caching. Enable cache for extra files
too. A separate cache process/thread is started for each file, which
is less than optimal but probably better than no caching if the user
explicitly enabled cache. This commit only implements caching for
Matroska ordered chapters (not for EDL timeline).

To build the timeline we need to demux the files in the current
directory to look for segments with matching uuid. This first demux is
done with no cache since we don't need to read a lot of the stream. If
the file is recognized as one of the needed sources it's reopened with
cache enabled.

Also move the stream_cache_size global variable to the options struct.

Conflicts:
	cfg-mplayer.h
	mplayer.c
	stream/stream.h
	timeline/tl_matroska.c
2012-09-18 21:07:30 +02:00
wm4 d21b109bf7 core: fix DVD subtitle selection
Add all subtitle tracks as reported by libdvdread at playback start.
Display language for subtitle and audio tracks. This commit restores
these features to the state when demux_mpg was default for DVD playback,
and makes them work with demux_lavf and the recent changes to subtitle
selection in the frontend.

demux_mpg, which was the default demuxer for DVD playback, reordered
the subtitle streams according to the "logical" subtitle track number,
which conforms to the track layout reported by libdvdread, and is what
stream_dvd expects for the STREAM_CTRL_GET_LANG call. demux_lavf, on
the other hand, adds the streams in the order it encounters them in
the MPEG stream. It seems this order is essentially random, and can't
be mapped easily to what stream_dvd expects.

Solve this by making demux_lavf hand out the MPEG stream IDs (using the
demuxer_id field). The MPEG IDs are mapped by mplayer.c by special
casing DVD playback (map_id_from/to_demuxer() functions). This mapping
is essentially the same what demux_mpg did. Making demux_lavf reorder
the streams is out of the question, because its stream handling is
already messy enough.

(Note that demux_lavf doesn't export stream IDs for other formats,
because most time libavformat demuxers do not set AVStream.id, and we
don't know which demuxers do. But we know that MPEG is safe.)

Another major complication is that subtitle tracks are added lazily, as
soon as the demuxer encounters the first subtitle packet for a given
subtitle stream. Add the streams in advance. If a yet non-existent
stream is selected, demux_lavf must be made to auto-select that subtitle
stream as soon as it is added. Otherwise, the first subtitle packet
would be lost. This is done by DEMUXER_CTRL_PRESELECT_SUBTITLE.
demux_mpg didn't need this: the frontend code could just set ds->id to
the desired stream number. But demux_lavf's stream IDs don't map
directly to the stream number as used by libdvdread, which is why this
hack is needed.
2012-09-18 21:04:45 +02:00
wm4 3a5d5f01d4 Remove support for LIVE555 RTSP streaming
The main excuse for removing this is that LIVE555 deprecated the API
the mplayer implementation was using. The old API still seems to be
somewhat supported, but must be explicitly enabled at LIVE555
compilation, so mplayer won't always work on any user installation.

The implementation was also very messy, in C++, and FFmpeg support is
available as alternative.

Remove it completely.
2012-08-20 15:36:03 +02:00
wm4 41fbcee1f5 Remove dvdnav support (DVD menus)
When the internal mplayer MPEG demuxer was removed (commit 1fde09db),
the default demuxer when using dvdnav was set to libavformat. Now it
turns out that this doesn't work with libavformat. It will terminate
playback right after the audio runs out (instead of looping it like the
video, or whatever it's supposed to do). I'm not sure what exactly the
problem is, but since 1. even mplayer-svn can't handle DVD menus
directly (missing highlights), 2. DVD menus are essentially worthless,
and 3. I don't directly watch DVDs, don't bother with it and remove it.

For basic playback, there's still libdvdread support.

Also, use pkg-config for libdvdread, and drop support for in-tree
libdvdread. Remove support for in-tree libdvdcss as well.
2012-08-16 17:17:49 +02:00
mplayer-svn 804bf91570 commands, dvd, dvdnav, bluray: cleanup sub/audio track language display
Code cleanup: Use a stream_control instead of global functions to
get the language associate with a audio or subtitle stream from
the streaming layer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34736 b3059339-0415-0410-9bf9-f77b7e298cf2

Support showing the stream language with br:// playback.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34737 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix DVDs showing the subtitle language as "unknown"
for a long time.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34777 b3059339-0415-0410-9bf9-f77b7e298cf2

Author: reimar

Note: heavily modified by wm4 for this fork of mplayer.
2012-08-03 01:59:15 +02:00
mplayer-svn bbc9fccd46 cache2: allow cache sizes up to 4 TB
Remove variable that is only assigned but never used.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34791 b3059339-0415-0410-9bf9-f77b7e298cf2

Allow using a cache size of up to 4 TB.
Obviously anything close to 4 GB will always fail
on 32 bit systems.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34792 b3059339-0415-0410-9bf9-f77b7e298cf2

Replace off_t by int64_t in cache code.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34793 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove casts that are no longer necessary.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34794 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix header file after r34793.

Patch by Stephen Sheldon, sfsheldo gmail com.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34802 b3059339-0415-0410-9bf9-f77b7e298cf2

Put #include <inttypes.h> into the header file where it should be.

Reported by Stephen Sheldon, sfsheldo gmail com.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34798 b3059339-0415-0410-9bf9-f77b7e298cf2

Correct r34798.

The header only needs stdint.h while the C file needs inttypes.h.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34799 b3059339-0415-0410-9bf9-f77b7e298cf2

Author: reimar
2012-08-03 01:52:40 +02:00
mplayer-svn 98f15b645f stream: add new stream control command STREAM_CTRL_GET_NUM_TITLES
This provides the total number of titles (aka tracks) of CDs / VCDs / DVDs.

Additionally, add a titles property to the get_property slave command.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34474 b3059339-0415-0410-9bf9-f77b7e298cf2
Author: ib
2012-08-03 01:43:03 +02:00
mplayer-svn 76ce3b7d6e Replace 'q' printf length modifier by 'll'
'q' is just a deprecated synonym of 'll' that should no longer be used.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34224 b3059339-0415-0410-9bf9-f77b7e298cf2
Author: diego
2012-08-03 01:31:00 +02:00
wm4 7059c15f4a mplayer: rip out --capture support
While this was an interesting idea, it wasn't actually useful.
Basically it dumped the raw data (as requested by the demuxer) into a
file. The result is only useful if the file format was raw or maybe
some MPEG packet stream, but not with most modern file formats.
2012-08-02 23:22:52 +02:00
reimar 55def9cc1b stream: show negative seek position value in error message
Make "Invalid seek to negative position" message more useful by
printing the actual value.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33556 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 09:30:04 +03:00
Clément Bœsch 6506d4ad84 cleanup: remove more warnings 2011-05-02 00:46:48 +03:00
Uoti Urpala 4c117849b3 stream.[ch], ass_mp: new stream function for whole-file reads
Add new stream_read_complete() function which reads the complete
contents of file. Use that in ass_mp.c which had custom code to do the
same.
2011-03-03 21:39:24 +02:00
Uoti Urpala 5177b24b25 cleanup: demuxer.[ch]: remove unused code, make functions static
Remove some unused lines from demuxer.h. Make some demuxer.c functions
static. Move new_ds_stream() declaration from demuxer.h to stream.h
(the function is defined in stream.c). Clean up some code in mplayer.c
that had commented-out free_demuxer_stream() calls.
2011-02-22 15:16:41 +02:00
reimar eb5765e96a stream.h: check against huge negative values in stream_seek()
Add validity check for stream_seek argument to avoid a integer
overflow for huge negative values that would break the internal state
of the stream buffer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32702 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 0792847d4a cache: read up to 64 KiB at once from stream_file
Make the file protocol read up to 64 KiB at once when the cache is used,
assuming that files will generally be readable with high bandwidth.
This should improve performance when playing e.g. from high-latency
network shares.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32616 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:24:11 +02:00
Clément Bœsch 6526bee39b options: move some demux options to option struct
Following options were moved: audiofile, audiofile-cache, subfile,
demuxer, audio-demuxer, sub-demuxer, [no]extbased.
2010-11-11 16:31:46 +02:00
reimar f94717cdc4 cache, stream: avoid extra memcpy when using cache
Add a stream_read_internal() function that reads directly into a given
buffer instead of the stream's internal one. Use this to read directly
into cache memory, avoiding a memcpy(). This requires also adding a
stream_seek_internal() as the normal seek function reads into the
stream's buffer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32559 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-07 21:46:22 +02:00
Uoti Urpala 3cb3bbbddc Add a simple capture feature (-capture)
If a specified key is pressed during playback, the current stream is
captured to a file, similar to what -dumpstream achieves.

original patch by Pásztor Szilárd, don tricon hu

Taken from the following svn commits, but with several fixes and
modifications (one obvious user-visible difference is that the default
key binding is 'C', not 'c'):

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32524 b3059339-0415-0410-9bf9-f77b7e298cf2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32529 b3059339-0415-0410-9bf9-f77b7e298cf2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32530 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 07:48:31 +02:00
reimar 837b6d245d cache: add sanity-check for sector size
Add sanity-check for sector size to avoid strange crashes if it is
too large.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31914 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:34 +02:00
diego 578ad534b3 configure: Rename "network" variable and option to "networking"
This avoids conflicts with the FFmpeg variable of the same name.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31749 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:44 +02:00
ben 6704008a46 stream_bluray: add unencrypted Blu-ray playback
Support for unencrypted Blu-ray playback through libbluray.
Use it through: mplayer br:////path/to/disc

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31631 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:20 +02:00
reimar 27408d4f14 stream.h: support backswards stream_skip() within buffer
Never just ignore a backwards skip, even if the stream is not seekable
it might still be in a buffer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31465 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:11:07 +02:00
Uoti Urpala 0e0d88ede9 Merge svn changes up to r31256 2010-05-30 16:39:41 +03:00
reimar 16e3978e1e Document time scale for stream_check_interrupt argument.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31253 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-28 18:45:25 +00:00
diego 5e71e43bb5 Drop pointless _st suffix from 'struct stream'.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31237 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-27 20:38:25 +00:00
Uoti Urpala de5566f0b5 stream.h: remove bad EOF check in stream_seek()
Also remove a redundant stream->eof = 0 in demuxer.c.
2010-05-22 06:40:34 +03:00
Uoti Urpala a2133d7684 options: move -chapter values to option struct
-chapter can optionally take a range with a start and an end. Add a
new option type which supports such values and use that instead of a
custom per-option function.

This commit also fixes a build configuration bug: before the
availability of the -chapter option depended on DVD functionality
being enabled in the binary, even though the option works with other
sources too.
2010-04-25 22:48:10 +03:00
Uoti Urpala 1d4d1bff82 stream_ffmpeg, demux_lavf: Use flv demuxer for rtmp streams
Use lavf's flv demuxer for rtmp/rtmps/... stream types. Letting
generic format probing handle this could work, but with the current
probing implementation it'd at least depend on not-really-guaranteed
details of the stream layer (probing different formats and then
decoding depends on seeking back in between; rtmp streams don't
support such seeking directly so would need to rely on details of
caching behavior).
2010-04-23 22:57:25 +03:00
Uoti Urpala 0269d22d32 Merge svn changes up to r30876 2010-03-10 03:18:42 +02:00
Uoti Urpala 4857965118 Merge svn changes up to r30815 2010-03-10 02:36:35 +02:00
Uoti Urpala bc1d0ca37d Merge svn changes up to r30798 2010-03-10 02:35:02 +02:00
Uoti Urpala e74708f619 Merge svn changes up to r30748 2010-03-10 01:50:55 +02:00
Uoti Urpala 194efde18f Merge svn changes up to r30702 2010-03-10 01:08:50 +02:00
Uoti Urpala 0dce155dd3 Merge svn changes up to r30694 2010-03-10 01:01:15 +02:00
Uoti Urpala 327463be52 Merge svn changes up to r30672 2010-03-10 00:34:16 +02:00