1
mirror of https://github.com/mpv-player/mpv synced 2024-11-07 01:47:00 +01:00
Commit Graph

33085 Commits

Author SHA1 Message Date
Uoti Urpala
eb66a3fe07 subreader.c: don't run FriBiDi code if using libass
Libass has its own BiDi handling now, and preprocessing the subtitles
with FriBiDi before passing them to libass breaks things. Disable our
own FriBiDi code when libass rendering is used. This affects external
subtitle files of other formats parsed with subreader.c and converted
to ASS tracks.
2011-09-23 14:43:53 +03:00
Uoti Urpala
0383070588 sd_ass.c: set event->Style to fix --ass-styles
Set the "Style" attribute for subtitle events created in sd_ass to
match the "default_style" attribute of the track. This is required to
make --ass-styles work with recent libass versions (otherwise the
event would use style 0, which is a fallback style added by libass
now).

Commit 378ada847c ("sub/ass: use default
style, not first style unconditionally") fixed the same issue for
external subtitles converted with mp_ass_read_subdata(); this commit
fixes it for muxed ones.
2011-09-23 13:57:11 +03:00
Uoti Urpala
e35362f507 codecs.conf: add Libav ProRes decoder 2011-09-23 06:27:05 +03:00
Uoti Urpala
ef81031350 options: make "choice" option type parsing ignore case 2011-09-11 16:35:44 +03:00
Uoti Urpala
159102e0cb core: fix --sstep
The --step option had broken at some point. Probably nobody uses it,
but it was easy to fix.
2011-09-04 22:12:51 +03:00
Uoti Urpala
b948dd3461 cosmetics: mplayer.c: minor tweaks 2011-09-04 22:08:26 +03:00
Uoti Urpala
d33f7cf6f2 options: --pphelp: fix after libpostproc version change
The last libpostproc major version change from 51 to 52 changed the
type of the "pp_help" symbol from a pointer to help text to the help
text itself. This made --pphelp crash. Change the option definition to
match the new type. This probably makes it crash if compiled against
older libpostproc, but the option is not important enough to try
supporting that (I've seen no reports of the crash, probably people
just don't use the option).
2011-09-04 21:34:11 +03:00
Uoti Urpala
89b37a32da options: add "disabled option" functionality
Add functionality to mark options that depend on features disabled at
compile time as disabled rather than not compiling the option
definitions at all. This allows printing a warning about the option
not being available because of a disabled feature, instead of just
"unknown option". Because the option definitions are still compiled
fully, this only works for definitions that do not reference symbols
which are not available if the feature is disabled. Use the new
functionality for options depending on libass.
2011-09-04 14:36:09 +03:00
Uoti Urpala
79469244f7 input/ar.c, input/lirc.c: fix changes missing from 1916b95b8
1916b95b8 changed two function types from returning "void" to
returning "int", but was missing changes to add "return 0;" to the
functions. Fix.

The reason for the change in the original commit was that the
functions were called through a function pointer returning int anyway,
so the missing return probably made things no more likely to fail at
runtime than they were before that commit. However, it caused a
compilation failure with clang, which treats non-void function not
returning a value as a fatal error (in GCC it's just a warning).
2011-09-04 08:04:31 +03:00
Uoti Urpala
83fc5b6004 options: move libass-related options to struct 2011-09-03 14:26:14 +03:00
Clément Bœsch
3e0a270559 subassconvert: handle "\r\n" line ends
Previously the code converting text subtitles to ASS format converted
newline characters, and only those, to ASS "new line" markup. If the
subtitles contained "\r\n", the "\r" was thus left in the text. In
previous libass versions the "\r" was not visible, but in the current
one it produces an empty box. Improve the conversion to remove the
"\r" in that case. Also treat a lone "\r" as a newline.
2011-09-02 12:22:15 +03:00
Uoti Urpala
5a13d47b97 demux_mf: fix option value allocated with strdup
demux_mf allocated the "type" suboption of "--mf" with strdup if it
was not explicitly set. This caused a crash after playing an mf://
entry. Fix to use talloc instead.
2011-09-02 08:04:52 +03:00
Uoti Urpala
081e2d0b7b options: commandline: support "--no-opt" for flag options
When parsing the command line, map "--no-foo" to "--foo=no" if an
option named "foo" exists and is a flag option. Non-empty parameters
are not allowed with this syntax ("--no-foo=no" is invalid).

This implementation is different from the existing "--nofoo" variants
for most flag options. Those are implemented as completely separate
options; there's an option named "fs" and a separate option named
"nofs" (thus "--no-nofs" actually works after this change...). The
reason for adding the new syntax is to support the much more standard
"--no-" prefix and to allow eventually cleaning up the option handling
(though the "nofoo" variants of existing options can't be removed soon
due to backwards compatibility).
2011-09-01 18:32:11 +03:00
Uoti Urpala
b6628f4e1e csputils/vo_gl: rewrite YUV->RGB matrix generation
Rewrite the csputils.c code generating a conversion matrix for
YUV->RGB conversions (currently used by vo_gl only). Functional
differences:
- The separate "mplayer default" colorspace is removed, and BT.601 is
  used instead (the default colorspace was in fact BT.601; see below).
- The old code was missing chroma scaling. As a result the "mplayer
  default" colorspace actually mapped to BT.601, and everything else
  was buggy (I guess the other colorspaces were added with particular
  coefficient semantics, without understanding that the original
  "default colorspace" was actually BT.601 and why its coefficients
  differed from the added version).
- The old code had a bug in the equalizer hue equations.
- The old code assumed that for specifying whether input and output
  were limited-range or full-range YUV or RGB it would make sense to
  specify "no conversion" meaning full-range YUV to full-range RGB or
  limited-range YUV to limited-range RGB. This isn't true; limited-
  range YUV has different ranges for luma and chroma (16-235
  vs 16-240) which means you have to scale chroma for limited->limited
  conversions. The new code assumes limited->limited conversions for
  the levelconv parameter 2. It'd probably make sense to change the
  API later to specify the ranges of input and output separately.
- The undocumented EBU and XYZ colorspaces are removed. I doubt any
  videos use these. Also the EBU colorspace looks like it'd expect
  a different input range - at least no input would map to full RGB
  red as it was.
2011-08-29 06:34:36 +03:00
Uoti Urpala
1478f658f3 cosmetics: csputils.[ch]: reindent 2011-08-28 05:52:46 +03:00
Uoti Urpala
506ab685d4 demuxer.h: raise pad amount to allow compiling against FFmpeg
FFmpeg has increased FF_INPUT_BUFFER_PADDING_SIZE to 16 (unlike Libav
which still has it at 8). Raise MP_INPUT_BUFFER_PADDING_SIZE to 16 to
allow compilation against FFmpeg too (demuxer.c checks the padding
size for packets is at least as much as libavcodec wants for its
decoders, and this check failed with the previous value of 8).
2011-08-26 06:29:36 +03:00
Uoti Urpala
9fe2fa599b core: remove bad workaround for files without FPS set
Commit dde8b753e4 merged an mplayer1 change (r31328) that set
correct_pts to true if FPS was not set (on the assumption that
correct-pts mode could provide proper timing without FPS). As the
merge commit noted this change was somewhat questionable, as the
option shouldn't really change after things have already been
initialized. After recent changes it can cause an outright crash
(assert in ds_get_packet2() from 9c7c4e5b7d fails). Remove the hack.
Also only print a warning about not having FPS if correct_pts is not
set (in correct_pts mode not having FPS shouldn't be a real problem,
as everything is based on timestamps anyway).
2011-08-25 02:45:13 +03:00
harklu
8cc5ba5ab8 video_out.h: change VOCTRL_* defines to enum
Convert the list of VOCTLR_* defines to an enum, dropping some unused
values. This resolves a collision between VOCTRL_XOVERLAY_SET_COLORKEY
and VOCTRL_REDRAW_OSD, which had the same value (the XOVERLAY one was
only used by vo_xvr100 and vo_tdfx, so this didn't matter much in
practice).
2011-08-25 02:19:25 +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
2c5285c151 demux_lavf: Adding av_dup_packet() missing from recent 6e8d420a41
Commit 6e8d420a41 ("demux: avoid a copy of demux packets with lavf,
reduce padding") was missing an av_dup_packet() line. As a result at
least formats that use parsing on the lavf side could fail (with
parsing the packet may contain pointers to temporary fields that
will be overwritten/freed when reading further packets, and
av_dup_packet() is required to allocate permanent storage).
2011-08-21 21:55:32 +03:00
Martin Herkt
47f5d53d85 osdep/mplayer.rc: change to use "mplayer2" name 2011-08-21 02:18:00 +03:00
Uoti Urpala
36fcd351f6 configure: libav: use "pkg-config --print-errors", "Libav" name
Use the "--print-errors" flag of pkg-config when testing for the
presence of Libav libraries. Even though the error output is a bit
messy (printed on the same "Checking for"... line), it does contain
useful information for this test which checks for several libraries at
once.

Also change the test name from "FFmpeg" to "Libav" and rename the
option from --disable-ffmpeg to --disable-libav. The change should
cause no compatibility problems as the option is very rarely used.
2011-08-21 00:36:23 +03:00
Uoti Urpala
c9c6b878be demux_mkv: fix failure to open some files from 0ece360eea
After 0ece360eea ("demux_mkv: skip files faster in ordered chapter
file search") some Matroska files failed to open. The problem was that
demux_mkv_read_info() returned 0 on success, but the opening code
interpreted this as a value to stop parsing further headers. Fix this
and also modify some of the other return value handling.
2011-08-20 21:45:42 +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
Uoti Urpala
e2ca8853a6 demux_mkv: support extradata for wavpack audio tracks
Export the codec private data field for WavPack and TrueHD audio
tracks. At least for WavPack this is necessary to make some samples
work.

Also change some other cases to use the same data-copying code.
2011-08-20 06:06:12 +03:00
Uoti Urpala
46d90010ba demux_mkv: clean up audio codec handling somewhat 2011-08-20 05:54:27 +03:00
Uoti Urpala
01fa34d537 demux_mkv: check for valid track in video/audio switching
When switching audio or video tracks, demux_mkv only checked that the
new index fell in the range corresponding to tracks existing in the
file being played. However, if the demuxer can not recognize the
format of a track or detects an error, some of those tracks in the
file may not be exported from the demuxer and are not visible to the
rest of the player. Selecting such a track would cause a crash. Add
checks skip such tracks when cycling to next track and switch to
nosound instead if given an explicit track number corresponding to
such a track.
2011-08-20 02:43:51 +03:00
Uoti Urpala
f253de24af demux_mkv: remove bad mkv_free() from 0ece360eea
demuxer.c calls demuxer->close() even if opening failed. Thus the
mkv_free() call added in 0ece360eea ("demux_mkv: skip files faster
in ordered chapter file search") was wrong, and could cause a crash
from a double free if some data structures were allocated before the
opening attempt was aborted.
2011-08-19 21:37:16 +03:00
Uoti Urpala
3043beffab demuxer.h: avoid including stream.h
Drop the unnecessary include and add a missing direct include in some
files. This also revealed that demux_rtp_internal.h was missing a
config.h include, fix that too.
2011-08-19 21:37:16 +03:00
Uoti Urpala
b2e213d889 aviheader.h: avoid including demuxer.h
Remove unnecessary demuxer.h include from aviheader.h. Through
stheader.h aviheader.h is included in a lot of files. Add missing
mp_msg.h includes to av_sub.c and sd_ass.c (previously hidden by
indirect inclusion through demuxer.h and stream.h).
2011-08-19 21:37:16 +03:00
Uoti Urpala
6e8d420a41 demux: avoid a copy of demux packets with lavf, reduce padding
When demux_lavf read a new packet it used to copy the data from
libavformat's struct AVPacket to struct demux_packet and then free the
lavf packet. Change it to instead keep the AVPacket allocated and
point demux_packet fields to the buffer in that.

Also change MP_INPUT_BUFFER_PADDING_SIZE to 8 which matches
FF_INPUT_BUFFER_PADDING SIZE; demux_lavf packets won't have more
padding now anyway (it was increased from 8 earlier when
FF_INPUT_BUFFER_PADDING_SIZE was increased in libavcodec, but that
change was reverted).
2011-08-19 21:32:47 +03:00
Uoti Urpala
6ec60c976f talloc.[ch]: remove "type safety" hack that violates C types
The destructors used by talloc take a "void *" first parameter.
However talloc.h had a #define hack that treated the destructor as a
function taking first parameter of type "typeof(ptr)" where ptr is the
pointer the destructor is set for. I suppose this was done to add some
kind of "type safety" against adding a destructor expecting another
type of pointer; however this hack is questionable and violates the
real C level typing. Remove the hack from the header and adjust
talloc.c to avoid a warning about a C type violation that became
visible after removing the hack.
2011-08-19 03:01:16 +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
Uoti Urpala
54d0763b92 av_log: don't crash if called with NULL AVClass
At least libavformat mpegts demuxer may give bad parameters with NULL
AVClass to the av_log callback. Check for this and print a warning
instead of crashing.
2011-08-15 02:58:51 +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
e30416c997 vo_vpdau: fix preemption recovery broken in decec7f2a3
Commit decec7f2a3 ("vo_vdpau: skip resize code if not fully
initialized") broke preemption recovery because the resize code stayed
incorrectly disabled when it would have been used to reinitialize
things during recovery. Revert that commit and add different checks
to avoid running various code when not in a fully functional state.
2011-08-11 21:46:27 +03:00
Uoti Urpala
2a30588258 ao_pcm: fix pointless message due to uninitialize variable
The variable corresponding to the "fast" suboption of ao_pcm was
uninitialized. Fix. The only effect was possibly printing a warning
about the suboption being deprecated even if it wasn't used.
2011-08-11 20:58:05 +03:00
Uoti Urpala
1cb179855e dvdnav: fix crash caused by missing line from 58834653c0
The committed version of 58834653c0 ("dvdnav: make
mp_dvdnav_save_smpi() more robust") was somehow missing one line which
caused a crash with dvdnav. Add it back.
2011-08-10 23:26:48 +03:00
Uoti Urpala
ca9065b93f demux_lavf: don't interpret MPEG codec tags as generic tags
Don't interpret native MPEG codec tags using our generic
format-agnostic codec tag tables. MPEG may use tag 3 for MP3, whereas
the generic tables map 3 to uncompressed PCM. Make the code ignore the
codec_tag field for the "mpeg" and "mpegts" libavformat demuxers and
rely on the codec_id value provided by lavf only.
2011-08-10 22:52:35 +03:00
harklu
d4b8d1486a core: allocate OSD text buffers dynamically
The OSD text buffers (mp_osd_msg_t.text and osd_state.text) used to be
static arrays, with the buffer sizes spread all over the code as magic
constants. Make the buffers dynamically allocated and remove the
arbitrary length limits.
2011-08-09 03:28:58 +03:00
Uoti Urpala
fada084499 options: remove old disabled options that just print an error
Remove several old options that were deprecated and disabled years ago
and whose only effect now was to show a custom error message about the
option in question being deprecated and then exit. Also remove the -vd
option which was just a stupid joke and never had useful functionality.
2011-08-09 03:28:32 +03:00
Uoti Urpala
b4c90d78f0 options: support --leak-report (double dash form)
The special option --leak-report is manually checked so didn't
automatically get double-dash support. Update the test.
2011-08-08 07:58:21 +03:00
Uoti Urpala
c6141b03f4 core: minor audio-only+timeline fix for chapter handling
Remove outdated "!mpctx->sh_video" checks in chapter seeking and
naming functions left over from when timeline functionality did not
support audio-only case.
2011-08-08 07:42:28 +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
f5d493d017 subs: libass: remove bad ass_set_margins() on settings reset
When libass-related options were changed at runtime, the
reinitilization code executed ass_set_margins() with arguments that
were correct for the vf_ass case but wrong for EOSD. This could cause
the subtitles to be displayed incorrectly for one frame (vf_vo would
run ass_set_margins() again with the correct parameters for the next
frame). The call is actually redundant for the vf_ass case too as
it's currently not possible to modify the margins during playback, so
fix the problem by disabling the call.
2011-08-08 06:01:05 +03:00
Uoti Urpala
9920d64650 cleanup: move global ass_force_reload to struct osd_state 2011-08-08 05:59:23 +03:00
harklu
d843c9ca38 commands: property sub_scale: update old subs immediately
When using the "old" subtitle renderer (i.e. not libass), changes to this
property were not reflected immediately, and came into effect only when the
next subtitle event was rendered.
2011-08-08 04:20:25 +03:00
Uoti Urpala
d52acba688 cleanup: reformat command.c 2011-08-07 04:57:16 +03:00