summaryrefslogtreecommitdiffstats
path: root/audio/chmap.c
Commit message (Collapse)AuthorAgeFilesLines
* chmap: make up some channel layout nameswm42015-06-121-0/+3
| | | | | Going by the existing names, these should make sense. HDMI knows about these layouts, but does not name them.
* audio: use unknown channel layouts if there is no standard layoutwm42015-06-121-5/+5
| | | | | | | | | This is just a conceptual issue, since for now every channel count has an associated standard layout. But should the max. channel count ever be bumped, some things would stop function if mp_chmap_from_channels() refused to work for any channel count within the allowed range.
* audio: fix messed up channel reorderingwm42015-06-121-2/+2
| | | | Quite a blunder, really.
* chmap: use av_popcount64()wm42015-05-211-9/+3
| | | | Saves us some code, and also happens to fix #1968.
* audio: simplify furtherwm42015-05-081-14/+8
| | | | | | Drop mp_chmap_diff() (which is unused too now), and implement mp_chmap_diffn() in a slightly simpler way. (Too bad there is no standard function for counting set bits.)
* audio: remove mp_chmap_contains()wm42015-05-081-10/+0
| | | | It's unsued now.
* audio: add chmap utility functionwm42015-05-081-0/+9
|
* audio: fix messed up assert()wm42015-05-071-1/+1
| | | | This made no sense and always evaluated to true.
* audio: remove UNKNOWN pseudo speakerswm42015-05-071-6/+6
| | | | | | Reuse MP_SPEAKER_ID_NA for this. If all mp_chmap entries are set to NA, the channel layout has special "unknown channel layout" semantics, which are used to deal with some corner cases.
* audio: define only a single NA speaker IDwm42015-05-071-18/+8
| | | | | Remove the requirement from mp_chmap that speaker entries must be unique. Use this to get rid of all the redundant NA speaker IDs.
* audio: introduce support for padding channelswm42015-05-051-18/+52
| | | | | | | | | | | | | | | | | | | Some audio APIs explicitly require you to add dummy channels. These are not rendered, and only exist for the sake of the audio API or hardware strangeness. At least ALSA, Sndio, and CoreAudio seem to have them. This commit is preparation for using them with ao_coreaudio. The result is a bit messy. libavresample/libswresample don't have good API for this; avresample_set_channel_mapping() is pretty useless. Although in theory you can use it to add and remove channels, you can't set the channel counts. So we do the ordering ourselves by making sure the audio data is planar, and by swapping the plane pointers. This requires lots of messiness to get the conversions in place. Also, the input reordering is still done with the "old" method, and doesn't support padded channels - hopefully this will never be needed. (I tried to come up with cleaner solutions, but compared to my other attempts, the final commit is not that bad.)
* audio: chmap: explicitly drop channels not supported by lavcwm42015-05-041-2/+5
| | | | Basically as before, but avoid undefined behavior.
* audio: drop unused functionwm42015-05-041-9/+0
|
* audio: accept 1.0 and 2.0 as aliases for mono and stereowm42015-02-261-0/+2
|
* chmap_sel: add multichannel fallback heuristicStefano Pigozzi2014-12-291-0/+23
| | | | | | | | | | | | Instead of just failing during channel map selection, try to select a close layout that makes most sense and upmix/downmix to that instead of failing AO initialization. The heuristic is rather simple, and uses the following steps: 1) If mono is required always prefer stereo to a multichannel upmix. 2) Search for an upmix that is an exact superset of the required channel map. 3) Search for a downmix that is the exact subset of the required channel map. 4) Search for either an upmix or downmix that is the closest (minimum difference of channels) to the required channel map.
* chmap: add a 7.1(rear) layout nameStefano Pigozzi2014-12-291-0/+1
| | | | This is common on Apple systems so it's handy to have a label for it.
* audio: make mp_chmap_to_str() return a stack-allocated stringwm42014-11-241-12/+14
| | | | Simplifies memory management.
* options: accept --audio-channels=autowm42014-10-301-0/+1
| | | | This sounds much more intuitive, while "empty" was a bit of a WTF.
* Add more constwm42014-06-111-3/+3
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* options: fix off-by-1 error in option help outputwm42014-03-151-1/+1
|
* m_option, m_config: mp_msg conversionswm42013-12-211-8/+8
| | | | | | | | Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-1/+1
| | | | Followup commit. Fixes all the files references.
* chmap: fix oddity due to ambiguous 6.1 ffmpeg channel layoutwm42013-05-131-2/+3
| | | | | | | | FFmpeg (as well as Libav) have two layouts called "6.1": AV_CH_LAYOUT_6POINT1 and AV_CH_LAYOUT_6POINT1_BACK. We call them "6.1" and "6.1(back)". Change the default layout for 7 channels as well to return the same layout as av_get_default_channel_layout(). (Looks a bit questionable, but for now it's better to follow FFmpeg.)
* audio: fix ALSA 4 channel surround outputwm42013-05-131-1/+3
| | | | | | | | | It turns out that ALSA's 4 channel layout is different from mpv's and ffmpeg's 4.0 layout. Thus trying to do 4 channel output led to incorrect remixing via lib{av,sw}resample. Fix the default layouts for the internal filter chain as well, although I'm not sure if it matters at all.
* audio: add channel map selection functionwm42013-05-121-16/+24
| | | | | | | | | | | | | | | | | | | | The point is selecting a minimal fallback. The AOs will call this through the AO API, so it will be possible to add options affecting the general channel layout selection. It provides the following mechanism to AOs: - forcing the correct channel order - downmixing to stereo if no layout is available - allow 5.1 <-> 5.1(side) fallback - handling "unknown" channel layouts This is quite weak and lots of code/complexity for little gain. All AOs already made sure the channel order was correct, and the fallback is of little value, and could perhaps be done in the frontend instead, like stereo downmixing with --channels=2 is handled. But I'm not really sure how this stuff should _really_ work, and the new code will hopefully provides enough flexibility to make radical changes to channel layout negotiation easier.
* audio: add channel map APIwm42013-05-121-0/+478
Unused, will be used in the following commits. Let chmap.h define the number of maximum channels, because that is most convenient.