summaryrefslogtreecommitdiff
path: root/libavcodec/wmaprodec.c
Commit message (Collapse)AuthorAge
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | 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-05
| | | | | | | | | | | 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-05
| | | | | | | | 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-21
| | | | | | | | | | | 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-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-21
| | | | | | | | | | 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-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/wmaprodec: Do not initialize unused variable to out of array valueMichael Niedermayer2021-10-05
| | | | | | | | | 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-17
| | | | | | | | | | | 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-03
|
* avcodec/wmaprodec: improve flushing for >2 channels in XMAPaul B Mahol2021-09-03
|
* avcodec/wmaprodec: improve xma2 extradata parsingPaul B Mahol2021-09-03
|
* avcodec/wmaprodec: unbreak xma >2 channel decoding after last changePaul B Mahol2021-09-03
|
* avcodec/wmaprodec: add gapless supportPaul B Mahol2021-09-02
|
* avcodec/wmaprodec: return value check for init_get_bitsmaryam ebrahimzadeh2021-08-28
| | | | Also replace init_get_bits with init_get_bits8().
* avcodec/wma: Return specific error codeOlivier Crête2021-08-26
| | | | | | | 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-10
| | | | | | | | | | | | | 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-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | 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-08
| | | | | | | | 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-01
| | | | They are not properly namespaced and not intended for public use.
* put_bits: make avpriv_copy_bits() lavc-localAnton Khirnov2020-10-28
| | | | | 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-15
| | | | | | | | 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-10
| | | | | | | | 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-10
| | | | | | | | 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-10
| | | | | | | | | | 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-01
| | | | | | | | 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-09
| | | | | | | | | 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-14
| | | | | | | | | | | | 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-10
| | | | | | | | | 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-03
| | | | | | | | | | 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-10
| | | | | | Writes missing (delay) samples after EOF. Signed-off-by: bnnm <bananaman255@gmail.com>
* avcodec/wmaprodec: support decoding up to 16 channels of xmaMaxton2018-03-01
| | | | Signed-off by: Maxton <maxton@maxton.xyz>
* avcodec/wmaprodec: support multichannel XMA stream configurationsbnnm2017-10-09
| | | | | | Signed-off-by: bnnm <bananaman255@gmail.com> Now accepts any combination of 1/2ch streams, described in the RIFF chunks/extradata
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* avcodec/wmaprodec: reset offsets when error happensPaul B Mahol2017-03-20
| | | | | | Fixes #6250. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* wmaprodec: fix leaking fdsp on init failureAndreas Cadhalpun2017-02-17
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/wmaprodec: add xma_flush for seeking in XMA2Paul B Mahol2017-01-20
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: unbreak XMA mono decodingPaul B Mahol2017-01-20
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: check number of channels for XMA streamsPaul B Mahol2017-01-19
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmapro: redone stream selection for XMA1/2Paul B Mahol2017-01-19
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: >2 channel support for XMAPaul B Mahol2017-01-19
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: do not force extradata presence for XMAPaul B Mahol2017-01-11
| | | | | | Mainly useful for supporting decoding of headerless files. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: cleanup extradata dumpingPaul B Mahol2016-12-22
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* all: move ff_exp10, ff_exp10f, ff_fast_powf to lavu/ffmath.hGanesh Ajjanagadde2016-03-22
| | | | | | | | | | | The idea is to use ffmath.h for internal implementations of math functions. Currently, it is used for variants of libm functions, but is by no means limited to such things. Note that this is not exported; use lavu/mathematics for such purposes. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
* lavc: use get_bitsz to simplify the codeAndreas Cadhalpun2016-01-03
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* lavc/wmaprodec: replace pow(10,x) by ff_exp10(x)Ganesh Ajjanagadde2015-12-25
| | | | Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* avcodec/wmaprodec: Check bits per sample to be within the range not causing ↵Michael Niedermayer2015-12-05
| | | | | | | | | integer overflows Fixes: 549d5aab1480d10f2a775ed90b0342f1/signal_sigabrt_7ffff6ae7cc9_5643_96bbb0cfe3e28be1dadfce1075016345.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Fix overflow of cutoffMichael Niedermayer2015-12-05
| | | | | | | Fixes: 129ca3e28d73af7b1e24a9d4118e7a2d/signal_sigabrt_7ffff6ae7cc9_836_762b310fc3ef6087bd7771e5d8e90b9b.asf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmaprodec: Check for overread in decode_packet()Michael Niedermayer2015-11-15
| | | | | | | | Fixes assertion failure Fixes: 0256e92df2df7e933b43a2c70e4c8040/signal_sigabrt_7ffff6ae7cc9_1358_999ac18684788221490757582ce9af84.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>