summaryrefslogtreecommitdiff
path: root/libavcodec/dvbsubdec.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/dvdsubdec, dvbsubdec: remove bitmap dumping in DEBUG buildssoftworkz2022-06-08
| | | | | | | | | It's been a regular annoyance and often undesired. There will be a subtitle filter which allows to dump individual subtitle bitmaps. Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/codec_internal: Constify AVPacket in decode_sub cbAndreas Rheinhardt2022-04-05
| | | | | | No subtitle decoder ever modifies the AVPacket given to it. 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: Add FFCodec.decode_subAndreas Rheinhardt2022-04-05
| | | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVSubtitle *sub = data;" line for subtitle decoders. Its only downside is that it increases sizeof(FFCodec), yet this can be more than offset lateron. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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>
* avcodec/decode: Fix leaks upon subtitle decoding errorsAndreas Rheinhardt2021-12-16
| | | | | | | | | | | | | | Up until now, various subtitle decoders have not cleaned up the AVSubtitle on error; this task must not be left to the user because the documentation explicitly states that the AVSubtitle "must be freed with avsubtitle_free if *got_sub_ptr is set" (which it isn't on error). Leaks happen upon failure in ff_ass_add_rect() or in ass_decode_frame(); freeing generically also allows to remove now redundant freeing code in pgssubdec and dvbsubdec. While just at it, also reset got_sub_ptr generically on error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Use av_memdup() where appropriateAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dvbsubdec: Make decoder init-threadsafeAndreas Rheinhardt2021-05-02
| | | | | | | | | Note: This decoder uses a static variable in save_display_set() (which is only enabled if DEBUG is defined); yet said function can't be reached from the decoder's init function at all, so it is no problem for setting the FF_CODEC_CAP_INIT_THREADSAFE flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dvbsubdec: Add const where appropriateAndreas Rheinhardt2021-05-02
| | | | | | | | | These pointers sometimes point to static storage (namely to default_clut), so adding const to the pointed-to type is important to ensure that one does not accidentally modify something that is not owned by a single AVCodecContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.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: Remove deprecated AVPicture APIAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in a17a7661906ba295d67afd80ac0770422e1b02b3. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dvbsubdec: Support computing clut only onceMichael Niedermayer2021-03-29
| | | | | | This avoids crafted files from consuming excessive resources recomputing the clut after each pixel change Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dvbsubdec: error out on unsupported coding methodsClément Bœsch2020-08-22
|
* avcodec/dvbsubdec: request samples for missing coding methodsClément Bœsch2020-08-22
|
* avcodec/dvbsubdec: CosmeticsLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/dvbsubdec: prefer to use variable instead of type for sizeofLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/dvbsubdec: simplify code by using OFFSET() macroLimin Wang2020-07-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/dvbsubdec: replace data_size with got_sub_ptr for better readabilityLimin Wang2020-03-25
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dvbsubdec: Use ff_set_dimensions()Michael Niedermayer2019-07-20
| | | | | | | | | Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 'int' Fixes: 15740/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5641749164195840 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/dvbsubdec: Check object positionMichael Niedermayer2019-03-14
| | | | | | | | | | Reference: ETSI EN 300 743 V1.2.1 7.2.2 Region composition segment Fixes: Timeout Fixes: 13325/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5143979392237568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dvbsubdec: Compute scoretab without iterating over pixels multiple ↵Michael Niedermayer2018-06-27
| | | | | | | | | | | times in compute_default_clut() Improves speed 102->2 sec Testcase: 8655/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-6277869285146624 Fixes: Timeout Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dvbsubdec: Avoid re-computing clutMichael Niedermayer2017-11-15
| | | | | | | | Fixes: Timeout Fixes: 3218/clusterfuzz-testcase-5390672154591232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7'James Almer2017-11-06
|\ | | | | | | | | | | | | | | | | | | | | | | * commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7': dvbsubdec: Free subrect memory on allocation error dvbsubdec: Fixed segfault when decoding subtitles See fbb59a3bf4c8668197521b3db5f26d0e93aed1a6 39dfe6801a3f67c2964a829b65e8e38e3cb22217 Merged-by: James Almer <jamrial@gmail.com>
| * dvbsubdec: Free subrect memory on allocation errorVittorio Giovara2017-06-28
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * dvbsubdec: Fixed segfault when decoding subtitlesLorenz Brun2017-06-28
| | | | | | | | | | | | | | | | | | | | This fixes a segfault (originally found in Movian, but traced to libav) when decoding subtitles because only an array of rects is allocated, but not the actual structs it contains. The issue was probably introduced in commit 2383323 where the loop to allocate the rects in the array was thrown away. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * Use bitstream_init8() where appropriateDiego Biurrun2017-02-07
| |
| * dvbsubdec: Convert to the new bitstream readerAlexandra Hájková2017-01-09
| |
* | avcodec/dvbsubdec: Split best score computation out of loop in ↵Michael Niedermayer2017-10-14
| | | | | | | | | | | | | | | | compute_default_clut() 3% faster Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Factor a few expressions out of compute_default_clut()Michael Niedermayer2017-10-14
| | | | | | | | | | | | 32% faster loop Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Check for duplicate regions in dvbsub_parse_page_segment()Michael Niedermayer2017-08-25
| | | | | | | | | | | | | | | | Fixes: OOM Fixes: 3051/clusterfuzz-testcase-minimized-5745818336231424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Check pixel buffer size constraint from ETSI EN 300 743 ↵Michael Niedermayer2017-06-10
| | | | | | | | | | | | | | | | | | | | V1.3.1 Fixes: OOM Fixes: 2143/clusterfuzz-testcase-minimized-5482288060039168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Use av_image_check_size2()Michael Niedermayer2017-06-10
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Check entry_idMichael Niedermayer2017-05-11
| | | | | | | | | | | | | | | | Fixes: randomly writing over the array end Fixes: 1473/clusterfuzz-testcase-minimized-5768907824562176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: check region dimensionsMichael Niedermayer2017-05-08
| | | | | | | | | | | | | | | | Fixes: 1408/clusterfuzz-testcase-minimized-6529985844084736 Fixes: integer overflow Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dvbsubdec: Replace fprintf(stderr) by av_log()Michael Niedermayer2017-04-05
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec'Clément Bœsch2017-04-03
|\| | | | | | | | | | | | | * commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec': dvbsub: cosmetics: Group all debug code together Merged-by: Clément Bœsch <u@pkh.me>
| * dvbsub: cosmetics: Group all debug code togetherDiego Biurrun2016-11-23
| |
* | Merge commit 'b8cd7a3c8df2c3aac8d7a0b5a02d83caf61bd769'Clément Bœsch2017-04-03
|\| | | | | | | | | | | | | | | | | * commit 'b8cd7a3c8df2c3aac8d7a0b5a02d83caf61bd769': dvbsub: Check for errors from system() printf(...) replaced with fprintf(stderr, ...) for logging errors. Merged-by: Clément Bœsch <u@pkh.me>
| * dvbsub: Check for errors from system()Diego Biurrun2016-11-23
| | | | | | | | | | libavcodec/dvbsubdec.c:145:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result] libavcodec/dvbsubdec.c:148:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
* | Merge commit '7effebde78977fafce935776153ea2f7c0981fa3'Clément Bœsch2017-03-19
|\| | | | | | | | | | | | | * commit '7effebde78977fafce935776153ea2f7c0981fa3': dvbsubdec: Remove disabled, near-duplicate debug code Merged-by: Clément Bœsch <u@pkh.me>
| * dvbsubdec: Remove disabled, near-duplicate debug codeDiego Biurrun2016-08-17
| |
| * dvbsubdec: Use NULL instead of 0 as pointer valueDiego Biurrun2016-08-03
| |
* | dvbsubdec: fix division by zero in compute_default_clutAndreas Cadhalpun2016-11-10
| | | | | | | | | | | | | | | | This problem was introduced in commit 4b90dcb8493552c17a811c8b1e6538dae4061f9d. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Merge commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376': Reduce the scope of some variables Merged-by: Clément Bœsch <u@pkh.me>
| * Reduce the scope of some variablesDiego Biurrun2016-05-11
| | | | | | | | | | This avoids unused variable warnings after the next version bump. Also drop a trace level av_log() call that is in the way.
* | avcodec: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
| |
* | Merge commit 'a17a7661906ba295d67afd80ac0770422e1b02b3'Hendrik Leppkes2015-10-22
|\| | | | | | | | | | | | | * commit 'a17a7661906ba295d67afd80ac0770422e1b02b3': lavc: Add data and linesize to AVSubtitleRect Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>