aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ccaption_dec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/ccaption_dec: Use static_assert instead of _Static_assertAndreas Rheinhardt2024-03-181-3/+4
| | | | | | The latter is not supported by MSVC 19.27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ccaption_dec: use consistent naming convention of Closed CaptionsMarth642024-03-101-2/+2
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* avcodec/ccaption_dec: clarify log message when out-of-display columns are ↵Marth642024-03-101-1/+1
| | | | | | ignored Signed-off-by: Marth64 <marth64@proxyid.net>
* avcodec/ccaption_dec: Avoid relocations for stringsAndreas Rheinhardt2024-03-081-100/+115
| | | | | | | | | | | | | The longest string here takes four bytes, so using an array of pointers is wasteful even when ignoring the cost of relocations; the lack of relocations also implies that this array will now be put into .rodata and not into .data.rel.ro. Static asserts are used to ensure that all strings are always properly zero-terminated. Tested-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+1
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-1/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ccaption_dec: simplify init functionPaul B Mahol2023-05-201-7/+1
|
* avcodec/ccaptions_dec: correct flushing output on EOFPaul B Mahol2023-05-181-0/+1
| | | | Prevents infinite flushing same last output.
* avcodec/ccaption_dec: return the number of bytes decodedwang-bin2023-02-201-1/+1
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | 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: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-1/+0
| | | | | | | | | | | 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: Constify AVPacket in decode_sub cbAndreas Rheinhardt2022-04-051-1/+1
| | | | | | 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-051-1/+1
| | | | | | | | | | | 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-051-3/+3
| | | | | | | | | 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-211-7/+7
| | | | | | | | | | | | | | | | 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-1/+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>
* avcodec/ccaption_dec: Use ff_ass_add_rect2()Michael Niedermayer2022-03-181-3/+4
| | | | | | | | Fixes: Timeout Fixes: 42258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CCAPTION_fuzzer-5540144118104064 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: Make real-time latency configurablePavel Koshevoy2021-06-181-1/+3
| | | | | | | | | | | Un-hardcode the 200ms minimum latency between emitting subtitle events so that those that wish to receive a subtitle event for every screen change could do so. The problem with delaying realtime output by any amount is that it is unknown when the next byte pair that would trigger output will happen. It may be within 200ms, or it may be several seconds later -- that's not realtime at all.
* avcodec: Mark ff_ass_subtitle_header based decoders as init-threadsafeAndreas Rheinhardt2021-05-021-0/+2
| | | | | | | ff_ass_subtitle_header_full() just uses av_asprintf() and is therefore thread-safe itself. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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/ccaption_dec: add support for background colorsPaul B Mahol2020-06-231-4/+64
|
* avcodec/ccaption_dec: use uint8_t type for prev_cmd arrayPaul B Mahol2020-06-201-1/+1
| | | | Commands are unsigned so be consistent.
* avcodec/ccaption_dec: do not modify packet data in case of parity errorPaul B Mahol2020-06-201-8/+8
| | | | To dissallow similar errors in future, make pointers const.
* avcodec/ccaption_dec: allow selection of second field captionsPaul B Mahol2020-06-201-3/+12
|
* avcodec/ccaption_dec: rework non-real-time mode with pop-on captions by delayingPaul B Mahol2020-06-201-49/+68
| | | | So it give similar output as visual output of real-time mode.
* avcodec/ccaption_dec: do not modify pkt data and stop removing parity bit twicePaul B Mahol2020-06-171-6/+1
|
* avcodec/ccaption_dec: remove usage of extra bufferPaul B Mahol2020-06-161-12/+1
|
* avcodec/ccaption_dec: fix some small style issuesPaul B Mahol2020-06-161-6/+5
|
* avcodec/ccaption_dec: remove pts parameter from handle_char()Paul B Mahol2020-06-161-4/+4
|
* avcodec/ccaption_dec: add support for colorsPaul B Mahol2020-06-151-8/+35
|
* avcodec/ccaption_dec: switch active screen in end of caption earlyPaul B Mahol2020-06-131-1/+2
| | | | Fixes dropping of last caption.
* avcodec/ccaption_dec: remove unused arguments from functionPaul B Mahol2020-06-131-2/+2
|
* avcodec/ccaption_dec: check for error codesPaul B Mahol2020-06-131-12/+25
|
* avcodec/ccaption_dec: Add a blank like at the end to avoid rollup reading ↵Michael Niedermayer2019-04-211-4/+4
| | | | | | | | | | | from outside Fixes: index 20 out of bounds for type 'const char *[4][128]' Fixes: 14367/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CCAPTION_fuzzer-5718819672162304 Reviewed-by: Paul B Mahol <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodecc/ccaption_dec: remove extra word from long codec descriptionPaul B Mahol2017-01-251-1/+1
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/ccaption_dec: Use simple array instead of AVBufferMichael Niedermayer2016-09-091-16/+11
| | | | | | | | | | This is simpler and fixes an out of array read, fixing it with AVBuffers would be more complex Fixes: e00d9e6e50e5495cc93fea41147b97bb/asan_heap-oob_12dcdbb_8798_b32a97ea722dd37bb5066812cc674552.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: default rollup to row 10Aman Gupta2016-07-181-1/+2
| | | | | | | | | This ensures that captions are written towards the bottom of the screen when tuning into mid-stream. The row will be reset on the receipt of the next PAC command. Row 10 was chosen as it corresponds to the value of "0" in a PAC (see row_map in handle_pac()). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: implement positioning for closed captionsAman Gupta2016-07-181-3/+26
| | | | | | Positioning math is based on the guidelines in https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: change write_char() to void as return value is unusedAman Gupta2016-07-171-4/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: Fix mixed declaration and statement.Michael Niedermayer2016-06-281-1/+2
| | | | | Found-by: ubitux Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ccaption_dec: implement tab offset commandsAman Gupta2016-06-281-0/+5
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/ccaption_dec: remove usage of avctx->time_baseClément Bœsch2016-04-021-7/+8
| | | | | | | | | | lavc/utils already rescales avpkt->pts to sub->pts in AV_TIME_BASE_Q before calling the decode callback. This prevents from rescaling again into the decoder, and avoid the use of avctx->time_base which will disappear in the incoming codecpar merge. This commit also replaces the use of "20 centisecond" (ass time base) with "200 ms".
* lavc/options: add ass_ro_flush_noop to flags2Clément Bœsch2016-02-261-1/+2
|
* lavc: allow subtitle text format to be ASS without timingClément Bœsch2016-02-261-13/+11
|
* lavc/ccaption_dec: implement special and extended character setsAman Gupta2016-02-171-3/+149
| | | | character sets implemented as defined in https://en.wikipedia.org/wiki/EIA-608#Characters
* lavc/ccaption_dec: do not ignore repeated character commandsAman Gupta2016-02-171-9/+10
| | | | | | | | | | | control codes in a cc stream can be repeated, and must be ignored. however, repeated characters must not be ignored. the code attempted to wipe prev_cmd in handle_char to allow repeated characters to be processed, but prev_cmd would previously get reset _after_ handle_char() i also moved the prev_cmd reset out from handle_char() so it can be re-used for special character sets, which _must_ be ignored when repeated.
* avcodec/ccaption_dec: Fix mixed declarations and codeMichael Niedermayer2016-01-191-1/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/ccaption_dec: clear all unused rows during rollupAman Gupta2016-01-141-1/+4
| | | | | | Sometimes rollup captions can move around the screen. This fixes "ghost" captions from below the current rollup area from continuing to be captured when a rollup moves higher up on the screen.
* lavc/ccaption_dec: clean up whitespaceAman Gupta2016-01-141-2/+1
|