summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* msg: bump up log level of --log-fileNiklas Haas2017-12-151-2/+2
| | | | This now logs -v -v by default, instead of -v.
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
* Fix various typos in log messagesNicolas F2017-12-031-1/+1
|
* av_common: drop old hack against ancient lavc vdpau wrapperwm42017-12-011-6/+1
| | | | | | | 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).
* build: make it easier to force FFmpeg upstreamwm42017-11-011-4/+2
| | | | | | | | | | | 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.
* Bump libav* API usewm42017-10-301-4/+4
| | | | (Not tested on Windows and OSX.)
* av_common: fix Libav buildwm42017-10-161-0/+13
| | | | Fucking shit.
* video: properly pass through ICC datawm42017-10-162-0/+38
| | | | | | | | | | | | | | | | | | 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.
* msg: make --msg-level affect --log-file toowm42017-10-041-1/+1
| | | | | | | 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.
* build: add preliminary LGPL modewm42017-09-212-18/+14
| | | | | | | 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.
* player: fix --lavfi-complex freezewm42017-08-111-4/+5
| | | | | | | | | | | | | | | | | | | Commit 0e0b87b6f3297 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.
* vo_opengl: further GL API use separationwm42017-08-072-0/+7
| | | | | | | | | | | | | | | 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.
* common, vo_opengl: add/use helper for formatted strings on the stackwm42017-07-242-0/+17
| | | | | | | | | | | 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.
* Replace remaining avcodec_close() callswm42017-07-161-8/+2
| | | | | | | | 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.
* options: handle suffixes like -add in a more generic waywm42017-06-261-3/+3
| | | | | | | | | | | | | | | | 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.
* options: unbreak -vwm42017-06-231-1/+1
| | | | Sigh... broken with the --really-quiet commit. I hate -v.
* options: remove weird --really-quiet special behaviorwm42017-06-231-1/+5
| | | | | | | | | 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.)
* encode_lavc: move from GPL 2+ to LGPL 2.1+.Rudolf Polzer2017-06-133-14/+37
|
* player: make sure version information is always included in --log-filewm42017-05-222-0/+14
| | | | | | | 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.
* demux_raw: drop "mp-rawvideo" usewm42017-05-201-4/+0
| | | | | | 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.
* av_log: mark as almost LGPLwm42017-05-051-0/+2
| | | | | All authors agreed. Some of the code originated from commit 3c49701490aecb by michael, thus the license change has to be delayed.
* msg.c/h: partially change license to LGPLwm42017-05-052-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 48bd03dd91232. 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 fc4d6e617d8d removed these specific additions a long time ago).
* common.h: change license to LGPLwm42017-04-211-7/+7
| | | | | | | | | | | 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.
* video: support positional arguments for automatic lavfi option bridgewm42017-04-031-0/+30
| | | | | | Now e.g. --vf=pad=1000:1000 works. All in all pretty ugly and hacky. Just look away.
* encode_lavc: fix build failure after libavcodec major bumpwm42017-03-231-2/+2
|
* options: add M_OPT_FILE to some more file optionsPhilip Sequeira2017-03-061-1/+1
| | | | (Helps shell completion.)
* Use AV_INPUT_BUFFER_PADDING_SIZE instead of deprecated onewang-bin2017-02-081-2/+2
| | | | Signed-off-by: wm4 <wm4@nowhere>
* player: add experimental stream recording featurewm42017-02-072-0/+405
| | | | | 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".
* build: explicitly check for FFmpeg vs. Libav, and their exact versionswm42017-01-271-4/+4
| | | | | | | | | | | | | | | | | | 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.
* ad_lavc, vd_lavc: preserve codec_id/codec_type when setting paramswm42017-01-251-0/+8
| | | | | | | | | | 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).
* ad_lavc, vd_lavc: move mpv->lavc decoder parameter setup to common codewm42017-01-252-6/+70
| | | | | | | | 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.
* av_common: remove old/unused timestamp passthrough codewm42017-01-241-21/+8
| | | | | | | | | | | | | | | | | | 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.
* av_common: drop unused functionwm42017-01-242-24/+0
| | | | Unused since the AVCodecParameters change.
* options: drop deprecated --vd/--ad codecs selection featureswm42017-01-191-58/+11
| | | | | Only simple selection works now. Using "-" to terminate codec selection remains in the code (might get undeprecated).
* Prefix libavcodec CODEC_FLAG_ constants with AV_wm42016-12-291-1/+1
| | | | The unprefixed versions are silently deprecated.
* options: deprecate some other complex --ad/--vd featureswm42016-12-231-0/+3
| | | | | | | Who even needs those? Once these deprecations are gone, --ad/--vd are simple lists without any kind of complex matching.
* options: deprecate codec family selection in --vd/--adwm42016-12-232-12/+20
| | | | | Useless now, so get rid of it. Also affects some user-visible display things (like reported codec in use).
* audio: change how spdif codecs are selectedwm42016-12-232-21/+0
| | | | | | | | | | | | | | 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.
* Remove compatibility thingswm42016-12-074-34/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* av_common: always make sure to return a valid timebasewm42016-11-101-1/+5
| | | | | | | | | | | | | | | 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.
* demux_lavf: "support" mov edit lists and log errors if usedwm42016-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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.)
* ad_lavc, vd_lavc: fix a recent libavcodec deprecation warningwm42016-10-171-0/+9
| | | | | | | | | | | | | | 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.
* msg: flush after every message for --log-filewm42016-09-301-0/+1
| | | | | | 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.
* msg: make --log-file and --dump-stats accept config path expansionwm42016-09-281-17/+27
| | | | | | | | | 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.
* client API: more or less deprecate mpv_set_option()wm42016-09-211-19/+19
| | | | | | | | | | | | | | | | | | | | | | 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.
* player: make --log-file and --dump-stats freely settable at runtimewm42016-09-192-21/+37
| | | | | Same deal as with the previous commit. We use the file paths to decide when we should attempt to reopen them.
* osdep: rename atomics.h to atomic.hwm42016-09-071-1/+1
| | | | | The standard header is stdatomic.h, so the extra "s" freaks me out every time I look at it.
* common: use char array for version stringwm42016-09-062-4/+4
| | | | | Use a char array instead of a pointer, which allows using the version variables in a constant context.
* m_config: introduce basic mechanism to synchronize global option updateswm42016-09-021-1/+5
| | | | | | | | | | | | | | | | | | 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.
* common: add assert.h includewm42016-08-281-0/+1
| | | | Because why not.
* video/audio: always provide "proper" timestamps to libavcodecwm42016-08-192-0/+26
| | | | | | | | | | | | | | | | | | | 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.
* av_common: improve rounding for float->int timestamp conversionswm42016-08-191-2/+4
|
* player: fatal error if linked and compiled FFmpeg versions mismatchwm42016-07-012-10/+6
| | | | | | | | | 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().
* av_log: readd ffmpeg library runtime version mismatch warningwm42016-05-011-1/+13
| | | | It just happens far too often.
* encode_lavc: Migrate to codecpar API.Rudolf Polzer2016-04-112-159/+198