summaryrefslogtreecommitdiffstats
path: root/video/decode
Commit message (Collapse)AuthorAgeFilesLines
...
* Add more constwm42014-06-111-1/+1
| | | | | | | 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.
* player: hide audio/video codec and file format messageswm42014-05-311-2/+1
| | | | | None of these are very important usually. For error analysis, the plain log is useless anyway, and this information is still printed with "-v".
* vd_lavc: set video bitrate if availableMarcoen Hirschberg2014-05-281-0/+5
| | | | Set the bitrate of dec_video if it is available in avcodec.
* audio: rename i_bps to 'bitrate' to avoid confusionMarcoen Hirschberg2014-05-282-3/+3
| | | | Since i_bps now contains bits/sec, rename it to reflect this change.
* audio: change values from bytes-per-second to bits-per-secondMarcoen Hirschberg2014-05-282-3/+3
| | | | | | | The i_bps members of the sh_audio and dev_video structs are mostly used for displaying the average audio and video bitrates. Keeping them in bits-per-second avoids truncating them to bytes-per-second and changing them back lateron.
* vaapi: fix destruction with --hwdec=haapi-copywm42014-05-281-2/+6
| | | | | | | This is incomplete; the video chain will still hold some vaapi objects after destroying the decoder and thus the vaapi context. This is very bad. Fixing it would require something like refcounting the vaapi context, but I don't really want to.
* video: warn if an emulated hwdec API is usedwm42014-05-284-4/+17
| | | | | | | | | | | | | | | | mpv supports two hardware decoding APIs on Linux: vdpau and vaapi. Each of these has emulation wrappers. The wrappers are usually slower and have fewer features than their native opposites. In particular the libva vdpau driver is practically unmaintained. Check the vendor string and print a warning if emulation is detected. Checking vendor strings is a very stupid thing to do, but I find the thought of people using an emulated API for no reason worse. Also, make --hwdec=auto never use an API that is detected as emulated. This doesn't work quite right yet, because once one API is loaded, vo_opengl doesn't unload it, so no hardware decoding will be used if the first probed API (usually vdpau) is rejected. But good enough.
* video: better handling for (very) broken timestampswm42014-05-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, Matroska files store monotonic PTS for h264 tracks with b-frames, which means the decoder actually returns non-monotonic PTS. Handle this with an evil trick: if DTS is missing, set it to the PTS. Then the existing logic, which deals with falling back to DTS if PTS is broken. Actually, this trick is not so evil at all, because usually, PTS has no errors, and DTS is either always set, or always unset. So this _should_ provoke no regressions (famous last words). libavformat actually does something similar: it derives DTS from PTS in ways unknown to me. The result is very broken, but it causes the DTS fallback to become active, and thus happens to work. Also, prevent the heuristic from being active if PTS is merely monotonic instead of strictly-monotonic. Non-unique PTS is broken, but we can't fallback to DTS anyway in these cases. The specific mkv file that is fixed with this commit had the following fields set: Muxing application: libebml v1.3.0 + libmatroska v1.4.1 Writing application: mkvmerge v6.7.0 ('Back to the Ground') [...] But I know that this should also fix playback of mencoder produced mkv files.
* video: add --video-rotate option for controlling auto-rotationwm42014-05-241-0/+7
|
* vdpau: don't fallback to software decoding on preemptionwm42014-05-181-7/+12
| | | | | This was requested by someone. Not sure if it's a good idea; it seems more can go wrong than right.
* vda: Hwaccel 1.2 supportLuca Barbato2014-05-121-34/+69
| | | | Use the new context and the default functions provided.
* vda: Simplify codec selectionLuca Barbato2014-05-121-28/+2
| | | | VDA supports h264 only.
* vd_lavc: Support hwaccel 1.2 and laterLuca Barbato2014-05-121-4/+4
| | | | | Hwaccel 1.2 populates only the third data field and assumes that the AVCodecContext is available to the dealloc function.
* vdpau: handle display preemption during decodingwm42014-05-101-38/+13
| | | | | | | | | | | | This was broken for some time, and it didn't recover correctly. Redo decoder display preemption. Instead of trying to reinitialize the hw decoder, simply fallback to software decoding. I consider display preemption a bug in the vdpau API, so being able to _somehow_ recover playback is good enough. The approach taking here will probably also make it easier to handle multithreading.
* options: remove deprecated --identifyMartin Herkt2014-05-041-1/+0
| | | | | | | 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.
* video: change everythingwm42014-05-022-6/+2
| | | | | | | Change how the video decoding loop works. The structure should now be a bit easier to follow. The interactions on format changes are (probably) simpler. This also aligns the decoding loop with future planned changes, such as moving various things to separate threads.
* video: handle colorspace and aspect overrides separatelywm42014-05-021-2/+2
| | | | | Now the video filter code handles these explicitly, which should increase robustness (or at least find bugs earlier).
* video: improve error messageswm42014-04-301-1/+1
|
* video: add a "hwdec" property to enable or disable hw decoding at runtimewm42014-04-233-0/+11
|
* demux: export video rotation parameterwm42014-04-211-0/+1
| | | | | Now the rotation hint is propagated everywhere. It just isn't used anywhere yet.
* player: add a --dump-stats optionwm42014-04-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | 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.
* vdpau: remove pointer indirection for a fieldwm42014-03-191-3/+3
| | | | There's no reason to. This is basically a cosmetic change.
* vdpau: fix decoder init return valuewm42014-03-191-3/+3
|
* vaapi: make struct va_surface privatewm42014-03-171-11/+8
| | | | | | It's not really needed to be public. Other code can just use mp_image. The only disadvantage is that the other code needs to call an accessor to get the VASurfaceID.
* vaapi: replace image pool implementation with mp_image_poolwm42014-03-171-30/+29
| | | | | | | | | | | | Although I at first thought it would be better to have a separate implementation for hwaccels because the difference to software images are too large, it turns out you can actually save some code with it. Note that the old implementation had a small memory management bug. This got painted over in commit 269c1e1, but is hereby solved properly. Also note that I couldn't test vf_vavpp.c (due to lack of hardware), and I hope I didn't accidentally break it.
* vdpau: remove legacy pixel formatswm42014-03-171-1/+1
| | | | | | They were used by ancient libavcodec versions. This also removes the need to distinguish vdpau image formats at all (since there is only one), and some code can be simplified.
* vdpau: remove unused typewm42014-03-171-6/+0
|
* vd_lavc: reinit hwdec on profile changeswm42014-03-172-2/+6
| | | | | Needed in theory. I don't know if there are even any real-world files which change the profile mid-stream.
* vd_lavc: remove unused fieldwm42014-03-162-3/+0
|
* vd_lavc: reduce hardware decoder mid-stream reinitializationswm42014-03-161-1/+6
| | | | | | | | | | Instead of doing it on every seek (libavcodec calls get_format on every seek), reinitialize the decoder only if the video resolution changes. Note that this may be relatively naive, since we e.g. (or: in particular) don't check for profile changes. But it's not worse than the state before the get_format change, and at least it paints over the current vaapi breakage (issue #646).
* vd_lavc: remove compatibility crapwm42014-03-167-798/+28
| | | | | | | All this code was needed for compatibility with very old libavcodec versions only (such as Libav 9). Includes some now-possible simplifications too.
* vd_lavc: ridiculous workaround for Libav 9 compatibilitywm42014-03-163-1/+23
| | | | | | | | This "sometimes" crashed when seeking. The fault apparently lies in libavcodec: the decoder returns an unreferenced frame! This is completely insane, but somehow I'm apparently still expected to work this around. As a reaction, I will drop Libav 9 support in the next commit. (While this commit will go into release/0.3.)
* video: initialize hw decoder in get_formatwm42014-03-104-46/+42
| | | | | | | | | | | | | | | | Apparently the "right" place to initialize the hardware decoder is in the libavcodec get_format callback. This doesn't change vda.c and vdpau_old.c, because I don't have OSX, and vdpau_old.c is probably going to be removed soon (if Libav ever manages to release Libav 10). So for now the init_decoder callback added with this commit is optional. This also means vdpau.c and vaapi.c don't have to manage and check the image parameters anymore. This change is probably needed for when libavcodec VDA supports gets a new iteration of its API.
* vdpau: change the error message when video too largeAndrey Morozov2014-02-241-1/+2
|
* video: fix --no-aspectwm42014-02-111-2/+2
| | | | This also affects the --aspect option and the "aspect" property.
* vd_lavc: matroska: remove weird code setting extra_huff for mjpegwm42014-01-111-12/+0
| | | | | | | | | | | Like with the previous commit, this is probably not needed, but it's unclear whether that really is the case. Most likely, it used to be needed by some demuxer, and now the only demuxer left that could _possibly_ trigger this is demux_mkv.c. Note that mjpeg is the only decoder that reads the extra_huff option, and nothing in libavformat actually sets the option. So maybe it's fundamentally not needed anymore.
* vd_lavc: matroska: remove weird realvideo special handlingwm42014-01-111-16/+1
| | | | | | | | | | | | | This case can't happen with the normal realvideo codepath in demux_mkv.c, because the code would errors out if the extradata is too small, and everything would be broken anyway in the case the vd_lavc.c condition is actually triggered. It still might happen with VfW-muxed realvideo in Matroska, though. Basically, I'm hoping this doesn't matter anyway, and that the vd_lavc.c code was for other old demuxers, like demux_avi or demux_rm. Following the commit history, it's not really clear for what demuxer this code was added.
* vd_lavc: minor simplificationwm42014-01-111-11/+2
|
* Factor out setting AVCodecContext extradatawm42014-01-111-19/+8
|
* video: fix --brightness etc. optionswm42013-12-291-11/+0
| | | | They were set before the VO was intitialized, which silently failed.
* vd_lavc: by default, output all frames, even corrupted oneswm42013-12-291-0/+10
| | | | | | | | | | | | | | | | Set the flag CODEC_FLAG_OUTPUT_CORRUPT by default. Note that there is also CODEC_FLAG2_SHOW_ALL, which is older, but this seems to be ffmpeg only. Note that whether you want this enabled depends on the user. Some might prefer that only good frames are output, while others want the decoder to try as hard as possible to output _anything_. Since mplayer/mpv is rather the kind of player that tries hard instead of being "clever", set the new default to override libavcodec's default. A nice way to test this is switching video tracks. Since mpv doesn't wait for the next key frame, it'll start feeding the decoder with a packet from the middle of the stream.
* vda: attempt to fix build (2)wm42013-12-221-2/+2
| | | | Still no OSX here.
* msg: rename mp_msg_log -> mp_msgwm42013-12-211-2/+2
| | | | Same for companion functions.
* codecs: mp_msg conversionwm42013-12-211-1/+1
|
* vaapi: mp_msg conversionswm42013-12-211-26/+24
| | | | | | This ended up a little bit messy. In order to get a mp_log everywhere, mostly make use of the fact that va_surface already references global state anyway.
* vdpau: mp_msg conversionswm42013-12-212-11/+14
|
* video/decode: mp_msg conversionswm42013-12-215-65/+71
| | | | Doesn't cover vdpau/vaapi parts yet, because these are a bit messier.
* Reduce recursive config.h inclusions in headerswm42013-12-181-2/+0
| | | | | | In my opinion, config.h inclusions should be kept to a minimum. MPlayer code really liked including config.h everywhere, though, even in often used header files. Try to reduce this.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-175-13/+13
|
* Move options/config related files from mpvcore/ to options/wm42013-12-172-3/+3
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgwm42013-12-162-20/+20
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* dec_video: fix handling of timestamp resetswm42013-12-121-1/+0
| | | | | | This code tried to pass a still monotonic (even if not strictly monotonic) PTS to the player, but as a result it remained stuck on the PTS before a reset (since the PTS was lower).
* video: display last frame, drain frames on video reconfigwm42013-12-102-0/+5
| | | | | | | | | | | | | | | | | | | | | | Until now, the player didn't care to drain frames on video reconfig. Instead, the VO was reconfigured (i.e. resized) before the queued frames finished displaying. This can for example be observed by passing multiple images with different size as mf:// filename. Then the window would resize one frame before image with the new size is displayed. With --vo=vdpau, the effect is worse, because this VO queues more than 1 frame internally. Fix this by explicitly draining buffered frames before video reconfig. Raise the display time of the last frame. Otherwise, the last frame would be shown for a very short time only. This usually doesn't matter, but helps when playing image files. This is a byproduct of frame draining, because normally, video timing is based on the frames queued to the VO, and we can't do that with frames of different size or format. So we pretend that the frame before the change is the last frame in order to time it. This code is incorrect though: it tries to use the framerate, which often doesn't make sense. But it's good enough to test this code with mf://.
* video: move handling of brightness and deinterlacing controlwm42013-12-102-3/+42
| | | | | Handling of brightness/gamma/saturation/etc. and deinterlacing is moved from vf_vo.c to dec_video.c.
* video: move video filter chain initialization from decoder to playerwm42013-12-105-62/+37
| | | | | | | | | | | | | This should help fixing some issues (like not draining video frames correctly on reinit), as well as decoupling the decoder, filter chain, and VO code. I also wanted to make the hardware video decoding fallback work properly if software-only video filters are inserted. This currently has the issue that the fallback is too violent, and throws away a bunch of demuxer packets needed to restart software decoding properly. But keeping "backup" packets turned out as too hacky, so I'm not doing this, at least not yet.
* video: create a separate context for video filter chainwm42013-12-073-52/+11
| | | | | | This adds vf_chain, which unlike vf_instance refers to the filter chain as a whole. This makes the filter API less awkward, and will allow handling format negotiation better.
* video: remove --flipwm42013-12-051-15/+3
| | | | | | | | | | | | | | | | The --flip option flipped the image upside-down, by trying to use VO support, or if not available, by inserting a video filter. I'm not sure why it existed. Maybe it was important in ancient times when VfW based decoders output an image this way (but even then, flipping an image is a free operation by negating the stride). One nice thing about this is that it provided a possible path for implementing video orientation, which is a feature we should probably support eventually. The important part is that it would be for free for VOs that support it, and would work even with hardware decoding. But for now get rid of it. It's useless, trivial, stands in the way, and supporting video orientation would require solving other problems first.
* vd_lavc: factor out libavcodec thread setupwm42013-12-041-15/+1
|
* vd_lavc: don't check required hwdec fieldswm42013-12-041-4/+3
|
* av_common: add timebase parameter to mp_set_av_packet()wm42013-12-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the timebase is set, it's used for converting the packet timestamps. Otherwise, the previous method of reinterpret-casting the mpv style double timestamps to libavcodec style int64_t timestamps is used. Also replace the kind of awkward mp_get_av_frame_pkt_ts() function by mp_pts_from_av(), which simply converts timestamps in a way the old function did. (Plus it takes a timebase parameter, similar to the addition to mp_set_av_packet().) Note that this should not change anything yet. The code in ad_lavc.c and vd_lavc.c passes NULL for the timebase parameters. We could set AVCodecContext.pkt_timebase and use that if we want to give libavcodec "proper" timestamps. This could be important for ad_lavc.c: some codecs (opus, probably mp3 and aac too) have weird requirements about doing decoding preroll on the container level, and thus require adjusting the audio start timestamps in some cases. libavcodec doesn't tell us how much was skipped, so we either get shifted timestamps (by the length of the skipped data), or we give it proper timestamps. (Note: libavcodec interprets or changes timestamps only if pkt_timebase is set, which by default it is not.) This would require selecting a timebase though, so I feel uncomfortable with the idea. At least this change paves the way, and will allow some testing.
* vo_opengl: support for vda hardware decodingStefano Pigozzi2013-12-021-0/+3
| | | | | | | | | | | The harder work was done in the previous commits. After that this feature comes out almost for free. The only problem is I can't get the textures created with CGLTexImageIOSurface2D to download properly, thus the code performs download using some CoreVideo APIs. If someone knows why download of textures created with CGLTexImageIOSurface2D doesn't work please contact me :)
* Take care of some libavutil deprecations, drop support for FFmpeg 1.0wm42013-11-292-9/+9
| | | | | | | | | | | | | | PIX_FMT_* -> AV_PIX_FMT_* (except some pixdesc constants) enum PixelFormat -> enum AVPixelFormat Losen some version checks in certain newer pixel formats. av_pix_fmt_descriptors -> av_pix_fmt_desc_get This removes support for FFmpeg 1.0.x, which is even older than Libav 9.x. Support for it probably was already broken, and its libswresample was rejected by our build system anyway because it's broken. Mostly untested; it does compile with Libav 9.9.
* vdpau: always let decoder output IMGFMT_VDPAUwm42013-11-291-0/+1
| | | | | | | | | | The old ffmpeg vdpau support code uses separate vdpau pixel formats for each decoder (pretty much because mplayer's architectu