Commit Graph

35864 Commits

Author SHA1 Message Date
wm4 ad1641c0da m_property: fix non-sense code
Undefined behavior.
2013-07-26 00:19:15 +02:00
wm4 9cc5630fd5 video: support setting libswscale chroma position 2013-07-25 23:03:20 +02:00
Diogo Franco (Kovensky) 24e50ee74e w32_common: Don't use globals for TRACKMOUSEEVENT
It seems working on getch2 gave me some brain damage.
2013-07-25 14:47:49 -03:00
Diogo Franco (Kovensky) f0b1834d59 w32_common: Track when the mouse leaves the window
Windows doesn't send WM_MOUSELEAVE by default unless you ask it to;
request tracking for leave events when the mouse enters the window (or is
moved).

Tracking is automatically de-activated once the mouse leaves the window,
so we have to re-request it every time the mouse re-enters the window.
2013-07-25 14:19:12 -03:00
Diogo Franco (Kovensky) 0cfc382355 getch2: Doing it right this time
getch2_pos should be set to 1, not 0, when backtracking. Avoids the
possible infinite loop but correctly.
2013-07-25 13:29:10 -03:00
Diogo Franco (Kovensky) c36a5e0f36 Revert "getch2: Avoid possible infinite loop"
This reverts commit ba95aed6f1.
2013-07-25 13:26:19 -03:00
Diogo Franco (Kovensky) ba95aed6f1 getch2: Avoid possible infinite loop
If the first character is not a valid UTF-8 start code nor is in termcap,
getch2 would enter an infinite loop. Always walk 1 byte in the UTF-8 case
unless it's a valid start code.
2013-07-25 13:24:22 -03:00
Diogo Franco (Kovensky) 1aa0ad2725 Merge branch 'getch2/refactor'
* getch2/refactor:
  configure: Fix bad variable assignment
  getch2, mplayer: Always call load_termcap
  getch2: Remove unused function, fix possible crash
  getch2: Refactor/rewrite
2013-07-25 12:25:31 -03:00
Diogo Franco (Kovensky) 1df1eb0b61 configure: Fix bad variable assignment
Bourne shell hates having spaces before or after the = sign.
2013-07-25 12:24:09 -03:00
Diogo Franco (Kovensky) 5586b02931 getch2, mplayer: Always call load_termcap
getch2 now deals with the cases where we don't have termcap. Add a dummy
load_termcap to getch2-win so we don't get linking errors on mingw.
2013-07-25 12:23:40 -03:00
Diogo Franco (Kovensky) 19b1279bb3 getch2: Remove unused function, fix possible crash
If we still haven't read the full key from the input but it's regardless a
unique match in the database, we could receive a NULL keycode from
keys_search (it's not a full match after all) and proceed to use it.

Don't disable the keycode matching code if we don't have termcap as we can
still match against the hardcoded sequences.
2013-07-25 12:21:22 -03:00
Diogo Franco (Kovensky) 057467f6b3 getch2: Refactor/rewrite
Still uses termcap, but uses terminfo for loading the termcap database if
possible. Adds configure test to find terminfo; skips the termcap test
if terminfo is found since terminfo provides termcap.

Use termcap completely for special keys; if we can't get it from termcap
and it isn't one of the known fallbacks, we ignore its specialness and
treat as a sequence of UTF-8 codes.

Further hardcoded fallbacks can be added by calling keys_push_once in
load_termcap; there is no limit to the amount of keys pushed.

Uses the "ke" and "ks" capabilities to start / exit application mode, which
is necessary on vt100 emulators (including screen, xterm and all terminals
that emulate either of those) to correctly receive arrow keys.

It's now possible to compile getch2 even without termcap, though it won't
be of much use since it'll be unable to detect special keys.

Converted to 4 spaces per tab, prettified some statements.
2013-07-25 00:01:51 -03:00
Diogo Franco (Kovensky) 2c07cb0036 mp_msg: Support colors on cygwin
A cygwin mpv will usually run inside mintty, and even if it were to be run
in a regular console window, the cygwin dll emulates ANSI escapes.
2013-07-24 23:59:05 -03:00
wm4 3f04bf2722 demux_libass: actually set priv context
This was a memory leak: the ASS_Track was never deallocated.
2013-07-24 19:47:22 +02:00
wm4 202b9e8069 mp_image: create AVBuffers for all planes when converting to AVFrame
It appears the API requires you to cover all plane data with AVBuffers
(that is, one AVBuffer per plane in the most general case), because
certain code can make certain assumptions about this. (Insert rant
about how this is barely useful and increases complexity and potential
bugs.) I don't know any cases where the current code actually fails,
but we want to follow the API, so do it anyway.

Note that we don't really know whether or not planes are from a single
memory allocation, so we have to assume the most general case and create
an AVBuffer for each plane. We simply assume that the data is padded to
the full stride in the last image line. All these extra dummy references
are stupid, but the code might become much simpler once we only support
libavcodec versions with refcounting and can use AVFrame directly.
2013-07-24 19:47:05 +02:00
wm4 31c271f4ad m_config: don't override profile option if not required
The --profile top-level option is handled specially in m_config.c. But
this code also broke sub-options that happened to be named "profile"
(e.g. when trying to use "-af-add=bs2b=profile=cmoy"). Handle it
specially only if it's the top-level --profile option.
2013-07-24 19:44:10 +02:00
wm4 837377a6ce input: fix dangling pointer issues with multi-part commands
This didn't setup the linked list of sub-commands for multi-part
commands ("a ; b ; c") correctly. Also, the new commands were attached
to the allocation of the _old_ command instead of the new one. (Wow,
whatever the hell I was (not) thinking when I wrote this code.)
2013-07-24 19:43:31 +02:00
wm4 4e7ab517c1 demux_lavf: set keyframe flag on attached pictures
Gives really funky results with PNG attachments otherwise. The main
problem is that avcodec_flush_buffers() does not fully reset the
decoder, so passing multiple PNG packets without keyframe flags will
attempt to combine the new picture with the previously decoded
contents. (Makes no sense with proper PNG - maybe this codepath is
intended for MNG or APNG.)
2013-07-24 19:42:02 +02:00
wm4 782d5ec3a0 mplayer: remove dead code
Attached pictures are now handled specially and on a separate codepath,
so this hack is not needed anymore. Remove it from the normal codepath.
2013-07-24 19:41:24 +02:00
wm4 e83cbde1a4 Fix some -Wshadow warnings
In general, this warning can hint to actual bugs. We don't enable it
yet, because it would conflict with some unmerged code, and we should
check with clang too (this commit was done by testing with gcc).
2013-07-23 00:45:23 +02:00
wm4 78ebb3c6fa options: make legacy hacks for AFs/VFs more explicit
This means that AOs/VOs with no options set do not take the legacy
option parsing path, but instead report that they have no options.
2013-07-22 23:07:23 +02:00
wm4 f32a90a839 audio/out: remove options argument from init()
Same as with VOs in the previous commit.
2013-07-22 22:58:09 +02:00
wm4 1f5ffe7d30 video/out: remove options argument from preinit()
All VOs use proper option parsing now, and compatibility hacks are not
needed.
2013-07-22 22:52:42 +02:00
wm4 1df2ad7e03 Remove subopt-helper
Finally not used by anything anymore. Farewell.
2013-07-22 22:42:55 +02:00
Stefano Pigozzi 14f1a25a8e ao_coreaudio: fix ifdef'd conditional
The big endian case was not covered. Doesn't make much difference since mpv
runs on Macs with x86 only, but for the sake of correctness.
2013-07-22 22:35:44 +02:00
Stefano Pigozzi cd10936357 ao_coreaudio: use new option API 2013-07-22 22:27:08 +02:00
Stefano Pigozzi 7d58c51fd6 ao_coreaudio: switch properties getters to talloc 2013-07-22 21:53:18 +02:00
Stefano Pigozzi af6ad6717f ao_coreaudio: reduce verbosity of the chmapping code 2013-07-22 21:53:18 +02:00
Stefano Pigozzi df39121206 ao_coreaudio: revert to original device format on digital uninit
This is not done automatically by CoreAudio. I am told that it would a PITA
to have to switch back the format manually on the device (especially if the
same device is used for lpcm output).
2013-07-22 21:53:18 +02:00
Stefano Pigozzi c11c744998 ao_coreaudio: refactor chmap detection
b2f9e0610 introduced this functionality with code that was quite 'monolithic'.
Split the functionality over several functions and ose the new macros to get
array properties.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 18777ecfe8 ao_coreaudio: refactor properties code
Introduce some macros to deal with properties. These allow to work around the
limitation of CoreAudio's API being `void **` based. The macros allow to keep
their client's code DRY, by not asking size and other details which can be
derived by the macro itself. I have no idea why Apple didn't design their API
like this in the first place.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 1ed1175636 ao_coreaudio: move utils functions to snake_case 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 1e37965597 ao_coreaudio: split ao_coreaudio_common in two files
* ao_coreaudio_utils: contains several utility function
 * ao_coreaudio_properties: contains functions to set and get  audio object
   properties.

Conflicts:
	audio/out/ao_coreaudio.c
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 5a195845e3 ao_coreaudio: store asbd only when selected
Previous code needlessly stored the input asbd before actually testing it's
support against the hardware.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 4e0618dab9 ao_coreaudio: fallback to waveext on non surround inputs 2013-07-22 21:53:18 +02:00
Stefano Pigozzi c2de6fdf34 ao_coreaudio: set channel layout based on hardware query
this is a wip
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 9652245ef0 ao_coreaudio: fix regression in digital stream selection
The condition was checked wrongly on asbd which is the input format
description. This lead to the condition always being true, thus selecting lpcm
streams for digital input.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi e61102e637 ao_coreaudio: return errors instead false in init functions 2013-07-22 21:53:18 +02:00
Stefano Pigozzi b41fcc1e2c ao_coreaudio: remove useless function declaration 2013-07-22 21:53:18 +02:00
Stefano Pigozzi b174d647e5 ao_coreaudio: only set chmap_sel info for lpcm 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 4d15f1bb60 ao_coreaudio: set channel layout bitmap 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 24cad42363 ao_coreaudio: move digital detection before asbd creation 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 6473cc59b1 ao_coreaudio: remove chmap selection if format is digital 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 6d2f9a2804 ao_coreaudio: remove volume multiplication by 4
kHALOutputParam_Volume is the linear gain so it should be at maximum 1 to
keep the audio quality good. No idea why it was more than that.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi a2d106cb31 ao_coreaudio: remove device property listener on uninit
Also extract this functionality inside a function in coreaudio_common
2013-07-22 21:53:18 +02:00
Stefano Pigozzi 7b2b292343 ao_coreaudio: print help string in one go 2013-07-22 21:53:18 +02:00
Stefano Pigozzi 5a4ae42892 ao_coreaudio: change all ++var to var++
Luckily they all were inside for loops so the functionality does not actually
change.
2013-07-22 21:53:18 +02:00
Stefano Pigozzi d3fb585b58 ao_coreaudio: change private vars names to match mpv conventions 2013-07-22 21:53:17 +02:00
Stefano Pigozzi d9c0dc7733 ao_coreaudio: remove packetSize private variable 2013-07-22 21:53:17 +02:00
Stefano Pigozzi 7d7381f9cf ao_coreaudio: refactor play/pause 2013-07-22 21:53:17 +02:00