aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio
Commit message (Collapse)AuthorAge
* audio: fix format function consistency issuesGravatar wm42015-06-26
| | | | | | | | | | | Replace all the check macros with function calls. Give them all the same case and naming schema. Drop af_fmt2bits(). Only af_fmt2bps() survives as af_fmt_to_bytes(). Introduce af_fmt_is_pcm(), and use it in situations that used !AF_FORMAT_IS_SPECIAL. Nobody really knew what a "special" format was. It simply meant "not PCM".
* audio: replace format name tableGravatar wm42015-06-26
| | | | Having a big switch() is simpler.
* audio: remove bitmask format definition messGravatar wm42015-06-26
| | | | | | | | | | Audio formats used a semi-clever schema to encode the properties of the PCM encoding as bitfields into the format integer value. The af_fmt_change_bits() implementation becomes a bit weird, but it's an improvement to the rest of the code. (I've always disliked it, so why not get rid of it.)
* ao_coreaudio_utils: use a macroGravatar wm42015-06-26
| | | | | This is actually the last line of code outside of format.c/h which still tries to fiddle with the format bitfields.
* ao_sndio: fix commentGravatar wm42015-06-26
| | | | | | So whoever (nobody?) would want to deal with this broken and obscure AO for an obscure audio API could add support for some more channel layouts.
* ao_coreaudio: support non-interleaved outputGravatar wm42015-06-26
| | | | | This saves us the trouble of interleaving the audio data for no reason.
* ao_coreaudio: explicitly skip input streamsGravatar wm42015-06-26
| | | | | | | This may or may not fix some issues with the format switching code. Actually, it seems somewhat unlikely, but then checking the stream type isn't incorrect either, and is probably something the API user should always be doing.
* ao_coreaudio_utils: compare full AudioStreamBasicDescriptionGravatar wm42015-06-25
| | | | | | Originally, this was written for comparing the sample format only, but ca_change_physical_format_sync() actually expects that the full format is compared. (For all other uses it doesn't matter.)
* audio: output human-readable channel layouts tooGravatar wm42015-06-25
| | | | | This gets you the "logical" channel layout, instead of the exact thing we're sending to the AO. (Tired of the cryptic shit ALSA gives me.)
* audio: fix channel map fallback selection (again)Gravatar wm42015-06-25
| | | | | | | | | | | | | | | | | | | | The speaker replacement nonsense sometimes made blatantly incorrect decisions. In this case, it prefered a 7.1(rear) upmix over outputting 5.1(side) as 5.1, which makes no sense at all. This happened because 5.1 and 7.1(rear) appeared equivalent to the final selection, as both of them lose the sl-sr channels. The old code was too stupid to select the one with the lower number of channels as well. Redo this. There's really no reason why there should be a separate final decision, so move the speaker replacement logic into the mp_chmap_is_better() function. Improve some other details. For example, we never should compare the plain number of channels for deciding upmix/downmix, because due to NA channels this is essentially meaningless. Remove the NA channels when doing this comparison. Also, explicitly handle exact matches. Conceptually this is not necessary, but it avoids that we have to needlessly shuffle audio data around.
* ao: standardize channel layout name in debug output furtherGravatar wm42015-06-25
|
* af: move af_from_dB() function to af_volume.cGravatar wm42015-06-23
| | | | | And also simplify it (it certainly had the most awkward API you could think of for such a simple function).
* af_volume: add a replaygain fallback optionGravatar wm42015-06-23
|
* af_lavrresample: free and reallocate resample context on reconfigGravatar wm42015-06-22
| | | | | | | | This avoids keeping "bad" state from previous reconfig calls, such as the internal_sample_format option (which is set only on the first reconfig call). There's no advantage to keeping the resample contexts around anyway.
* af_lavrresample: fix commentGravatar wm42015-06-22
| | | | | mp_format is not a libavresample input format here, and the comment was more confusing than it helped.
* af: restore detaching of PCM filters when using spdifGravatar wm42015-06-22
| | | | | | Basically, af_fix_format_conversion() behaves stupid you insert a conversion filter that won't work, and adding back the conversion test function is the simplest fix to it.
* af_lavrresample: don't flush in uninitialized stateGravatar wm42015-06-22
| | | | libswresample verbosely complains.
* ao_alsa: fix a log messageGravatar wm42015-06-21
| | | | | | | | | | | | | | | | | So apparently, this essentially happens when the kernel driver doesn't implement write accesses in the channel map control. Which doesn't necessarily mean that the channel map is unsupported, or that there is a bug - it's just lazyness and a consequence of the terrible ALSA kernel API for the channel mapping stuff. In these cases, the channel count implicitly selects the channel map, and snd_pcm_set_chmap() always fails with ENXIO. I'm actually not sure what happens if dmix is on top of e.g. HDMI, which actually lets you change the channel mapping. I'm also not sure why commit d20e24e5d1614354e9c8195ed0b11fe089c489e4 (alsa-lib git repository) does not take care of this.
* demux: merge extradata fieldsGravatar wm42015-06-21
| | | | | | | MPlayer traditionally had completely separate sh_ structs for audio/video/subs, without a good way to share fields. This meant that fields shared across all these headers had to be duplicated. This commit deduplicates essentially the last remaining duplicated fields.
* demux: rename sh_stream.format to sh_stream.codec_tagGravatar wm42015-06-21
| | | | | Why not. "format" sounds too misleading for the actual importance and meaning of this field.
* Various spelling fixesGravatar Marcin Kurczewski2015-06-18
| | | | Signed-off-by: wm4 <wm4@nowhere>
* ao_wasapi: fix crash on hotplug init errorGravatar wm42015-06-17
| | | | | On init error, the mp_msg macros are actually called. They could cause a crash because state->log was NULL.
* af_lavrresample: include osdep/endian.hGravatar wm42015-06-17
| | | | The 24 bit conversion code needs the relevant preprocessor symbols.
* af: remove conversion filter searchGravatar wm42015-06-16
| | | | | | This attempted to find a minimal filter graph for a format conversion involving multiple conversion filters. With the last 2 commits it becomes dead code - remove it.
* af_convert24: remove this filterGravatar wm42015-06-16
|
* af_lavrresample: integrate 24 bit (3 bytes per sample) outputGravatar wm42015-06-16
| | | | | | | | | | | | Now af_lavrresample can output 24 bit samples directly, by doing the conversion "inline". Luckily, S32->S24 can be done in-place, so this isn't too much work. But the output conversion logic (which seems to be adding up) gets slightly more complicated again. Normally this is done by af_convert24. But having multiple conversion filters complicates some aspects of the filter chain. S24 output is the only thing the code for multiple conversion filters is still needed for, and getting rid of that is preferable.
* af_lavrresample: always fill reorderGravatar wm42015-06-16
| | | | | | If the code path for additional output conversion is active, reorder_planes() is always called, even if the reorder_out array wasn't filled. This is obviously wrong - always fill this array.
* audio: remove S8, U16, U24, U32 formatsGravatar wm42015-06-16
| | | | | | | | | | | | | They are useless. Not only are they actually rarely in use; but libavcodec doesn't even output them, as libavcodec has no such sample formats for decoded audio. Even if it should happen that we actually still need them (e.g. if doing direct hardware output), there are better solutions. Swapping the sign is a fast and lossless operation and can be done inplace, so AO actually needing it could do this directly. If you wonder why we keep U8 instead of S8: because libavcodec does it.
* audio: fix crash on uninitGravatar wm42015-06-15
| | | | Shit.
* af_lavcac3enc: fix A/V syncGravatar wm42015-06-15
| | | | | | The filter can buffer singificant amounts of audio. (The proper fix is making the filter chain PTS-aware.)
* af: fix an aspect of filter chain flushingGravatar wm42015-06-15
| | | | | Even if we flush the current filter, we have to read the remaining output from the frame we previously fed to the filter.
* audio: remove unused readonly fieldGravatar wm42015-06-15
| | | | Its last use was removed in 433402b5.
* chmap: make up some channel layout namesGravatar wm42015-06-12
| | | | | Going by the existing names, these should make sense. HDMI knows about these layouts, but does not name them.
* ao_alsa: if possible, reorder device maps to std layoutsGravatar wm42015-06-12
| | | | | | | Channel maps reported by the device as SND_CHMAP_TYPE_VAR can be freely reordered. We don't use this much (out of laziness), but in this case it's a simple way to reduce necessary reordering (which would be an extra libavresample invocation), and to make debug output more readable.
* ao_alsa: make it accept 7.1 over HDMIGravatar wm42015-06-12
| | | | | SDR/SDL is what lavc outputs for 7.1(rear), while RRC/RLC is what ALSA uses for some 7.1 layouts, so this makes sense to me.
* chmap_sel: improve speaker replacement handlingGravatar wm42015-06-12
| | | | | This didn't really work since the last time the channel map fallback code was touched. In some cases, quite bad results were selected.
* chmap_sel: do naive speaker replacements lastGravatar wm42015-06-12
| | | | | This prevents that the potentially better pick by mp_chmap_sel_fallback() is overridden.
* audio: fill NA channels with silenceGravatar wm42015-06-12
| | | | | | | | | | | | | | | Until now, we didn't do this, because it required some effort, and didn't seem to be necessary. It probably still isn't, but it sounds like a good idea not to output arbitrary data on these channels. The situation is complicated by the fact that just adding new channels to a planar frame would require messing with buffers. So we would have to allocate new buffers and add them to the frame. We could have to maintain an extra buffer pool for this. Avoid this by being "clever", and just allocate a frame with enough channels in the first place. libav/swresample won't know about these channels and won't write to them, but we can grab them in reorder_planes() and use them for the NA channels.
* audio: use unknown channel layouts if there is no standard layoutGravatar wm42015-06-12
| | | | | | | | | 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 reorderingGravatar wm42015-06-12
| | | | Quite a blunder, really.
* audio: deal with AVFrame-style buffer assignmentsGravatar wm42015-06-12
| | | | | | | | | | | | | | | | In the AVFrame-style system (which we inreasingly map our internal data stuctures on), buffers and plane pointers don't necessarily have a 1:1 correspondence. For example, a single buffer could cover 2 or more planes, all while other planes are covered by a second buffer, and so on. They don't need to be ordered in the same way. Change mp_audio_get_allocated_size() to retrieve the maximum size all planes provide. This also considers the case of planes not pointing to buffer start. Change mp_audio_realloc() to reset all planes, even if corresponding buffers are not reallocated. (The caller has to be careful anyway if it wants to be sure the contents are preserved on realloc calls.)
* ao_alsa: change ALSA braindeath heuristicGravatar wm42015-06-11
| | | | | | | | | | | | If you try to play surround with dmix, it will advertise surround and lets you set more than 2 channels, but will report a stereo channel map, with the extra channels identified as NA. We could handle this now, but we don't want to (because it's excessively stupid). Do it only if the channel map is not what we requested, instead of just acting if it contains NA entries at all. This avoids that we hurt ourselves in the unlikely but possible case we actually have to use channel maps with NA entries.
* ao_coreaudio: change physical stream format synchronouslyGravatar wm42015-06-09
|
* audio/out/pull: avoid dropping some audio when drainingGravatar wm42015-06-09
| | | | | | | | | | | | If the audio API takes a while for starting the audio callback, the current heuristic can be off. In particular, with very short files, it can happen that the audio callback is not called before playback is stopped, so no audio is output at all. Change draining so that it essentially waits for the ringbuffer to empty. The assumption is that once the audio API has read the data via the callback, it will always output it, even if the audio API is stopped right after the callback has returned.
* audio/out/pull: correctly pad partial frames with silenceGravatar wm42015-06-09
| | | | | | | | If a frame could only be partially filled with real audio data, the silence wasn't written at the correct offset. It could have happened that the remainder of the frame contained garbage. (This didn't happen in the more common case of playing dummy silence.)
* ao_alsa: refine channel count mismatch error messageGravatar wm42015-06-09
| | | | I suspect we need to hand this more gracefully in some cases.
* audio: add --audio-spdif as new method for enabling passthroughGravatar wm42015-06-05
| | | | | | | | | | | | | This provides a new method for enabling spdif passthrough. The old method via --ad (--ad=spdif:ac3 etc.) is deprecated. The deprecated method will probably stop working at some point. This also supports PCM fallback. One caveat is that it will lose at least 1 audio packet in doing so. (I don't care enough to prevent this.) (This is named after the old S/PDIF connector, because it uses the same underlying technology as far as the higher level protoco is concerned. Also, the user should be renamed that passthrough is backwards.)
* ad_spdif: use a pseudo codec entry to select DTS-HD instead of an optionGravatar wm42015-06-05
| | | | | | | | | This deprecates the --ad-spdif-dtshd option, and replaces it with a pseudo decoder. This means ad_spdif will report two decoders, "dts" and "dts-hd", of which the second simply enables what the option did. The --ad-spdif-dtshd option will actually be deprecated in the next commit.
* ao_alsa: refuse to use spdif if AES flags can't be setGravatar wm42015-06-04
| | | | | Seems like a good idea to avoid accidentally playing noise by writing spdif data to pure PCM devices.
* af_lavrresample: slightly better computation of total delayGravatar wm42015-06-04
| | | | | | | On libavresample, don't ignore the buffered output data. On libswresample, don't round the total buffer size to the input samplerate.