summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* encode: print on log which muxers/codecs are in useRudolf Polzer2012-12-011-0/+12
| | | | | | This is consistent with the demuxer/decoder info output mpv already has, and is also generally useful to know, especially if using --ao=codec1,codec2,... syntax.
* mplayer: fix track language displaywm42012-11-251-1/+2
| | | | | | This caused e.g. "--alang=" (without anything following) to be printed in the terminal output when the file specified no language for the track. Introduced by commit 9085b8.
* sub: add --sub-gray option to display image subs in grayscalewm42012-11-252-0/+2
| | | | | | | | | | MPlayer/mplayer2 still show DVD subtitles in gray. Depending on who you ask, this can be considered a bug or a feature. Include rendering in gray as explicit feature, so the user can decide what is better. This affects all indexed sub bitmaps entering the OSD rendering path. Currently, this means all image subs are affected by this option, but nothing else.
* sub: reimplement -spugauss as --sub-gausswm42012-11-252-0/+2
| | | | | | | | | | | | | | | | Apparently the -spugauss option was popular. The code originally implementing this is gone (scaler stuff in spudec.c). Reimplement it using libswscale to scale and blur image subtitles if the --sub-gauss option is set. The code does some rather lazy padding to allow the blur to spread pixels past the original image bounding box. (This problem exists with normal bilinear scaling too, but is barely noticable.) Technically, this doesn't just blur subtitles, but anything RGBA (or indexed) that enters the OSD rendering path. But only image subtitles produce these OSD formats currently, so no explicit check is done to prevent blurring in other cases.
* screenshot: add subs even with vf_screenshotwm42012-11-211-5/+11
| | | | | | | | | | | | | | Until now, screenshots with the video filter didn't add subs (unclear whether that was an oversight or feature). Fix this and make behavior when taking screenshots with vf_screenshot more consistent with VO screenshots. The change in vf_screenshot is needed, because add_subs() checks this flag to decide whether it's allowed to mutate the image. This commit has another user visible side effect. When taking a screenshot each frame (using the "each-frame" mode of the screenshot command), a normal screenshot command will stop the each-frame mode.
* video: fix bogus uses of mp_image.w/widthwm42012-11-211-2/+2
| | | | | | | | | | | | | | | | | mp_image has this confusing distinction between the w/h and width/height fields. w/h are the actual width and height, while width/height have a very special meaning inside the video filter code: it's the actually allocated width, which is also used for stride padding. Screenshot related code abused the w/h fields to store the aspect corrected size. Some code confused the role of w/h and width/height. Fix these issues. For aspect corrected size, display_w/h are used, while width/height should never be used outside vf.c internals and related code. This also fixes an actual bug when taking screenshots of anamorphic video with vf_screenshot, as well as using vo_image with such videos.
* cfg-config: avoid warning with -Wincompatible-pointer-typesStefano Pigozzi2012-11-211-1/+1
| | | | | This was throwing off a warning with clang. Add a cast to (void *) like many other options do.
* core: minor cleanupswm42012-11-202-3/+4
| | | | | | | Enable printf format warnings for set_osd_[t]msg. Remove the pointless assertion in mplayer.c (the assertion proved that the following NULL check is probably pointless, but leave that check anyway for robustness - it's not really clear whether it's needed).
* osd: fix OSD status symbol display in some caseswm42012-11-204-14/+22
| | | | | | | | | | | | | | | | | | | | | The playback status symbol in the OSD status display on video (such as displayed when seeking or with the show_progress input command) sometimes kept displaying the last seek, without resetting the symbol. (For example: disable the OSD, seek, enable the OSD, run show_progress; but also other cases.) The main reason for that was the code clearing the OSD bar is also responsible for clearing the osd_function (which stores the playback symbol). If no OSD bar was set, the osd_function was never reset. Fix by always setting the timer for clearing the OSD bar and the osd_function whenever the osd_function is set. Clearing the OSD bar when it wasn't set is OK. If the OSD bar is set some time after osd_function is set, the timer is overwritten - that's a good thing, as it makes both disappear from the screen at exactly the same time. Always reset osd_function to 0 and determine the playback status explicitly from mpctx->paused when displaying the status on screen.
* command: use yes/no instead of enabled/disabled for consistencywm42012-11-201-4/+2
| | | | | The idea is that the OSD uses the same names as the options, if possible.
* mplayer: disable auto-loading of external codecs.confwm42012-11-204-21/+6
| | | | | | | | | | Do not load codecs.conf files located in $PREFIX/etc/mpv/ or ~/.mpv/. There really is no use for this, other than possibly breaking things. It's still possible to use --codecs-file explicitly to load an external config file, and this option can be used in ~/.mpv/config. While we're at it, remove the global codecs_file variable, and another unused variable.
* m_option: print valid integer range for choices on parsing errorswm42012-11-201-0/+2
| | | | | | | | | Only some choices have an additional integer range. For those which do, printing the choices only would be confusing. E.g. --cursor-autohide accepts the choices "always", "no", or an integer value. The help text printed on option parse errors should print the accepted integer range additional to "always" and "no".
* osd: make the OSD and sub font more customizablewm42012-11-205-36/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make more aspects of the OSD font customizable. This also affects the font used for unstyled subtitles (such as SRT), or when using the --no-ass option. This adds back some customizability that was lost with commit 74e7a1 (osd: use libass for OSD rendering). Removed options: --ass-border-color --ass-color --font --subfont --subfont-text-scale Added options: --osd-color --osd-border --osd-back-color --osd-shadow-color --osd-font --osd-font-size --osd-border-size --osd-margin-x --osd-margin-y --osd-shadow-offset --osd-spacing --sub-scale The font size is now specified in pixels as it would be rendered on a window with a height of 720 pixels. OSD and subtitles are always scaled with the window height, so specifying or expecting an absolute font size doesn't make sense. Such scaled pixel units are used to specify font border etc. as well. (Note: the font size is directly passed to libass. How the fonts are actually rasterized is outside of our control, but in theory ASS font sizes map to "script" pixels and then are scaled to screen size.) The default settings should be about the same, with slight difference due to rounding to the new scales. The OSD and subtitle fonts are not separately configurable. It has limited use and would double the number of newly added options, which would be more confusing than helpful. It could be easily added later, should the need arise. Other small details that change: - ASS_Style.Encoding is not set to -1 for subs anymore (assuming subs use VSFilter direction in -no-ass mode too) - use a different WrapStyle for OSD - ASS forced styles are not applied to OSD
* m_option: add color option typewm42012-11-202-0/+54
| | | | | | | | | | | This accepts HTML-style hex colors in the form #RRGGBB. It's also possible to provide an alpha component with #AARRGGBB. Each 2-digit group is a hex number, which gives the color value from 0-255 (e.g. There is existing code in subassconvert.c, which parses HTML-style color values in SRT subs. This is not used: it's probably better if option parsing is completely separate from code specific to certain subtitle formats, even if a little code is duplicated.
* core: fix crash when video filter returns inf as PTSwm42012-11-201-1/+1
| | | | | | | | | | | | | | | | | | | When a video filter returned inf as PTS, the player crashed. One reason for this was that decode_audio() was called with a negative minlen parameter, which at some point caused it to call a memory allocation function with a ridiculous value, triggering an out of memory code path in talloc.c. (talloc.c has been modified to abort() on out of memory situations.) Fix this by sanity checking minlen in decode_audio(). (The check against outbuf->len always succeeded, because it's an unsigned comparison.) Make an existing sanity check in mplayer.c more robust: check for NaN too, which happens if the video PTS is inf. This happened with "-vf pullup,softpulldown" (but is not triggered when the following commit is applied).
* mplayer: fix potential issue when ao_play() failswm42012-11-201-1/+2
| | | | | | | | | ao_play() can fail; in that case a negative error code is returned. This error code is returned by write_to_ao() in turn. The function fill_audio_out_buffers(), which calls write_to_ao(), doesn't check for any error codes, and will likely trigger the assertion following the function call. Change write_to_ao() to return 0 on failure to hopefully prevent crashes when AOs fail.
* stream: fix dvd:// + cache crashingwm42012-11-201-2/+2
| | | | | | The language string was dynamically allocated, which completely fails if the cache is forked (which it usually is). Change it back to a fixed length string, like the original code had it.
* stream, demux: replace off_t with int64_twm42012-11-201-2/+2
| | | | | | On reasonable systems, these types were the same anyway. Even on unreasonable systems (seriously, which?), this may reduce potential breakage.
* Fix potential bugs and issues, general cleanupsreimar2012-11-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of these are reimar fixing issues found by Coverity static analyzer, and possibly some more cleanup commits independent from this. Since these commits are rather noisy, squash them all together. Try to make code a bit clearer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35294 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: audio/out/ao_alsa.c Check the correct variable for NULL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35323 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless unreachable code (the loop condition already checks the 0xff case). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35325 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix typo that might have caused reading beyond the string end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35326 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not needlessly use "long" types. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35331 b3059339-0415-0410-9bf9-f77b7e298cf2 Use AV_RB32 to avoid sign extension issues and validate offset before using it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35332 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove nonsense casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35343 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix crash in case sh_audio allocation failed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35348 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix potential NULL dereference. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35351 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpcodecs/ad_ffmpeg.c Note: Slightly modified. Fix malloc failure check to check the correct variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35353 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid code duplication and pointless casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35363 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/tv.c Error out if an invalid channel list name was specified instead of continuing and reading outside array bounds all over the place. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35364 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/tv.c Make array "static const". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35365 b3059339-0415-0410-9bf9-f77b7e298cf2 Properly free resources even when encountering many parse errors. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35367 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: parser-cfg.c Avoid leaks in error handling. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35380 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not do sign comparisons on "char" type which can be both signed or unsigned. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35381 b3059339-0415-0410-9bf9-f77b7e298cf2 Free cookies file data after parsing it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35382 b3059339-0415-0410-9bf9-f77b7e298cf2 http_set_field only makes a copy of the string, so we still need to free it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35383 b3059339-0415-0410-9bf9-f77b7e298cf2 check4proxies does not modify input URL, so mark it const. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35390 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove proxy "support" from stream_rtp and stream_upd, trying to use a http proxy for UDP connections makes no sense. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35394 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/stream_rtp.c stream/stream_udp.c Add url_new_with_proxy function to reduce code duplication and memleaks. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35395 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/pnm.c stream/stream_live555.c stream/stream_nemesi.c stream/stream_rtsp.c Fix off-by-one errors in file descriptor validity checks. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35402 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35403 b3059339-0415-0410-9bf9-f77b7e298cf2 Abort when opening the file failed instead of calling "write" with an invalid descriptor. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35404 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless local variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35411 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/http.c
* options: support chapters for --start and --endwm42012-11-203-1/+16
| | | | | | | | | | | | | The --start and --end switch now accept a chapter number. The chapter number is prefixed with '#', e.g. "--start=#2" jumps to chapter 2. The chapter support might be able to replace --chapter completely, but for now I am not sure how well this works out with e.g. DVDs and BDs, and a separate --chapter option is useful interface-wise. (This was supposed to be added in 51503a, but apparently the fixup commit adding it was lost in a rebase. This might also be the reason for the mess-up fixed in 394285.)
* m_option: fix braindead --start, --length, --end option parsing bugswm42012-11-181-4/+4
| | | | | | | | | | | | | The option type m_option_type_rel_time was completely broken. It interpreted everything starting with a number as percent position. This is because sscanf() semantics are idiotic (trailing string doesn't need to be matched), and due to my own idiocy this was overlooked when testing. Fix by considering sscanf() evil and not using it. (bstr_sscanf() is a straight wrapper around sscanf()). Even if the percent code was fixed, there was another bug: it always interpreted times as negative (starting from end for --start). Fix the basic logic.
* command: export A/V sync difference as "avsync" propertywm42012-11-161-0/+9
| | | | This is the same as on the status line after the "A-V: ".
* demux_mf: allow displaying single image files, various cleanupswm42012-11-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable autoprobing for demux_mf, so that image files can be directly displayed with e.g. "mpv file.jpg --pause". (The --pause switch is needed to prevent the window from closing immediately.) Since demux_mf doesn't have any real file format probing and goes by file extension only, move the demuxer down the demuxer list to ensure it's checked last. (ffmpeg's demux_mf equivalent, "image2", probes by file extensions too, and there doesn't seem to be anything that can probe typical image file formats from binary data.) Remove the --mf "w" and "h" suboptions. Don't pass the width/height to the video stream header. Both of these are useless, because the decoder reads the real image size at a later point from the file headers. Remove setting the BITMAPINFOHEADER as well, as vd_lavc doesn't need this. Enable --correct-pts by default. This fixes displaying a single image with vo_vdpau (as mentioned by uau). Keep around a pointer to the sh_video stream header instead of accessing demuxer->video->sh_video. Fixes a crash when deselecting the video track. Note that the format probing is incorrect when opening images from HTTP locations. File extensions don't have to match the actual file format. A correct implementation would require to check the MIME type, or to probe the binary data correctly.
* subtitles: improve support for libavformat demuxed subtitleswm42012-11-161-1/+18
| | | | | | | | | | Make demux_lavf not error out if no video or audio track is present. This allows opening subtitle files with the demuxer. Improve the test whether subtitles read from demuxers must do explicit packet reads. (I'm not sure whether always doing these reads could have bad effects, such as reading too many audio and video packets at once, so be conservative.)
* mplayer: refactor: move computation of a/v syncwm42012-11-161-21/+26
| | | | | | The computation for the A/V sync value was inside print_status(). Move it into its own function; this makes things simpler and gets rid of some minor dead code.
* core: add --keep-open, which doesn't close the file on EOFwm42012-11-165-1/+20
| | | | | | | | | | | | | | | | | The --keep-open option causes mpv not to close the current file. Instead, it will pause, and allow the user to seek around. When seeking beyond the end of the file, mpv does a precise seek back to the previous last known position that produced video output. In some corner cases, mpv might not be able to produce video output at all, despite having created a VO. (Possibly when only 1 frame could be decoded, but the video filter chain queues frames. Then a VO would be created, without sending an actual video frame to the VO.) In these cases, the VO window will not redraw, not even OSD. Based on a patch by coax [1]. [1] http://devel.mplayer2.org/ticket/210#comment:4
* command: add sub_reload and sub_remove commandswm42012-11-165-11/+71
| | | | | | | | | | sub_remove remove an external subtitle track, for whatever this may be needed. sub_reload removes and re-adds an external subtitle track. Also rename sub_load to sub_add, because that seems to be more in line with sub_remove.
* subreader: replace sub_free() by talloc destructorwm42012-11-161-7/+4
| | | | Makes it less annoying to free the sub_data.
* options: add --mute for setting initial audio mute statuswm42012-11-164-4/+14
| | | | | Similar to --volume. Takes this as opportunity to move the variable corresponding to --volume into MPOpts.
* options: rename -sub-fuzziness to -autosub-match, change option valueswm42012-11-161-1/+2
| | | | | | | | | | "--autosub-match" is close to "--autosub", and reflects what this option does slightly better. Replace the magic number option values with choices: --sub-fuzziness=0 becomes --autosub-match=exact --sub-fuzziness=1 becomes --autosub-match=fuzzy --sub-fuzziness=2 becomes --autosub-match=all
* options: rename --cursor-autohide, replace magic number valueswm42012-11-161-1/+2
| | | | | | --cursor-autohide-delay=-2 becomes --cursor-autohide=always --cursor-autohide-delay=-1 becomes --cursor-autohide=no --cursor-autohide-delay=123 becomes --cursor-autohide=123
* options: --field-dominance: replace magic number values with choiceswm42012-11-161-1/+2
| | | | | | --field-dominance=-1 becomes --field-dominance=auto --field-dominance=0 becomes --field-dominance=top --field-dominance=1 becomes --field-dominance=bottom
* options: rename -ss and -endpos, allow relative timeswm42012-11-166-72/+96
| | | | | | | | | | | | | | | | Rename the -ss option to -start, and -endpos to -length. Add a -end option. The -end option always specifies an absolute end time, as opposed to -endpos/-length. All these options (--start, --end, --length) now accept relative times. Percent positions (e.g. "--start=30%") are interpreted as fractions of the file duration. Negative times (e.g. "--start=-1:00) are interpreted relative to the end of the file. Chapters (e.g. "--start=#3") yield the chapter's time position. The chapter support might be able to replace --chapter completely, but for now I am not sure how well this works out with e.g. DVDs and BDs, and a separate --chapter option is useful interface-wise.
* options: respect --no-msgcolor during early program startwm42012-11-161-1/+1
| | | | | | | Using --no-msgcolor, error messages that happened before "really" parsing the command line were still printed in color. Add the CONF_PRE_PARSE flag to make this option take effect as early as possible.
* options: remove --displaywm42012-11-161-4/+0
| | | | | Was used to set the X11 display. XDisplayName(NULL) does the same, using the DISPLAY environment variable instead.
* options: rename --xineramascreen to --screen, remove magic valueswm42012-11-162-1/+3
| | | | | --xineramascreen=-2 becomes --screen=all --xineramascreen=-1 becomes --screen=current
* options: remove --osdlevel in favor of --osd-levelwm42012-11-161-1/+0
| | | | | --osdlevel has been documented as renamed/removed. Not actually removing it was probably an oversight.
* options, vo_x11: remove -zoom option, make it defaultwm42012-11-162-2/+0
| | | | | | | | | | | | | | The -zoom option enabled scaling with vo_x11. Remove the -zoom option, and make its behavior default. Since vo_x11 has to use libswscale for colorspace conversion anyway, which doesn't do actual extra scaling when vo_x11 is run in windowed mode, there should be no speed difference with this change. The code removed from vf_scale attempted to scale the video to d_width/ d_height, which matters for anamorphic video and the --xy option only. vo_x11 can handle these natively. The only case for which the removed vf_scale code could matter is encoding with vo_lavc, but since that didn't set VOFLAG_SWSCALE, nothing actually changes.
* input: silence warning if input.conf is missingwm42012-11-161-0/+4
| | | | | | | | | It's silly to print a warning if an optional config file is missing. Don't print anything at the default message level if an input config is not found. Unfortunately, the behavior is the same for explicitly passed input config files (with --input=conf=file.conf).
* mplayer: do not freeze when trying to loop an unseekable filewm42012-11-141-1/+13
| | | | | | | | | | | | | | Using --loop=inf on an unseekable file would put mpv (and all other mplayers as well) into an endless loop, trying to seek to the start of the file on each playback loop iteration. When the seek fails, playback simply remains in the at-end-of-file state, and tries to issue a new seek command for looping. Fix by checking if the seek command fails, and abort looping in this case. For that, queue_seek() is replaced with seek(). Due to the circumstances, these two calls happen to be equal in this case: the seek is absolute (i.e. no seek coalescing done), and the execution of queued seeks is right after the loop code anyway.
* options: make --loop always per-filewm42012-11-141-1/+1
| | | | | | | In this example, only f1.mkv was looped: mpv f1.mkv f2.mkv --loop=2 This is because the playloop actually changes the global option value, assuming it would be reset when going to the next file. When mpv was changed to not reset options between files, this assumption was broken.
* cfg-mplayer: do not include encode options when encoding disabledwm42012-11-141-0/+2
| | | | | | | | | Normally, we always want to enable encoding, as it uses stock ffmpeg APIs and has no other dependencies or disadvantages. However, supporting older releases of ffmpeg and Libav (which equal to outdated git snapshots fix security and crash fi