summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-14 17:59:26 +0200
committerwm4 <wm4@nowhere>2013-07-14 17:59:26 +0200
commite18ffd6b998858ca0797cb0ce4aabd4a509655dd (patch)
tree199bddd30923db1175a1331191eb86ba684e9e41
parent3e7d483ac89289f613138002be2043ec5f479bb0 (diff)
parent5ead20bdb3328d199dad693039d18e7a05eb2465 (diff)
downloadmpv-e18ffd6b998858ca0797cb0ce4aabd4a509655dd.tar.bz2
mpv-e18ffd6b998858ca0797cb0ce4aabd4a509655dd.tar.xz
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
-rw-r--r--DOCS/man/en/changes.rst1
-rw-r--r--DOCS/man/en/options.rst21
-rw-r--r--DOCS/tech-overview.txt65
-rw-r--r--Makefile15
-rw-r--r--audio/decode/ad.h4
-rw-r--r--audio/decode/ad_lavc.c62
-rw-r--r--audio/decode/ad_mpg123.c16
-rw-r--r--audio/decode/ad_spdif.c79
-rw-r--r--audio/decode/dec_audio.c34
-rw-r--r--core/asxparser.c4
-rw-r--r--core/command.c10
-rw-r--r--core/encode_lavc.c2
-rw-r--r--core/input/input.c2
-rw-r--r--core/mp_core.h3
-rw-r--r--core/mplayer.c409
-rw-r--r--core/options.c18
-rw-r--r--core/options.h3
-rw-r--r--core/playlist_parser.c5
-rw-r--r--core/timeline/tl_cue.c15
-rw-r--r--core/timeline/tl_edl.c10
-rw-r--r--core/timeline/tl_matroska.c20
-rw-r--r--demux/asf.h251
-rw-r--r--demux/asfguid.h89
-rw-r--r--demux/asfheader.c721
-rw-r--r--demux/asfheader.h28
-rw-r--r--demux/aviheader.c674
-rw-r--r--demux/aviheader.h382
-rw-r--r--demux/aviprint.c197
-rw-r--r--demux/aviprint.h35
-rw-r--r--demux/demux.c1006
-rw-r--r--demux/demux.h231
-rw-r--r--demux/demux_asf.c691
-rw-r--r--demux/demux_avi.c899
-rw-r--r--demux/demux_cue.c34
-rw-r--r--demux/demux_edl.c34
-rw-r--r--demux/demux_lavf.c113
-rw-r--r--demux/demux_libass.c76
-rw-r--r--demux/demux_mf.c119
-rw-r--r--demux/demux_mkv.c75
-rw-r--r--demux/demux_mng.c101
-rw-r--r--demux/demux_mpg.c1306
-rw-r--r--demux/demux_raw.c274
-rw-r--r--demux/demux_rawaudio.c127
-rw-r--r--demux/demux_rawvideo.c178
-rw-r--r--demux/demux_subreader.c26
-rw-r--r--demux/demux_ts.c3532
-rw-r--r--demux/demux_ts.h24
-rw-r--r--demux/extension.c104
-rw-r--r--demux/mp3_hdr.c144
-rw-r--r--demux/mp3_hdr.h36
-rw-r--r--demux/mpeg_hdr.c539
-rw-r--r--demux/mpeg_hdr.h55
-rw-r--r--demux/ms_hdr.h54
-rw-r--r--demux/parse_es.c158
-rw-r--r--demux/parse_es.h45
-rw-r--r--demux/stheader.h47
-rw-r--r--demux/video.c620
-rw-r--r--stream/dvbin.h1
-rw-r--r--stream/stream.c78
-rw-r--r--stream/stream.h81
-rw-r--r--stream/stream_avdevice.c9
-rw-r--r--stream/stream_bluray.c14
-rw-r--r--stream/stream_cdda.c11
-rw-r--r--stream/stream_dvb.c15
-rw-r--r--stream/stream_dvd.c17
-rw-r--r--stream/stream_file.c43
-rw-r--r--stream/stream_lavf.c15
-rw-r--r--stream/stream_memory.c7
-rw-r--r--stream/stream_mf.c9
-rw-r--r--stream/stream_null.c10
-rw-r--r--stream/stream_pvr.c10
-rw-r--r--stream/stream_radio.c10
-rw-r--r--stream/stream_smb.c35
-rw-r--r--stream/stream_tv.c9
-rw-r--r--stream/stream_vcd.c54
-rw-r--r--stream/tv.c79
-rw-r--r--stream/tv.h4
-rw-r--r--stream/vcd_read.h2
-rw-r--r--sub/dec_sub.c6
-rw-r--r--sub/osd_libass.c2
-rw-r--r--video/decode/dec_video.c4
-rw-r--r--video/decode/vd.c1
-rw-r--r--video/decode/vd_lavc.c5
-rw-r--r--video/out/gl_lcms.c2
84 files changed, 1299 insertions, 13057 deletions
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst
index 70f6fd71ec..eeac7fada9 100644
--- a/DOCS/man/en/changes.rst
+++ b/DOCS/man/en/changes.rst
@@ -104,7 +104,6 @@ Command Line Switches
``-subdelay`` ``--sub-delay``
``-subpos`` ``--sub-pos``
``-forcedsubsonly`` ``--sub-forced-only``
- ``-ni`` ``--avi-ni``
``-benchmark`` ``--untimed`` (no stats)
``-xineramascreen`` ``--screen`` (different values)
``-ss`` ``--start``
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 150c12d043..58fc365db1 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -695,12 +695,6 @@
Stop at given absolute time. Use ``--length`` if the time should be relative
to ``--start``. See ``--start`` for valid option values and examples.
-``--no-extbased``, ``--extbased``
- ``--no-extbased`` disables extension-based demuxer selection. By default,
- when the file type (demuxer) cannot be detected reliably (the file has no
- header or it is not reliable enough), the filename extension is used to
- select the demuxer. Always falls back on content-based demuxer selection.
-
``--field-dominance=<auto|top|bottom>``
Set first field for interlaced content. Useful for deinterlacers that
double the framerate: ``--vf=yadif=1`` and ``--vo=vdpau:deint``.
@@ -1049,11 +1043,6 @@
This option only works if the underlying media supports seeking
(i.e. not with stdin, pipe, etc).
-``--ignore-start``
- Matters with the builtin AVI demuxer only, which is not enabled by default.
- Ignore the specified starting time for streams in AVI files. This
- nullifies stream delays.
-
``--include=<configuration-file>``
Specify configuration file to be parsed after the default ones.
@@ -1258,20 +1247,10 @@
depends on the VO backend and how it handles keyboard input. Does not
apply to terminal input.)
-``--avi-ni``
- (Internal AVI demuxer which is not used by default only)
- Force usage of non-interleaved AVI parser (fixes playback of some bad AVI
- files).
-
``--no-aspect``
Ignore aspect ratio information from video file and assume the video has
square pixels. See also ``--aspect``.
-``--no-bps``
- (Internal AVI demuxer which is not used by default only)
- Do not use average byte/second value for A-V sync. Helps with some AVI
- files with broken header.
-
``--no-cache``
Turn off input stream caching. See ``--cache``.
diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt
index e242df1325..d4dbd95938 100644
--- a/DOCS/tech-overview.txt
+++ b/DOCS/tech-overview.txt
@@ -1,9 +1,9 @@
NOTE: DOCS/OUTDATED-tech/* may contain more detailed information, but most of it
is possibly or definitely outdated. This file intends to give a big
- picture of how mplayer/mpv is structured.
+ picture of how mpv is structured.
core/mplayer.c:
- This contains the main play loop, anything related to mplayer and playback
+ This contains the main play loop, anything related to mpv and playback
related initializations. It also contains the main function. Generally, it
accesses all other subsystems, initializes them, and pushes data between
them during playback.
@@ -59,7 +59,7 @@ talloc.h & talloc.c:
allocation. (Needless to say, talloc_free() and free() are completely
different things.)
- The copy in mplayer has been modified to abort on OOM conditions. An
+ The copy in mpv has been modified to abort on OOM conditions. An
allocation call will never return NULL.
One very useful feature of talloc is fast tracking of memory leaks. ("Fast"
@@ -72,9 +72,13 @@ talloc.h & talloc.c:
Documentation can be found here:
http://git.samba.org/?p=samba.git;a=blob;f=lib/talloc/talloc.h;hb=HEAD
+ Note: unlike tcmalloc, jemalloc, etc., talloc() is not actually a malloc
+ replacement. It works on top of system malloc and provides additional
+ features that are supposed to make memory management easier.
+
core/mp_core.h:
Data structures for mplayer.c and command.c. They are usually not accessed
- by other parts of mplayer for the sake of modularization.
+ by other parts of mpv for the sake of modularization.
Note that there are lots of global variables floating around everywhere
else. This is an ongoing transition, and eventually there should be no
@@ -92,7 +96,7 @@ core/input/input.c:
Note that keyboard input and slave mode input are essentially the same
things. Just looking at input.conf should make this clear. (The other
- direction of slave mode communication, mplayer to application, consists of
+ direction of slave mode communication, mpv to application, consists of
random mp_msg() calls all over the code in all parts of the player.)
core/command.c:
@@ -100,18 +104,18 @@ core/command.c:
Properties are essentially dynamic variables changed by certain commands.
This is basically responsible for all user commands, like initiating
seeking, switching tracks, etc. It calls into mplayer.c, where most of the
- work is done, but also into other parts of mplayer.
+ work is done, but also into other parts of mpv.
core/mp_msg.h:
- All terminal output should go though mp_msg().
+ All terminal output should go through mp_msg().
stream/*:
File input is implemented here. stream.h/.c provides a simple stream based
- interface (like reading a number of bytes at a given offset). mplayer can
+ interface (like reading a number of bytes at a given offset). mpv can
also play from http streams and such, which is implemented here.
- E.g. if mplayer sees "http://something" on the command line, it will pick
- stream_http.c based on the prefix, and pass the rest of the filename to it.
+ E.g. if mpv sees "http://something" on the command line, it will pick
+ stream_lavf.c based on the prefix, and pass the rest of the filename to it.
Some stream inputs are quite special: stream_dvd.c turns DVDs into mpeg
streams (DVDs are actually a bunch of vob files etc. on a filesystem),
@@ -120,39 +124,40 @@ stream/*:
Some stream inputs are just there to invoke special demuxers, like
stream_mf.c. (Basically to make the prefix "mf://" do something special.)
- cache2.c is a horrible little thing which provides a caching wrapper around
- stream implementations, needed for smooth network playback.
+ cache.c is a caching wrapper around streams implementations, needed for
+ smooth network playback.
demux/:
Demuxers split data streams into audio/video/sub streams, which in turn
- yield packets. Packets (see demux_packet.h) are mostly byte chunks tagged
- with a playback time (PTS). These packets are passed to the decoders.
+ are split in packets. Packets (see demux_packet.h) are mostly byte chunks
+ tagged with a playback time (PTS). These packets are passed to the decoders.
Most demuxers have been removed from this fork, and the only important and
"actual" demuxers left are demux_mkv.c and demux_lavf.c (uses libavformat).
There are some pseudo demuxers like demux_cue.c, which exist only to invoke
other frontend code (tl_cue.c in this case).
- The main interface is in demux.h. A demuxer provides a list of available
- streams. Also, for each type of stream (video/audio/sub) there is a
- demux_stream. This contains the current packet stream coming from the
- demuxer as a linked list of demux_packets.
+ The main interface is in demux.h. The stream headers are in stheader.h.
+ There is a stream header for each audio/video/sub stream, and each of them
+ holds codec information about the stream and other information.
video/:
- This contains several things related to audio/video encoding, as well as
+ This contains several things related to audio/video decoding, as well as
video filters.
- mp_image.h and img_format.h define how mplayer stores video frames
+ mp_image.h and img_format.h define how mpv stores decoded video frames
internally.
video/decode/:
- vd_*.c are video decoders. (There's only vd_ffmpeg.c left.) dec_video.c/vd.c
+ vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c/vd.c
handle most of connecting the frontend with the actual decoder.
video/filter/:
vf_*.c and vf.c form the video filter chain. They are fed by the video
decoder, and output the filtered images to the VOs though vf_vo.c. By
- default, no video filters (except vf_vo) are used.
+ default, no video filters (except vf_vo) are used. vf_scale is automatically
+ inserted if the video output can't handle the video format used by the
+ decoder.
video/out/:
Video output. They also create GUI windows and handle user input. In most
@@ -167,13 +172,18 @@ video/out/:
vo_vdpau and vo_opengl should be taken as reference.
audio/:
- format.h/format.c define the audio formats.
+ format.h/format.c define the uncompressed audio formats. (As well as some
+ compressed formats used for spdif.)
audio/decode/:
- ad_*.c and dec_audio.c/ad.c handle audio decoding.
+ ad_*.c and dec_audio.c/ad.c handle audio decoding. ad_lavc.c is the
+ decoder using ffmpeg. ad_spdif.c is not really a decoder, but is used for
+ compressed audio passthrough.
audio/filter/:
- Audio filter chain.
+ Audio filter chain. af_lavrresample is inserted if any form of conversion
+ between audio formats is needed. (af_format.c is also used for some corner
+ cases.)
audio/out/:
Audio outputs.
@@ -182,7 +192,7 @@ audio/out/:
--gapless-audio, even playing a new file will close and re-open the audio
device.
- Note that mplayer synchronizes the video to the audio. That's the reason
+ Note that mpv synchronizes the video to the audio. That's the reason
why buggy audio drivers can have a bad influence on playback quality.
sub/:
@@ -210,7 +220,8 @@ sub/:
Text subtitles can be preloaded, in which case they are read fully as soon
as the subtitle is selected, and then effectively stored in an ASS_Track.
It's used for external text subtitles, and required to make codepage
- detection as well as timing postprocessing work.
+ detection as well as timing postprocessing work. (Timing postprocessing
+ removes tiny gaps or overlaps between subtitle events.)
core/timeline/:
A timeline is the abstraction used by mplayer.c to combine several files
diff --git a/Makefile b/Makefile
index c3638c865f..5c0c1c6490 100644
--- a/Makefile
+++ b/Makefile
@@ -187,30 +187,17 @@ SOURCES = talloc.c \
core/timeline/tl_edl.c \
core/timeline/tl_matroska.c \
core/timeline/tl_cue.c \
- demux/asfheader.c \
- demux/aviheader.c \
- demux/aviprint.c \
demux/codec_tags.c \
demux/demux.c \
- demux/demux_asf.c \
- demux/demux_avi.c \
demux/demux_edl.c \
demux/demux_cue.c \
demux/demux_lavf.c \
demux/demux_mf.c \
demux/demux_mkv.c \
- demux/demux_mpg.c \
demux/demux_subreader.c \
- demux/demux_ts.c \
- demux/mp3_hdr.c \
- demux/parse_es.c \
- demux/mpeg_hdr.c \
- demux/demux_rawaudio.c \
- demux/demux_rawvideo.c \
+ demux/demux_raw.c \
demux/ebml.c \
- demux/extension.c \
demux/mf.c \
- demux/video.c \
osdep/io.c \
osdep/numcores.c \
osdep/timer.c \
diff --git a/audio/decode/ad.h b/audio/decode/ad.h
index ff51ecbe35..1c8a211f5b 100644
--- a/audio/decode/ad.h
+++ b/audio/decode/ad.h
@@ -42,10 +42,6 @@ typedef struct ad_functions
// NULL terminated array of all drivers
extern const ad_functions_t * const mpcodecs_ad_drivers[];
-// fallback if ADCTRL_RESYNC not implemented: sh_audio->a_in_buffer_len=0;
#define ADCTRL_RESYNC_STREAM 1 // resync, called after seeking
-// fallback if ADCTRL_SKIP not implemented: ds_fill_buffer(sh_audio->ds);
-#define ADCTRL_SKIP_FRAME 2 // skip block/frame, called while seeking
-
#endif /* MPLAYER_AD_H */
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index b5a4ee1ef8..e78e26f208 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -24,6 +24,7 @@
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
+#include <libavutil/common.h>
#include "talloc.h"
@@ -50,8 +51,8 @@ struct priv {
uint8_t *output_packed; // used by deplanarize to store packed audio samples
int output_left;
int unitsize;
- int previous_data_left; // input demuxer packet data
bool force_channel_map;
+ struct demux_packet *packet;
};
#define OPT_BASE_STRUCT struct MPOpts
@@ -344,9 +345,9 @@ static int control(sh_audio_t *sh, int cmd, void *arg)
switch (cmd) {
case ADCTRL_RESYNC_STREAM:
avcodec_flush_buffers(ctx->avctx);
- ds_clear_parser(sh->ds);
- ctx->previous_data_left = 0;
ctx->output_left = 0;
+ talloc_free(ctx->packet);
+ ctx->packet = NULL;
return CONTROL_TRUE;
}
return CONTROL_UNKNOWN;
@@ -375,43 +376,35 @@ static int decode_new_packet(struct sh_audio *sh)
{
struct priv *priv = sh->context;
AVCodecContext *avctx = priv->avctx;
- double pts = MP_NOPTS_VALUE;
- int insize;
- bool packet_already_used = priv->previous_data_left;
- struct demux_packet *mpkt = ds_get_packet2(sh->ds,
- priv->previous_data_left);
- unsigned char *start;
- if (!mpkt) {
- assert(!priv->previous_data_left);
- start = NULL;
- insize = 0;
- ds_parse(sh->ds, &start, &insize, pts, 0);
- if (insize <= 0)
- return -1; // error or EOF
- } else {
- assert(mpkt->len >= priv->previous_data_left);
- if (!priv->previous_data_left) {
- priv->previous_data_left = mpkt->len;
- pts = mpkt->pts;
- }
- insize = priv->previous_data_left;
- start = mpkt->buffer + mpkt->