summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* video: reset filters on seekwm42013-01-201-0/+2
| | | | | | | | | | | | | | | | Drop queued frames on seek. Reset the internal state of some filters that seem to need it as well: at least vf_divtc still produced some frames using the previous PTS. This fixes weird behavior with some filters on seeking. In particular, this could lead to A/V desync or apparent lockups due to the PTS of filtered frames being too far away from audio PTS. This commit does only the minimally required work to fix these PTS related issues. Some filters have state dependent on previously filtered frames, and these are not automatically reset with this commit (even vf_divtc and vf_softpulldown reset the PTS info only). Filters that actually require a full reset can implement VFCTRL_SEEK_RESET.
* core: make gapless-audio also apply to format changes within a fileRudolf Polzer2013-01-181-1/+2
| | | | | | Format changes within a file can e.g. happen in MPEG-TS streams. This fix also fixes encoding of such files, because ao_lavc is not capable of reconfiguring the audio stream.
* input: enqueue commands to the end of the queueStefano Pigozzi2013-01-161-1/+1
| | | | | `mp_input_queue_cmd` erroneusly added commands to the head of the queue resulting in LIFO behaviour instead of the intended FIFO.
* vd_lavc: remove -lavdopts vstats suboptionwm42013-01-131-1/+0
| | | | | | This printed per-frame statistics into a file, like bitrate or frame type. Not very useful and accesses obscure AVCodecContext fields (danger of deprecation/breakage), so get rid of it.
* vd_lavc: remove lowres decodingwm42013-01-131-1/+0
| | | | | | | | | | This was a "broken misfeature" according to Libav developers. It wasn't implemented for modern codecs (like h264), and has been removed from Libav a while ago (the AVCodecContext field has been marked as deprecated and its value is ignored). FFmpeg still supports it, but isn't much useful due to aforementioned reasons. Remove the code to enable it.
* sub: add experimental --force-rgba-osd-rendering switchwm42013-01-132-0/+2
|
* mp_common: add some rectangle utility functionswm42013-01-132-0/+26
|
* sub: do not copy the target image if there is no OSD/subswm42013-01-131-2/+0
| | | | | | | | | | | | | | | | | | | | | It's not easy to tell whether the OSD/subs are empty, or if something is drawn. In general you have to use osd_draw() with a custom callback. If nothing is visible, the callback is never invoked. (The actual reason why this is so "hard" is the implementation of osd_libass.c, which doesn't allow separating rendering and drawing of OSD elements, because all OSD elements share the same ASS_Renderer.) To simplify avoiding copies, make osd_draw_on_image() instead of the caller use mp_image_make_writeable(). Introduce osd_draw_on_image_p(), which works like osd_draw_on_image(), but gets the new image allocation from an image pool. This is supposed to be an optimization, because it reduces the frequency of large allocations/deallocations for image data. The result of this is that the frequency of copies needed in conjunction with vf_sub, screenshots, and vo_lavc (encoding) should be reduced. vf_sub now always does true pass-through if no subs are shown. Drop the pts check from vf_sub. This didn't make much sense.
* video: decouple internal pixel formats from FourCCswm42013-01-134-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mplayer's video chain traditionally used FourCCs for pixel formats. For example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the string 'YV12' interpreted as unsigned int. Additionally, it used to encode information into the numeric values of some formats. The RGB formats had their bit depth and endian encoded into the least significant byte. Extended planar formats (420P10 etc.) had chroma shift, endian, and component bit depth encoded. (This has been removed in recent commits.) Replace the FourCC mess with a simple enum. Remove all the redundant formats like YV12/I420/IYUV. Replace some image format names by something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P. Add img_fourcc.h, which contains the old IDs for code that actually uses FourCCs. Change the way demuxers, that output raw video, identify the video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to request the rawvideo decoder, and sh_video->imgfmt specifies the pixel format. Like the previous hack, this is supposed to avoid the need for a complete codecs.cfg entry per format, or other lookup tables. (Note that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT raw video, but this is still considered better than adding a raw video decoder - even if trivial, it would be full of annoying lookup tables.) The TV code has not been tested. Some corrective changes regarding endian and other image format flags creep in.
* vf_screenshot: simplifywm42013-01-131-52/+19
| | | | | | | | | | Instead of using a callback to "capture" the image next time the filter function is called, do it the other way around: on every filter invocation, create a reference to the image, and return it if a screenshot is requested. This also fixes the 1-frame delay when taking screenshots with the filter. This also allows simplifying screenshot.c.
* video/out: replace VFCAP_TIMER with vo->untimed, fix vo_image and vo_lavcwm42013-01-131-4/+2
| | | | | | | | VFCAP_TIMER disables any additional waiting done by mpv in the playloop. Remove VFCAP_TIMER, but re-use the idea for vo_image and vo_lavc. This means --untimed doesn't have to be passed when using --vo=image.
* video/filter: change filter API, use refcounting, remove filter DRwm42013-01-132-14/+44
| | | | | | | | | | | | | | | | | | | | Change the entire filter API to use reference counted images instead of vf_get_image(). Remove filter "direct rendering". This was useful for vf_expand and (in rare cases) vf_sub: DR allowed these filters to pass a cropped image to the filters before them. Then, on filtering, the image was "uncropped", so that black bars could be added around the image without copying. This means that in some cases, vf_expand will be slower (-vf gradfun,expand for example). Note that another form of DR used for in-place filters has been replaced by simpler logic. Instead of trying to do DR, filters can check if the image is writeable (with mp_image_is_writeable()), and do true in-place if that's the case. This affects filters like vf_gradfun and vf_sub. Everything has to support strides now. If something doesn't, making a copy of the image data is required.
* video: different way to enable hardware decoding, add software fallbackwm42013-01-132-0/+9
| | | | | | | | | | | | | | Deprecate the hardware specific video codec entries (like ffh264vdpau). Replace them with the --hwdec switch, which requests that a specific hardware decoding API should be used. The codecs.conf entries will be removed at a later time, but for now they are useful for testing and compatibility. Instead of --vc=ffh264vdpau, --hwdec=vdpau should be used. Add a fallback if hardware decoding fails. Most hardware decoders (including vdpau) support only a subset of h264, and having such a fallback is supposed to enable a better user experience.
* video: simplify decoder pixel format handlingwm42013-01-134-99/+3
| | | | | | | | | | | | | | | | | | | | Simplify the decoder pixel format handling by making it handle only the case vd_lavc needs: a video stream always decodes to a single pixel format. Remove the handling for multiple pixel formats, and remove the codecs.conf pixel format declarations that are left. Remove the handling of "ambiguous" pixel formats like YV12 vs. I420 (via VDCTRL_QUERY_FORMAT etc.). This is only a problem if the video chain supports I420, but not YV12, which doesn't seem to be the case anywhere, and in fact would not have any advantage. Make the "flip" flag a global per-codec flag, rather than a pixel format specific flag. (Some ffmpeg decoders still return a flipped image, so this has to be done manually.) Also fix handling of the flip operation: do not overwrite the global flip option, and make the --flip option invert the codec flip option rather than overriding it.
* video: remove slice based filtering and video outputwm42013-01-132-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Slices allowed filtering or drawing video in horizontal bands or blocks. This allowed working on the video in smaller units. In theory, this could bring a performance win by lowering cache pressure, as you didn't have to keep the whole video frame in cache while filtering, only the slice. In practice, the slice code path was barely used for the following reasons: - Multithreaded decoding with ffmpeg didn't use slices. The ffmpeg slice callback was disabled, because it can be called from another thread, and the mplayer video chain is not thread-safe. - There was nothing that would turn "full" images into appropriate slices, so slices were rarely used. - Most filters didn't actually support slices. On the other hand, supporting slices lead to code duplication and more complex code in general. I made some experiments and didn't find any actual measurable performance improvements when using slices. Even ffmpeg removed slices based filtering from libavfilter in favor of simpler code. The most broken thing about the slices code path is that slices can't be queued, like it is done for images in vo.c.
* Replace strsep() useswm42013-01-133-6/+22
| | | | | | This function sucks and apparently is not very portable (at least on mingw, the configure check fails). Also remove the emulation of that function from osdep/strsep*, and remove the configure check.
* core: timeline: prevent inaccurate seeks outside timelineUoti Urpala2013-01-131-2/+3
| | | | | | | | | Ensure that even if a seek is inaccurate it will not show video from outside the defined timeline. Previously, seeking to the beginning of a segment could show frames from before the start of the segment if the seek was done in inaccurate mode and the demuxer seeked to an earlier position. Now hr-seek machinery is used to skip at least the frames that should not be part of playback timeline at all.
* sub: do not apply timeline offset to external subtitleswm42013-01-121-3/+8
| | | | | | | | | | | | Now external subtitles essentially use the playback time, instead of the segment time. This is more useful when using external subtitles with mkv ordered chapters. The previous behavior is not necessarily incorrect, and e.g. makes it easier to use subtitles directly extracted from ordered chapters segments. But we consider the new behavior more useful. Also see commit 06e3dc8.
* Fix lots of bugs in mp_http URL handlingRudolf Polzer2013-01-101-2/+12
| | | | | Many instances of "http" were not changed to "mp_http", which made many aspects of the mp_http protocol handler broken.
* mplayer: make --loop loop the playlist instead of each playlist entrywm42013-01-092-32/+9
| | | | | | | | | | This is simpler and more useful. We could add a new switch for the old functionality, but that would probably be more confusing than helpful. When passing only a single file to the command line, this commit shouldn't change behavior. (Classic mplayer provided both features by duplicating the loop functionality in the "playtree".)
* mplayer: keep pause state when frame stepping in last framewm42013-01-091-0/+3
| | | | | | | When the last frame is displayed, and a frame step command is issued, playback ands and advances to the next file. But before this commit, the next file was played unpause. Fix this, and make sure pause is kept.
* sub: use correct fallback font for subtitleswm42013-01-061-1/+2
| | | | Accidentally still used the OSD font.
* sub: add --sub-text-* options to unstyled text subtitles fontwm42013-01-052-0/+4
| | | | | | | Before this commit, the --osd-* options (like --osd-font-size etc.) configured both the OSD and subtitle font. Make them separate, and add --sub-text-* options (like --sub-text-size etc.). Now --osd-* affects the OSD font only, and --sub-text-* unstyled text subtitles only.
* Update copyright yearwm42013-01-041-1/+1
|
* core: fix crash if VO init failswm42012-12-281-1/+1
|
* sdl, encode_lavc: fix copyright headersRudolf Polzer2012-12-282-4/+6
| | | | | | Some of them had changes in 2012; extend their header. Fix project name.
* core: make WAKEUP_PERIOD overridable by the voRudolf Polzer2012-12-191-12/+26
| | | | | | | | | | | | This is better than having just the operating system type decide the wakeup period, as e.g. when compiling for Win32/cygwin, a wakeup period of 0.5 would work perfectly fine. Instead, the default wakeup period is now only decided by availability of a working select() system call (which is the case on cygwin but not mingw and MSVC) AND a vo that can provide an event file descriptor or a similar hack (vo_corevideo). vos that cannot do either need polling for event handling and now can set the wakeup period to 0.02 in the vo code.
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-154-87/+77
| | | | | | | | | | | | | | Add `mp_find_config_file` to search different known paths and use that in ass_mp to look for the fontconfig configuration file. Some incidental changes spawned by this feature where: * Buffer allocation for the strings containing the paths is now performed with talloc. All of the allocations are done on a NULL context, but it still improves readability of the code. * Move the OSX function for lookup inside of a bundle: this code path was currently not used by the bundle generated with `make osxbundle`. The plan is to use it again in a future commit to get a fontconfig config file.
* core: path: run uncrustifyStefano Pigozzi2012-12-151-80/+86
| | | | | | | | | | Even if this is not so bad as other files, I need to add some stuff so... why not!? `uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.h` `uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.c` The header was unchanged by the tool.
* options: move -ass-bottom-margin/-ass-top-margin options to vf_subwm42012-12-122-4/+0
| | | | | These options might be useful sometimes, but they are not that important, and work with vf_sub only. Make them vf_sub sub-options.
* cleanup: remove ao.brokenptswm42012-12-121-7/+0
| | | | This field was used by ao_v4l2, and is now unused.
* options: handle -v during pre-parsing command linewm42012-12-121-5/+2
| | | | | Otherwise -v is honored too late, and some output will be missing. In particular, this prevented printing of the libav* library versions.
* sd_lavc: keep subs on subtitle track switchingwm42012-12-121-1/+1
| | | | | | | | | | | | | Keep the currently displayed subtitles even when the user cycles through subtitle tracks, and the subtitle is decoded by libavcodec (such as vobsubs). Do this by not clearing the subtitles on reset(). reset() is also called on seek, so check the start PTS whether the subtitle should really be displayed (there's already an end PTS). Note that sd_ass does essentially something similar. The existing code has checks for whether the PTS reported by the demuxer is invalid (MP_NOPTS_VALUE). I don't know under what circumstances this can happens, so fall back to the old behavior if the PTS is invalid.
* mplayer: prefer audio PTS over video PTS for status linewm42012-12-111-3/+3
| | | | | | | | | | | | This slightly improves display of the current playback time in files with sparse video packets (like video tracks containing a slow MJPG slideshows as in [1]), or audio files with cover art image attachments. While the video PTS is always "stuck" at the last frame displayed or the last seek, audio is usually continuous. Given sane samplerates and working audio drivers (to query how much of the current audio buffer has been played), the audio PTS should always be more reliable. [1] http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/rtpodcast/Rooster_Teeth_Podcast_191.m4a
* core: allow disabling display of "album art" in audio fileswm42012-12-115-5/+18
| | | | | | | | | | | | | | | | | | ffmpeg pretends that image attachments (such as contained in ID3v2 metadata) are video streams. It injects the attached pictures as packets into the packet stream received with av_read_frame(). Add the --audio-display option to allow configuring whether attached pictures should be displayed. The default behavior doesn't change (images are displayed). Identify video streams, that are actually image attachments, with "[P]" in the terminal output. Modify the default stream selection such that real video streams are preferred over attached pictures. (This is just for robustness; I do not know of any samples where images are added before actual video streams and could lead to bad default stream selection with the old code.)
* windows support: fix compilation with pthreadswm42012-12-111-0/+4
| | | | | | | | | | | | | | | This caused errors like: core/mplayer.c:4308:5: error: implicit declaration of function 'pthread_win32_thread_detach_np' [-Werror=implicit-function-declaration] It turns out a pthread.h include was missing. It's not clear why this used to work (or rather, why it happens only sometimes). Possibly some libraries or system headers recursively include pthread.h under certain circumstances or configurations. Fix missing quoting in configure, which led to broken terminal output. Closes #6.
* mplayer: make --length work if --start is missingwm42012-12-111-1/+1
| | | | In this case, --start should default to 0 obviously.
* demux_lavf: make minimum probe score customizable, remove lavf_preferredwm42012-12-111-0/+1
| | | | | | | | | | | | | | | | | | | | | libavformat wants to read a full ~400KB of data to determine whether it's really AAC. This causes slow startup with AAC web radio streams [1] (possible due to a broken initial packet). There are similar issues with other file formats. Make the probe "score" (libavformat's mechanism for testing file formats) configurable with the -lavfdtops:probescore option. This allows lowering the amount of data read on probing. If the probe score is below the probescore option value, demux_lavf will try to get a higher score by feeding more data to libavformat, until the required score or the max. probe size is reached. Remove the lavf_preferred demuxer entry. This had a purpose in mplayer-svn, but now there doesn't seem to be any good reason for it to exist. Make sure that our native "good" demuxers are above demux_lavf in demuxer_list[] instead (so that they are preferred). [1] http://lr2mp0.latvijasradio.lv:8000
* sub: remove vobsub reader in favor of ffmpeg vobsub demuxerwm42012-12-115-115/+28
| | | | | | | | ffmpeg recently added a demuxer that can read vobsubs (pairs of .sub and .idx files). Get rid of the internal vobsub reader, and use the ffmpeg demuxer instead. Sneak in an unrelated manpage change (autosub default).
* core: improve seeking in external fileswm42012-12-111-11/+27
| | | | | | | | | | | | | | | | | | | | | | | | This affects streams loaded with -subfile and -audiofile. They could get out of sync when they were deselected, and the main file was seeked. Add code to seek external files when they are selected (see init_demux_stream()). Use avformat_seek_file() under certain circumstances. Both av_seek_frame() ("old" API) and avformat_seek_file() ("new" API) seem to be broken with some formats. At least the vobsub demuxer doesn't implement the old API (and the old API doesn't fallback to the new API), while the fallback from new API to old API gives bad results. For example, seeking forward with small step sizes seems to fail with the new API (tested with Matroska by trying to seek 1 second forward relative to priv->last_pts). Since only subtitle demuxers implement the new API anyway, checking whether iformat->read_seek2 is set to test whether the old API is not supported gives best results. This is a hack at best, but makes things work. Remove backwards seeking on seek failure. This was annoying, and only was there to compensate for obscure corner cases (see 1ad332). In particular, files with completely broken seeking that used to skip back to the start on every seek request may now terminate playback.
* sub: use ffmpeg decoder for DVD subswm42012-12-101-1/+47
| | | | | | | | | | | | | | | | | Do this only if demux_lavf is used. Using demux_mpg and the ffmpeg DVD subtitle decoder doesn't work. The problem is probably that demux_mpg doesn't join split sub packets, while demux_lavf does. The internal DVD sub decoder (spudec.c) can, while ffmpeg's dvdsub can't. I do not know whether this is the actual problem. If DVD playback is used, create "fake" vobsub-style text extradata (like .idx files) to pass resolution and palette information to the ffmpeg decoder. We could use the "palette" AVOpt and avcodec_set_dimensions() instead, but it's actually simpler this way. Note that the decoder doesn't parse any other fields. Also note that DVD playback still uses demux_mpg by default, so this code is inactive unless -demuxer lavf is specified. This is mainly preparation for the case when we manage to get rid of demux_mpg for DVD playback.
* core/cfg-mplayer: fix segfault when using DVD subsRudolf Polzer2012-12-051-1/+1
| | | | | | The option sub-forced-only was accidentally renamed back to forcedsubsonly in commit 72205635abe7, causing a segfault in mp_property_generic_option due to missing option.
* input: do not generate double clicks for mouse wheelwm42012-12-031-1/+1
| | | | | | | | | Button 3 and 4 are mapped to the mouse wheel. Double click events for them annoying and not useful at all. I don't know about buttons 5-19; for all I know these could be mapped to wheels as well. Even if not, double click events are probably not very important for these. Disable double clicks for these as well.
* subs: remove --utf8, simplify codeUoti Urpala2012-12-031-2/+1
| | | | | | | | | | | | | | | | | | | Remove the options --utf8 and --unicode which had no effect any more (what they once did should be doable with --subcp). The only use of corresponding variables left in code was subreader.c code using sub_utf8 as a flag indicating whether iconv conversion was active. Change the code to test the existence of iconv context instead. Conflicts: DOCS/man/en/options.rst core/cfg-mplayer.h sub/sub.c sub/sub.h sub/subreader.c Merged from mplayer2 commit ea7311. Note: --unicode was already removed
* core: automatically pause on low cachewm42012-12-035-3/+47
| | | | | | | | | | | | | | | When the cache fill status goes below a certain threshold, automatically pause the player. When the cache is filled again, unpause again. This is intended to help with streaming from http. It's better to pause a while, rather than exposing extremely crappy behavior when packet reads during decoding block the entire player. In theory, we should try to increase the cache if underruns happen too often. Unfortunately, changing the cache implementation would be very hard, because it's insane code (forks, uses shared memory and "volatile" etc.). So for now, this just reduces the frequency of the stuttering if the network is absolutely too slow to play the stream in realtime.
* cache: simplify furtherwm42012-12-031-8/+17
| | | | | | | | | | | | This commit is separate from the previous one to separate our own changes from changes merged from mplayer2 (as far as that was possible). Make it easier for stream implementations to request being cached. Set a default cache size in stream.c, and remove them from various stream implementations. Only MS streaming support sets a meaningful cache size. Make querying cache size saner. This reduces the amount of #ifdefs needed.
* cache: refactor how cache enabling is doneUoti Urpala2012-12-033-28/+17
| | | | | | | | | | | | | | | | | | | | | | | | Code enabling the cache by default for network streams did that by modifying the value of the "cache" option. This wasn't sane, as multiple streams may be created and all share the same options. Change the code to not modify options but store data in the stream instance instead. Conflicts: core/mplayer.c demux/demux.c stream/cache2.c stream/network.c stream/network.h stream/pnm.c stream/stream.c stream/stream_rtp.c Merged from mplayer2 commit e26070. Note that this doesn't solve any actual bug, as the playlist crashing bug has been fixed before. Since the global cache size option value is not overwritten anymore, the option doesn't need to be restored on end of playback (M_OPT_LOCAL).
*