Commit Graph

405 Commits

Author SHA1 Message Date
wm4 46247df6e5 common: add MP_IS_ALIGNED macro 2019-09-19 20:37:05 +02:00
wm4 6646e82daa demux: move timestamp helper macros to common.h
These are probably generally useful.
2019-09-19 20:37:05 +02:00
wm4 6d11668a9c demux: use no overlapping packets for lossless audio
Worthless optimization, but at least it justifies that the
--audio-backward-overlap option has an "auto" choice. Tested with PCM
and FLAC.
2019-09-19 20:37:04 +02:00
ekisu cd7bcb9d0c encode: set sample_aspect_ratio on AVStream struct
Some libavformat muxers (e.g. matroskaenc.c) expect this field to be set
on the AVStream struct, and not only in the AVCodecParameters.
2019-08-14 21:54:44 +02:00
Niklas Haas 7006d6752d vo_gpu: vulkan: use libplacebo instead
This commit rips out the entire mpv vulkan implementation in favor of
exposing lightweight wrappers on top of libplacebo instead, which
provides much of the same except in a more up-to-date and polished form.

This (finally) unifies the code base between mpv and libplacebo, which
is something I've been hoping to do for a long time.

Note: The ra_pl wrappers are abstract enough from the actual libplacebo
device type that we can in theory re-use them for other devices like
d3d11 or even opengl in the future, so I moved them to a separate
directory for the time being. However, the rest of the code is still
vulkan-specific, so I've kept the "vulkan" naming and file paths, rather
than introducing a new `--gpu-api` type. (Which would have been ended up
with significantly more code duplicaiton)

Plus, the code and functionality is similar enough that for most users
this should just be a straight-up drop-in replacement.

Note: This commit excludes some changes; specifically, the updates to
context_win and hwdec_cuda are deferred to separate commits for
authorship reasons.
2019-04-21 23:55:22 +03:00
wm4 9d8afcf79e demux: add another stream recording feature
--record-file is nice, but only sometimes. If you watch some sort of
livestream which you want to record, it's actually much nicer not to
record what you're currently "seeing", but anything you're receiving.
2018-12-06 10:31:10 +01:00
Anton Kindestam 8b83c89966 Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition
This bumps libmpv version to 1.103
2018-12-05 19:19:24 +01:00
Jan Ekström be47e22b55 encode: simplify encode_lavc_add_packet
We're doing the same thing as the primary path - just that we log
and set 'failed' to true.
2018-10-01 23:34:11 +03:00
Niklas Haas 6d61c5f68a encode: fix AVPacket deinitialization logic
Since this function is called with packets on the stack, trying to free
them makes no sense. Instead, it should unref (which is what
`av_interleaved_write_frame` does anyway, rather than freeing).

Also, the calling code tried unreffing the packet a second time, even
after it was "freed" by the callee in the failure case - and after
ownership was taken over by `av_interleaved_write_frame` in the
successful case. Both of these cases were wrong.
2018-10-01 20:20:25 +03:00
wm4 f8ab59eacd player: get rid of mpv_global.opts
This was always a legacy thing. Remove it by applying an orgy of
mp_get_config_group() calls, and sometimes m_config_cache_alloc() or
mp_read_option_raw().

win32 changes untested.
2018-05-24 19:56:35 +02:00
wm4 3569857b75 path: don't access global option struct
The path functions need to access the option that forces non-default
config directories. Just add it as a field to mpv_global - it seems
justified. The accessed options were always enforced as immutable after
init, so there's not much of a change.
2018-05-24 19:56:35 +02:00
wm4 d33e5972b3 demux: get rid of free_demuxer[_and_stream]()
Them being separate is just dumb. Replace them with a single
demux_free() function, and free its stream by default. Not freeing the
stream is only needed in 1 special case (demux_disc.c), use a special
flag to not free the stream in this case.
2018-05-24 19:56:35 +02:00
wm4 76dc5d9aa9 command: make loadlist command async and abortable
Don't allow it to freeze everything when loading a playlist from network
(although you definitely shouldn't do that, but whatever).

This also affects the really obscure --ordered-chapters-files option.
The --playlist option on the other hand has no choice but to freeze the
shit, because there's no concept of aborting the player during command
line parsing.
2018-05-24 19:56:35 +02:00
wm4 0ab3184526 encode: get rid of the output packet queue
Until recently, ao_lavc and vo_lavc started encoding whenever the core
happened to send them data. Since audio and video are not initialized at
the same time, and the muxer was not necessarily opened when the first
encoder started to produce data, the resulting packets were put into a
queue. As soon as the muxer was opened, the queue was flushed.

Change this to make the core wait with sending data until all encoders
are initialized. This has the advantage that we don't need to queue up
the packets.
2018-05-03 01:08:44 +03:00
wm4 f18c4175ad encode: remove old timestamp handling
This effectively makes --ocopyts the default. The --ocopyts option
itself is also removed, because it's redundant.
2018-05-03 01:08:44 +03:00
wm4 60dade1040 encode: restore 2-pass mode
While I'm not sure whether it really works, at least it writes the pass1
log correctly now.

How 2-pass stat output is supposed to interact with the new decode API
is rather fishy. ffmpeg.c does the same, and before this change, the
log was not written on EOF (when at least libvpx actually outputs its
stats).
2018-05-03 01:08:44 +03:00
wm4 3c2d20e414 common: add missing %f time format
It was documented for --screenshot-template, but apparently never
implemented.

This value is not explicitly rounded, other than for printf() %f default
formatting (which rounds to 6 digits).
2018-05-01 00:25:27 +03:00
wm4 8f67fa13f1 common: round all integer times to milliseconds
This means that a time of 4.5678 is displayed as "00:00:04.568" when the
format string is "%H:%M:%S.%T". Likewise, 59.99999 will be displayed as
"00:01:00.000". Before this change, the sub-ms times were just
truncated.

Requested by TheAMM.
2018-05-01 00:25:27 +03:00
wm4 2a28712b44 f_lavfi: support setting common filter options like "threads"
AVFilterContext instances support some additional AVOptions over the
actual filter. This includes useful options like "threads". We didn't
support setting those for the "direct" wrapper (--vf=yadif:threads=1
failed). Change this. It requires setting options on the AVFilterContext
directly, except the code for positional parameters still needs to
access the actual filter's AVOptions.
2018-04-29 02:21:32 +03:00
wm4 6c8362ef54 encode: rewrite half of it
The main change is that we wait with opening the muxer ("writing
headers") until we have data from all streams. This fixes race
conditions at init due to broken assumptions in the old code.

This also changes a lot of other stuff. I found and fixed a few API
violations (often things for which better mechanisms were invented, and
the old ones are not valid anymore). I try to get away from the public
mutex and shared fields in encode_lavc_context. For now it's still
needed for some timestamp-related fields, but most are gone. It also
removes some bad code duplication between audio and video paths.
2018-04-29 02:21:32 +03:00
wm4 bfc33da250 encode: get rid of AVDictionary setter helper
Removes a good hunk of weird code.

This loses qscale "emulation", some logging, and the fact that duplicate
keys for values starting with +/- were added with AV_DICT_APPEND. I
don't assign those any importance, even if they are user-visible
changes.

The new M_OPT_ flag is just so that nothing weird happens for other
key-value options, which do not interpret a "help" key specially.
2018-04-29 02:21:32 +03:00
wm4 05e75e7946 encode: some more cleanups 2018-04-29 02:21:32 +03:00
wm4 78227706ad encode: simplify colorspace setting
This was also refactored at some point, and is now unnecessarily
roundabout.
2018-04-20 12:37:34 +02:00
wm4 20a1f250c6 encode: cosmetics
Mostly whitespace changes; some semantic preserving transformations.
2018-04-20 12:37:34 +02:00
wm4 c490b3f8ea encode: remove some unused functions 2018-04-20 12:37:34 +02:00
wm4 f2b026f941 encoding: deprecate a bunch of obscure options
--audio-delay does not work correctly yet, but hopefully this can be
fixed later.
2018-04-20 12:37:15 +02:00
wm4 e7e06a47a0 demux: support for some kinds of timed metadata
This makes ICY title changes show up at approximately the correct time,
even if the demuxer buffer is huge. (It'll still be wrong if the stream
byte cache contains a meaningful amount of data.)

It should have the same effect for mid-stream metadata changes in e.g.
OGG (untested).

This is still somewhat fishy, but in parts due to ICY being fishy, and
FFmpeg's metadata change API being somewhat fishy. For example, what
happens if you seek? With FFmpeg AVFMT_EVENT_FLAG_METADATA_UPDATED and
AVSTREAM_EVENT_FLAG_METADATA_UPDATED we hope that FFmpeg will correctly
restore the correct metadata when the first packet is returned.

If you seke with ICY, we're out of luck, and some audio will be
associated with the wrong tag until we get a new title through ICY
metadata update at an essentially random point (it's mostly inherent to
ICY). Then the tags will switch back and forth, and this behavior will
stick with the data stored in the demuxer cache. Fortunately, this can
happen only if the HTTP stream is actually seekable, which it usually is
not for ICY things. Seeking doesn't even make sense with ICY, since you
can't know the exact metadata location. Basically ICY metsdata sucks.

Some complexity is due to a microoptimization: I didn't want additional
atomic accesses for each packet if no timed metadata is used. (It
probably doesn't matter at all.)
2018-04-18 01:17:42 +03:00
wm4 596f66cccf av_common: cosmetic simplification to ffmpeg component iteration loops 2018-04-03 20:08:15 +03:00
wm4 428fc1cbef f_lavfi: use new libavfilter iteration API 2018-04-03 20:08:15 +03:00
wm4 fd90c003d2 mp_image: replace rude function with less rude FFmpeg upstream function
This is new, thus a dependency bump is required.
2018-03-03 02:38:01 +02:00
wm4 706bb1d0c7 Fix recent FFmpeg deprecations
This includes codec/muxer/demuxer iteration (different iteration
function, registration functions deprecated), and the renaming of
AVFormatContext.filename to url (plus making it a malloced string).

Libav doesn't have the new API yet, so it will break. I hope they will
add the new APIs too.
2018-02-13 17:45:29 -08:00
wm4 8b3306924d codecs: remove unused family field
MPlayer used this to distinguish multiple decoder wrappers (such as
libavcodec vs. binary codec loader vs. builtin decoders). It lost
meaning in mpv as non-libavcodec things were dropped. Now it doesn't
serve any purpose anymore.

Parsing was removed quite a while ago, and the recent filter change
removed any use of the internal family field. Get rid of it.
2018-02-01 10:21:55 +01:00
wm4 76e7e78ce9 audio: move to decoder wrapper
Use the decoder wrapper that was introduced for video. This removes all
code duplication the old audio decoder wrapper had with the video code.

(The audio wrapper was copy pasted from the video one over a decade ago,
and has been kept in sync ever since by the power of copy&paste. Since
the original copy&paste was possibly done by someone who did not answer
to the LGPL relicensing, this should also remove all doubts about
whether any of this code is left, since we now completely remove any
code that could possibly have been based on it.)

There is some complication with spdif handling, and a minor behavior
change (it will restrict the list of codecs to spdif if spdif is to be
used), but there should not be any difference in practice.
2018-01-30 03:10:27 -08:00
wm4 76276c9210 video: rewrite filtering glue code
Get rid of the old vf.c code. Replace it with a generic filtering
framework, which can potentially handle more than just --vf. At least
reimplementing --af with this code is planned.

This changes some --vf semantics (including runtime behavior and the
"vf" command). The most important ones are listed in interface-changes.

vf_convert.c is renamed to f_swscale.c. It is now an internal filter
that can not be inserted by the user manually.

f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed
once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is
conceptually easy, but a big mess due to the data flow changes).

The existing filters are all changed heavily. The data flow of the new
filter framework is different. Especially EOF handling changes - EOF is
now a "frame" rather than a state, and must be passed through exactly
once.

Another major thing is that all filters must support dynamic format
changes. The filter reconfig() function goes away. (This sounds complex,
but since all filters need to handle EOF draining anyway, they can use
the same code, and it removes the mess with reconfig() having to predict
the output format, which completely breaks with libavfilter anyway.)

In addition, there is no automatic format negotiation or conversion.
libavfilter's primitive and insufficient API simply doesn't allow us to
do this in a reasonable way. Instead, filters can use f_autoconvert as
sub-filter, and tell it which formats they support. This filter will in
turn add actual conversion filters, such as f_swscale, to perform
necessary format changes.

vf_vapoursynth.c uses the same basic principle of operation as before,
but with worryingly different details in data flow. Still appears to
work.

The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are
heavily changed. Fortunately, they all used refqueue.c, which is for
sharing the data flow logic (especially for managing future/past
surfaces and such). It turns out it can be used to factor out most of
the data flow. Some of these filters accepted software input. Instead of
having ad-hoc upload code in each filter, surface upload is now
delegated to f_autoconvert, which can use f_hwupload to perform this.

Exporting VO capabilities is still a big mess (mp_stream_info stuff).

The D3D11 code drops the redundant image formats, and all code uses the
hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a
big mess for now.

f_async_queue is unused.
2018-01-30 03:10:27 -08:00
wm4 ad1d845682 av_log: stop accessing private ffmpeg fields
MPlayer legacy added in 3c49701490.
2018-01-03 15:11:27 -08:00
Ricardo Constantino 828bd2963c
command: add demuxer-lavf-list property
Was only available with --demuxer-lavf-format=help and the demuxer
needed to be used for it to actually print the list.

This can be used in the future to check if 'dash' support was compiled
with FFmpeg so ytdl_hook can use it instead. For now, dashdec is too
rudimentary to be used right away.
2018-01-02 20:46:58 +00:00
wm4 49e704cb19
build: move copyright statement to a shared location
Now macosx_menubar.m and mpv.rc (win32) use the same copyright string.
(This is a bit roundabout, because mpv.rc can't use C constants. Also
the C code wants to avoid rebuilding real source files if only version.h
changed, so only version.c includes version.h.)
2018-01-01 21:05:09 +00:00
TheAMM 8b7da7a8e5 encode: implement --oset-metadata, and --oremove-metadata
This commit introduces a new --oset-metadata key-value-list option,
allowing the user to specify output metadata when encoding
(eg. --oset-metadata=title="Hello",comment="World").

A second option --oremove-metadata is added to exclude existing metadata
from the output file (assuming --ocopy-metadata is enabled).

Not all output formats support all tags, but luckily libavcodec
simply discards unsupported keys.
2017-12-26 03:33:19 -07:00
TheAMM c8d955571d encode: rename option --ometadata to --ocopy-metadata
--copy-metadata describes the result of the option better, (copying metadata
from the source file to the output file). Marks the old --no-ometadata
OPT_REMOVED with a suggestion for the new --no-ocopy-metadata.
2017-12-26 03:33:19 -07:00
Kevin Mitchell e2f71f509f tags: add mp_tags_remove
This removes all tags matching the provided key. This will be used for removing
metadata tags during encoding.
2017-12-26 03:33:18 -07:00
Niklas Haas d64c33c518 msg: bump up log level of --log-file
This now logs -v -v by default, instead of -v.
2017-12-15 22:28:47 -08:00
Niklas Haas ba1943ac00 msg: reinterpret a bunch of message levels
I've decided that MP_TRACE means “noisy spam per frame”, whereas
MP_DBG just means “more verbose debugging messages than MSGL_V”.
Basically, MSGL_DBG shouldn't create spam per frame like it currently
does, and MSGL_V should make sense to the end-user and provide mostly
additional informational output.

MP_DBG is basically what I want to make the new default for --log-file,
so the cut-off point for MP_DBG is if we probably want to know if for
debugging purposes but the user most likely doesn't care about on the
terminal.

Also, the debug callbacks for libass and ffmpeg got bumped in their
verbosity levels slightly, because being external components they're a
bit less relevant to mpv debugging, and a bit too over-eager in what
they consider to be relevant information.

I exclusively used the "try it on my machine and remove messages from
MSGL_* until it does what I want it to" approach of refactoring, so
YMMV.
2017-12-15 22:28:47 -08:00
Nicolas F 744b67d9e5 Fix various typos in log messages 2017-12-03 21:24:18 +01:00
wm4 8b141ab9ac av_common: drop old hack against ancient lavc vdpau wrapper
Seems like they finally got rid of this. It was the first lavc vdpau
API, and mpv stopped supporting it in favor of newer APIs a long time
ago, causing confusion to users who tried to enable vdpau decoding by
forcing the decoders (MPlayer style).
2017-12-01 18:15:52 +01:00
wm4 a7a1ae0b3d build: make it easier to force FFmpeg upstream
Apparently some people want this. Actually making it compile is still
their problem, though, and I expect that build with FFmpeg upstream will
occasionally be broken (as it is right now). This is because mpv also
relies on API provided by Libav, and if FFmpeg hasn't merged that yet,
it's not our problem - we provide a version of FFmpeg upstream with
those changes merged, and it's called ffmpeg-mpv.

Also adjust the README which still talked about FFmpeg releases.
2017-11-01 16:50:18 +01:00
wm4 a7f4ecb012 Bump libav* API use
(Not tested on Windows and OSX.)
2017-10-30 20:55:42 +01:00
wm4 2defa64d3b av_common: fix Libav build
Fucking shit.
2017-10-16 17:24:07 +02:00
wm4 0a7c5a130e video: properly pass through ICC data
The same should happen with any other side data that matters to mpv,
otherwise filters will drop it.

(No, don't try to argue that mpv should use AVFrame. That won't work.)

ffmpeg_garbage() is copy&paste from frame_new_side_data() in FFmpeg
(roughly feed201849b8f91), because it's not public API. The name
reflects my opinion about FFmpeg's API.

In mp_image_to_av_frame(), change the too-fragile

  *new_ref = (struct mp_image){0};

into explicitly zeroing out the fields that are "transferred" to the
created AVFrame.
2017-10-16 16:36:51 +02:00
wm4 10dd120baa msg: make --msg-level affect --log-file too
But --msg-level can only raise the log level used for --log-file,
because the original idea with --log-file was that it'd log verbose
messages to disk even if terminal logging is lower than -v or fully
disabled.
2017-10-04 22:08:19 +02:00
wm4 bfa9b62858 build: add preliminary LGPL mode
See "Copyright" file for caveats.

This changes the remaining "almost LGPL" files to LGPL, because we think
that the conditions the author set for these was finally fulfilled.
2017-09-21 13:56:27 +02:00
wm4 c391640645 player: fix --lavfi-complex freeze
Commit 0e0b87b6f3 fixed that dropped packets did not trigger further
work correctly. But it also made trivial --lavfi-complex freeze. The
reason is that the meaning if DATA_AGAIN was overloaded: the decoders
meant that they should be called again, while lavfi.c meant that other
outputs needed to be checked again. Rename the latter meaning to
DATA_STARVE, which means that the current input will deliver no more
data, until "other" work has been done (like reading other outputs, or
feeding input).

The decoders never return DATA_STARVE, because they don't get input from
the player core (instead, they get it from the demuxer directly, which
is why they still can return DATA_WAIT).

Also document the DATA_* semantics in the enum.

Fixes #4746.
2017-08-11 21:29:35 +02:00
wm4 47ea771b7a vo_opengl: further GL API use separation
Move multiple GL-specific things from the renderer to other places like
vo_opengl.c, vo_opengl_cb.c, and ra_gl.c.

The vp_w/vp_h parameters to gl_video_resize() make no sense anymore, and
are implicitly part of struct fbodst.

Checking the main framebuffer depth is moved to vo_opengl.c. For
vo_opengl_cb.c it always assumes 8. The API user now has to override
this manually. The previous heuristic didn't make much sense anyway.

The only remaining dependency on GL is the hwdec stuff, which is harder
to change.
2017-08-07 19:17:28 +02:00
wm4 24dc91907a common, vo_opengl: add/use helper for formatted strings on the stack
Seems like I really like this C99 idiom. No reason not to generalize it
do snprintf(). Introduce mp_tprintf(), which basically this idiom to
snprintf(). This macro looks like it returns a string that was allocated
with alloca() on the caller site, except it's portable C99/C11. (And
unlike alloca(), the result is valid only within block scope.)

Use it in 2 places in the vo_opengl code. But it has the potential to
make a whole bunch of weird looking code look slightly nicer.
2017-07-24 08:12:42 +02:00
wm4 ddd068491c Replace remaining avcodec_close() calls
This API isn't deprecated (yet?), but it's still inferior and harder to
use than avcodec_free_context().

Leave the call only in 1 case in af_lavcac3enc.c, where we apparently
seriously close and reopen the encoder for whatever reason.
2017-07-16 12:51:48 +02:00
wm4 50008adf4a options: handle suffixes like -add in a more generic way
This affects options like --vf or --display-tags. These used a "*"
suffix to match all options starting with a specific name, and handled
the rest in the option parser. Change this to remove the "*" special
case, and require every option parser to declare a list of allowed
suffixes via m_option_type.actions.

The new way is conceptually simpler, because we don't have to account
for the "*" in a bunch of places anymore, and instead everything is
centrally handled in the CLI part of the option parser, where it's
actually needed.

It automatically enables suffixes like -add for a bunch of other
stringlist options.
2017-06-26 21:07:00 +02:00
wm4 0744fc1c94 options: unbreak -v
Sigh... broken with the --really-quiet commit. I hate -v.
2017-06-23 21:04:41 +02:00
wm4 633152e55a options: remove weird --really-quiet special behavior
This was especially grating because it causes problems with the
option/property unification, uses as only thing OPT_FLAG_STORE, and
behaves weird with the client API or scripts.

It can be reimplemented in a much simpler way, although it needs
slightly more code. (Simpler because less special cases.)
2017-06-23 20:42:20 +02:00
Rudolf Polzer e2573e5b8d encode_lavc: move from GPL 2+ to LGPL 2.1+. 2017-06-13 14:22:15 -04:00
wm4 25a4d10c8e player: make sure version information is always included in --log-file
If --log-file was used in config files, this could be missing due to the
exact timing when the messages are print, and when the options are
applied. Fix this by always dumping the version again when a log file is
opened.
2017-05-22 18:31:39 +02:00
wm4 9b5e4e5715 demux_raw: drop "mp-rawvideo" use
This is an old pseudo codec to pass through the pixel format. Setup a
suitable AVCodecParameter directly instead, so the "rawvideo" codec can
be used.
2017-05-20 11:43:57 +02:00
wm4 2fd20f638e av_log: mark as almost LGPL
All authors agreed. Some of the code originated from commit
3c49701490 by michael, thus the license change has to be delayed.
2017-05-05 07:15:17 +02:00
wm4 b537b59e65 msg.c/h: partially change license to LGPL
msg.c is "partial" due to "michael", whose work can be changed to LGPL
only once the core is LGPL. It's explained in the Copyright file. I
prefer to do the relicensing incrementally (due to the overwhelming
workload). Changing the license before that happens would be legally
questionable, but nothing can stop us from essentially marking it as
"will be LGPL".

All authors have agreed to LGPL, with the following exceptions:

9df11ee8bf: the author (probably) didn't agree, but the line that is
added is later fully removed.

35e90f1556: was not asked, but all iconv code was 100% removed from the
mp_msg mechanism (we alwas require UTF-8 now).

4e4f3f806e: the change by michael.

50a86fcc34: the identify variable was move, and completely removed the
latest in commit 48bd03dd91.

1f6c494641: did not agree, but due to a major mp_msg change the added
line became unnecessary and was removed.

da63498bf9: was not reachable, but the MPlayer GUI is gone from mpv
anyway (also commit fc4d6e617d removed these specific additions a long
time ago).
2017-05-05 06:53:23 +02:00
wm4 16c468d014 common.h: change license to LGPL
The only definitions from MPlayer code are the CONTROL_* defines (added
in 7a2eec4b as part of libao2 - not part of libao), and MP_NOPTS_VALUE,
which was added in e6338c58. The latter is by "michael", who has agreed
under the condition that the core is LGPL, which has not happened yet,
but considering the macro definition used to be different, has the same
value and similar name to libavformat's AV_NOPTS_VALUE (which existed
first, and as LGPL), and that this almost certainly not copyrightable,
I'm assuming that this is fine.
2017-04-21 08:49:25 +02:00
wm4 31611fc46b video: support positional arguments for automatic lavfi option bridge
Now e.g. --vf=pad=1000:1000 works.

All in all pretty ugly and hacky. Just look away.
2017-04-03 18:12:42 +02:00
wm4 a993a871ee encode_lavc: fix build failure after libavcodec major bump 2017-03-23 11:30:11 +01:00
Philip Sequeira a2a5fa4545 options: add M_OPT_FILE to some more file options
(Helps shell completion.)
2017-03-06 15:41:06 +01:00
wang-bin e285e22143 Use AV_INPUT_BUFFER_PADDING_SIZE instead of deprecated one
Signed-off-by: wm4 <wm4@nowhere>
2017-02-08 16:55:16 +01:00
wm4 96a45a16af player: add experimental stream recording feature
This is basically a WIP, but it can't remain in a branch forever. A
warning is print when using it as it's still a bit "shaky".
2017-02-07 17:05:17 +01:00
wm4 cfda696580 build: explicitly check for FFmpeg vs. Libav, and their exact versions
In a first pass, we check whether libavcodec is present.

Then we try to compile a snippet and check for FFmpeg vs. Libav. (This
could probably also be done by somehow checking the pkgconfig version.
But pkg-config can't deal with that idiotic FFmpeg idea that a micro
version number >= 100 identifies FFmpeg vs. Libav.)

After that we check the project-specific version numbers. This means it
can no longer happen that we accidentally allow older, unsupported
versions of FFmpeg, just because the Libav version numbers are somehow
this way.

Also drop the resampler checks. We hardcode which resampler to each with
each project. A user can no longer force use of libavresample with
FFmpeg.
2017-01-27 09:57:01 +01:00
wm4 04376fa024 ad_lavc, vd_lavc: preserve codec_id/codec_type when setting params
avcodec_parameters_to_context() overwrites codec_type and codec_id. But
we already set these by passing the selected AVCodec to
avcodec_alloc_context3(). It's entirely possible that at least codec_id
is different when forcing codecs with --ad/--vd. It's probably better
not to cause confusion by overwriting them. It might even trigger
undefined behavior in libavcodec (how it behaves or whether codec_id is
supposed to be strictly set is unknown, though).
2017-01-25 08:30:14 +01:00
wm4 801fa486b0 ad_lavc, vd_lavc: move mpv->lavc decoder parameter setup to common code
This can be useful in other contexts.

Note that we end up setting AVCodecContext.width/height instead of
coded_width/coded_height now. AVCodecParameters can't set coded_width,
but this is probably more correct anyway.
2017-01-25 08:24:19 +01:00
wm4 f762fc4230 av_common: remove old/unused timestamp passthrough code
This attempted to pass through double float timestamps in a bit exact
way by reinterpret casting them to int64_t. This usually worked, because
libavcodec (in decoding mode) is mostly not allowed to interpret
timestamps. libavcodec doesn't even know the unit of the timestamps,
unless the API user sets a timebase.

We've stopped doing this, and always set a timebase. Only ad_spdif.c
still used this (indirectly through mp_set_av_packet()), but doesn't
actually need timestamps on the packet. In fact, it's already explicitly
setting the packet timestamp fields to 0 before passing it to FFmpeg
API.

This code is unused, and the passthrough method wasn't terribly elegant
to begin with. Drop this code. Arbitrarily use AV_TIME_BASE_Q as
fallback in situations the passthrough was used.
2017-01-24 08:36:40 +01:00
wm4 c06fd19d8f av_common: drop unused function
Unused since the AVCodecParameters change.
2017-01-24 08:15:38 +01:00
wm4 13add62cf0 options: drop deprecated --vd/--ad codecs selection features
Only simple selection works now. Using "-" to terminate codec selection
remains in the code (might get undeprecated).
2017-01-19 15:38:58 +01:00
wm4 b9cebf180b Prefix libavcodec CODEC_FLAG_ constants with AV_
The unprefixed versions are silently deprecated.
2016-12-29 07:37:31 +01:00
wm4 1c761bd6f5 options: deprecate some other complex --ad/--vd features
Who even needs those?

Once these deprecations are gone, --ad/--vd are simple lists without any
kind of complex matching.
2016-12-23 18:18:17 +01:00
wm4 9d21f2503f options: deprecate codec family selection in --vd/--ad
Useless now, so get rid of it. Also affects some user-visible display
things (like reported codec in use).
2016-12-23 18:12:29 +01:00
wm4 c560f6ff0a audio: change how spdif codecs are selected
Remove ad_spdif from the normal codec list, and select it explicitly.

One goal was to decouple this from the normal codec selection, so
they're less entangled and the decoder selection code can be simplified
in the far future. This means spdif codec selection is now done
explicitly via select_spdif_codec(). We can also remove the weird
requirements on "dts" and "dts-hd" for the --audio-spdif option, and it
can just do the right thing.

Now both video and audio codecs consist of a single codec family each,
vd_lavc and ad_lavc.
2016-12-23 18:10:07 +01:00
wm4 3eceac2eab Remove compatibility things
Possible with bumped FFmpeg/Libav.

These are just the simple cases.
2016-12-07 19:53:11 +01:00
wm4 98e7b4e538 av_common: always make sure to return a valid timebase
av_reduce(&num, &den, 1, 14112000, 1000000) can return num=0, den=1.
This means a 1/14112000 timebase (as used by the mp3 demuxer) would
become invalid.

The intention of mp_get_codec_timebase() is to always return a valid
timebase. av_reduce() probably does the logically correct thing - so add
a fallback to the safe default timebase.

Also, increase the av_reduce() parameter to INT_MAX. Let's just pray
this doesn't cause any actual problems. libavformat does the same, but
might be in a different position due to using av_rescale() etc., while
we convert between fractional timestamps and floats.
2016-11-10 12:06:17 +01:00
wm4 b86a2316df demux_lavf: "support" mov edit lists and log errors if used
FFmpeg recently got "support" for mov edit lists. This is a terrible
hack that will fail completely at least with some decoders (in
particular wrappers for hardware decoding might be affected). As such it
makes no point to pretend they are supported, even if we assume that the
"intended" functionality works, that there are no implementation bugs
(good luck with all that messy code added to the already huge mov
demuxer), and that it covers enough of the mov edit list feature to be
of value.

So log an error if the FFmpeg code for mov edit lists appears to be
active - AV_PKT_FLAG_DISCARD is used only for "clipping" edit list
segments on non-key frame boundaries.

In the first place, FFmpeg committed this only because Google wanted it
in, and patch review did not even pick up obvious issues. (Just look how
there was no lavc version bump when AV_PKT_FLAG_DISCARD was added.)

We still pass the new packet flag to the decoders (av_common.c change),
which means we "support" FFmpeg's edit list code now. (Until it breaks
due to FFmpeg not caring about all the details.)
2016-10-18 16:57:02 +02:00
wm4 139f6b5de7 ad_lavc, vd_lavc: fix a recent libavcodec deprecation warning
Both AVFrame.pts and AVFrame.pkt_pts have existed for a long time. Until
now, decoders always returned the pts via the pkt_pts field, while the
pts field was used for encoding and libavfilter only. Recently, pkt_pts
was deprecated, and pts was switched to always carry the pts.

This means we have to be careful not to accidentally use the wrong
field, depending on the libavcodec version. We have to explicitly check
the version numbers. Of course the version numbers are completely
idiotic, because idiotically the pkg-config and library names are the
same for FFmpeg and Libav, so we have to deal with this explicitly as
well.
2016-10-17 19:18:03 +02:00
wm4 ea50f6fdef msg: flush after every message for --log-file
We'd like to get log messages on the output as soon as possible in the
output. I also feel like using fflush() is nicer than using setvbuf().
Who knows how the latter behaves on win32.
2016-09-30 14:55:59 +02:00
wm4 ef2bbd5a7a msg: make --log-file and --dump-stats accept config path expansion
Seems like a valid use-case. Not sure if I like it calling back into the
config code. Care has to be taken for not letting the config path
resolving code dead-lock (which is why locking details in the msg.c code
are changed).

Fixes #3591.
2016-09-28 15:04:38 +02:00
wm4 7783f0b7d7 client API: more or less deprecate mpv_set_option()
With the merging of options and properties, the mpv_set_option()
function is close to being useless, and mpv_set_property() can be used
for everything instead. There are certain conflicts remaining, which are
explained in depth in the docs. For now, none of this should affect
existing code using the client API.

Make mpv_set_property() redirect to mpv_set_option() before
initialization.

Remove some options marked as M_OPT_FIXED. The "pause" and "speed"
options cannot be written anymore without the playloop being notified by
it, so the M_OPT_FIXED does nothing. For "vo-mmcss-profile", the problem
was lack of synchronization, which has been added. I'm not sure what the
problem was with "frames" - I think it was only marked as M_OPT_FIXED
because changing it during playback will have no effect. Except for
pause/speed, these changes are needed to make them writable as
properties after mpv_initialize().

Also replace all remaining uses of CONF_GLOBAL with M_OPT_FIXED.
2016-09-21 17:35:00 +02:00
wm4 ce65ea3345 player: make --log-file and --dump-stats freely settable at runtime
Same deal as with the previous commit. We use the file paths to decide
when we should attempt to reopen them.
2016-09-19 19:56:40 +02:00
wm4 591e21a2eb osdep: rename atomics.h to atomic.h
The standard header is stdatomic.h, so the extra "s" freaks me out every
time I look at it.
2016-09-07 11:26:25 +02:00
wm4 723e3ec8d9 common: use char array for version string
Use a char array instead of a pointer, which allows using the version
variables in a constant context.
2016-09-06 20:08:44 +02:00
wm4 423e53ba0b m_config: introduce basic mechanism to synchronize global option updates
The way option runtime changes are handled is pretty bad in the current
codebase. There's a big option struct (MPOpts), which contains almost
everything, and for which no synchronization mechanism exists. This was
handled by either making some options read-only after initialization,
duplicating the option struct, using sub-options (in the VO), and so on.

Introduce a mechanism that creates a copy of the global options (or
parts of it), and provides a well-defined way to update them in a
thread-safe way.

Most code can remain the same, just that all the component glue code has
to explicitly make use of it first.

There is still lots of room for improvement. For example, the update
mechanism could be better.
2016-09-02 15:50:40 +02:00
wm4 5e56c07417 common: add assert.h include
Because why not.
2016-08-28 19:33:04 +02:00
wm4 05e4df3f0c video/audio: always provide "proper" timestamps to libavcodec
Instead of passing through double float timestamps opaquely, pass real
timestamps. Do so by always setting a valid timebase on the
AVCodecContext for audio and video decoding.

Specifically try not to round timestamps to a too coarse timebase, which
could round off small adjustments to timestamps (such as for start time
rebasing or demux_timeline). If the timebase is considered too coarse,
make it finer.

This gets rid of the need to do this specifically for some hardware
decoding wrapper. The old method of passing through double timestamps
was also a bit questionable. While libavcodec is not supposed to
interpret timestamps at all if no timebase is provided, it was
needlessly tricky. Also, it actually does compare them with
AV_NOPTS_VALUE. This change will probably also reduce confusion in the
future.
2016-08-19 14:59:30 +02:00
wm4 4aaa83339c av_common: improve rounding for float->int timestamp conversions 2016-08-19 14:11:32 +02:00
wm4 d057e7a142 player: fatal error if linked and compiled FFmpeg versions mismatch
We don't support this anymore.

This tries to exit in a controlled way after command line options are
applied in order to honor logging options and, in case of libmpv, not to
kill the host. Not sure if it would be better to just vomit text to
stderr and call abort().
2016-07-01 20:56:59 +02:00
wm4 3ff3749b7d av_log: readd ffmpeg library runtime version mismatch warning
It just happens far too often.
2016-05-01 20:11:15 +02:00
Rudolf Polzer 160497b8ff encode_lavc: Migrate to codecpar API. 2016-04-11 14:57:20 -04:00
wm4 c971220cdd demux_lavf, ad_lavc, ad_spdif, vd_lavc: handle FFmpeg codecpar API change
AVFormatContext.codec is deprecated now, and you're supposed to use
AVFormatContext.codecpar instead.

Handle this for all of the normal playback code.

Encoding mode isn't touched.
2016-03-31 22:00:45 +02:00
Niklas Haas b9c48ca8f3 playlist: improve shuffle algorithm
The old algorithm produced results which were not uniformly distributed,
i.e. some particular shuffles were preferred over others.

The new algorithm is an implementation of the Fisher-Yates shuffle which
is guaranteed to shuffle uniformly given a sufficiently uniform rand()
and ignoring potential floating-point errors.

Signed-off-by: wm4 <wm4@nowhere>
2016-03-20 19:51:22 +01:00
wm4 fa8b2be4de av_common: explicitly exclude _vdpau deccoders from enumeration
Completely pointless abominations that FFmpeg refuses to remove. They
are ancient, long deprecated API which we can't use anymore. They
confused users as well.

Pretend that they don't exist. Due to the way --vd works, they can't
even be forced anymore. The older hack which explicitly rejects these
can be dropped as well.
2016-03-02 22:20:15 +01:00
wm4 46a3165cde msg: introduce partial line buffers per mp_log
The goal is reducing log messups (which happen surprisingly often) by
buffering partial lines in mp_log. This is still not 100% reliable, but
better.

The extrabuffers for MSGL_STATUS and MSGL_STATS are not needed anymore,
because a separate mp_log instance can be used if problems really occur.

Also, give up, and replace the snprintf acrobatics with bstr.

mp_log.partial has a quite subtle problem wrt. talloc: talloc parents
can not be used, because there's no lock around the internal talloc
structures associated with mp_log. Thus it has to be freed manually,
even if this happens through a talloc destructor.
2016-03-01 22:36:05 +01:00
wm4 a5eef06225 msg: minor simplification
Instead of playing ugly tricks with the buffer to append a \r or \n to
the text buffer, extend print_terminal_line() to print a second string.
2016-03-01 22:11:09 +01:00
wm4 4e53272376 av_log: avoid partial lines
We want to add a prefix to the ffmpeg log message, so we called mp_msg
multiple times until now. But logging such partial lines is a race
condition, because there's only one internal mp_msg buffer, and no
external mp_msg locks.

Avoid this by building the message on a stack buffer.

I might make a mp_log-local partial line buffer, but even then av_log()
can be called from multiple threads, while targetting the same mp_log.
(Really, ffmpeg's log API needs to be fixed.)
2016-03-01 22:03:45 +01:00
wm4 e094499197 msg: use dynamic buffer for message formatting
Until now, a rather large stack buffer was used for this, and also a
static buffer in mp_log_root. The latter was added to buffer partial
lines, and the stack buffer was used only for MSGL_STATUS and MSGL_STATS
(I guess because these are the most likely/severe to clash with partial
line buffering).

Make the buffer in mp_log_root dynamically sized, so we don't get cut
off log lines if the text is excessively large. (The OpenGL extension
list dumped by vo_opengl is such an example.)

Since we still have to support partial line buffering (FFmpeg's log
callbacks leave no other choice), keep the stack buffer. But make it
smaller; there's no way all ~6KB are going to be needed in any
situation.
2016-03-01 21:51:59 +01:00
wm4 33774e18ed command: add encoder-list property
Also change decoder-list (for the sake of sharing the underlying code
for both properties).
2016-03-01 21:46:57 +01:00
Jan Ekström ff0112e08d Initial Android support
* Adds an 'android' feature, which is automatically detected.
* Android has a broken strnlen, so a wrapper is added from FreeBSD.
2016-02-10 21:29:36 +01:00
kwkam 3314483a02 common/common.c: handle utf16 in mp_parse_escape
Signed-off-by: wm4 <wm4@nowhere>
2016-02-06 22:54:49 +01:00
wm4 45345d9c41 build: make libavfilter mandatory
The complex filter support that will be added makes much more complex
use of libavfilter, and I'm not going to bother with adding hacks to
keep libavfilter optional.
2016-02-05 23:17:33 +01:00
wm4 ab318aeea8 audio/video: merge decoder return values
Will be helpful for the coming filter support. I planned on merging
audio/video decoding, but this will have to wait a bit longer, so only
remove the duplicate status codes.
2016-02-01 22:03:04 +01:00
wm4 8a9b64329c Relicense some non-MPlayer source files to LGPL 2.1 or later
This covers source files which were added in mplayer2 and mpv times
only, and where all code is covered by LGPL relicensing agreements.

There are probably more files to which this applies, but I'm being
conservative here.

A file named ao_sdl.c exists in MPlayer too, but the mpv one is a
complete rewrite, and was added some time after the original ao_sdl.c
was removed. The same applies to vo_sdl.c, for which the SDL2 API is
radically different in addition (MPlayer supports SDL 1.2 only).

common.c contains only code written by me. But common.h is a strange
case: although it originally was named mp_common.h and exists in MPlayer
too, by now it contains only definitions written by uau and me. The
exceptions are the CONTROL_ defines - thus not changing the license of
common.h yet.

codec_tags.c contained once large tables generated from MPlayer's
codecs.conf, but all of these tables were removed.

From demux_playlist.c I'm removing a code fragment from someone who was
not asked; this probably could be done later (see commit 15dccc37).

misc.c is a bit complicated to reason about (it was split off mplayer.c
and thus contains random functions out of this file), but actually all
functions have been added post-MPlayer. Except get_relative_time(),
which was written by uau, but looks similar to 3 different versions of
something similar in each of the Unix/win32/OSX timer source files. I'm
not sure what that means in regards to copyright, so I've just moved it
into another still-GPL source file for now.

screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but
they're all gone.
2016-01-19 18:36:06 +01:00
wm4 31adc87bde global: add client API pointer to library handle
Makes the next commit simpler. It's probably a bad idea to add more
fields to the global state, but on the other hand the client API state
is pretty much per-instance anyway. It also will help with things like
the proposed libmpv custom stream API.
2016-01-15 22:54:08 +01:00
Dmitrij D. Czarkoff ea442fa047 mpv_talloc.h: rename from talloc.h
This change helps avoiding conflict with talloc.h from libtalloc.
2016-01-11 21:05:55 +01:00
wm4 994459e4ce common: add mp_tag_str() utility function 2016-01-11 16:24:11 +01:00
wm4 6a73fcc9ed common: allow "\/" as escape sequence
mp_parse_escape() is used by the JSON parser in json.c, and JSON allows
escaping "/" (solidus).

Although it makes no sense, apparently Javascript traditionally allowed
that as escape sequence for working around issues with embedding
Javascript in HTML. (Or something like this must have been the history
of this issue.) Since it's valid in Javascript, it had to be valid in
JSON as well, and JSON explicitly specifies it as valid escape.

Fixes #2694.
2016-01-08 09:22:25 +01:00
wm4 35f43dfacb player: make watch later/resume work when "playing" directories
If you do "mpv /bla/", and then branch out into sub-directories using
playlist navigation, and then used quit and watch later, then playing
the same directory did not resume from the previous point. This was
because resuming is based on the path hash, so a path prefix can't be
detected when resuming the parent directory.

Solve this by writing each path prefix when playing directories is
involved. (This includes all parent paths, so interestingly, "mpv /"
would also resume in the above example.)

Something like this was requested multiple times, and I want it too.
2016-01-06 22:40:55 +01:00
wm4 05444e8135 command: replace ROUND() with lrint()
lrint() pretty much does what ROUND() is supposed to do, but it's more
precise.
2015-12-26 18:36:45 +01:00
wm4 791228f2ab msg: remove redundant condition
Found by Coverity.
2015-12-05 23:53:24 +01:00
wm4 e1128c8b28 video: pass through libavformat has_b_frames field
This fixes initial decoding of some samples. See #1341.

According to Libav devs, this should be considered a libavcodec bug, but
as it's hard to fix, here we go.
2015-10-19 15:00:21 +02:00
wm4 da496ae2fe msg: remove the useless trailing comment from stats dumping
The origin of the stats line was added as a comment (starting with '#').
It was useless and just blowing up file sizes.
2015-10-14 18:50:58 +02:00
wm4 82f0d373fb video: make container vs. bitstream aspect ratio configurable
Utterly idiotic bullshit.

Fixes #2259.
2015-08-30 23:04:17 +02:00
wm4 62aba69e15 av_common: remove deprecated API usage
As the removed comment says, not copying this field may cause problems
on older libav* releases. See also commit 5f7de399.

Remove this, as newer FFmpeg releases are available. As of this commit,
use of mpv with FFmpeg 2.5.x and below, or Libav 11 and below is not
recommended, and may lead to random video decoding issues. (Although the
failure cases are apparently somewhat obscure.)
2015-08-07 15:45:27 +02:00
wm4 0b1c3e8de2 player: warn against using HLS URLs with --playlist
That just makes no sense, but seems to be a somewhat common user error.

The detection is not perfect. It's conceivable that EXT-X-... headers
are used in normal m3u playlists. After all, HLS playlists are by
definition a compatible extension to m3u playlists, as stupid as it
sounds.
2015-08-04 17:51:00 +02:00
wm4 5594333337 av_log: remove dumb shit
It's the user's fault if he/she/it does something that is not
recommended.

Fixes #2110.
2015-07-18 14:21:31 +02:00
wm4 8e82a64f56 player: parse and expose m3u playlist titles
Requested. Closes #2100.
2015-07-10 21:22:35 +02:00
wm4 5446637e99 av_log: print FFmpeg version
The individual library versionsd are pretty useless. This will actually
tell us at least the git hash or git tag of the FFmpeg build.
2015-07-03 15:11:29 +02:00
wm4 23b83c6676 client API: allow using msg-level option for log messages
Client API users can enable log output with mpv_request_log_messages().
But you can enable only a single log level. This is normally enough, but
the --msg-level option (which controls the terminal log level) provides
more flexibility. Due to internal complexity, it would be hard to
provide the same flexibility for each client API handle. But there's a
simple way to achieve basically the same thing: add an option that sends
log messages to the API handle, which would also be printed to the
terminal as by --msg-level.

The only change is that we don't disable this logic if the terminal is
disabled. Instead we check for this before the message is output, which
in theory can lower performance if messages are being spammed. It could
be handled with some more effort, but the gain would be negligible.
2015-06-20 21:40:47 +02:00
wm4 34fce974c6 av_log: skip prefix if unknown
This happens with av_log(NULL, ...) calls. Drop the "?: " fallback
prefix, because it was confusing.

(Of course FFmpeg should not do this at all, but it's a very long way to
making the FFmpeg log callback sane.)
2015-06-20 17:02:56 +02:00
Marcin Kurczewski 797277a233 Various spelling fixes
Signed-off-by: wm4 <wm4@nowhere>
2015-06-18 19:36:58 +02:00
wm4 f53135ffea av_log: set default av_log callback on exit
This is slightly "dangerous", because it could overwrite a log callback
another library has set, after we've set our own callback. But it's
probably still slightly better than leaving our own callback, which will
run the fallback code if no mpv instance is set. (Multiple mpv instances
sharing the same global state will safely avoid overwriting each other's
log callback.)

Note that we can't do much better, because the global state in FFmpeg is
obviously insane.
2015-06-17 14:52:31 +02:00
wm4 57048c7393 audio: add --audio-spdif as new method for enabling passthrough
This provides a new method for enabling spdif passthrough. The old
method via --ad (--ad=spdif:ac3 etc.) is deprecated. The deprecated
method will probably stop working at some point.

This also supports PCM fallback. One caveat is that it will lose at
least 1 audio packet in doing so. (I don't care enough to prevent this.)

(This is named after the old S/PDIF connector, because it uses the same
underlying technology as far as the higher level protoco is concerned.
Also, the user should be renamed that passthrough is backwards.)
2015-06-05 22:42:59 +02:00
wm4 04c02796bd path: make mp_path_join accept normal C strings
Instead of bstr. Most callers of this function do not need bstr. The
bstr version of this function is now mp_path_join_bstr().
2015-05-09 15:26:47 +02:00
Niklas Haas daf4334697
x11: query ICC profile based on center of window
Right now, the default behavior is to pick the numerically lowest screen
ID that overlaps the window in any way - but this means that mpv will
decide to pick an ICC profile in a pretty arbitrary way even if the
window only overlaps another screen by a single pixel.

The new behavior is to query it based on the center of the window
instead.
2015-04-29 14:01:27 +02:00
wm4 91f6f2bf11 options: remove unneeded hack from command line parser
This was traditionally needed to silence terminal output from errors
during command line parsing preparsing. Preparsing is done so that
options controlling the terminal and config files are parsed and applied
first, with a second command line parsing pass applying all other
options, _and_ printing error messages for the preparsed ones.

But the hack silencing log output during the preparse pass is actually
not needed anymore, since the terminal is enabled only after preparsing
is finished. update_logging() in main.c does this.

So as long as update_logging() is called before
m_config_preparse_command_line(), this will work.
2015-04-23 21:08:19 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
wm4 9657e5a2ca vd_lavc: request 1 more threads than CPU cores
This duplicates the logic which FFmpeg's libavcodec uses. The effects
are unknown, though it's somewhat clear that a single thread doesn't
necessarily saturate a single CPU.

(Eventually we should just let FFmpeg auto-init the thread count, but
for now I prefer it this way, so e.g. verbose mode will print the
thread count.)
2015-03-05 12:55:54 +01:00
wm4 a4b6bf8c41 player: refine rar:// playlist-safety handling
It was possible to make the player play local files by putting rar://
links into remote playlists, and some other potentially unsafe things.

Redo the handling of it. Now the rar-redirector (the thing in
demux_playlist.c) sets disable_safety, which makes the player open any
playlist entries returned. This is fine, because it redirects to the
same file anyway (just with different selection/interpretation of the
contents). On the other hand, rar:// itself is now considered fully
unsafe, which means that it is ignored if found in normal playlists.
2015-03-02 19:09:36 +01:00
wm4 01b87e509c msg: use relaxed atomics for log level test
This should be sufficient.

If stdatomic.h is not available, we make no difference.
2015-03-02 19:09:31 +01:00
wm4 1cac7d1a65 demux: add a demux_open_url() function
Often stream and a demuxer are opened at the same time. Provide a
function for this and replace most of its uses.
2015-02-20 21:56:55 +01:00
wm4 6aa6778ac4 demux: change demux_open() signature
Fold the relatively obscure force_format parameter into demuxer_params.
2015-02-20 21:21:14 +01:00
wm4 e920a00eba player: drop explicit exit() calls
The code in main.c calls exit() explicitly, but the code is actually
easier to follow by simply exiting from main() instead. The exit() call
in av_log.c happens only on severely broken builds, so replace it with
abort().

(Shuts up rpmlint warnings.)
2015-02-12 17:28:22 +01:00
wm4 ffe894ec0a options: change --msg-level option
Make it accept "," as separator, instead of only ":". Do this by using
the key-value-list parser. Before this, the option was stored as a
string, with the option parser verifying that the option value as
correct. Now it's stored pre-parsed, although the log levels still
require separate verification and parsing-on-use to some degree (which
is why the msg-level option type doesn't go away).

Because the internal type changes, the client API "native" type also
changes. This could be prevented with some more effort, but I don't
think it's worth it - if MPV_FORMAT_STRING is used, it still works the
same, just with a different separator on read accesses.
2015-02-06 16:48:52 +01:00
wm4 5f7de39942 av_common: add comment about using now-deprecated libavcodec field
FFmpeg and Libav have the stupid practice of replacing and deprecating
API symbols on the same day. So with FFmpeg git, this is useless and
will print a compile time warning, while it's required with all stable
releases, and might lead to decoding errors with xvid/avi (apparently).

Add a comment before someone writes a patch and I have to explain it all
over again.
2015-01-30 15:57:40 +01:00
wm4 96f7c96da0 msg: add --log-file option
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
2015-01-26 11:31:02 +01:00
wm4 a1ed13869c video: remove vfcap.h
And remove all uses of the VFCAP_CSP_SUPPORTED* constants. This is
supposed to reduce conversions if many filters are used (with many
incompatible pixel formats), and also for preferring the VO's natively
supported pixel formats (as opposed to conversion).

This is worthless by now. Not only do the main VOs not use software
conversion, but also the way vf_lavfi and libavfilter work mostly break
the way the old MPlayer mechanism worked. Other important filters like
vf_vapoursynth do not support "proper" format negotation either.

Part of this was already removed with the vf_scale cleanup from today.

While I'm touching every single VO, also fix the query_format argument
(it's not a FourCC anymore).
2015-01-21 22:08:24 +01:00
wm4 8144d142e4 player: don't set tag strings to NULL
bstr is a bounded string type, consisting of a pointer and a length
value. If the length is 0, the pointer can be NULL. This is somewhat
logical due to how this abstraction works, but it can leak when
converting to C strings.

talloc_strndup() returns NULL instead of "" in this case, which broke
some other code. Use bstrto0() instead, which is the "proper" function
to convert bstr to char*.

Fixes #1462.
2015-01-12 14:33:56 +01:00
wm4 3f3e1547ba player: change --display-tags behavior
Remove the "all" special-behavior, and instead interpret trailing "*"
characters. --display-tags=all is replaced by --display-tags=* as a
special-case of the new behavior.

See #1404.

Note that the most straight-forward value for matchlen in the normal
case would be INT_MAX, because it should be using the entire string.
I used keylen+1 instead, because glibc seems to handle this case
incorrectly:

    snprintf(buf, sizeof(buf), "%.*s", INT_MAX, "hello");

The result is empty, instead of just containing the string argument.
This might be a glibc bug; it works with other libcs (even MinGW-w64).
2015-01-12 04:57:56 +01:00
wm4 d7dfbc8610 player: use libavutil API to get number of CPUs
Our own code was introduced when FFmpeg didn't provide this API (or
maybe didn't even have a way to determine the CPU count). But now,
av_cpu_count() is available for all FFmpeg/Libav versions we support,
and there's no reason to have our own code.

libavutil's code seems to be slightly more sophisticated than our's, and
it's possible that the detected CPU count is different on some platforms
after this change.
2015-01-05 12:34:34 +01:00
wm4 0f4bf347c5 player: print used number of threads in verbose mode
Also, don't use av_log() for mpv output.
2015-01-05 12:17:55 +01:00
wm4 4c3f042777 command: make the "run" command work on Windows too
Do so by using mp_subprocess(). Although this uses completely different
code on Unix too, you shouldn't notice a difference. A less ncie thing
is that this reserves an entire thread while the command is running
(which wastes some memory for stack, at least). But this is probably
still the simplest way, and the fork() trick is apparently not
implementable with posix_subprocess().
2015-01-01 20:37:49 +01:00
wm4 8048374a5c player: filter tags, add --display-tags option
This attempts to increase user-friendliness by excluding useless tags.
It should be especially helpful with mp4 files, because the FFmpeg mp4
demuxer adds tons of completely useless information to the metadata.

Fixes #1403.
2014-12-29 22:51:18 +01:00
wm4 cc54377463 Do not call strerror()
...because everything is terrible.

strerror() is not documented as having to be thread-safe by POSIX and
C11. (Which is pretty much bullshit, because both mandate threads and
some form of thread-local storage - so there's no excuse why
implementation couldn't implement this in a thread-safe way. Especially
with C11 this is ridiculous, because there is no way to use threads and
convert error numbers to strings at the same time!)

Since we heavily use threads now, we should avoid unsafe functions like
strerror().

strerror_r() is in POSIX, but GNU/glibc deliberately fucks it up and
gives the function different semantics than the POSIX one. It's a bit of
work to convince this piece of shit to expose the POSIX standard
function, and not the messed up GNU one.

strerror_l() is also in POSIX, but only since the 2008 standard, and
thus is not widespread.

The solution is using avlibc (libavutil, by its official name), which
handles the unportable details for us, mostly. We avoid some pain.
2014-11-26 21:21:56 +01:00
wm4 86b521f7df Silence some Coverity warnings
None of this really matters.
2014-11-21 09:59:58 +01:00
wm4 12212a1685 common: fix version variable declarations
This was stupid.
2014-11-02 17:38:07 +01:00
shdown df6ded7c94 common: fix \x-style escaping
This was rejecting correct escapes and accepting incorrect ones.
2014-10-16 21:17:01 +02:00
wm4 26bc6b4831 Add some missing "const"s
The one in msg.c was mistakenly removed with commit e99a37f6.

I didn't actually test the change in ao_sndio.c (but obviously "ap"
shouldn't be static).
2014-10-10 13:44:08 +02:00
Stefano Pigozzi e99a37f635 fix -Wduplicate-decl-specifier warnings with clang 2014-10-09 22:14:41 +02:00
wm4 06ecf54fdf msg: fix unwanted blank lines
Was broken in a commit earlier this day.
2014-10-08 15:03:48 +02:00
wm4 0ec5d35d57 client API: introduce numeric log levels
Maybe using strings for log levels was a mistake (too broad and too
impractical), so I'm adding numeric log level at least for the receiver
side. This makes it easier to map mpv log levels to other logging
systems.

I'm still too stingy to add a function to set the log level by a numeric
value, though.

The numeric values are not directly mapped to the internal mpv values,
because then almost every file in mpv would have to include the client
API header.

Coalesce this into API version 1.6, since 1.6 was bumped just yesterday.
2014-10-08 14:17:33 +02:00
wm4 f73778ad82 msg, client API: buffer partial lines
The API could return partial lines, meaning the message could stop
in the middle of a line, and the next message would have the rest of
it (or just the next part of it). This was a pain for the user, so do
the nasty task of buffering the lines ourselves.

Now only complete lines are sent. To make things even easier for the
API user, don't put multiple lines into a single event, but split them.

The terminal output code needed something similar (inserting a prefix
header on start of each line). To avoid code duplication, this commit
refactors the terminal output so that lines are split in a single
place.
2014-10-08 13:11:55 +02:00
wm4 2632ea3de6 msg, client API: never send the status line as log message
The status line is a bit special; for example it uses special control
codes by design and is not terminated with a newline character in order
to update it on the terminal without scrolling. It's not helpful for
client API users either, and would require special-casing them
(emulating aspects of a terminal?). Also, the status line code is
explicitly disabled on osd.c unless the --terminal option is enabled,
so there was no good way to even enable the status line for the API.

Just pretend that the status line does not exist as far as the client
API is concerned. It won't be sent as MPV_EVENT_LOG_MESSAGE.
2014-10-08 12:51:12 +02:00
wm4 046ad8c5ae msg: set an explicit overflow message
So client API users don't have to worry about this specifically.

Also document the overflow case. (Not sure if we really need to do
this; maybe it'd be better not to, since this just adds more noise
to the docs.)
2014-10-08 12:49:04 +02:00
wm4 2e91d44e20 stream: redo playback abort handling
This mechanism originates from MPlayer's way of dealing with blocking
network, but it's still useful. On opening and closing, mpv waits for
network synchronously, and also some obscure commands and use-cases can
lead to such blocking. In these situations, the stream is asynchronously
forced to stop by "interrupting" it.

The old design interrupting I/O was a bit broken: polling with a
callback, instead of actively interrupting it. Change the direction of
this. There is no callback anymore, and the player calls
mp_cancel_trigger() to force the stream to return.

libavformat (via stream_lavf.c) has the old broken design, and fixing it
would require fixing libavformat, which won't happen so quickly. So we
have to keep that part. But everything above the stream layer is
prepared for a better design, and more sophisticated methods than
mp_cancel_test() could be easily introduced.

There's still one problem: commands are still run in the central
playback loop, which we assume can block on I/O in the worst case.
That's not a problem yet, because we simply mark some commands as being
able to stop playback of the current file ("quit" etc.), so input.c
could abort playback as soon as such a command is queued. But there are
also commands abort playback only conditionally, and the logic for that
is in the playback core and thus "unreachable". For example,
"playlist_next" aborts playback only if there's a next file. We don't
want it to always abort playback.

As a quite ugly hack, abort playback only if at least 2 abort commands
are queued - this pretty much happens only if the core is frozen and
doesn't react to input.
2014-09-13 16:09:51 +02:00
wm4 c0fbab7a7c player: deal with some corner cases with playlist navigation
The purpose is making accessing the current playlist entry saner when
commands are executed during initialization, termination, or after
playlist navigation commands.

For example, the "playlist_remove current" command will invalidate
playlist->current - but some things still access the playlist entry even
on uninit. Until now, checking stop_play implicitly took care of it, so
it worked, but it was still messy.

Introduce the mpctx->playing field, which points to the current playlist
entry, even if the entry was removed and/or the playlist's current entry
was moved (e.g. due to playlist navigation).
2014-09-09 01:23:10 +02:00
wm4 9cb1e2c58c player: normalize playlist entries on add
This is not necessarily more correct, but it's less trouble.
2014-09-09 01:23:10 +02:00
wm4 5ea84e17c0 player: don't allow remote playlists to load local files
Because that might be a bad idea.

Note that remote playlists still can use any protocol marked with
is_safe and is_network, because the case of http-hosted playlists
containing URLs using other streaming protocols is not unusual.
2014-09-01 00:13:22 +02:00
wm4 129a7c056a playlist: don't add the base path twice
Loading a playlist with --playlist from a sub-directory added the
playlist's base path twice: one time in the playlist demuxer, and then
again in playlist_parse_file(). The latter function is used only for
--playlist, so it worked when loading the playlist directly.

(This is probably a mess-up when the MPlayer playlist parsers were
replaced with newer code.)

CC: @mpv-player/stable
2014-09-01 00:13:10 +02:00
wm4 866e0e1670 player: always load playlists
Until now, you had to use --load-unsafe-playlists or --playlist to get
playlists loaded. Change this and always load playlists by default.

This still attempts to reject unsafe URLs. For example, trying to invoke
libavdevice pseudo-demuxer is explicitly prevented. Local paths and any
http links (and some more) are always allowed.
2014-08-31 19:49:39 +02:00
wm4 68ff8a0484 Move compat/ and bstr/ directory contents somewhere else
bstr.c doesn't really deserve its own directory, and compat had just
a few files, most of which may as well be in osdep. There isn't really
any justification for these extra directories, so get rid of them.

The compat/libav.h was empty - just delete it. We changed our approach
to API compatibility, and will likely not need it anymore.
2014-08-29 12:31:52 +02:00
Ben Boeckel 7c0a5698eb posix: use STD*_FILENO constants
Rather than "magic" numbers, use meaningful constant names provided by
unistd.h.
2014-08-28 12:03:17 +02:00
wm4 cae22ae3b6 msg: allow duplicating a mp_log
Trivial; this is mostly just reindenting the normal codepath.
2014-08-25 00:48:56 +02:00
wm4 758f8f7bd4 demux: always use AVPacket
This is a simplification, because it lets us use the AVPacket
functions, instead of handling the details manually.

It also allows the libavcodec rawvideo decoder to use reference
counting, so it doesn't have to memcpy() the full image data. The change
in av_common.c enables this.

This change is somewhat risky, because we rely on the following AVPacket
implementation details and assumptions:
- av_packet_ref() doesn't access the input padding, and just copies the
  data. By the API, AVPacket is always padded, and we violate this. The
  lavc implementation would have to go out of its way to make this a
  real problem, though.
- We hope that the way we make the AVPacket refcountable in av_common.c
  is actually supported API-usage. It's hard to tell whether it is.

Of course we still use our own "old" demux_packet struct, just so that
libav* API usage is somewhat isolated.
2014-08-25 00:46:26 +02:00
wm4 47b29094c3 win32: emulate some ANSI terminal escape codes
We already redirect all terminal output through our own wrappers (for
the sake of UTF-8), so we might as well use it to handle ANSI escape
codes.

This also changes behavior on UNIX: we don't retrieve some escape codes
per terminfo anymore, and just hardcode them. Every terminal should
understand them.

The advantage is that we can pretend to have a real terminal in the
normal player code, and Windows atrocities are locked away in glue
code.
2014-08-21 22:45:58 +02:00
wm4 d68a759fa4 Improve setting AVOptions
Use OPT_KEYVALUELIST() for all places where AVOptions are directly set
from mpv command line options. This allows escaping values, better
diagnostics (also no more "pal"), and somehow reduces code size.

Remove the old crappy option parser (av_opts.c).
2014-08-02 03:12:33 +02:00
wm4 bf5b1e9a05 Remove the last remains of slave mode
Almost nothing was left of it.

The only thing this commit actually removes is support for reading
input commands from stdin. But you can emulate this via:

 --input-file=/dev/stdin --input-terminal=no

However, this won't work on Windows. Just use a named pipe.
2014-08-01 22:57:56 +02:00
wm4 26d973ce82 stream_lavf: allow setting AVOptions with --stream-lavf-o
This commit also creates a private option struct for stream_lavf.c, but
since I'm lazy, I'm not moving any existing options to it.
2014-07-30 01:15:42 +02:00
Alessandro Ghedini 08415933db command: append entries to the end of the playlist with loadlist append
Currently entries are added after the current playlist element. This is kinda
confusing, more so given that "loadfile append" appends at the end of the
playlist.
2014-07-25 14:32:34 +02:00
wm4 63373ca424 encode: deal with codec->time_base deprecation
This seems to work with both Libav 10 and FFmpeg d3e51b41.
2014-07-22 23:04:12 +02:00
wm4 69a8f08f3e tags: add copy function 2014-07-16 22:40:12 +02:00
wm4 d27a2bc546 build: allow compilation without any atomics
Not all compilers on all platforms have atomics available (even if they
could, technically speaking).

We don't use atomics that much, only the following things rely on it:
1. the audio pull code, and all audio outputs using it
2. updating global msg levels
3. reading log messages through the client API

Just disable 1. and 3. if atomics are not available. For 2., using fake-
atomics isn't too bad; at worst, message levels won't properly update
under certain situations (but most likely, it will work just fine).

This means if atomics are not available, the client API function
mpv_request_log_messages() will do nothing.

CC: @mpv-player/stable
2014-07-05 17:07:16 +02:00
wm4 7e209185f1 demux, stream: change metadata notification
(Again.)

This time, we simply make it event-based, as it should be. This is done
for both demuxer metadata and stream metadata.

For some ogg-over-icy streams, 2 updates are reported on stream start.
This is because libavformat reports an update right on start, while
including the same info in the "static" metadata. I don't know if that's
a bug or a feature.
2014-07-05 17:07:14 +02:00
wm4 7412257305 av_common: remove unneeded field
This is actually needed for encoding only, and not decoding. Drop it.
2014-06-29 20:39:32 +02:00
Rudolf Polzer 309eb6398c Revert "encode: make the central lock recursive"
This reverts commit 231c667214.
2014-06-12 10:37:17 +02:00
wm4 231c667214 encode: make the central lock recursive
Unfortunately, there's a recursive function call in ao_lavc.c (play
function), leading to a deadlock. The locking is getting a bit messy, so
just make the lock recursive.

This fixes #844.
2014-06-12 00:55:10 +02:00
wm4 8f60de98be encode: make option struct local
Similar to previous commits.
2014-06-11 02:05:07 +02:00
wm4 99f5fef0ea Add more const
While I'm not very fond of "const", it's important for declarations
(it decides whether a symbol is emitted in a read-only or read/write
section). Fix all these cases, so we have writeable global data only
when we really need.
2014-06-11 00:39:14 +02:00
wm4 3b7402b51c client API: call wakeup callback if there are new messages
Listening on messages currently uses polling (every time
mpv_wait_event() has no new events, the message buffer is polled and a
message event is possibly created). Improve this situation a bit, and
call the user-supplied wakeup callback.

This will increase the frequency with which the wakeup callback is
called, but the client is already supposed to be able to deal with this
situation. Also, as before, calling mpv_wait_event() from the wakeup
callback is forbidden, so the client can't read new messages from the
callback directly.

The wakeup pipe is written either. Since the wakeup pipe is created
lazily, we can't access the pipe handle without creating a race
condition or a deadlock. (This is actually very silly, since in practice
the race condition won't matter, but for now let's keep it clean.)
2014-06-06 19:24:30 +02:00
wm4 9d0e5f6da6 playlist: fix playlist_move on itself
A playlist_move command that moves an entry onto itself (both arguments
have the same index) should do nothing, but it did something broken. The
underlying reason is that it checks the prev pointer of the entry which
is temporarily removed for moving.
2014-05-25 19:42:51 +02:00
wm4 8e7cf4bc99 atomics: switch to C11 stdatomic.h
In my opinion, we shouldn't use atomics at all, but ok.

This switches the mpv code to use C11 stdatomic.h, and for compilers
that don't support stdatomic.h yet, we emulate the subset used by mpv
using the builtins commonly provided by gcc and clang.

This supersedes an earlier similar attempt by Kovensky. That attempt
unfortunately relied on a big copypasted freebsd header (which also
depended on much more highly compiler-specific functionality, defined
reserved symbols, etc.), so it had to be NIH'ed.

Some issues:
- C11 says default initialization of atomics "produces a valid state",
  but it's not sure whether the stored value is really 0. But we rely on
  this.
- I'm pretty sure our use of the __atomic... builtins is/was incorrect.
  We don't use atomic load/store intrinsics, and access stuff directly.
- Our wrapper actually does stricter typechecking than the stdatomic.h
  implementation by gcc 4.9. We make the atomic types incompatible with
  normal types by wrapping them into structs. (The FreeBSD wrapper does
  the same.)
- I couldn't test on MinGW.
2014-05-21 02:21:18 +02:00
Rudolf Polzer 4ac4269389 encoding: No error when the output format doesn't support a stream type at all.
When writing a video to foo.mp3, the user's intention is clearly to drop
the video stream, and similarly, when writing to foo-%d.png, the
intention is clearly to drop the audio stream. Now, explicit
specification of --no-audio or --no-video is no longer necessary in
these cases.
2014-05-16 21:41:32 +02:00
wm4 3c322b1022 common: change MP_NOPTS_VALUE definition
Use the exact floating point value, instead of a broken integer
constant. The expression calculating the constant probably relied on
undefined behavior, because it left-shifts a negative value.

This also changes the type of the constant to double, which is perfectly
fine, and maybe better than an integer constant.
2014-05-10 10:44:16 +02:00
wm4 a8b267540e common: change mp_snprintf_append semantics
Make it more suitable for chaining. This means a function formatting a
value to a string using a static buffer can work exactly like
mp_snprintf_append itself.

Also rename it to mp_snprintf_cat, because that's shorter.
2014-05-05 23:56:12 +02:00
Martin Herkt 48bd03dd91 options: remove deprecated --identify
Also remove MSGL_SMODE and friends.

Note: The indent in options.rst was added to work around a bug in
ReportLab that causes the PDF manual build to fail.
2014-05-04 02:46:11 +02:00
wm4 81171e37b2 common: add mp_snprintf_append() utility function 2014-04-29 13:14:48 +02:00
wm4 e0cf983e53 stream: remove interrupt callback global variables
This used global variables for the asynchronous interrupt callback.

Pick the simple and dumb solution and stuff the callback into
mpv_global. Do this because interrupt checking should also work in the
connect phase, and currently stream creation equates connecting.
Ideally, this would be passed to the stream on creation instead, or
connecting would be separated from creation. But since I don't know yet
which is better, and since moving stream/demuxer into their own thread
is something that will happen later, go with the mpv_global solution.
2014-04-25 19:12:24 +02:00
wm4 ac1a21e488 terminal: fix printing of prefix
This was subtly change in 5cfb18. Revert the change.
2014-04-23 21:16:50 +02:00
wm4 0cff5836c3 Remove CPU detection and inline asm handling
Not needed anymore. I'm not opposed to having asm, but inline asm is too
much of a pain, and it was planned long ago to eventually get rid fo all
inline asm uses.

For the note, the inline asm use that was removed with the previous
commits was almost worthless. It was confined to video filters, and most
video filtering is now done with libavfilter. Some mpv filters (like
vf_pullup) actually redirect to libavfilter if possible.

If asm is added in the future, it should happen in the form of external
files.
2014-04-19 17:10:56 +02:00
wm4 9dba2a52db player: add a --dump-stats option
This collects statistics and other things. The option dumps raw data
into a file. A script to visualize this data is included too.

Litter some of the player code with calls that generate these
statistics.

In general, this will be helpful to debug timing dependent issues, such
as A/V sync problems. Normally, one could argue that this is the task of
a real profiler, but then we'd have a hard time to include extra
information like audio/video PTS differences. We could also just
hardcode all statistics collection and processing in the player code,
but then we'd end up with something like mplayer's status line, which
was cluttered and required a centralized approach (i.e. getting the data
to the status line; so it was all in mplayer.c). Some players can
visualize such statistics on OSD, but that sounds even more complicated.
So the approach added with this commit sounds sensible.

The stats-conv.py script is rather primitive at the moment and its
output is semi-ugly. It uses matplotlib, so it could probably be
extended to do a lot, so it's not a dead-end.
2014-04-17 21:47:00 +02:00
FRAU KOUJIRO 6c24a80009 msg: correct ringbuffer log level comparison 2014-04-17 01:43:07 +02:00
Rudolf Polzer a7c6c4656d New option --no-ometadata to opt out of including metadata when encoding.
This re-allows the previous behaviour of being able to reencode with
metadata removed, which is useful when encoding "inconsistently" tagged
data for a device/player that shows file names when tags are not
present.
2014-04-14 20:33:35 +02:00
Kevin Mitchell bc79ded75a mp_tags: move generic mp_tags stuff into its own .c/.h files in common/
rename add_metadata to the more genera/descriptive mp_tags_copy_items_from_av_dictionary

Signed-off-by: wm4 <wm4@nowhere>
2014-04-13 18:03:01 +02:00
wm4 47972a0077 player: remove ASX, SMIL and NSC playlist parsers
These playlist parsers are all what's left from the old mplayer playlist
parsing code. All of it is old code that does little error checking; the
type of C string parsing code that gives you nightmare.

Some playlist parsers have been rewritten and are located in
demux_playlist.c. The removed formats were not reimplemented. ASX and
SMIL use XML, and since we don't want to depend on a full blown XML
parser, this is not so easy. Possibly these formats could be supported
by writing a very primitive XML-like lexer, which would lead to success
with most real world files, but I haven't attempted that. As for NSC, I
couldn't find any URL that worked with MPlayer, and in general this
formats seems to be more than dead.

Move playlist_parse_file() to playlist.c. It's pretty small now, and
basically just opens a stream and a demuxer. No use keeping
playlist_parser.c just for this.
2014-04-13 15:40:05 +02:00
Evan Purkhiser 5cfb180a89 terminal: pretty print modules for --msgmodule 2014-04-12 11:37:53 +02:00