summaryrefslogtreecommitdiff
path: root/libavcodec/mmaldec.c
Commit message (Collapse)AuthorAge
...
* | 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
| |
* | mmaldec: hack against buffering problems on broken inputwm42015-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'def97856de6021965db86c25a732d78689bd6bb0': lavc: AV-prefix all codec capabilities Conflicts: cmdutils.c ffmpeg.c ffplay.c libavcodec/8svx.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/adpcm.c libavcodec/alac.c libavcodec/atrac3plusdec.c libavcodec/bink.c libavcodec/dnxhddec.c libavcodec/dvdec.c libavcodec/dvenc.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/fic.c libavcodec/flacdec.c libavcodec/flacenc.c libavcodec/flvdec.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/gifdec.c libavcodec/h261dec.c libavcodec/hevc.c libavcodec/iff.c libavcodec/imc.c libavcodec/libopenjpegdec.c libavcodec/libvo-aacenc.c libavcodec/libvorbisenc.c libavcodec/libvpxdec.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec_float.c libavcodec/msmpeg4dec.c libavcodec/mxpegdec.c libavcodec/nvenc_h264.c libavcodec/nvenc_hevc.c libavcodec/pngdec.c libavcodec/qpeg.c libavcodec/ra288.c libavcodec/rv10.c libavcodec/s302m.c libavcodec/sp5xdec.c libavcodec/takdec.c libavcodec/tiff.c libavcodec/tta.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/vp6.c libavcodec/vp9.c libavcodec/wavpack.c libavcodec/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-27
| | | | | | | | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '49e531ff4706279c7eed774f2c8b896942924ce2'Michael Niedermayer2015-04-14
|\| | | | | | | | | | | | | * commit '49e531ff4706279c7eed774f2c8b896942924ce2': mmal: Reference MMAL VC lib explicitly Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mmal: Reference MMAL VC lib explicitlywm42015-04-14
| | | | | | | | | | | | | | | | | | | | This is optional, but ensures that linking with -Wl,--as-needed does not drop the library containing the MMAL VC driver. The driver normally "registers" itself in the library constructor, but since no symbols are explicitly referenced, the linker could remove it with --as-needed enabled. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '2de7650451d90520135d8cf6f96caa0658824208'Michael Niedermayer2015-04-14
|\| | | | | | | | | | | | | * commit '2de7650451d90520135d8cf6f96caa0658824208': mmal: Move system headers before local headers Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * mmal: Move system headers before local headerswm42015-04-14
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit 'c48456166e95648719a8be8f8613f9dee98205c1'Michael Niedermayer2015-03-29
|/ | | | | | | | | | | | | | | | * commit 'c48456166e95648719a8be8f8613f9dee98205c1': lavc: add MMAL hardware decoder wrapper Conflicts: Changelog configure doc/APIchanges libavcodec/Makefile libavcodec/allcodecs.c libavcodec/version.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavc: add MMAL hardware decoder wrapperwm42015-03-29
Based on a patch by Rodger Combs. Signed-off-by: Anton Khirnov <anton@khirnov.net>