summaryrefslogtreecommitdiffstats
path: root/audio
Commit message (Collapse)AuthorAgeFilesLines
* af: streamline format negotiationwm42013-04-133-167/+210
| | | | | | | | | | | | | Add dummy input and output filters to remove special cases in the format negotiation code (af_fix_format_conversion() etc.). The output of the filter chain is now negotiated in exactly the same way as normal filters. Negotiate setting the sample rate in the same way as other audio parameters. As a side effect, the resampler is inserted at the start of the filter chain instead of the end, but that shouldn't matter much, especially since conversion and channel mixing are conflated into the same filter (due to libavresample's API).
* af_lavrresample: add no-detach suboptionwm42013-04-131-1/+6
| | | | | Normally, af_lavrresample detaches itself immediately if the input and output audio parameters are the same. no-detach prevents this.
* options: remove --af-advwm42013-04-133-23/+1
| | | | | | | Anything this option did has been removed in the preceding 3 commits. Note that even though these options sounded like a good idea (like setting accuracy vs. speed tradeoffs), they were not really properly implemented.
* af: remove accuracy optionwm42013-04-131-15/+4
| | | | | | | | All this option did was deciding whether the resample filter was to be insert at the beginning or end of the filter chain. Always do what the option set for accuracy did. I doubt it makes much of a difference. libavresample does most things in just one go anyway, so it won't matter.
* af: remove force optionwm42013-04-131-64/+49
| | | | | | Dangerous and misleading. If it turns out that this is actually needed to make certain setups work right, it should be added back in a better way (in a way it doesn't cause random crashes).
* audio: remove float processing optionwm42013-04-135-30/+5
| | | | | | | | | | | | | | The only thing this option did was changing the behavior of af_volume. The option decided what sample format af_volume would use, but only if the sample format was not already float. If the option was set, it would default to float, otherwise to S16. Remove use of the option and all associated code, and make af_volume always use float (unless a af_volume specific sub-option is set). Silence maximum value tracking. This message is printed when the filter is destroyed, and it's slightly annoying. Was enabled due to enabling float by default.
* audio: switch to libavcodec channel order, use libavresample for mixingwm42013-04-135-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | Switch the internal channel order to libavcodec's. If the channel number mismatches at some point, use libavresample for up- or downmixing. Remove the old af_pan automatic downmixing. The libavcodec channel order should be equivalent to WAVEFORMATEX order, at least nowadays. reorder_ch.h assumes that WAVEFORMATEX and libavcodec might be different, but all defined channels have the same mappings. Remove the downmixing with af_pan as well as the channel conversion with af_channels from af.c, and prefer af_lavrresample for this. The automatic downmixing behavior should be the same as before (if the --channels option is set to 2, which is the default, the audio output is forced to 2 channels, and libavresample does all downmixing). Note that mpv still can't do channel layouts. It will pick the default channel layout according to the channel count. This will be fixed later by passing down the channel layout as well. af_hrtf depends on the order of the input channels, so reorder to ALSA (for which this code was written). This is better than changing the filter code, which is more risky. ao_pulse can accept waveext order directly, so set that as channel mapping.
* ao_alsa: reorder channels from internal to alsa orderwm42013-04-131-0/+6
| | | | | Currently, internal and alsa order are exactly the same, so this will do absolutely nothing.
* af: simplificationwm42013-04-131-35/+20
| | | | | | | | | If format negotiation fails, and additional filters are inserted to fix this, don't try to reinitialize the filter immediately. Instead, correct the audio format, and let the caller retry. Add a retry counter to af_reinit() to ensure that misbehaving filters can't put the format negotiation into an endless loop.
* af: factor channel filter insertionwm42013-04-131-30/+45
| | | | Do this just like it has been done for the format filter.
* af: use af_lavrresample for format conversions, if possiblewm42013-04-134-45/+111
| | | | | | | | | | | | | Refactor to remove the duplicated format filter insertion code. Allow other format converting filters to be inserted on format mismatches. af_info.test_conversion checks whether conversion between two formats would work with the given filter; do this to avoid having to insert multiple conversion filters at once and such things. (Although this isn't ideal: what if we want to avoid af_format for some conversions? What if we want to split af_format in endian-swapping filters etc.?) Prefer af_lavrresample for conversions that it supports natively, otherwise let af_format handle the full conversion.
* af: remove automatically inserted filters on full reinitwm42013-04-132-31/+44
| | | | | | | | | | | | | | | | | | | | | | Make sure automatically inserted filters are removed on full reinit (they are re-added later if they are really needed). Automatically inserted filters were never explicitly removed, instead, it was expected that redundant conversion filters detach themselves. This didn't work if there were several chained format conversion filters, e.g. s16le->floatle->s16le, which could result from repeated filter insertion and removal. (format filters detach only if input format and output format are the same.) Further, the dummy filter (which exists only because af.c can't handle an empty filter chain for some reason) could introduce bad conversions due to how the format negotiation works. Change the code so that the dummy filter never takes part on format negotiation. (It would be better to fix format negotiation, but that would be much more complicated and would involving fixing all filters.) Simplify af_reinit() and remove the start audio filter parameter. This means format negotiation and filter initialization is run more often, but should be harmless.
* af_lavrresample: allow other ffmpeg sample formats for input/outputwm42013-04-131-17/+48
| | | | | | | The format was locked to s16. Extend it to accept all other ffmpeg sample formats, and even allow different in- and output formats. The generic filter code will still insert af_format on format mismatches, though.
* audio/filter: replace pointless memcpys with assignmentswm42013-04-134-17/+10
| | | | | | The change in af_scaletempo actually fixes a memory leak. af->data contained a pointer to an allocated buffer, which was overwritten during format negotiation. Set the format explicitly instead.
* af: uncrustifywm42013-04-132-466/+496
|
* ad_lavc: use fmt-conversion to map sample formatsStefano Pigozzi2013-04-133-18/+95
|
* ao_jack: fix deprecation warningStefano Pigozzi2013-04-121-2/+5
| | | | | jack_port_get_total_latency is deprecated: use the "new" API based on jack_port_get_latency_range instead.
* mplayer: keep volume persistent, even when using --volumewm42013-04-102-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider: mpv --volume 10 file1.mkv file2.mkv Before this commit, the volume was reset to 10 when playing file2.mkv. This was inconsistent to most other options. E.g. --brightness is a rather similar case. In general, settings should never be reset when playing the next file, unless the option was explicitly marked file-local. This commit corrects the behavior of the --volume and --mute options. File local --volume still works as expected: mpv --{ --volume 10 file1.mkv file2.mkv --} This sets the volume always to 10 on playback start. Move the m_config_leave_file_local() call down so that the mixer code in uninit_player() can set the option volume and mute variables without overwriting the global option values. Another subtle issue is that we don't want to set volume if there's no need to, which is why the user_set_volume/mute fields are introduced. This is important because setting the volume might change the system volume depending on other options.
* ao_dsound: add missing includeKovensky2013-03-231-0/+1
| | | | libavutil/common.h is needed for FF_ARRAY_ELEMS.
* af_lavrresample: add new resampling filter to replace the old onesStefano Pigozzi2013-03-135-795/+280
| | | | | | | | | | Remove `af_resample` and `af_lavcresample`. The former is a mess while the latter uses an API that was long deprecated in libavcodec and is now removed. `af_lavrresample` rougly has the same features and structure of `af_lavcresample`. libswresample fallback by wm4.
* Prefix CODEC_ID_ with AV_wm42013-03-132-15/+15
| | | | | | | | | The old names have been deprecated a while ago, but were needed for supporting older ffmpeg/libav versions. The deprecated identifiers have been removed from recent Libav and FFmpeg git. This change breaks compatibility with Libav 0.8.x and equivalent FFmpeg releases.
* af_lavcac3enc: switch to avcodec_encode_audio2()wm42013-03-131-45/+71
| | | | | | | | avcodec_encode_audio() was deprecated, and was finally removed from Libav and FFmpeg git. This appears to work. I get heavy A/V desync with -ao alsa and -ao pcm, but this was already so before this change.
* Add a --dtshd optionWessel Dankers2013-03-041-13/+22
| | | | | | | | | | 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.
* Rename af_volnorm to af_drcMartin2013-02-122-20/+20
| | | | | | The previous name of this filter was misleading, because it doesn’t actually normalize volume levels. What it does is closer to performing low-quality dynamic range compression, hence it is now called af_drc.
* demux_lavf, ad_lavc, vd_lavc: pass codec header data directlywm42013-02-101-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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, ad_lavc, vd_lavc: refactor, cleanupwm42013-02-101-24/+18
| | | | | | | | | Rearrange some code to make it easier readable. Remove some dead code, and stop printing AVI headers in demux_lavf. (These are not actual AVI headers, just for internal use.) There should be no functional changes, other than reducing output in verbose mode.
* core: redo how codecs are mapped, remove codecs.confwm42013-02-109-250/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* dec_audio: uncrustifywm42013-02-092-193/+203
|
* audio/out, video/out: hide encoding VO/AOwm42013-02-063-8/+19
| | | | | | mpv -ao help and mpv -vo help shouldn't show the encoding outputs (named "lavc" on both cases). Also make it impossible to select these manually when not encoding.
* audio/out: prefer ao_dsound over ao_portaudiowm42013-02-061-3/+3
| | | | | | On Linux, ao_portaudio has weird freezing issues (possibly specific to the ALSA backend, though). Also ao_dsound is more likely to get multi- channel audio output right, and ao_portaudio probably mangles these.
* mixer: prefer AO softvol control over volume filterwm42013-02-062-2/+3
| | | | | | | | | | | | | | | This partially reverts earlier decisions, when I thought it would always be better to prefer the audio volume filter over the AO's, because the AO's relies on the underlying audio-API, which could be broken or exhibit unusual behavior (like it happened with ao_dsound). However, since the audio buffer can be quite large (500 ms), and we don't attempt to flush & refilter the audio on volume changes, always prefer AO volume control (as long as the AO mixer doesn't control the system mixer). Also document what the mixer.c related AO fields mean (hopefully not too brief).
* ao_dsound: support 6.1 and 7.1 channel configurationswm42013-02-061-30/+43
| | | | | | | Instead of doing the channel reordering manually, use the existing support in reorder_ch.c. Untested.
* ao_coreaudio: use 0 as timeout for CFRunLoopRunInModeMad Fish2013-01-201-1/+1
| | | | | | | Handle all pending events and exit instead of waiting. When there are lots of input events (for example, scrolling with trackpad), timeout can add up to make a huge frame delay. In my tests, if I scroll fast enough, that loop would never exit.
* Replace strsep() useswm42013-01-131-2/+7
| | | | | | This function sucks and apparently is not very portable (at least on mingw, the configure check fails). Also remove the emulation of that function from osdep/strsep*, and remove the configure check.
* mixer: keep fractional part of volume settingUoti Urpala2013-01-131-2/+2
| | | | | | | | mixer_setvolume() accepts float values for volume, but used the integer function av_clip() to limit range, losing the fractional part as a side effect. Change the code to use av_clipf() instead. For most uses this shouldn't make any real difference; actual AO volume settings may not have that much precision anyway.
* af_volnorm: fix output range with float inputUoti Urpala2013-01-131-3/+3
| | | | | | | | | af_volnorm can process either int16_t or float audio data. The float version used 0 to INT_MAX as full value range, when it should be 0 to 1. This effectively disabled the filter (due to all input being considered to fall in the silence range). Fix. Reported by Tobias Jacobi <liquid.acid@gmx.net>.
* ao_alsa: do not call snd_pcm_delay() when pausedwm42013-01-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | This causes trouble when a hw device is used: pcm_hw.c:514:(snd_pcm_hw_delay) SNDRV_PCM_IOCTL_DELAY failed (-77): File descriptor in bad state when running mpv test.mkv --ao=alsa:device=iec958,alsa and pausing during playback. Historically, mplayer usually did not call snd_pcm_delay() (which is called by get_delay()) while paused, so this problem never showed up. But at least mpv has changes that cause get_delay() to be called when updating the status line (see commit 3f949cf). It's possible that calling snd_pcm_delay() is not always legal when the audio is paused, and at least fails with the error message mentioned above is the device is a hardware device. Change get_delay() to return the last delay before the audio was paused. The intention is to get a continuous playback status display, even when pausing or frame stepping, otherwise we could just return the audio buffer fill status in get_delay() or even just 0 when paused.
* ao_sdl: fix compilation with Libavwm42013-01-061-0/+1
| | | | | On Libav, <libavutil/fifo.h> doesn't recursively include common.h, but the code in ao_sdl.c uses some macros defined by this header.
* audio: make de-planarization fasterwm42012-12-283-16/+44
| | | | | | Uses the same trick as the planarization code to turn per-sample memcpy calls into mov instructions. Makes decoding a ~25min 48000Hz 2ch floatle audio file faster from 3.8s to 2.7s.
* sdl, encode_lavc: fix copyright headersRudolf Polzer2012-12-282-4/+4
| | | | | | Some of them had changes in 2012; extend their header. Fix project name.
* vo/ao: SDL 1.2+ audio driver, SDL 2.0+ accelerated video driverRudolf Polzer2012-12-282-0/+383
| | | | | | | | | | | This mainly serves as a fallback for platforms where nothing better is available; also as a debugging help. Both the audio and video driver are not first class - the audio driver lacks delay detection, and the video driver only supports a single YUV color space. Configure options: --disable-sdl2 to disable SDL 2.0+ detection, --disable-sdl to disable SDL 1.2+ detection. Both options need to be specified to turn off SDL support entirely.
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-151-6/+7
| | | | | | | | | | | | | | Add `mp_find_config_file` to search different known paths and use that in ass_mp to look for the fontconfig configuration file. Some incidental changes spawned by this feature where: * Buffer allocation for the strings containing the paths is now performed with talloc. All of the allocations are done on a NULL context, but it still improves readability of the code. * Move the OSX function for lookup inside of a bundle: this code path was currently not used by the bundle generated with `make osxbundle`. The plan is to use it again in a future commit to get a fontconfig config file.
* ao_lavc: stop using av_get_alt_sample_fmtRudolf Polzer2012-12-131-6/+6
| | | | Use av_get_planar_sample_fmt instead.
* cleanup: remove ao.brokenptswm42012-12-121-1/+0
| | | | This field was used by ao_v4l2, and is now unused.
* audio: remove support for native alaw/mulaw/adpcm outputwm42012-12-119-1228/+4
| | | | | | This is considered a worthless feature. Note that alaw/mulaw/adpcm input is unaffected: such data is handed to libavcodec and "decoded" to linear PCM.
* audio/decode: remove ad_dvdpcm and use ad_lavc for DVD PCMwm42012-12-112-164/+0
| | | | | | | | | | ad_dvdpcm reads MPEG specific headers directly (passed through codecdata by demux_mpg), so you couldn't use ffmpeg's "pcm_dvd" with demux_mpg. Change demux_mpg to set the correct audio parameters directly. The code for this is taken from ad_dvdpcm. ad_dvdpcm is evil because it still does partial packet reads (with demux_read_data()), and it's redundant to libavcodec anyway.
* audio/decode: remove ad_pcm and use ad_lavc for PCMwm42012-12-113-226/+95
| | | | | | | | | | | | | | | Since libavcodec doesn't have a "generic" PCM decoder, we have to go out of out way to make it look like ad_lavc provides one: make it provide a pseudo "pcm" decoder, which maps some format tags manually to the individual libavcodec PCM decoders. Format tags which uniquely map to one libavcodec could be mapped via codecs.conf. Since defining these in tag_map[] is much shorter (one line vs. a full codec entry in codecs.conf), and since we need tag_map[] anyway, we don't use codecs.conf for these. ad_pcm is evil because it still does partial packet reads (with demux_read_data()), and it's redundant to libavcodec anyway.
* audio: make AC3 pass-through with ad_spdif workreimar2012-12-034-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not fall back to 0 for samplerate when parser is not initialized. Might fix some issues with using -ac spdifenc with audio in MKV or MP4. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35517 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace outdated list of unsupported formats by list of supported formats. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35534 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not call af_fmt2str on the same data over and over. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35535 b3059339-0415-0410-9bf9-f77b7e298cf2 ad_spdif: use the more specific AF_FORMAT_AC3_LE when we handle AC3. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35536 b3059339-0415-0410-9bf9-f77b7e298cf2 Make AF_FORMAT_IS_IEC61937 include AF_FORMAT_IS_AC3. Our AC3 "sample format" is also iec61937. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35537 b3059339-0415-0410-9bf9-f77b7e298cf2 af_format: support endianness conversion also for iec61937 formats in general, not just AC3. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35538 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: audio/filter/af_format.c af_format: Fix check_format, non-special formats are of course supported. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35545 b3059339-0415-0410-9bf9-f77b7e298cf2 Note: see mplayer bug #2110
* audio: improve decoder open failure handlingUoti Urpala2012-12-031-0/+2
| | | | | | | | | | | | | | | | Reinitialize sh_audio->samplesize and sample_format before falling back to another audio decoder (some decoders rely on default values). Remove code setting these fields from demux_mkv and demux_lavf (no decoder should depend on demuxer-set values for these fields). Conflicts: audio/decode/ad_lavc.c Merged from mplayer2 commit 6b9567. The changes to ad_lavc.c are not merged, as they