summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ad_ffmpeg.c
Commit message (Collapse)AuthorAgeFilesLines
* Update Libav API usesUoti Urpala2012-02-011-12/+15
| | | | | | | | | | | | | | | | | | | Change various code to use the latest Libav API. The libavcodec error_recognition setting has been removed and replaced with different semantics. I removed the "--lavdopts=er=<value>" option accordingly, as I don't think it's widely enough used to be worth attempting to emulate the old option semantics using the new API. A new option with the new semantics can be added later if needed. Libav dropped APIs that were necessary with all Libav versions until quite recently (like setting avctx->age), and it would thus not be possible to keep compatibility with previous Libav versions without adding workarounds. The new APIs also had some bugs/limitations in the recent Libav release 0.8, and it would not work fully (at least some avcodec options would not be set correctly). Because of those issues, this commit makes no attempt to maintain compatibility with anything but the latest Libav git head. Hopefully the required fixes and improvements will be included in a following Libav point release.
* ad_ffmpeg: pass packet side data from libavformatUoti Urpala2012-01-081-13/+26
| | | | | Pass avpacket->side_data when using a libavcodec audio decoder together with libavformat demuxer (this was already done for video).
* Libav API updates (remove most deprecated-in-0.7 uses)Uoti Urpala2011-12-221-2/+1
| | | | | | | | Update various code using Libav libraries to remove use of API features that were deprecated at Libav release 0.7. I think this removes them all with the exception of URLContext functions still used in stream_ffmpeg.c (at least other uses that generated deprecation warnings with libraries from 0.7 are removed).
* ad_ffmpeg: avoid avcodec_close() if avcodec_open() failedUoti Urpala2011-12-061-1/+1
| | | | | | Avoid calling avcodec_close() in uninit() if avcodec_open() failed. Calling avcodec_close() on a non-open codec context causes a crash with recent Libav versions.
* ad_ffmpeg: free resources on init failureUoti Urpala2011-08-211-4/+12
| | | | | | | | | | ad_ffmpeg init() function did not free resources if opening failed. Outside code (dec_audio.c) does not automatically call uninit() if init() returns failure, and the uninit function would have crashed in some cases had it been called (it did freed lavc_context->extradata, but lavc_context could have been NULL after early init failure). Add explicit calls to uninit() after failure and make uninit function safe to call at any point.
* ad_ffmpeg: handle timing for partially decoded packets betterUoti Urpala2011-08-211-7/+23
| | | | | | | | | | | | | | | | | | | | | | | At least the libavcodec WavPack decoder can return output for an audio frame in multiple parts and return 0 bytes input consumed for the initial parts. Timing info was not set correctly in this case: sh_audio->pts and pts_bytes were reset each time when decoding more from the packet, as if the packet had been new (ds_get_packet_pts() has a check to return MP_NOPTS_VALUE if the packet has already been partially read, but that didn't trigger since libavcodec returned exactly 0 bytes read so the demuxer-visible packet state didn't change). Add a field to keep track of whether a packet has already been decoded from, and don't reset timing info again if so. Adding the field requires adding a decoder context to store it (there wasn't one before). BTW the WavPack decoder behavior and avcodec_decode_audio3() documentation don't match - the documentation says the return value is "zero if no frame data was decompressed (used) from the input AVPacket", while the decoder DOES return some frame data which comes from the input packet.
* cosmetics: ad_ffmpeg.c: reformatUoti Urpala2011-08-211-131/+137
|
* cleanup: do libav* initialization on startupUoti Urpala2011-07-181-2/+0
| | | | | | | Do the global initialization of libavcodec and libavformat (avcodec_register_all(), av_register_all()) immediately on program startup and remove the initialization calls from various individual modules that use libavcodec/libavformat functionality.
* ad_ffmpeg: return failure from init() if initial decode failsUoti Urpala2011-05-031-6/+13
| | | | | | | | | | | | | | The init() method in ad_ffmpeg tries to decode some audio data after opening the libavcodec decoder; however the method returned success even if this part failed. Change it to return failure instead, indicating that the codec could not be successfully opened. This improves behavior at least with some AAC files, for which the libavcodec decoder can be successfully initialized but decoding packets always fails. Before the audio would be decoded with libavcodec, producing only a constant stream of errors; after this commit audio decoder initialization falls back to FAAD (if available) which works for these samples.
* Update libav API usesUoti Urpala2011-04-201-1/+1
| | | | | | | | | | | Update various code to use newer alternatives instead of deprecated functions/fields that are being dropped at libav API bump. An exception is avcodec_thread_init() which is being dropped even though it's still _necessary_ with fairly recent libav versions, so there's no good alternative which would work with both those recent versions and latest libavcodec. I think there are grounds to consider the drop premature and revert it for now; if that doesn't happen I'll add a version-test #if check around it later.
* ad_ffmpeg: add missing extradata paddingUoti Urpala2011-02-021-1/+2
| | | | | | One of two alternative code parts passing codec extradata to libavcodec didn't add the buffer padding that libavcodec requires, resulting in invalid reads beoynd allocated memory area. Fix.
* demux_mkv, ad_ffmpeg: use Matroska OutputSamplingFrequency if availableUoti Urpala2010-11-211-11/+16
| | | | | | | | | | | | | | | | | | Use the value of the OutputSamplingFrequency element instead of the SamplingFrequency element as the "container samplerate". In most cases this only removes a warning, as those typically differ for SBR AAC files and there was already a special case detecting this in ad_ffmpeg. The implementation adds a new "container_out_samplerate" field to the sh_audio struct. Reusing the existing "samplerate" field and the equivalent inside the 'wf' struct and just setting those to the new value instead would probably work (at least I'm not aware of any codec that would need the original SamplingFrequency for initialization). However using a separate field also avoids some ugliness: the 'wf' struct may not exist (though most demuxers create it), and the 'samplerate' field is overwritten to reflect the final value decided by codec when decoding is first initialized.
* ad_ffmpeg: Handle EAGAIN, needed for LATM to work properly with demux_tsreimar2010-11-081-0/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32583 b3059339-0415-0410-9bf9-f77b7e298cf2
* options: move audio_output_channels, audio_output_format to structUoti Urpala2010-11-021-1/+1
|
* cleanup: malloc+memset->calloc, sizeof(TYPE)->sizeof(*ptr)reimar2010-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32181 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32182 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32183 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace some sizeof(type) by sizeof(*pointer) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32184 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32186 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32187 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32188 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizoef(type) by sizeof(*ptrvar). Besides being consistent with FFmpeg style, this reduces the size of a patch to rename these types to not conflict with the windows.h definitions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32189 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32191 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32192 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) by sizeof(*ptrvar) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32193 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32194 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32195 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32196 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace several sizeof(WAVEFORMATEX) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32197 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace one more instance of sizeof(WAVEFORMATEX); fix compilation. patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32199 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid some pointless uses of sizeof() and one related cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32200 b3059339-0415-0410-9bf9-f77b7e298cf2 Merge one malloc() + memset() invocation into calloc(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32202 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32203 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(WAVEFORMATEX) occurrences. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32205 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32206 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(BITMAPINFOHEADER) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32207 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add central init_avcodec() to avoid duplicated libavcodec init codediego2010-11-021-6/+2
| | | | | | | | | | | | | | | | Patch by Vlad Seryakov, vseryakov gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32043 b3059339-0415-0410-9bf9-f77b7e298cf2 Refactor more instances of avcodec_initialized handling into init_avcodec(). This is a leftover from the previous commit. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32044 b3059339-0415-0410-9bf9-f77b7e298cf2 Add missing #include for vd_ffmpeg.h; fixes the warning: libmpcodecs/vf_zrmjpeg.c:472: warning: implicit declaration of function 'init_avcodec' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32176 b3059339-0415-0410-9bf9-f77b7e298cf2
* ad_ffmpeg, vd_ffmpeg: remove pointless castsdiego2010-11-021-1/+1
| | | | | | | | Remove pointless casts of avcodec_find_decoder_by_name() return value. avcodec_find_decoder_by_name() already returns AVCodec*, so there is no need to cast the return value to this type. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32007 b3059339-0415-0410-9bf9-f77b7e298cf2
* audio: support parameter changes (e.g. channel count) during playbackreimar2010-11-021-21/+49
| | | | | | | | | | | | | | | | | Add support for parameter changes (e.g. channel count) during playback. This makes decoding AC3 files that switch between 2 and 6 channels work reasonably well even with -channels 6 and ffac3 decoder. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31737 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix typo in error message: ACC -> AAC git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32473 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid printing AAC with SBR warning on every decode call, instead print it only after every decoder reconfiguration. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32476 b3059339-0415-0410-9bf9-f77b7e298cf2
* ad_ffmpeg: set lavc drc_scale parameter according to opts->drc_levelUoti Urpala2010-06-021-0/+3
|
* ad_ffmpeg: prefer codec to container samplerate for ffaacUoti Urpala2010-03-211-1/+6
| | | | | | Container-level information can be unreliable for AAC because of SBR handling problems, so use the samplerate value from the codec instead.
* Delete things related to old translation systemUoti Urpala2010-03-101-1/+0
| | | | | Remove the help/ subdirectory, configure code to create toplevel help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
* Merge svn changes up to r30463Uoti Urpala2010-03-091-0/+18
|\ | | | | | | | | | | Note that r30455 is wrong, that commit does not in fact change the default behavior as claimed in the commit message. It only breaks "-af-adv force=0", which was already pretty much useless though.
| * Add missing license headers to all files in the libmpcodecs directory.diego2010-01-301-0/+18
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30463 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r30437Uoti Urpala2010-01-281-0/+1
|\|
| * Reset the parser on seek. Should fix some cases of audio "blips" after seeking.reimar2010-01-241-0/+1
| | | | | | | | | | | | | | AC3 is still broken due to the libavcodec parser being broken. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30421 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r30322Uoti Urpala2010-01-251-1/+1
|\|
| * We only need to disable seeking back in ad_ffmpeg when we actually _use_reimar2010-01-151-1/+1
| | | | | | | | | | | | | | | | a parser, not when just needs_parsing is set. Fixes playback of e.g. ADPCM in AVI like http://samples.mplayerhq.hu/avi/imaadpcm.avi git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30314 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r30136Uoti Urpala2009-12-301-2/+13
|\| | | | | | | Ignore another broken correct-pts change in 30134.
| * Add support for parsing audio streams (though should be easy to extend to video)reimar2009-12-271-2/+13
| | | | | | | | | | | | | | | | | | | | | | via libavcodec. Parsing can be done at the demuxer stage (currently disabled) or at the decoder (ad_ffmpeg, enabled). Should allow using the libavcodec AAC, DTS, ... decoders independent of container format. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30130 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29971Uoti Urpala2009-11-291-1/+1
|\|
| * when using -v, print also which lavc codec has been used, notattila2009-11-281-1/+1
| | | | | | | | | | | | | | just that the init was ok git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29970 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29962Uoti Urpala2009-11-231-1/+5
|\|
| * Switch ad_ffmpeg to avcodec_decode_audio3reimar2009-11-221-1/+5
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29955 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Remove unused variable.reimar2009-11-221-1/+0
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29954 b3059339-0415-0410-9bf9-f77b7e298cf2
* | cosmetics: remove some unused variablesUoti Urpala2009-11-171-1/+0
| |
* | Merge svn changes up to r29912Uoti Urpala2009-11-161-8/+1
|\|
| * ad_ffmpeg: Fix channel layout for ffvorbis and ffaactack2009-11-041-8/+1
| | | | | | | | | | | | | | | | | | | | | | Patch submitted by Nicolas George, nicolas.george normalesup org The layout exceptions removed by this patch were rendered unnecessary by changes in ffmpeg which normalize channel layout for aac (r20067) and vorbis (r20148). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29821 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29752Uoti Urpala2009-10-061-0/+1
|\| | | | | | | | | | | | | | | | | As part of merging subtitle-in-terminal changes make update_subtitles() only clear existing subtitles if called with the reset argument, and not try to set new ones. Later calls should set the needed new subtitles, and this change avoids some problems with trying to set subtitles when mp_property_sub() in command.c gets called from initialization code before full initialization.
| * Make sure avctx->codec_type and codec_id are set, since libavcodecreimar2009-09-231-0/+1
| | | | | | | | | | | | | | | | | | currently requires that. That probably is an unintended API change and should be fixed/reverted in lavc but it hurts little to workaround here. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29709 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29644Uoti Urpala2009-09-041-1/+4
|\|
| * Reindentreimar2009-08-261-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29554 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Retry deciding to get audio parameters several times on errors, this avoidsreimar2009-08-261-0/+3
| | | | | | | | | | | | | | failing to init the decoder completely just because the first packet is broken. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29553 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29544Uoti Urpala2009-08-221-14/+6
|\|
| * Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,tack2009-08-181-14/+6
| | | | | | | | | | | | | | | | | | ffdca, ffflac, ffaac, fftruehd). In the process, adds support for 32-bit samples. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29533 b3059339-0415-0410-9bf9-f77b7e298cf2
| * whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-8/+8
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Remove trailing whitespace from most filesUoti Urpala2009-07-071-7/+7
| |
* | Translation system changes part 2: replace macros by stringsAmar Takhar2009-07-071-3/+3
| | | | | | | | | | Replace all MSGTR_ macros in the source by the corresponding English string.
* | Translation system changes part 1: wrap translated stringsAmar Takhar2009-07-071-3/+3
| | | | | | | | | | Replace mp_msg() calls which have a translated string as the format argument with mp_tmsg and add _() around all other translated strings.
* | Merge svn changes up to r29277Uoti Urpala2009-05-081-1/+2
|\|
| * Fix E-AC-3 channel ordering. E-AC-3 needs to use the same ordering as AC-3,diego2009-04-121-1/+2
| | | | | | | | | | | | | | | | not the standard ordering. patch by Andrew de Quincey, adq_dvb lidskialf net git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29173 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r29117Uoti Urpala2009-04-011-1/+10
|\|
| * Support FFmpeg codecs that decode to other formats than S16.reimar2009-03-181-1/+10
| | | | | | | | | | | | | | Double format is currently not supported. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28990 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to 27824Uoti Urpala2008-10-251-0/+2
|\| | | | | | | | | | | |