summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* core: redo how codecs are mapped, remove codecs.confwm42013-02-1014-866/+395
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use codec names instead of FourCCs to identify codecs. Rewrite how codecs are selected and initialized. Now each decoder exports a list of decoders (and the codec it supports) via add_decoders(). The order matters, and the first decoder for a given decoder is preferred over the other decoders. E.g. all ad_mpg123 decoders are preferred over ad_lavc, because it comes first in the mpcodecs_ad_drivers array. Likewise, decoders within ad_lavc that are enumerated first by libavcodec (using av_codec_next()) are preferred. (This is actually critical to select h264 software decoding by default instead of vdpau. libavcodec and ffmpeg/avconv use the same method to select decoders by default, so we hope this is sane.) The codec names follow libavcodec's codec names as defined by AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders have names different from the canonical codec name. The AVCodecDescriptor API is relatively new, so we need a compatibility layer for older libavcodec versions for codec names that are referenced internally, and which are different from the decoder name. (Add a configure check for that, because checking versions is getting way too messy.) demux/codec_tags.c is generated from the former codecs.conf (minus "special" decoders like vdpau, and excluding the mappings that are the same as the mappings libavformat's exported RIFF tables). It contains all the mappings from FourCCs to codec name. This is needed for demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the codec as determined by libavformat, while the other demuxers have to do this on their own, using the mp_set_audio/video_codec_from_tag() functions. Note that the sh_audio/video->format members don't uniquely identify the codec anymore, and sh->codec takes over this role. Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which provide cover the functionality of the removed switched. Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure container/video combinations (e.g. the sample Film_200_zygo_pro.mov) are played flipped. ffplay/avplay doesn't handle this properly either, so we don't care and blame ffmeg/libav instead.
* options: change --no-config option, make it apply to input.conf as wellwm42013-02-097-35/+29
| | | | | | | | | | | | | Simplify --no-config and make it a normal flag option, and doesn't take an argument anymore. You can get the same behavior by using --no-config and then --include to explicitly load a certain config file. Make --no-config work for input.conf as well. Make it so that --input:conf=file still works in this case. As a technically unrelated change, the file argument now works as one would expect, instead of making it relatively to "~/.mpv/". This makes for simpler code and easier to understand option semantics. We can also print better error messages.
* mplayer: remove seconds/centiseconds display from terminal status linewm42013-02-091-6/+2
| | | | | | | | | Doesn't have much of a purpose for normal playback. You can get milliseconds display with --osd-fractions. It's also possible to build a custom status line with --status-msg. This gives more space on the status line and, in my opinion, is a bit less annoying.
* cleanup: replace OPT_FLAG_ON and OPT_MAKE_FLAGS with OPT_FLAGwm42013-02-093-45/+43
| | | | | | | | | | OPT_MAKE_FLAGS() used to emit two options (one with "no" prefixed), but that has been long removed by special casing flag options in the option parser. OPT_FLAG_ON() used to imply that there's no "no-" prefixed option, but this hasn't been the case for a while either. (Conceptually, it has been replaced by OPT_FLAG_STORE().) Remove OPT_FLAG_OFF, which was unused.
* options: unify single dash and double dash optionswm42013-02-097-184/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two option syntax variations: "old": -opt value "new": --opt=value "-opt=value" was invalid, and "--opt value" meant "--opt=" followed by a separate option "value" (i.e. interpreted as filename). There isn't really any reason to do this. The "old" syntax used to be ambiguous (you had to call the option parser to know whether the following argument is an option value or a new option), but that has been removed. Further, using "=" in the option string is always unambiguous. Since the distinction between the two option variants is confusing, just remove the difference and allow "--opt value" and "-opt=value". To make this easier, do some other cleanups as well (e.g. avoid having to do a manual lookup of the option just to check for M_OPT_PRE_PARSE, which somehow ended up with finally getting rid of the m_config.mode member). Error reporting is still a mess, and we opt for reporting too many rather than too few errors to the user. There shouldn't be many user-visible changes. The --framedrop and --term-osd options now always require parameters. The --mute option is intentionally made ambiguous: it works like a flag option, but a value can be passed to it explicitly ("--mute=auto"). If the interpretation of the option is ambiguous (like "--mute auto"), the second string is interpreted as separate option or filename. (Normal flag options are actually ambiguous in this way too.)
* config: do not require option valuewm42013-02-091-54/+38
| | | | | | | Now setting a value with "=" is not required anymore in config files. This should work analogous to command line arguments. Putting an entry "opt=value" into the config file is like "--opt=value" on the command line, and "opt" is like "--opt=" and "--opt".
* options: change handling of "no-" optionswm42013-02-096-59/+101
| | | | | | | | | | | | | | | | Normally, all flag options can be negated by prepending a "no-", for example "--no-opt" becomes "--opt=no". Some flag options can't actually be negated, so add a CONF_TYPE_STORE option type to disallow the "no-" fallback. Do the same for choice options. Remove the explicit "no-" prefixed options, add "no" as choice. Move the handling of automatic "no-" options from parser-mpcmd.c to m_config.c, and use it in m_config_set_option/m_config_parse_option. This makes these options available in the config file. It also simplifies sub-option parsing, because it doesn't need to handle "no-" anymore.
* Remove BSD legacy TV/radio support (BT848 stuff)wm42013-02-061-4/+0
| | | | | FreeBSD actually supports V4L2, and V4L2 supports this chip. Also, this chip is from 1997. Farewell.
* core: remove --edlout functionalitywm42013-02-066-41/+0
| | | | | | | | | | | | | | | | This could write .edl files in MPlayer's format. Support for playing these files has been removed from mplayer2 quite a while ago. (mplayer2 can play its own, "new" .edl format, but does not support writing it.) Since this is a rather obscure functionality, and it's not really clear how it should behave (e.g. what should it do if a new file is played), and wasn't all that great to begin with (what if you made a mistake? the "edl_mark" command sucks for editing), get rid of it. Suggestions how to reimplement this in a nicer way are welcome. If it's just about retrieving timecodes, this in input.conf will do: KEY print_text "position: ${=time-pos}"
* command: add command to show playlist on OSDwm42013-02-063-0/+22
|
* mplayer: don't show bogus audio PTS during hr-seekwm42013-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem that happened with syncplay.pl [1] when ad_mpg123 was in use, and get_current_time() returning a bogus time position. This only happens during seeking; the reported time is correct after the seek is done. The audio PTS as returned by playing_audio_pts() is simply bogus during hr-seek. With ad_ffmpeg, it was actually set to MP_NOPTS_VALUE during seeking, so get_current_time() did a fallback to the video PTS. However, ad_mpg123 is different and explicitly decodes some audio when resetting on seek (reasons why it does this unknown and uninvestigated; apparently it's to reinit libmpg123). As a result, the audio PTS was set to the start position of the seek (or something similar), which could be very different from the seek target time. This confused syncplay. It got the bogus time because it spams the player with read commands to the "time-pos" property, so this corner case was hit. Fix this by making get_current_time() return the seek target time if hr-seek is active. This should make behavior the same as before commit 3f949cf "mplayer: prefer audio PTS over video PTS for status line". [1] http://syncplay.pl
* mplayer: properly handle framestep when showing last video framewm42013-02-031-10/+12
| | | | | | | | | | | | | | When doing a framestep while there is no more video, nothing happened, and audio continued to play. When advancing to the next file, the player was paused. Fix it so that it always pauses (except on very low frame rate video, which is yet another corner case). We also change the meaning of framestepping a bit: in audio only mode, framstepping unpauses for a single playloop iteration. This is probably not useful at all, but makes the code a bit more simpler/uniform. Just like the previous commit, this matters most for audio files with cover art, for which this special case is the normal case.
* mplayer: reset audio/video delay if there's no next video framewm42013-02-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | mpctx->delay is used to control audio/video sync. If more audio than video has been played, it grows larger, meaning A/V desync is happening. This logic is a bit broken when video has ended, and audio is still playing. In that case, it tries to read additional video frames from the video decoder (because even if you don't feed new packets to the decoder, it could still return delayed frames). For that, the code to determine whether frames should be dropped is invoked (check_framedrop()). This function detects that video is behind audio (mpctx- >delay growing big), and attempts to issue a framedrop. Reset mpctx->delay if there's no more video. This fixes the the frame drop display "counting up" on each playloop iteration when playing audio files with cover art. These files are basically audio+video files with a single video frame. When playing these files the the corner case of having run out of video while audio is still playing is the normal case. Also reset mpctx->last_av_difference. This is not updated anymore if video ends (since update_avsync() sets it, but it's not called if video_left is false). This removes the "stuck" A/V sync value when video ends. With audio files containing cover art we would display a meaningless value over the duration of the whole file otherwise.
* input: free all queued/allocated commands on exitwm42013-02-031-4/+21
| | | | | | | | | These were memory leaks in theory, though not in practice (all memory is free'd on exit anyway). However, it was still annoying when leak reporting is enabled. I'm not sure if there was an actual leak in check_autorepeat(), maybe not.
* mplayer: make advancing the playlist respect loopingwm42013-02-033-10/+23
| | | | | | | | | | | | | | | Explicitly advancing the playlist with input commands ("playlist_next") didn't jump back to the first file, if the current file was the last on the playlist and looping was enabled. Fix this and make the behavior with explicit input and playback EOF the same. Also add a minor feature: if looping is enabled, and the current file is the first on the playlist, going back one entry jumps to the last playlist entry (without changing loop count). Fixes #22.
* demux_lavf: remove weird stream auto-selectionwm42013-02-031-11/+0
| | | | | | | Should be dead code. Stream selection is handled either during demuxer initialization, or via DEMUXER_CTRL_SWITCH_*. (If there were actually situations where this code did something, it was probably broken anyway.)
* mp_common: improve OSD/status time formattingwm42013-02-031-4/+11
| | | | | | | | | Allow negative times. Timestamps can be negative, and we actually display negative time for other reasons too, such as when waiting for the old audio to drain with gapless audio.) Avoid overflows with relatively large time values. (We still don't handle values too large for int64_t.)
* cocoa_events: remove this functionalityStefano Pigozzi2013-02-021-16/+0
| | | | | | | | | | | | | This functionality looked smart but created problems with some kinds of multi touch events. Moreover some events coming from the windows server – like hovering a corner for window resize – didn't cause the player to wake up immediately. The "correct" non hacky way to implement async event polling with cocoa would be having the vanilla cocoa event loop driving the player and setting up mpv's terminal FDs as event sources for the cocoa event loop. Fixes #20
* screenshot: minor simplification, prefer VF over VOwm42013-01-301-22/+5
| | | | | | | | | | | | | Remove screenshot_force and associated logic. Always try to use the screenshot video filter before trying taking screenshots with the VO, which means that --vf=screenshot now takes the role of --vf=screenshot_force. (To make this clear, not adding a video filter is still the recommended way to take screenshots; we just change how VF screenshots are forced.) Preferring VO over VF and having --vf=screenshot_force used to make sense when not all VOs supported screenshots, and some VOs had somewhat broken screenshots (like vo_xv taking screenshots with OSD in it). But all these issues are fixed now, so just get rid of the cruft.
* mplayer: add newline for --print-msgwm42013-01-301-1/+1
|
* x11: cleanup, refactorwm42013-01-274-7/+7
| | | | | | | | | | | | | | | | Move things that are used by vo_xv only into vo_xv, same for vo_x11. Rename some functions exported by x11_common, like vo_init to vo_x11_common. Make functions not used outsode of x11_common.c private to that file. Eliminate all global variables defined by x11_common (except error handler and colormap stuff). There shouldn't be any functional changes, and only code is moved around. There are some minor simplifications in the X11 init code, as we completely remove the ability to initialize X11 and X11+VO separately (see commit b4d9647 "mplayer: do not create X11 state in player frontend"), and the respective functions are conflated into vo_x11_init() and vo_x11_uninit().
* stream: implement some HTTP specific options for stream_lavfwm42013-01-241-13/+0
| | | | | | | | | | | | | | | | | | The "http:" protocol has been switched to use ffmpeg's HTTP implementation some time ago. One problem with this was that many HTTP specific options stopped working, because they were obviously implemented for the internal HTTP implementation only. Add the missing things. Note that many options will work for ffmpeg only, as Libav's HTTP implementation is missing these. They will silently be ignored on Libav. Some options we can't fix: --ipv4-only-proxy, --prefer-ipv4, --prefer-ipv6 As far as I can see, not even libavformat internals distinguish between ipv4 and ipv6. --user, --passwd ffmpeg probably supports specifying these in the URL directly.
* sub: add stupid hack for vobsub decoding with Libavwm42013-01-241-1/+10
| | | | | | | If we detect Libav, always use the old builtin vobsub decoder (in spudec.c). Note that we do not want to use it for newer ffmpeg, as spudec.c can't handle the vobsub packets as generated by the .idx demuxer, and we want to get rid of spudec.c in general anyway.
* mp_msg, getch2: unix tty background supportRudolf Polzer2013-01-232-0/+20
| | | | | | | | Now, when backgrounded, mpv plays and outputs messages to stdout, but statusline is not output. Background<->foreground transitions are detected by signals and polling the process groups.
* options: make --fullscreen not a global optionwm42013-01-231-2/+2
| | | | | | | This was disabled in 4ea60a3 and 70c455a, when all options were still forced file local, and resetting fullscreen was annoyingly reset when switching to the next file. mpv keeps all options by default, so this isn't needed anymore.
* video: remove -x/-y/-xy optionswm42013-01-232-7/+0
| | | | | | | | | | | | | | | -x/-y were rather useless and obscure. The only use I can see is forcing a specific aspect ratio without having to calculate the aspect ratio float value (although --aspect takes values of the form w:h). This can be also done with --geometry and --no-keepaspect. There was also a comment that -x/-y is useful for -vm, although I don't see how this is useful as it still messes up aspect ratio. -xy is mostly obsolete. It does two things: a) set the window width to a pixel value, b) scale the window size by a factor. a) is already done by --autofit (--autofit=num does exactly the same thing as --xy=num, if num >= 8). b) is not all that useful, so we just drop that functionality.
* video: add --autofit and --autofit-larger optionswm42013-01-234-0/+34
| | | | | | | | | --autofit=WxH sets the window size to a maximum width and/or height, without changing the window's aspect ratio. --autofit-larger=WxH does the same, but only if the video size is actually larger than the window size that would result when using the --autofit=WxH option with the same arguments.
* options: allow using % for width and height in --geometrywm42013-01-232-63/+83
| | | | | | | | | | | | | | | | | | | | Now all numbers in the --geometry specification can take percentages. Rewrite the parsing of --geometry, because adjusting the sscanf() mess would require adding all the combinations of using and not using %. As a side effect, using % and pixel values can be freely mixed. Keep the aspect if only one of width or height is set. This is more useful in general. Note: there is one semantic change: --geometry=num used to mean setting the window X position, but now it means setting the window width. Apparently this was a mplayer-specific feature (not part of standard X geometry specifications), and it doesn't look like an overly useful feature, so we are fine with breaking it. In general, the new parsing should still adhere to standard X geometry specification (as used by XParseGeometry()).
* options: move -geometry parsing to m_option.cwm42013-01-234-3/+142
| | | | | | | | | This also means the option is verified on program start, not when the VO is created. The actual code becomes a bit more complex, because the screen width/height is not available at program start. The actual parsing code is still the same, with its unusual sscanf() usage.
* 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