summaryrefslogtreecommitdiffstats
path: root/audio/decode/ad_mpg123.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: make decoders output refcounted frameswm42014-11-101-9/+10
| | | | | | | | | | | | | | This rewrites the audio decode loop to some degree. Audio filters don't do refcounted frames yet, so af.c contains a hacky "emulation". Remove some of the weird heuristic-heavy code in dec_audio.c. Instead of estimating how much audio we need to filter, we always filter full frames. Maybe this should be adjusted later: in case filtering increases the volume of the audio data, we should try not to buffer too much filter output by reducing the input that is fed at once. For ad_spdif.c and ad_mpg123.c, we don't avoid extra copying yet - it doesn't seem worth the trouble.
* audio: change playback restart and resyncingwm42014-07-281-1/+3
| | | | | | | | | | | | | | | | | | | | | This commit makes audio decoding non-blocking. If e.g. the network is too slow the playloop will just go to sleep, instead of blocking until enough data is available. For video, this was already done with commit 7083f88c. For audio, it's unfortunately much more complicated, because the audio decoder was used in a blocking manner. Large changes are required to get around this. The whole playback restart mechanism must be turned into a statemachine, especially since it has close interactions with video restart. Lots of video code is thus also changed. (For the record, I don't think switching this code to threads would make this conceptually easier: the code would still have to deal with external input while blocked, so these in-between states do get visible [and thus need to be handled] anyway. On the other hand, it certainly should be possible to modularize this code a bit better.) This will probably cause a bunch of regressions.
* audio: fix timestampswm42014-07-241-1/+0
| | | | | | | | | Accidentally broken in b6af44d3. For ad_lavc (and in general), the PTS was not updated correctly when filtering only parts of audio frames, and for ad_mpg123 and ad_spdif the PTS was additionally offset by the frame size. This could lead to incorrect time display, and possibly broken A/V sync.
* audio: move initial decode to generic codewm42014-07-211-142/+68
| | | | | | | | | | | | This commit mainly moves the initial decoding of data (done to probe the audio format) to generic code. This will make it easier to make audio decoding non-blocking in a later commit. This commit also changes how decoders return data: instead of having them write the data into a prepared buffer, they return a reference to an internal buffer (by setting dec_audio.decoded). This makes it significantly easier to handle audio format changes, since the decoders don't really need to care anymore.
* audio: use symbolic constants instead of magic integerswm42014-07-201-4/+3
| | | | Similar to commit 26468743.
* af_fmt2bits: change to af_fmt2bps (bytes/sample) where appropriateMarcoen Hirschberg2014-05-281-1/+1
| | | | | | In most places where af_fmt2bits is called to get the bits/sample, the result is immediately converted to bytes/sample. Avoid this by getting bytes/sample directly by introducing af_fmt2bps.
* audio: rename i_bps to 'bitrate' to avoid confusionMarcoen Hirschberg2014-05-281-2/+2
| | | | Since i_bps now contains bits/sec, rename it to reflect this change.
* audio: change values from bytes-per-second to bits-per-secondMarcoen Hirschberg2014-05-281-5/+7
| | | | | | | The i_bps members of the sh_audio and dev_video structs are mostly used for displaying the average audio and video bitrates. Keeping them in bits-per-second avoids truncating them to bytes-per-second and changing them back lateron.
* audio: mp_msg conversionswm42013-12-211-9/+7
|
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* cosmetics: rename video/audio reset functionswm42013-11-271-1/+1
| | | | | | | | | | These used the suffix _resync_stream, which is a bit misleading. Nothing gets "resynchronized", they really just reset state. (Some audio decoders actually used to "resync" by reading packets for resuming playback, but that's not the case anymore.) Also move the function in dec_video.c to the top of the file.
* audio: remove ad_driver.preinitwm42013-11-231-1/+3
| | | | | This never had any real use. Get rid of dec_audio.initialized too, as it's redundant.
* audio: don't write decoded audio format to sh_audiowm42013-11-231-6/+4
| | | | | | | | sh_audio is supposed to contain file headers, not whatever was decoded. Fix this, and write the decoded format to separate fields in the decoder context, the dec_audio.decoded field. (Note that this field is really only needed to communicate the audio format from decoder driver to the generic code, so no other code accesses it.)
* audio: move decoder context from sh_audio into new structwm42013-11-231-56/+54
| | | | | | | | | Move all state that basically changes during decoding or is needed in order to manage decoding itself into a new struct (dec_audio). sh_audio (defined in stheader.h) is supposed to be the audio stream header. This should reflect the file headers for the stream. Putting the decoder context there is strange design, to say the least.
* audio: fix mid-stream audio reconfigurationwm42013-11-181-0/+5
| | | | | | | | | | | | | | | | | | | | | Commit 22b3f522 not only redid major aspects of audio decoding, but also attempted to fix audio format change handling. Before that commit, data that was already decoded but not yet filtered was thrown away on a format change. After that commit, data was supposed to finish playing before rebuilding filters and so on. It was still buggy, though: the decoder buffer was initialized to the new format too early, triggering an assertion failure. Move the reinit call below filtering to fix this. ad_mpg123.c needs to be adjusted so that it doesn't decode new data before the format change is actually executed. Add some more assertions to af_play() (audio filtering) to make sure input data and configured format don't mismatch. This will also catch filters which don't set the format on their output data correctly. Regression due to planar_audio branch.
* audio: drop "_NE"/"ne" suffix from audio formatswm42013-11-151-3/+3
| | | | | | You get the native format by not appending any suffix to the format. This change includes user-facing names, e.g. for the --format option.
* audio: add support for using non-interleaved audio from decoders directlywm42013-11-121-240/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | Most libavcodec decoders output non-interleaved audio. Add direct support for this, and remove the hack that repacked non-interleaved audio back to packed audio. Remove the minlen argument from the decoder callback. Instead of forcing every decoder to have its own decode loop to fill the buffer until minlen is reached, leave this to the caller. So if a decoder doesn't return enough data, it's simply called again. (In future, I even want to change it so that decoders don't read packets directly, but instead the caller has to pass packets to the decoders. This fits well with this change, because now the decoder callback typically decodes at most one packet.) ad_mpg123.c receives some heavy refactoring. The main problem is that it wanted to handle format changes when there was no data in the decode output buffer yet. This sounds reasonable, but actually it would write data into a buffer prepared for old data, since the caller doesn't know about the format change yet. (I.e. the best place for a format change would be _after_ writing the last sample to the output buffer.) It's possible that this code was not perfectly sane before this commit, and perhaps lost one frame of data after a format change, but I didn't confirm this. Trying to fix this, I ended up rewriting the decoding and also the probing.
* ad_mpg123: reduce ifdefferywm42013-11-121-47/+2
| | | | Drop support for anything before 1.14.0.
* Remove sh_audio->samplesizewm42013-11-091-5/+1
| | | | | | | | | This member was redundant. sh_audio->sample_format indicates the sample size already. The TV code is a bit strange: the redundant sample size was part of the internal TV interface. Assume it's really redundant and not something else. The PCM decoder ignores the sample size anyway.
* ad_mpeg123: support in-stream format changesThomas Orgis2013-10-061-61/+88
| | | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36461 b3059339-0415-0410-9bf9-f77b7e298cf2 Fixes playback of http://mpg123.org/test/44and22.mp3 Cherry-picked from MPlayer SVN rev. #36461, a patch by Thomas Orgis, committed by by Reimar Döffinger.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-1/+1
| | | | Followup commit. Fixes all the files references.
* audio/decode: remove macro crapwm42013-07-221-3/+12
| | | | | Declare decoders directly, instead of using the LIBAD_EXTERN macro. This is simpler (no weird magic) and more extensible.
* demux: remove facility for partial packet readswm42013-07-111-9/+7
| | | | | | | | | | | | | | | | | | Partial packet reads were needed because the video/audio parsers were working on top of them. So it could happen that a parser read a part of a packet, and returned that to the decoder. With libavformat/libavcodec, packets are already parsed, and everything is much simpler. Most of the simplifications in ad_spdif could have been done earlier. Remove some other stuff as well, like the questionable slave mode start time reporting (could be replaced by proper code, but we don't bother). Remove the unused skip_audio_frame() functionality as well (it was used by old demuxers). Some functions become private to demux.c, like demux_fill_buffer(). Introduce new packet read functions, which have simpler semantics. Packets returned from them are owned by the caller, and all packets in the demux.c packet queue are considered unread. Remove special code that dropped subtitle packets with size 0. This used to be needed because it caused special cases in the old code.
* options: remove --stereowm42013-06-131-12/+1
| | | | | | | Whatever this was supposed to be originally, it doesn't have much value anymore. It just forced ad_mpg123 to upmix mono to stereo by default (the audio chain can do that). As an option, it was mostly useless and misleading, so get rid of it.
* Merge branch 'audio_changes'wm42013-05-121-1/+1
|\ | | | | | | | | Conflicts: audio/out/ao_lavc.c
| * core: use channel map on demuxer level toowm42013-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps passing the channel layout correctly from decoder to audio filter chain. (Because that part "reuses" the demuxer level codec parameters, which is very disgusting.) Note that ffmpeg stuff already passed the channel layout via mp_copy_lav_codec_headers(). So other than easier dealing with the demuxer/decoder parameters mess, there's no real advantage to doing this. Make the --channels option accept a channel map. Since simple numbers map to standard layouts with the given number of channels, this is downwards compatible. Likewise for demux_rawaudio.
* | audio/decode: remove vararg from ad_control()wm42013-04-121-1/+1
|/ | | | | This was unused and dumb. Ancient MPlayer used varargs instead of void* arguments for control() functions, and this was the last leftover.
* core: redo how codecs are mapped, remove codecs.confwm42013-02-101-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Rename directories, move files (step 1 of 2) (does not compile)wm42012-11-121-0/+489
Tis drops the silly lib prefixes, and attempts to organize the tree in a more logical way. Make the top-level directory less cluttered as well. Renames the following directories: libaf -> audio/filter libao2 -> audio/out libvo -> video/out libmpdemux -> demux Split libmpcodecs: vf* -> video/filter vd*, dec_video.* -> video/decode mp_image*, img_format*, ... -> video/ ad*, dec_audio.* -> audio/decode libaf/format.* is moved to audio/ - this is similar to how mp_image.* is located in video/. Move most top-level .c/.h files to core. (talloc.c/.h is left on top- level, because it's external.) Park some of the more annoying files in compat/. Some of these are relicts from the time mplayer used ffmpeg internals. sub/ is not split, because it's too much of a mess (subtitle code is mixed with OSD display and rendering). Maybe the organization of core is not ideal: it mixes playback core (like mplayer.c) and utility helpers (like bstr.c/h). Should the need arise, the playback core will be moved somewhere else, while core contains all helper and common code.