summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* Add a --dtshd optionWessel Dankers2013-03-042-0/+2
| | | | | | | | | | The spdif decoder was hardcoded to assume that the spdif output is capable of accepting high (>1.5Mbps) bitrates. While this is true for modern HDMI spdif interfaces, the original coax/toslink system cannot deal with this and will fail to work. This patch adds an option --dtshd which can be enabled if you use a DTS-capable receiver behind a HDMI link.
* vo: remove and cleanup globalsAlexander Preisinger2013-03-046-93/+131
| | | | | | | | Removes almost every global variabel in vo.h and puts them in a special struct in MPOpts for video output related options. Also we completly remove the options/globals pts and refresh rate because they were unused.
* x11_common: fix --cursor-autohide when pausedwm42013-03-031-2/+8
| | | | | | | | When paused, --cursor-autohide worked with a precision of 500ms, which is the main loop's default sleep time when paused. Cursor hiding is polled in x11_common, and the main loop never called the X11 code at the right time. Fix this by allowing the VO to set a time when it should be called next.
* core: fix SEEK_FACTORwm42013-03-012-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Emulate percentage-seeks (SEEK_FACTOR) as normal time-seeks if possible. This fixes some issues with (let's call it) low quality implementations of SEEK_FACTOR (e.g. demux_mkv basically interprets this as byte-seek, and also seeking to 99.9% makes it seek back to the start). For weird MPEG formats the demuxer level SEEK_FACTOR is still used. These formats, which can have timestamp resets, are identified by setting demuxer->ts_resets_possible to true. Also, have get_current_pos_ratio() follow the same rules, and calculate the percentage position with the file position if timestamp resets are possible. This actually fixes percentage-seeks in .ts files with demux_lavf.c. This kind of seek is not really used now, but it will be more important when we add a progress bar. Note: seeking in chained ogg files is still completely broken. The main issue is that ffmpeg doesn't provide a sane API for dealing with timestamp resets, and trying to do byte seeks with ogg confuses demuxer and decoder (or something like this) and just does random things. (Tested with two concatenated flac-in-ogg files).
* m_option: don't define OPT_BASE_STRUCT by defaultwm42013-03-013-2/+4
| | | | | | | | | | | OPT_BASE_STRUCT defines which struct the OPT_ macros (like OPT_INT etc.) reference implicitly, since these macros take struct member names but no struct type. Normally, only cfg-mplayer.h should need this, and other places shouldn't be bothered with having to #undef it. (Some files, like demux_lavf.c, still store their options in MPOpts. In the long term, this should be removed, and handled like e.g. with VO suboptions instead.)
* m_option: reformat option macro definitionswm42013-03-011-31/+102
| | | | Slightly more bearable, but it's still incredibly ugly.
* m_options: more typesafetywm42013-03-014-30/+73
| | | | | | | | | | | | | Change the option definition macros so that they cause compiler warnings if the type of the referenced option struct member doesn't match the type implied by the macro. The compiler warning printed isn't very telling, but it's better than silently invoking undefined behavior by violating the C strict aliasing rules. Also fix some minor cases that violate the type rules. For the option "no-aspect" we have to add a new option type to handle it properly. Some option types are hard to check, so we don't in these cases.
* core: move X11 specific code to x11_common.cwm42013-03-011-5/+0
| | | | | Nothing changes, because vo_check_events() is called at the same place anyway.
* core: simplify OSD capability handling, remove VFCAP_OSDwm42013-03-011-3/+2
| | | | | | | | | | | | | | | | | | | VFCAP_OSD was used to determine at runtime whether the VO supports OSD rendering. This was mostly unused. vo_direct3d had an option to disable OSD (was supposed to allow to force auto-insertion of vf_ass, but we removed that anyway). vo_opengl_old could disable OSD rendering when a very old OpenGL version was detected, and had an option to explicitly disable it as well. Remove VFCAP_OSD from everything (and some associated logic). Now the vo_driver.draw_osd callback can be set to NULL to indicate missing OSD support (important so that vo_null etc. don't single-step on OSD redraw), and if OSD support depends on runtime support, the VO's draw_osd should just do nothing if OSD is not available. Also, do not access vo->want_redraw directly. Change the want_redraw reset logic for this purpose, too. (Probably unneeded, vo_flip_page resets it already.)
* core: use floats for OSD bar percentage displaywm42013-02-262-15/+17
| | | | | | | Use floats instead of integers in the range 0-100. Currently, the OSD is currently made up of 46 elements so no change should be visible, but rendering of the bar will be changed later to use vector drawings (using pixel coordinates) instead of glyphs. This commit is for preparation.
* core: use playback time to determine playback percent positionwm42013-02-261-6/+16
| | | | | | | | | | | | | The percent position is used for the OSD, the status line, and for the OSD bar (shown on seeks). By default, the PTS of the last demuxed packet was used to calculate it. This led to a "jumpy" display when the percentage value (casted to int) was changing. The reasons for this were the presence of video frame reordering (packet PTS is not monotonic), or getting PTS values from different streams (like audio/subs). Since these rely on PTS values and correct file durations anyway, simplify it by calculating it with the current playback position in mplayer.c instead.
* video/out: remove video mode switching (--vm)wm42013-02-262-7/+0
| | | | | | | | | | | | | | | | | | | | This allowed making the player switch the monitor video mode when creating the video window. This was a questionable feature, and with today's LCD screens certainly not useful anymore. Switching to a random video mode (going by video width/height) doesn't sound too useful either. I'm not sure about the win32 implementation, but the X part had several bugs. Even in mplayer-svn (where x11_common.c hasn't been receiving any larger changes for a long time), this code is buggy and doesn't do the right thing anyway. (And what the hell _did_ it do when using multiple physical monitors?) If you really want this, write a shell script that calls xrandr before and after calling mpv. vo_sdl still can do mode switching, because SDL has native support for it, and using it is trivial. Add a new sub-option for this.
* screenshot: make showing OSD message when taking a screenshot defaultwm42013-02-261-2/+1
| | | | | | | This can be disabled by prefixing the "screenshot" command with "no-osd" in input.conf: s no-osd screenshot
* screenshot: show a message on each screenshot takenwm42013-02-263-15/+45
| | | | | | The message reads: "Screenshot: filename", where the filename is what mpv passes to fopen(). It will also show error messages when saving the screenshot fails.
* commands: parse seek time arguments like time optionswm42013-02-263-2/+4
| | | | | | | | | | This means a commands like "seek 13:00 absolute" actually behaves like "--start=13:00", instead of interpreting the argument as fraction as with normal float options. This is probably slightly closer to what you'd expect. As a consequence, the seek argument's type changes from float to double internally.
* options: reject nan, inf, 0:0, etc. for float optionswm42013-02-261-0/+13
| | | | Same for time values.
* options: remove parsing of "," as decimal pointwm42013-02-261-17/+2
| | | | | | Apparently the intention was parsing numbers reliably in presence of non-C locales. mpv is always in C locale, and not being in C locale would probably break even more things, so remove this code.
* Remove --rootwin option and rootwin propertywm42013-02-243-12/+0
| | | | | | | | You can just use --wid=0 if you really want this. This only worked/works for X11, and even then it might interact badly with most desktop environments. All the option did was setting --wid to 0, and the property did nothing.
* core: print correct quit message when quitting, simplify codewm42013-02-242-27/+14
| | | | | | | | | "End of file" was printed to the terminal instead of "Quit" when exiting with the "quit" slave command (closing the window and such). Note that it will still print EOF when it exists because the end of the playlist is reached. Do some other (not strictly related) simplifications.
* m_option: remove preset mechanismwm42013-02-232-98/+0
| | | | | | | | | | Was very complicated to use, and its uses have been removed in the previous commits. (While this feature sounded kind of useful, it could be rewritten in a much simpler way, like storing presets as strings, and then using the option parser to apply a preset. The removed code did some major pointer juggling to handle raw values, which made it hard to use.)
* options: fix --no-shuffle and --no-{wm42013-02-232-2/+6
| | | | | --no-shuffle accidentally did nothing after commit 57879a2. The options --no-{ and --no-} make no sense and shouldn't exist (wrong option type).
* options: drop --opt:subopt option nameswm42013-02-234-40/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For all suboptions, "flat" options were available by separating the parent option and the sub option with ":", e.g. "--rawvideo:w=123". Drop this syntax and use "-" as separator. This means even suboptions are available as normal options now, e.g. "--rawvideo-w=123". The old syntax doesn't work anymore. Note that this is completely separate from actual suboptions. For example, "-rawvideo w=123:h=123" still works. (Not that this syntax is worth supporting, but it's needed anyway, for for other things like vf and vo suboptions.) As a consequence of this change, we also have to add new "no-" prefixed options for flag suboptions, so that "--no-input-default-bindings" works. ("--input-no-default-bindings" also works as a consequence of allowing "-input no-default-bindings" - they are handled by the same underlying option.) For --input, always use the full syntax in the manpage. There exist suboptions other than --input (like --tv, --rawvideo, etc.), but since they might be handled differently in the future, don't touch these yet. M_OPT_PREFIXED becomes the default, so remove it. As a minor unrelated cleanup, get rid of M_OPT_MERGE too and use the OPT_SUBSTRUCT() macro in some places. Unrelated: remove the duplicated --tv:buffersize option, fix a typo in changes.rst.
* core: add fs-screen option for fullscreen display selectionStefano Pigozzi2013-02-213-0/+5
| | | | | | | | | | | | `--fs-screen` allows to decide what display to go fullscreen into. The semantics of `--screen` changed and now it is only used to select the windowed display when starting the application. This is useful for people using mpv with an external TV. They will start windowed on their laptop's screen and switch to fullscreen on the TV. @wm4 worked on the x11 and w32 parts of the code. All is squashed in one commit for history clarity.
* core: move `xineramascreen` to `MPOpts` as `vo_screen_id`Stefano Pigozzi2013-02-213-2/+4
| | | | This is a small cleanup in preparation for the next commit.
* options: parse C-style escapes for some optionswm42013-02-203-11/+70
| | | | | | | | | | Being able to insert newline characters ("\n") is useful for --osd-status-msg, and possibly also for anything that prints to the terminal. Espcially --term-osd-esc looks relatively useless without being able to specify escapes. Maybe parsing escapes should happen during command line / config parsing instead (for all options).
* osd: prevent osd bar from sticking around on seekswm42013-02-202-7/+14
| | | | | | | | | | | | | This was supposed to be fixed in f897138, but there's another corner case. Basically, set_osd_function() reset the OSD time, which is not nice at all and breaks the logic of letting OSD elements disappear when they're not wanted anymore. Fix this by adding a separate timer for this. Additionally, make sure the OSD bar is _really_ always updated when visible. Also, redraw the OSD only if the OSD bar actually changes to prevent redrawing too often (every vo_osd_changed() will flag that the OSD should be redrawn, even if nothing changes).
* mplayer: don't display "-1" as chapter when chapter seek failswm42013-02-201-1/+6
| | | | | | | | | Increase robustness against out of bound chapter numbers. Normally these functions expect that the callers sanitize the chapter number. This went wrong at least in add_seek_osd_messages() (which displayed a chapter "-1" when chapters were not available). Make these functions a bit friendler and add some reasonable checks and fallbacks, which fixes the mentioned chapter seeking case as well.
* parser-cfg: fix profile-descwm42013-02-181-5/+6
| | | | | | | Printed "error parsing option profile-desc=..." when using that inside of profile sections. This happened because we now check the presence of an option before setting it, and profile-desc is not an option, but special cased in the config parser.
* osd: use --osd-duration for OSD barwm42013-02-171-2/+4
| | | | | It was hardcoded to 1 second (which is also the default for --osd-duration, so this was probably never noticed).
* mplayer: print "Cache:" instead of "C:" on the status linewm42013-02-171-1/+1
| | | | | Hasn't been done before because there wasn't enough space, but this changed recently.
* osd: show cache state on the playback progression display by defaultwm42013-02-171-0/+3
| | | | | | | This affects the "show_progress" command, by defualt on the 'P' key. If there are complaints, I'll probably remove it again. (It looks relatively annoying, but it also valueable information... sort of.)
* command: add "cache" read-only propertywm42013-02-173-6/+17
|
* cleanup: remove duplicated function, move escape parsing functionwm42013-02-163-57/+71
|
* osd: add --osd-status-msg option for custom OSD statuswm42013-02-163-5/+14
|
* mplayer: use talloc instead of malloc for status linewm42013-02-161-59/+35
|
* command: give feedback on the OSD if a property is unavailablewm42013-02-162-26/+24
| | | | | | | Until now, setting a property that is not available (e.g. deinterlacing if not using vdpau and no deinterlacing filter is inserted) silently failed (except for a messager on the terminal). Instead show on the OSD that the property is unavailable.
* osd: add --no-osd-bar option to disable the OSD barwm42013-02-165-3/+6
| | | | | In addition to disabling the OSD bar physically, also add some fallbacks to OSD text in places the OSD bar would have been used.
* osd: always update already visible OSD bar on seekswm42013-02-162-9/+22
| | | | | | | | | Seeks can be performed with OSD bar invisible (e.g. "osd-msg seek ..." command), and then an already visible bar won't be updated. But the bar will stick around until the OSD text is hidden. This is confusing, so change it that the bar is updated. (Making the bar disappear on such seeks would require much more changes, so we're lazy and go with this commit.)
* options: change handling of "no-" options yet againwm42013-02-164-45/+55
| | | | | | | | | | | | | | | | | | Commit 4a40eed "options: change handling of "no-" options" generally improved the handling of automatically added negation options (recognizing "--no-opt", even though only "--opt" is declared in the option list). Unfortunately, one corner case was missed, which broke the option "--input=no-default-bindings" (other suboptions, e.g. VO suboptions, were not affected, and this is the only option where this mattered). Instead of increasing the complexity further, use a completely different approach: add the "--no-" options at runtime, and make them behave like real options. This approach could be considered slightly less elegant, because the code now has to worry about some option implementation details rather than leaving it to the parser, but all in all the new code is simpler and there are less weird corner cases to worry about.
* osd: add --osd-bar-align-x/y options to control OSD bar positionwm42013-02-142-0/+4
|
* Fix compilation with Libavwm42013-02-141-0/+2
|
* mplayer: fix seek display during seeking when playing ordered chapterswm42013-02-131-9/+15
| | | | | | | | | | | | | | | | | The seek bar appeared to be "stuck" to the start of the current chapter. This is a regression from 630a2b1. This commit assumed that hrseek_pts would always contain the hrseek target time (when hrseek_active==true). But this is not always the case: when playing timeline stuff (e.g. ordered chapters), hrseek framedropping is abused to handle an obscure corner case, and then hrseek_pts contains something completely unrelated to the current playback time. See the added comment in mplayer.c and commit c1232c9. Fix this by trying something else to get a correct time "during" hr-seeks. mpctx->restart_playback looks ideal, because it's set while audio is being synced / audio buffers being filled, so we know that the audio time is probably bogus while it is set. Let's hope this is correct.
* Prefix keycode defines with MP_wm42013-02-126-378/+366
| | | | | | | | | | Do this to reduce conflicts with <linux/input.h>, which contains some conflicting defines. This changes the meaning of MP_KEY_DOWN: KEY_DOWN is renamed to MP_KEY_DOWN (cursor down key) MP_KEY_DOWN is renamed to MP_KEY_STATE_DOWN (modifier for key down state)
* mp_common: silence warningwm42013-02-121-1/+1
| | | | | | int64_t was accidentally used with "%lld" format specifiers, which is incorrect (even though long long int is always 64 bits, the type behind int64_t can be different, e.g. it can be long int on 64 bit platforms).
* demux_lavf, ad_lavc, vd_lavc: pass codec header data directlywm42013-02-102-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of putting codec header data into WAVEFORMATEX and BITMAPINFOHEADER, pass it directly via AVCodecContext. To do this, we add mp_copy_lav_codec_headers(), which copies the codec header data from one AVCodecContext to another (originally, the plan was to use avcodec_copy_context() for this, but it looks like this would turn decoder initialization into an even worse mess). Get rid of the silly CodecID <-> codec_tag mapping. This was originally needed for codecs.conf: codec tags were used to identify codecs, but libavformat didn't always return useful codec tags (different file formats can have different, overlapping tag numbers). Since we don't go through WAVEFORMATEX etc. and pass all header data directly via AVCodecContext, we can be absolutely sure that the codec tag mapping is not needed anymore. Note that this also destroys the "standard" MPlayer method of exporting codec header data. WAVEFORMATEX and BITMAPINFOHEADER made sure that other non-libavcodec decoders could be initialized. However, all these decoders have been removed, so this is just cruft full of old hacks that are not needed anymore. There's still ad_spdif and ad_mpg123, bu neither of these need codec header data. Should we ever add non-libavcodec decoders, better data structures without the past hacks could be added to export the headers.
* demux_lavf: remove code duplicationwm42013-02-101-3/+3
| | | | | | | | | | Also move the lang field into the general stream header. (SH_COMMON is an old hack to "share" code between audio/video/sub headers.) There should be no functional changes, other than not printing stream info in verbose mode or with slave mode. (The frontend already prints stream info, and this is just a leftover when individual demuxers did this, and slave mode remains broken.)
* 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
| | | | | | | | |