summaryrefslogtreecommitdiff
path: root/libavcodec/mmaldec.c
Commit message (Collapse)AuthorAge
* Merge commit 'd82d5379caca21005d8906829b35361c4a65408e'Clément Bœsch2017-04-08
|\ | | | | | | | | | | | | * 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-02
| | | | | | | | | | | | | | 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-29
| |
* | Merge commit '8385ba53f115401a67a4748c0d107769ebfb2941'Clément Bœsch2017-03-22
|\| | | | | | | | | | | | | * commit '8385ba53f115401a67a4748c0d107769ebfb2941': mmaldec: convert to stdatomic Merged-by: Clément Bœsch <u@pkh.me>
| * mmaldec: convert to stdatomicAnton Khirnov2016-10-02
| |
* | Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'Hendrik Leppkes2016-10-07
|\| | | | | | | | | | | | | * 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-21
| | | | | | | | | | | | | | | | | | | | | | 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-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | libavcodec/mmaldec.c: set AVFrame interlaced_frame and top_field_first, ↵Jens Ziller2016-09-12
| | | | | | | | | | | | 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-21
| |
* | Merge commit '74beead9bd596180bcac6108548fc0a86d8eb4ae'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | | | | | | | | | | | * 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-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-30
| | | | | | | | | | | | | | 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-30
| | | | | | | | | | | | | | | | 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-30
| | | | | | | | | | | | | | | | | | | | | | 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-30
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * mmaldec: Add mpeg2 decoding supportJulian Scheel2016-04-30
| | | | | | | | | | | | | | | | | | | | | | 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-30
| | | | | | | | | | | | | | | | | | 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-30
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge commit 'b8e899f4bf5f09900aa71552112d32a5566b6baf'Derek Buitenhuis2016-05-11
|\| | | | | | | | | | | | | * 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-12
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | mmaldec: limit internal bufferingwm42016-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-28
| | | | | | | | | | 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-28
| | | | | | | | | | 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-10
| | | | | | | | | | | | 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-07
| | | | | | | | | | | | | | | | | | 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-07
| |
* | mmaldec: Add mpeg2 decoding supportJulian Scheel2015-10-22
| | | | | | | | | | | | | | | | | | | | 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>
* | mmaldec: Fix avpriv_atomic_get usageJulian Scheel2015-10-21
| | | | | | | | | | | | | | | | | | 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: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/mmaldec: Use av_assert0() instead of assert()Michael Niedermayer2015-10-05
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '39f01e346cab464ef6c0d4ec58cc13b7123e60d8'Hendrik Leppkes2015-10-05
|\| | | | | | | | | | | | | * commit '39f01e346cab464ef6c0d4ec58cc13b7123e60d8': mmaldec: be more tolerant against MMAL not returning decoded output Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmaldec: be more tolerant against MMAL not returning decoded outputwm42015-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some situations, MMAL won't return a decoded frame for certain input frames. This can happen if a frame fails to decode, or if a packet does not actually contain a complete frame. In these situations, we would deadlock (or actually timeout) waiting for an expected output frame, which is not ideal. On the other hand, there are situations where we definitely have to block to avoid deadlocks. (This mess is a consequence of trying to map MMAL's asynchronous and flexible dataflow to libavcodec, which is more static and rigid.) Solve this by doing a blocking wait only if the amount of buffered data is too big. The whole purpose of the blocking wait is to avoid excessive buffering of input data, so we can skip it if it appears to be low. The consequence is that libavcodec can gracefully return no frame to the API user. We want to track the number of full packets to make our heuristic work. But MMAL buffers are fixed-size, requiring splitting large packets. This is why the previous commit is needed. We use the ..._FRAME_END flag to remember packet boundaries, but MMAL does not preserve these buffer flags when returning buffers to the user. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '65db4899fa8790049bec3af16ecdb75dd81051fd'Hendrik Leppkes2015-10-05
|\| | | | | | | | | | | | | * commit '65db4899fa8790049bec3af16ecdb75dd81051fd': mmaldec: refactor to have more context per MMAL input buffer Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmaldec: refactor to have more context per MMAL input bufferwm42015-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The next commit needs 1 bit of additional information per MMAL buffer sent to the MMAL input port. This information will be needed when the buffer is recycled (i.e. returned by the input port's callback). Normally, we could use MMAL_BUFFER_HEADER_FLAG_USER0, but that is unexpectedly not preserved. Do this by storing a pointer to FFBufferEntry in the MMAL buffer's user data, instead of an AVBufferRef. This also changes the lifetime of FFBufferEntry. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit 'a9b8c638cfe2f82191db65e3e3a39f3b35df81f5'Hendrik Leppkes2015-09-26
|\| | | | | | | | | | | | | * commit 'a9b8c638cfe2f82191db65e3e3a39f3b35df81f5': mmal: Fix AVBufferRef usage Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmal: Fix AVBufferRef usagewm42015-09-24
| | | | | | | | | | | | | | | | AVBufferRef.data and AVPacket.data don't need to have the same value. AVPacket could point anywhere into the buffer. Likewise, the sizes don't need to be the same. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '49623f531972be5dc2dd8c1b4b8748cad7c424ff'Hendrik Leppkes2015-09-26
|\| | | | | | | | | | | | | * commit '49623f531972be5dc2dd8c1b4b8748cad7c424ff': mmal: Remove setting extradata on input format Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmal: Remove setting extradata on input formatwm42015-09-24
| | | | | | | | | | | | | | | | This works only for extradata sizes up to 128 bytes. Additionally, I could never actually see it doing anything. The new code using MMAL_BUFFER_HEADER_FLAG_CONFIG now takes care of this. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit 'f290e48d86e10f34b5ddc519127636bcebec7c43'Hendrik Leppkes2015-09-26
|\| | | | | | | | | | | | | * commit 'f290e48d86e10f34b5ddc519127636bcebec7c43': mmal: drop the h264 BSF Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmal: drop the h264 BSFwm42015-09-24
| | | | | | | | | | | | | | | | We can send mp4-style data directly. But for some reason, this requires sending the extradata as buffer with MMAL_BUFFER_HEADER_FLAG_CONFIG set. Reuse the infrastructure for sending AVPackets to do this. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '99404597201911de90cff2ef85f2d44176d39147'Hendrik Leppkes2015-09-12
|\| | | | | | | | | | | | | * commit '99404597201911de90cff2ef85f2d44176d39147': mmaldec: fix pkt_dts determination Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmaldec: fix pkt_dts determinationwm42015-09-12
| | | | | | | | | | | | | | | | | | | | | | | | This also drops setting the frame->pts field. This is usually not set by decoders, so this would be an inconsistency that's at worst a danger to the API user. It appears the buffer->dts field is normally not set by the MMAL decoder, so don't use it. If it's ever going to be set by MMAL, we don't know whether the value will be what we want. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '87a051f97633010f71dfc1d23d806856499bf231'Hendrik Leppkes2015-09-12
|\| | | | | | | | | | | | | * commit '87a051f97633010f71dfc1d23d806856499bf231': lavc: allow asynchronous decoders to return correct pkt_dts values Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: allow asynchronous decoders to return correct pkt_dts valueswm42015-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generic code in utils.c sets the AVFrame.pkt_dts field from the packet it was supposedly decoded. This does not have to be true for a fully asynchronous decoder like mmaldec. It could be overwritten with an incorrect value. Even if the decoder doesn't determine the DTS (but sets it to AV_NOPTS_VALUE), it's impossible to determine a correct value in utils.c. Decoders can now be marked with FF_CODEC_CAP_SETS_PKT_DTS, in which case utils.c won't overwrite the field. The decoders are expected to set this field (even if they only set it to AV_NOPTS_VALUE). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit 'b7ab6e18eecad43593ad2a0e9fc9eba7f24751cb'Hendrik Leppkes2015-09-12
|\| | | | | | | | | | | | | * commit 'b7ab6e18eecad43593ad2a0e9fc9eba7f24751cb': mmaldec: disable timestamp interpolation Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * mmaldec: disable timestamp interpolationwm42015-09-12
| | | | | | | | | | | | | | | | | | This MMAL feature fills in missing timestamps from the framerate set on the input port. This is generally unwanted, since libavcodec decoders merely pass through timestamps without ever "fixing" them. The framerate is also unknown, and even the timebase doesn't have to be set. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * mmaldec: fix problems with flush logicwm42015-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't try to do a blocking wait for MMAL output if we haven't even sent a single real packet, but only flush packets. Obviously we can't expect to get anything back. Additionally, don't send a flush packet to MMAL in the same case. It appears the MMAL decoder will sometimes hang in mmal_vc_port_disable() (called from ffmmal_close_decoder()), waiting for a reply from the GPU which never arrives. Either MMAL disallows sending flush packets without preceding real data, or it's a MMAL bug. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
| * mmaldec: hack against buffering problems on broken inputwm42015-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I can't come up with a nice way to handle this. It's hard to keep the lock-stepped input/output in this case. You can't predict whether the MMAL decoder will output a picture (because it's asynchronous), so you have to assume in general that any packet could produce 0 or 1 frames. You can't continue to write input packets to the decoder, because then you might get too many output frames, which you can't get rid of because the lavc decoding API does not allow the decoder to return an output frame without consuming an input frame (except when flushing). The ideal fix is a M:N decoding API (preferably asynchronous), which would make this code potentially much cleaner. For now, this hack will do. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | mmaldec: fix problems with flush logicwm42015-08-11
| | | | | | | | | | | | | | | | | | | | | | | | Don't try to do a blocking wait for MMAL output if we haven't even sent a single real packet, but only flush packets. Obviously we can't expect to get anything back. Additionally, don't send a flush packet to MMAL in the same case. It appears the MMAL decoder will sometimes hang in mmal_vc_port_disable() (called from ffmmal_close_decoder()), waiting for a reply from the GPU which never arrives. Either MMAL disallows sending flush packets without preceding real data, or it's a MMAL bug.
* | mmaldec: do not mutate user's AVCodecContext extradata fieldwm42015-08-11
| |