summaryrefslogtreecommitdiff
path: root/libavcodec/mmaldec.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: use the new AVFrame interlace flags in all decoders and encodersJames Almer2023-05-041-2/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* 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: Add FF_CODEC_CAP_NOT_INIT_THREADSAFEAndreas Rheinhardt2022-07-181-1/+2
| | | | | | | This is in preparation of switching the default init-thread-safety to a codec being init-thread-safe. 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, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-9/+9
| | | | | | | | | | | | | | | | 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>
* avcodec/mmaldec: Deduplicate AVClassesAndreas Rheinhardt2021-12-121-9/+7
| | | | | | | Possible now that the child_class_next API is gone. Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mmaldec: Avoid creating unnecessary reference, simplify codeAndreas Rheinhardt2021-12-121-17/+6
| | | | | | | | | | ffmal_add_packet() basically duplicated the logic in av_packet_make_refcounted() with the added twist that it always created a reference even if one is already available. This commit stops doing this. Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mmaldec: fix pointer type warningHo Ming Shun2021-12-121-1/+1
| | | | | Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Ho Ming Shun <cyph1984@gmail.com>
* avcodec/mmaldec: re-use AVPacket for extra_dataHo Ming Shun2021-12-121-5/+3
| | | | | | | | | | | | extra_data and normal packets (from ff_decode_get_packet) processing do not overlap, thus we can re-use the spare AVPacket to send to ffmmal_add_packet. Furthermore, this removes allocation of AVPacket on the stack and stops using deprecated av_init_packet. Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Ho Ming Shun <cyph1984@gmail.com>
* avcodec/mmaldec: use decoupled dataflowHo Ming Shun2021-12-121-7/+25
| | | | | | | | | | | | | | | | | | MMAL is an fundamentally an asynchronous decoder, which was a bad fit for the legacy dataflow API. Often multiple packets are enqueued before a flood of frames are returned from MMAL. The previous lockstep dataflow meant that any delay in returning packets from the VPU would cause ctx->queue_decoded_frames to grow with no way of draining the queue. Testing this with mpv streaming from a live RTSP source visibly reduced latency introduced by frames waiting in queue_decoded_frames from roughly 2s to 0. Tested-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Ho Ming Shun <cyph1984@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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>
* avutil/frame: Remove deprecated AVFrame.pkt_pts fieldAndreas Rheinhardt2021-04-271-5/+0
| | | | | | | Deprecated in 32c8359093d1ff4f45ed19518b449b3ac3769d27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* All: update names in copyright headersrcombs2021-01-201-1/+1
|
* lavc: Mark hw_config pointer arrays as constMark Thompson2020-11-081-1/+1
| | | | They are read-only just like the HWConfig structures they point to.
* avcodec/decode: move the ff_decode_frame_props() prototype to the proper headerJames Almer2020-08-201-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: Rename hwaccel.h to hwconfig.hMark Thompson2020-04-261-1/+1
| | | | | This already applied to decoders as well as hwaccels, and adding encoder support was going to make the name even more inaccurate.
* avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | Explicitly identify decoder/encoder wrappers with a common name. This saves API users from guessing by the name suffix. For example, they don't have to guess that "h264_qsv" is the h264 QSV implementation, and instead they can just check the AVCodec .codec and .wrapper_name fields. Explicitly mark AVCodec entries that are hardware decoders or most likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing API users listing hardware decoders in a more generic way. The proposed AVCodecHWConfig does not provide this information fully, because it's concerned with decoder configuration, not information about the fact whether the hardware is used or not. AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software implementations in case the hardware is not capable. Based on a patch by Philip Langdale <philipl@overt.org>. Merges Libav commit 47687a2f8aca3f65b6fdd117b1cb66a7409a7fd1.
* lavc: Delete all fake hwaccelsMark Thompson2017-11-261-28/+0
| | | | They are now unused.
* lavc: Add hardware config metadata for decoders supporting hardware outputMark Thompson2017-11-261-0/+7
| | | | | | | | | This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time.
* Merge commit '04f691cd4fb7d226e54df886a21ba201cb5019f4'James Almer2017-11-011-0/+1
|\ | | | | | | | | | | | | * commit '04f691cd4fb7d226e54df886a21ba201cb5019f4': mmal: Add missing .item_name to AVClass declaration Merged-by: James Almer <jamrial@gmail.com>
| * mmal: Add missing .item_name to AVClass declarationDiego Biurrun2017-06-131-0/+1
| |
* | Merge commit 'd82d5379caca21005d8906829b35361c4a65408e'Clément Bœsch2017-04-081-1/+1
|\ \ | |/ | | | | | | | | | | * commit 'd82d5379caca21005d8906829b35361c4a65408e': mmaldec: initialize refcount using atomic_init() Merged-by: Clément Bœsch <u@pkh.me>
| * mmaldec: initialize refcount using atomic_init()Wan-Teh Chang2016-12-021-1/+1
| | | | | | | | | | | | | | This is how we initialize refcount in libavutil/buffer.c. Signed-off-by: Wan-Teh Chang <wtc@google.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavc: fix usages of av_get_codec_tag_string()Clément Bœsch2017-03-291-9/+6
| |
* | Merge commit '8385ba53f115401a67a4748c0d107769ebfb2941'Clément Bœsch2017-03-221-12/+13
|\ \ | |/ | | | | | | | | | | * commit '8385ba53f115401a67a4748c0d107769ebfb2941': mmaldec: convert to stdatomic Merged-by: Clément Bœsch <u@pkh.me>
| * mmaldec: convert to stdatomicAnton Khirnov2016-10-021-12/+13
| |
* | Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'Hendrik Leppkes2016-10-071-1/+6
|\ \ | |/ | | | | | | | | | | * commit '32c8359093d1ff4f45ed19518b449b3ac3769d27': lavc: export the timestamps when decoding in AVFrame.pts Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: export the timestamps when decoding in AVFrame.ptsAnton Khirnov2016-06-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | Currently it's exported as AVFrame.pkt_pts, which is also the only use for that field. The reason it is done like this is that lavc used to export various codec-specific "timing" information in AVFrame.pts, which is not done anymore. Since it is confusing to the callers to have a separate field which is used only for decoder timestamps and nothing else, deprecate pkt_pts and use just AVFrame.pts everywhere.
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-1/+1
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | libavcodec/mmaldec.c: set AVFrame interlaced_frame and top_field_first, ↵Jens Ziller2016-09-121-0/+20
| | | | | | | | | | | | AVCodecContext framerate Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/mmaldec: reduce some diffs with Libav missed in previous skipped mergesClément Bœsch2016-06-211-14/+14
| |
* | Merge commit '74beead9bd596180bcac6108548fc0a86d8eb4ae'Clément Bœsch2016-06-211-0/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '74beead9bd596180bcac6108548fc0a86d8eb4ae': mmaldec: limit internal buffering See 14a90c9ef09a4b046500dceab5ca1875e330a376 The introduction of the MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS check is merged. Merged-by: Clément Bœsch <clement@stupeflix.com>
| * mmaldec: limit internal bufferingwm42016-04-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses a new MMAL feature, which limits the number of extra frames that can be buffered within the decoder. VIDEO_MAX_NUM_CALLBACKS can be defined as positive or negative number. Positive numbers are absolute, and can lead to deadlocks if the user underestimates the number of required buffers. Negative numbers specify the number of extra buffers, e.g. -1 means no extra buffer, (-1-N) means N extra buffers. Set a gratuitous default of -11 (N=10). This is much lower than the firmware default, which appears to be 96. This is backwards compatible, but needs a symbol only present in newer firmware headers. (It's an enum item, so it requires a check in configure.) Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: print the MMAL format FourCC automaticallywm42016-04-301-3/+4
| | | | | | | | | | | | | | Slight simplification. The result is the same. Also, change the wording of the message as requested in patch review. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: send only a single EOS packet on flushingwm42016-04-301-0/+2
| | | | | | | | | | | | | | | | Fixes apparent mmal_port_disable() freezes in ffmmal_stop_decoder() when calling ffmmal_decode() with flush semantics a large number of times in a row. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: correct package buffering accountingwm42016-04-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | The assert in ffmmal_stop_decoder() could trigger sometimes. The packets_buffered counter was indeed not correctly maintained, and packets were not subtracted from it if they were still in the waiting queue. For some reason, this happened especially with VC-1. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: add vc1 decoding supportwm42016-04-301-0/+12
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: Add mpeg2 decoding supportJulian Scheel2016-04-301-24/+47
| | | | | | | | | | | | | | | | | | | | | | Register mmaldec as mpeg2 decoder. Supporting mpeg2 in mmaldec is just a matter of setting the correct MMAL_ENCODING on the input port. To ease the addition of further supported mmal codecs a macro is introduced to generate the decoder and decoder class structs. Signed-off-by: Julian Scheel <julian@jusst.de> Signed-off-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: Fix avpriv_atomic_get usageJulian Scheel2016-04-301-1/+1
| | | | | | | | | | | | | | | | | | There is no avpriv_atomic_get, instead avpriv_atomic_int_get is to be used for integers. This fixes building mmaldec. Signed-off-by: Julian Scheel <julian@jusst.de> Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: Use av_assert0() instead of assert()Michael Niedermayer2016-04-301-1/+1
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge commit 'b8e899f4bf5f09900aa71552112d32a5566b6baf'Derek Buitenhuis2016-05-111-14/+8
|\ \ | |/ | | | | | | | | | | * commit 'b8e899f4bf5f09900aa71552112d32a5566b6baf': mmaldec: Use imgutils.h for copying frames Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * mmaldec: Use imgutils.h for copying framesMartin Storsjö2016-04-121-14/+8
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | mmaldec: limit internal bufferingwm42016-01-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses a new MMAL feature, which limits the number of extra frames that can be buffered within the decoder. VIDEO_MAX_NUM_CALLBACKS can be defined as positive or negative number. Positive numbers are absolute, and can lead to deadlocks if the user underestimates the number of required buffers. Negative numbers specify the number of extra buffers, e.g. -1 means no extra buffer, (-1-N) means N extra buffers. Set a gratuitous default of -11 (N=10). This is much lower than the firmware default, which appears to be 96. This is backwards compatible, but needs a symbol only present in newer firmware headers. (It's an enum item, so it requires a check in configure.)
* | mmaldec: support MPEG-4wm42016-01-281-0/+11
| | | | | | | | | | I guess this means part 2 in both cases. Not sure which profiles exactly are actually supported properly.
* | mmaldec: print the MMAL format FourCC automaticallywm42016-01-281-3/+4
| | | | | | | | | | Slight simplification. The result is the same. Also, change the wording of the message as requested in patch review.
* | mmaldec: send only a single EOS packet on flushingwm42015-11-101-0/+2
| | | | | | | | | | | | Fixes apparent mmal_port_disable() freezes in ffmmal_stop_decoder() when calling ffmmal_decode() with flush semantics a large number of times in a row.
* | mmaldec: correct package buffering accountingwm42015-11-071-0/+3
| | | | | | | | | | | | | | | | | | The assert in ffmmal_stop_decoder() could trigger sometimes. The packets_buffered counter was indeed not correctly maintained, and packets were not subtracted from it if they were still in the waiting queue. For some reason, this happened especially with VC-1.
* | mmaldec: add vc1 decoding supportwm42015-11-071-0/+12
| |
* | mmaldec: Add mpeg2 decoding supportJulian Scheel2015-10-221-24/+47
| | | | | | | | | | | | | | | | | | | | Register mmaldec as mpeg2 decoder. Supporting mpeg2 in mmaldec is just a matter of setting the correct MMAL_ENCODING on the input port. To ease the addition of further supported mmal codecs a macro is introduced to generate the decoder and decoder class structs. Signed-off-by: Julian Scheel <julian@jusst.de> Signed-off-by: wm4 <nfxjfg@googlemail.com>