aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/wmaprodec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/wmaprodec: Avoid branch for setting block_alignAndreas Rheinhardt2025-07-031-8/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wma,wmaprodec: Remove always-false checksAndreas Rheinhardt2025-07-031-5/+0
| | | | | | | None of the codecs used here has the AV_CODEC_CAP_CHANNEL_CONF cap set, so the sample rate is checked generically. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: remove deprecated FF_API_SUBFRAMESJames Almer2025-03-281-15/+3
| | | | | | Deprecated since 2023-05-15. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/codec_internal, all: Use macros to set deprecated AVCodec fieldsAndreas Rheinhardt2025-03-101-6/+3
| | | | | | | | | | | | | | The aim of this is twofold: a) Clang warns when setting a deprecated field in a definition and because several of the widely set AVCodec fields are deprecated, one gets several hundred warnings from Clang for an ordinary build. Yet fortunately Clang (unlike GCC) allows to disable deprecation warnings inside a definition, so that one can create simple macros to set these fields that also suppress deprecation warnings for Clang. This has already been done in fdff1b9cbfd8cf5a9810c29efa4baf13a4786742 for AVCodec.channel_layouts. b) Using macros will allow to easily migrate these fields to internal ones. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: Explicitly return 0 on successAndreas Rheinhardt2024-03-281-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: Avoid superfluous VLC structuresAndreas Rheinhardt2023-10-311-34/+39
| | | | | | | | | | For all VLCs here, the number of bits of the VLC is write-only, because it is hardcoded at the call site. Therefore one can replace these VLC structures with the only thing that is actually used: The pointer to the VLCElem table. And in most cases one can even avoid this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vlc: Use proper namespaceAndreas Rheinhardt2023-09-111-7/+7
| | | | | | | | | | | | | | | | Therefore use a proper prefix for this API, e.g. ff_init_vlc_sparse -> ff_vlc_init_sparse ff_free_vlc -> ff_vlc_free INIT_VLC_LE -> VLC_INIT_LE INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC (The ancient INIT_VLC_USE_STATIC has been removed in 595324e143b57a52e2329eb47b84395c70f93087, so that the NEW has been dropped.) Finally, reorder the flags and change their values accordingly. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: deprecate AV_CODEC_CAP_SUBFRAMESAnton Khirnov2023-05-151-3/+15
| | | | There is nothing meaningful the caller can do with it.
* avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_numberMarton Balint2023-02-131-3/+3
| | | | | | | | | | Frame counters can overflow relatively easily (INT_MAX number of frames is slightly more than 1 year for 60 fps content), so make sure we use 64 bit values for them. Also deprecate the old 32 bit frame_number attribute. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/wmaprodec: add missing flush call for xma1Paul B Mahol2023-01-271-0/+1
|
* avcodec/wmaprodec: Remove unused variableAndreas Rheinhardt2022-11-061-1/+1
| | | | | | | Unused since 5f1111e42ea7763d24d74b596285f5daeaa203f7 (replaced by a new "err" variable). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* wmaprodec: convert to lavu/txLynne2022-11-061-10/+14
|
* avcodec/wmaprodec: Use symbol table more efficientlyAndreas Rheinhardt2022-09-071-11/+11
| | | | | | | | | By using a symbol table one can already bake in applying a LUT on the return value of get_vlc2(). So change the symbol table for the vec2 and vec4 tables to avoid using the symbol_to_vec2/4 LUTs. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: Move applying offset to VLC creationAndreas Rheinhardt2022-09-071-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: Use ff_init_vlc_from_lengths() instead of init_vlcAndreas Rheinhardt2022-09-071-21/+21
| | | | | | | It allows to replace tables of big codes (uint16_t and uint32_t) by tables of smaller symbols (mostly uint8_t). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-3/+3
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_get_buffer() to decode.hAndreas Rheinhardt2022-08-271-1/+2
| | | | | | | | | Only used by decoders (encoders have ff_encode_alloc_frame()). Also clean up the other headers a bit while removing now redundant internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-3/+3
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-3/+3
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-051-14/+7
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: ensure channel count in the private context and decoder ↵James Almer2022-03-211-1/+1
| | | | | | | | | | | context are consistent avctx->ch_layout will be reinitialized using channel_mask later in the function. Fixes: 45736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5769886813519872 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-21/+21
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-0/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* wma: convert to new channel layout APIAnton Khirnov2022-03-151-10/+20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/wmaprodec: Do not initialize unused variable to out of array valueMichael Niedermayer2021-10-051-2/+3
| | | | | | | | | Fixes: out of array read Fixes: 39452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-4678745030524928.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check that the EOF frame was allocated before decoding ↵Michael Niedermayer2021-09-171-1/+1
| | | | | | | | | | | into it Fixes: NULL pointer dereference Fixes: 38125/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5151909422432256 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: unbreak old xma2 decodingPaul B Mahol2021-09-031-1/+1
|
* avcodec/wmaprodec: improve flushing for >2 channels in XMAPaul B Mahol2021-09-031-9/+28
|
* avcodec/wmaprodec: improve xma2 extradata parsingPaul B Mahol2021-09-031-3/+5
|
* avcodec/wmaprodec: unbreak xma >2 channel decoding after last changePaul B Mahol2021-09-031-30/+25
|
* avcodec/wmaprodec: add gapless supportPaul B Mahol2021-09-021-59/+99
|
* avcodec/wmaprodec: return value check for init_get_bitsmaryam ebrahimzadeh2021-08-281-2/+7
| | | | Also replace init_get_bits with init_get_bits8().
* avcodec/wma: Return specific error codeOlivier Crête2021-08-261-5/+8
| | | | | | | This way, the calling function can just forward it instead of making it up. Signed-off-by: Olivier Crête <olivier.crete@collabora.com>
* avcodec/wmaprodec: Make decoders init-threadsafeAndreas Rheinhardt2021-05-101-36/+39
| | | | | | | | | | | | | In this case this actually fixes a potential data race: The static VLC tables were reinitialized every time an AVCodecContext has been initialized; while the mutex in avcodec_open2() ensured that the VLCs could not be initialized concurrently by multiple threads, nothing guaranteed that these VLCs are not read concurrently (when decoding a packet with an already initialized AVCodecContext) while another thread initializes them. This is undefined behaviour despite the values being written coinciding with the earlier values. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wmaprodec: Check ff_mdct_init() for failureAndreas Rheinhardt2021-05-101-5/+8
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-3/+3
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/wmaprodec: Check packet sizeMichael Niedermayer2021-01-081-0/+6
| | | | | | | | Fixes: left shift of negative value -25824 Fixes: 27754/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5760255962906624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-011-0/+2
| | | | They are not properly namespaced and not intended for public use.
* put_bits: make avpriv_copy_bits() lavc-localAnton Khirnov2020-10-281-2/+2
| | | | | It is not used outside of lavc anymore. Keep the avpriv exported symbol around until the next bump to preserve ABI compatibility.
* avcodec/wmaprodec: Fixes integer overflow with 32bit samplesMichael Niedermayer2019-12-151-1/+1
| | | | | | | | Fixes: left shift of 1 by 31 places cannot be represented in type 'int' Fixes: 18860/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5755223125786624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Set packet_loss when we error out on a sanity checkMichael Niedermayer2019-12-101-0/+1
| | | | | | | | Fixes: left shift of negative value -34 Fixes: 18719/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5642658173419520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check offsetMichael Niedermayer2019-12-101-0/+5
| | | | | | | | Fixes: index 33280 out of bounds for type 'float [32768]' Fixes: 18718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5635373899710464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check if the channel sum of all internal contexts match ↵Michael Niedermayer2019-12-101-0/+2
| | | | | | | | | | the external Fixes: NULL pointer dereference Fixes: 18689/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5715114640015360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Fix buflen computation in save_bits()Michael Niedermayer2019-12-011-3/+3
| | | | | | | | Fixes: Assertion failure Fixes: 18630/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5201588654440448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: get frame during frame decodeMichael Niedermayer2019-11-091-4/+6
| | | | | | | | | Fixes: memleak Fixes: 17615/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5681306024804352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check that the streams channels do not exceed the overall ↵Michael Niedermayer2019-10-141-1/+1
| | | | | | | | | | | | channels Fixes: NULL pointer dereference Fixes: 18075/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5708262036471808 Fixes: 18087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5740627634946048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Fix cleanup on errorMichael Niedermayer2019-10-101-0/+7
| | | | | | | | | Fixes: memleaks Fixes: 18023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5642535011090432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check if there is a streamMichael Niedermayer2019-10-031-1/+3
| | | | | | | | | | Fixes: null pointer dereference Fixes: signed integer overflow: 512 * 2147483647 cannot be represented in type 'int' Fixes: 17809/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5634409947987968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: improve XMA missing samplesbnnm2018-11-101-3/+32
| | | | | | Writes missing (delay) samples after EOF. Signed-off-by: bnnm <bananaman255@gmail.com>