Commit Graph

2761 Commits

Author SHA1 Message Date
Uoti Urpala ad0348cf0a core, vo: modify OSD redraw architecture, support EOSD
Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over
the current frame. Change this to VFCTRL_REDRAW_FRAME followed by
normal EOSD and OSD drawing calls, then vo_flip_page(). The new
version supports changing EOSD contents for libass-rendered subtitles
and simplifies the redraw support code needed per VO. vo_xv doesn't
support EOSD changes because it relies on vf_ass to render EOSD
contents earlier in the filter chain.

vo_xv logic is additionally simplified because the previous commit
removed the need to track the status of current and next images
separately (now each frame is guaranteed to become "visible" soon
after we receive it as "next", with no VO code running in the interval
between).
2011-12-06 05:03:39 +02:00
Uoti Urpala 8d6fc26bb9 Merge branch 'screenshot' (early part) 2011-11-25 23:59:23 +02:00
wm4 a661bd8f0d video: use talloc for mp_image, abort if out of memory
Make new_mp_image() allocate the struct with talloc and abort() if the
av_malloc for image plane data fails.
2011-11-25 23:56:28 +02:00
wm4 01cf896a2f core: add infrastructure to get screenshots from VOs
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot
directly from the VO. If VO support is available, screenshots will be
taken instantly (no more 1 or 2 frames delay). Taking screenshots when
hardware decoding is in use will also work (vdpau). Additionally, the
screenshots will now use the same colorspace as the video display.
Change the central MPContext to be allocated with talloc so that it
can be used as a talloc parent context.

This commit does not yet implement the functionality for any VO (added
in subsequent commits).

The old screenshot video filter is not needed anymore if VO support is
present, and in that case will not be used even if it is present in
the filter chain. If VO support is not available then the filter is
used like before. Note that the filter still has some of the old
problems, such as delaying the screenshot by at least 1 frame.
2011-11-25 23:56:28 +02:00
Uoti Urpala 3a39fc1fea commands, vd_ffmpeg: fix switch_ratio slave command
The implementation of the switch_ratio command was hacky and called
mpcodecs_config_vo() to reconfigure the filter/VO chain from under an
existing decoder. This call no longer worked properly with vd_ffmpeg
after that started using mpcodec_config_vo2(). Add new video decoder
control command VDCTRL_RESET_ASPECT and use this to tell vd_ffmpeg to
reinitialize the output chain properly.
2011-11-14 20:24:39 +02:00
Uoti Urpala 505f94cef9 vd_ffmpeg: disable slice use that fails with size changes
When not using direct rendering, vd_ffmpeg created an mp_image struct
before calling libavcodec decoder, so that possible slice support
could be checked from the mpi_image and output would be ready for
slice-drawing calls. However, this behavior is unsound with decoders
that can change output size, as the parameters can change after the
mp_image was created. Disable the code creating the mp_image at that
point, which also disables use of slices in this case. Slices are
disabled with threading anyway, so I think trying to add workarounds
to support them is not a high priority.

I think this code has always been buggy, but before common thread use
it was rarely executed because the direct-rendering case was used
instead.
2011-11-14 20:24:39 +02:00
Uoti Urpala dd1b848d92 cleanup: vf_scale.c, vf.c: replace numbers by flag macro names 2011-11-14 20:24:39 +02:00
Uoti Urpala 991d7387b3 cosmetics: vf.[ch]: reformat
Also a couple of smaller changes to other files.
2011-11-14 20:24:36 +02:00
Uoti Urpala c0b7851f23 vd_ffmpeg.c: remove useless realvideo avctx->sub_id setting
Libavcodec has ignored the caller-set sub_id value since 2006.
2011-10-25 20:35:03 +03:00
Uoti Urpala 3dd8b7326c cosmetics: vd_ffmpeg.c: reformat 2011-10-22 03:51:37 +03:00
Uoti Urpala 3595dcc089 audio/video: delete buggy "dynamic plugin" code
Codec selection for audio and video decoding had a "dynamic plugin"
feature that tried to load a shared library for any codec that had not
been enabled at compilation (disabled by default, but could be enabled
with --enable-dynamic-plugins configure switch; for unknown reasons
some distro packages have enabled it). The implementation was buggy
and could cause normal codec selection fallback to fail if the feature
was enabled. I'm not aware of any real uses of such dynamic plugins
and the feature seems questionable anyway (there are no ABI guarantees
that would make it safe to use). Remove the buggy feature.
2011-10-20 02:16:35 +03:00
wm4 75eab4f72a video, options: implement better YUV->RGB conversion control
Rewrite control of the colorspace and input/output level parameters
used in YUV-RGB conversions, replacing VO-specific suboptions with new
common options and adding configuration support to more cases.

Add new option --colormatrix which selects the colorspace the original
video is assumed to have in YUV->RGB conversions. The default
behavior changes from assuming BT.601 to colorspace autoselection
between BT.601 and BT.709 using a simple heuristic based on video
size. Add new options --colormatrix-input-range and
--colormatrix-output-range which select input YUV and output RGB range.
Disable the previously existing VO-specific colorspace and level
conversion suboptions in vo_gl and vo_vdpau. Remove the
"yuv_colorspace" property and replace it with one named "colormatrix"
and semantics matching the new option. Add new properties matching the
options for level conversion.

Colorspace selection is currently supported by vo_gl, vo_vdpau, vo_xv
and vf_scale, and all can change it at runtime (previously only
vo_vdpau and vo_xv could). vo_vdpau now uses the same conversion
matrix generation as vo_gl instead of libvdpau functionality; the main
functional difference is that the "contrast" equalizer control behaves
somewhat differently (it scales the Y component around 1/2 instead of
around 0, so that contrast 0 makes the image gray rather than black).
vo_xv does not support level conversion. vf_scale supports range
setting for input, but always outputs full-range RGB.

The value of the slave properties is the policy setting used for
conversions. This means they can be set to any value regardless of
whether the current VO supports that value or whether there currently
even is any video. Possibly separate properties could be added to
query the conversion actually used at the moment, if any.

Because the colorspace and level settings are now set with a single
VF/VO control call, the return value of that is no longer used to
signal whether all the settings are actually supported. Instead code
should set all the details it can support, and ignore the rest. The
core will use GET_YUV_COLORSPACE to check which colorspace details
have been set and which not. In other words, the return value for
SET_YUV_COLORSPACE only signals whether any kind of YUV colorspace
conversion handling exists at all, and VOs have to take care to return
the actual state with GET_YUV_COLORSPACE instead.

To be changed in later commits: add missing option documentation.
2011-10-16 21:11:11 +03:00
Uoti Urpala 83fc5b6004 options: move libass-related options to struct 2011-09-03 14:26:14 +03:00
Uoti Urpala a24e333fca ad_ffmpeg: free resources on init failure
ad_ffmpeg init() function did not free resources if opening failed.
Outside code (dec_audio.c) does not automatically call uninit() if
init() returns failure, and the uninit function would have crashed in
some cases had it been called (it did freed lavc_context->extradata,
but lavc_context could have been NULL after early init failure). Add
explicit calls to uninit() after failure and make uninit function safe
to call at any point.
2011-08-21 23:04:20 +03:00
Uoti Urpala 68df2b2b3f ad_ffmpeg: handle timing for partially decoded packets better
At least the libavcodec WavPack decoder can return output for an audio
frame in multiple parts and return 0 bytes input consumed for the
initial parts. Timing info was not set correctly in this case:
sh_audio->pts and pts_bytes were reset each time when decoding more
from the packet, as if the packet had been new (ds_get_packet_pts()
has a check to return MP_NOPTS_VALUE if the packet has already been
partially read, but that didn't trigger since libavcodec returned
exactly 0 bytes read so the demuxer-visible packet state didn't
change).

Add a field to keep track of whether a packet has already been decoded
from, and don't reset timing info again if so. Adding the field
requires adding a decoder context to store it (there wasn't one
before).

BTW the WavPack decoder behavior and avcodec_decode_audio3()
documentation don't match - the documentation says the return value is
"zero if no frame data was decompressed (used) from the input
AVPacket", while the decoder DOES return some frame data which comes
from the input packet.
2011-08-21 22:47:59 +03:00
Uoti Urpala da2b884c70 cosmetics: ad_ffmpeg.c: reformat 2011-08-21 22:20:07 +03:00
Uoti Urpala 9c7c4e5b7d core, demux, vd_ffmpeg: pass side data from demux_lavf to vd_ffmpeg
Pass the libavformat packet side_data field from demux_lavf to
vd_ffmpeg. Libavcodec/libavformat use this field for palette data, and
passing it is required for the playback of some paletted video codecs.

The implementation works by giving vd_ffmpeg a copy of the struct
demux_packet used to store the video packet (from which it can access
the avpacket field). The definition of struct demux_packet is moved to
new file demux_packet.h so that vd_ffmpeg.c can use it without
including all of demuxer.h.
2011-08-20 20:25:43 +03:00
harklu a7fee50ca0 vf_screenshot: better check for pixel format swscale support
vf_screenshot checked for a list of pixel formats that were known to
work with swscale. However, the list was incomplete. If a pixel format
was used that was not on the vf_screenshot list, but was supported
both by swscale and the VO driver, mplayer2 would insert a useless
scale filter to convert to a format supported by vf_screenshot. Fix
this by making vf_screenshot check directly whether the pixel format
is supported by swscale with sws_isSupportedInput().
2011-08-17 01:18:45 +03:00
harklu 9e6933440a options, subs: add --ass-vsfilter-aspect-compat
Add option --ass-vsfilter-aspect-compat and corresponding property
ass_vsfilter_aspect_compat. The setting controls whether to enable the
emulation of traditional VSFilter behavior where subtitles are
stretched if the video is anamorphic (previously always enabled for
native SSA/ASS subtitles). Enabled by default. Add 'V' as a new
default keybinding to toggle the property.
2011-08-12 14:19:10 +03:00
Uoti Urpala 8d1e5354e4 subs: libass: apply option changes to all track types
Libass rendering uses two renderer objects to support both VSFilter
aspect ratio (mis)behavior emulation and correct rendering. When
option values were changed during playback the changes were applied to
the renderer used for the currently active track only, and old values
could be used if the user then switched to a track using the other
renderer object. Fix to update both renderers.
2011-08-08 07:02:01 +03:00
Uoti Urpala 9920d64650 cleanup: move global ass_force_reload to struct osd_state 2011-08-08 05:59:23 +03:00
Uoti Urpala b33bb28ea3 build: fix --enable-debug, remove some "#ifdef MP_DEBUG"
Recent commit 5d5ca22a6d ("options: commandline: accept --foo=xyz
style options") left some bad code under "#ifdef MP_DEBUG" in
playtree.c, which caused a compilation failure if configured with
"--enable-debug". Fix this. Having the "#ifdef MP_DEBUG" there was
completely unnecessary; it only increased the risk for this kind of
problems for no real benefit - executing the asserts under it would
have no noticeable performance or other penalty in default builds
either. Remove several cases of such harmful "#ifdef MP_DEBUG".
2011-07-30 19:03:20 +03:00
Uoti Urpala e873d703e9 options: change option parsing to use bstr
Using bstr allows simpler parsing code, especially because it avoids
the need to modify or copy strings just to terminate extracted
substrings.
2011-07-29 05:50:38 +03:00
Uoti Urpala a4f4130819 cleanup: do libav* initialization on startup
Do the global initialization of libavcodec and libavformat
(avcodec_register_all(), av_register_all()) immediately on program
startup and remove the initialization calls from various individual
modules that use libavcodec/libavformat functionality.
2011-07-18 00:57:05 +03:00
Uoti Urpala 4e2b15fc5e vf_qp: enable compilation depending on libavutil eval API
Libavutil eval API seems to be enough for vf_qp, so enable the filter
if the API is available. Also clean up some left over lines for other
filters in Makefile.
2011-07-18 00:57:05 +03:00
Uoti Urpala e62fcc3a0e img_format.h, vo_gl: fix IMGFMT_IS_YUVP16() definition
Commit aba8a1838a which added 9- and 10-bit formats failed to change
the definition of the IMGFMT_IS_YUVP16() macro (which is misnamed btw,
it matches 9, 10 and 16 bits). This prevented vo_gl from accepting
input in supported 9 and 10 bit colorspaces. Fix.
2011-07-14 01:19:07 +03:00
Uoti Urpala 13151d7b69 vd_ffmpeg: make "-lavdopts lowres" handling more robust
Remove the copy of the "lowres" field that vd_ffmpeg kept in its
private struct and use the value from AVCodecContext directly instead.
The copy gave no benefit and it could be set to the wrong value if
someone used "-lavdopts o=lowres=X" (which would change the real value
but not the copy).
2011-07-09 14:14:38 +03:00
Uoti Urpala 1a7ef3b39c vd_ffmpeg: fix "-lavdopts skipframe" support
Support for -lavdopts skipframe had been broken since commit bc767c2a9
as framedrop logic now set the same field and thus overwrote the value
set from the option. Change that code to set it to the original value
instead of 0 when not dropping frames.
2011-07-09 13:50:16 +03:00
reimar f572826883 cosmetics: img_format.h: document some formats
Document the meaning of some of the packed YUV formats.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33692 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
reimar b0a88d1362 vf_stereo3d: Add support for converting to interleaved 3D
Patch by Steaphan Greene [sgreene cs.binghamton.edu]

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

Improve stereo3d interleaved man page description.

Patch by Steaphan Greene [sgreene cs.binghamton.edu]

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

Change memcpy_pic to force it to never write to image parts between
width and stride if creating a row-interleaved format, otherwise
the second memcpy_pic might overwrite what the first wrote.
Changing the first should not be necessary but might result in
better performance.

Patch by Steaphan Greene [sgreene cs.binghamton.edu]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33690 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
reimar 20ea5a1cfc vf_ilpack: fix incompatible function types
Do not call functions through a function pointer specifying more
arguments. It is theoretically possible to have calling models
where this would break horribly.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33536 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 09:24:31 +03:00
Uoti Urpala 3cbde4da84 cosmetics: vf_ilpack.c: tabs to 4 spaces 2011-07-06 09:23:53 +03:00
reimar be4d3d3491 vf_dint, vf_divtc: fix code assuming "char" is signed
Use int as type, there is no reason to use char which also
causes issues since it may be either signed or unsigned.

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

Fix code assuming that "char" is signed.

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

Fix code incorrectly assuming "char" is signed.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33531 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 09:15:57 +03:00
cigaes 4f4fae851d vf_delogo: allow to change the rectangle based on the time
NOTE: the memory for the "file" argument will be leaked; dynamic
options are not automatically freed. Not fixing that now as I might
implement more general handling later. -uau

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33498 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 07:13:08 +03:00
Uoti Urpala ecfffe6466 cosmetics: vf_delogo.c: remove tabs to allow direct merge
Remove tab characters to make the file match MPlayer 1 and thus allow
directly applying change from there.
2011-07-06 07:11:03 +03:00
Uoti Urpala befed529bc debug output: reduce verbosity of some frequent messages
Drop from frequent (per-frame) messages from DBG2 to DBG3. Drop VDPAU
clock adjustment messages from V to DBG2.
2011-07-05 00:50:41 +03:00
Uoti Urpala c8b3088c18 audio: move ready-for-ao data buffer from decoder to AO
Move the buffer storing audio data ready to be fed to the audio output
driver from the audio decoder object to the AO object. This will help
encoding code deal with end of input, and may also be useful to
improve other general gapless audio behavior (as AOs which do not
accept chunks smaller than a certain size may keep them in the buffer
while the decoder changes).

Less data may be dropped now when changing audio filters or switching
timeline parts.
2011-07-02 09:22:32 +03:00
Clément Bœsch 480f3fb8d0 cleanup: fix mp_dbg() format string warnings 2011-07-01 03:37:34 +03:00
reimar 57f48fc1bf vo_gl: don't accept 9/10-bit formats as input
Make mp_get_chroma_shift() simpler/more generic and add an argument
to get the per-component bit depth.
Use this to check more properly for supported formats in
gl and gl2 vos (only 8 and 16 bit are supported, 9 and 10 are not).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33452 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 10:49:41 +03:00
iive 49b31c2b43 vd_ffmpeg.c: fix one case of "-lavdopts vstats" crashing
Fix segfault with -lavdopts vstats and some codecs.
The vstats option relies on avctx->coded_frame being filled.
Unfortunately not all codecs do that (e.g. VP8) thus causing
NULL dereference.
FFmpeg code seems to always check if coded_frame != NULL,
so we should do the same.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33347 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 06:30:49 +03:00
Diego Biurrun 017c173d74 configure: Remove checks for default inline asm features
Remove checks for compiler support of >= 10 assembler operands and
named assembler arguments. Just assume the features are always
available. These features were only missing from obsolete GCC versions
which are not supported any more.
2011-06-28 19:04:22 +03:00
Uoti Urpala d3bef0286b vd_ffmpeg: autoselect output colorspaces without codecs.conf
Selecting the colorspace to output from a decoder is done in the
function mpcodecs_config_vo(). Add a new version of this function,
mpcodecs_config_vo2(), that allows the decoder to specify a list of
candidate colorspaces instead of always using a hardcoded list
specified in the codecs.conf entry. If the codecs.conf entry has any
"out" lines then those still take priority and the decoder-provided
list (if any) is ignored. Make vd_ffmpeg provide a list of the
colorspaces it's willing to output. Remove "out" lines from most
entries for libavcodec video decoders in codecs.conf, so that the
automatic values are now used instead.
2011-06-26 06:27:50 +03:00
Uoti Urpala aba8a1838a video/colorspaces: add new 9/10-bit formats from libavcodec
Add new internal 9/10-bit IMGFMT values and mappings to the
corresponding libav* PIX_FMT_* values.

Partially based on a patch from Arne Bochem <arneb.mp@ccan.de>.
2011-06-26 06:27:50 +03:00
Rudolf Polzer fbf6885395 vf_pullup, vf_yadif: pts handling fixes
vf_pullup: continue to calculate pts after detecting a seek

vf_yadif: add pts calculation for the one-frame-becomes-two mode
          (-vf yadif=1)
2011-06-24 22:31:44 +03:00
Uoti Urpala cbdb7e6305 vo_xvmc: drop XvMC support
Due to libavcodec changes vo_xvmc would have needed some modifications
to keep working. However, I think there's little real demand for XvMC,
so I'll just drop XvMC support. XvMC only supported MPEG-2, making it
of very limited usefulness nowadays, plus the vo_xvmc implementation
was not high quality and never worked particularly well or reliably
anyway.
2011-05-09 20:27:16 +03:00
Uoti Urpala b21e7dc7a9 audio: disallow partial samples, fix ad_pcm to comply
Add some asserts to check that decoders/filters produce complete
samples (byte amounts must be multiples of channels*datatype_size) and
that audio output drivers also accept input in complete units. Fix
ad_pcm which was known to violate this if its last input packet didn't
stop at a sample boundary.
2011-05-07 22:17:51 +03:00
Clément Bœsch b68f9fef32 cleanup: shut up more warnings 2011-05-06 18:33:16 +03:00
Uoti Urpala 24d0d48c4a audio: avoid duplicated error messages on init failure
dec_audio.c init_audio_codec() would in one case print
"ADecoder init failed :(\n" and return failure. Its only caller
init_best_audio_codec() printed exactly the same message if the
returned result was failure. Change the latter message to say
"Could not open audio decoder %s.\n" instead. Some of the
per-open-attempt messages are kind of value about their context; this
new message should make it more clear where the attempt to open one
specific codec ends.
2011-05-03 17:25:01 +03:00
Uoti Urpala 0321d683b4 ad_ffmpeg: return failure from init() if initial decode fails
The init() method in ad_ffmpeg tries to decode some audio data after
opening the libavcodec decoder; however the method returned success
even if this part failed. Change it to return failure instead,
indicating that the codec could not be successfully opened.

This improves behavior at least with some AAC files, for which the
libavcodec decoder can be successfully initialized but decoding
packets always fails. Before the audio would be decoded with
libavcodec, producing only a constant stream of errors; after this
commit audio decoder initialization falls back to FAAD (if available)
which works for these samples.
2011-05-03 16:52:57 +03:00
Clément Bœsch 6506d4ad84 cleanup: remove more warnings 2011-05-02 00:46:48 +03:00