1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-25 21:51:29 +02:00
Commit Graph

70 Commits

Author SHA1 Message Date
Andreas Rheinhardt
a247ac640d avcodec: Constify AVCodecs
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>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt
6e30b35b85 avutil/frame: Remove deprecated AVFrame.pkt_pts field
Deprecated in 32c8359093.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
rcombs
eabf5e6d6b All: update names in copyright headers 2021-01-20 01:02:56 -06:00
Mark Thompson
cd322794ee lavc: Mark hw_config pointer arrays as const
They are read-only just like the HWConfig structures they point to.
2020-11-08 18:54:42 +00:00
James Almer
c56d787fe3 avcodec/decode: move the ff_decode_frame_props() prototype to the proper header
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 13:17:50 -03:00
Mark Thompson
2594f6a362 lavc: Rename hwaccel.h to hwconfig.h
This already applied to decoders as well as hwaccels, and adding encoder
support was going to make the name even more inaccurate.
2020-04-26 18:38:25 +01:00
wm4
b945fed629 avcodec: add metadata to identify wrappers and hardware decoders
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 47687a2f8a.
2017-12-14 19:37:56 +01:00
Mark Thompson
da4e02b196 lavc: Delete all fake hwaccels
They are now unused.
2017-11-26 21:41:14 +00:00
Mark Thompson
758fbc54fe lavc: Add hardware config metadata for decoders supporting hardware output
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.
2017-11-26 21:35:53 +00:00
James Almer
f3f1bbc6a8 Merge commit '04f691cd4fb7d226e54df886a21ba201cb5019f4'
* commit '04f691cd4fb7d226e54df886a21ba201cb5019f4':
  mmal: Add missing .item_name to AVClass declaration

Merged-by: James Almer <jamrial@gmail.com>
2017-11-01 20:21:35 -03:00
Diego Biurrun
04f691cd4f mmal: Add missing .item_name to AVClass declaration 2017-06-13 13:30:34 +02:00
Clément Bœsch
b853d6aa5b Merge commit 'd82d5379caca21005d8906829b35361c4a65408e'
* commit 'd82d5379caca21005d8906829b35361c4a65408e':
  mmaldec: initialize refcount using atomic_init()

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-08 14:52:30 +02:00
Clément Bœsch
67e370ee52 lavc: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
Clément Bœsch
82d6179a88 Merge commit '8385ba53f115401a67a4748c0d107769ebfb2941'
* commit '8385ba53f115401a67a4748c0d107769ebfb2941':
  mmaldec: convert to stdatomic

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-22 18:01:51 +01:00
Wan-Teh Chang
d82d5379ca mmaldec: initialize refcount using atomic_init()
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>
2016-12-02 12:16:26 -05:00
Hendrik Leppkes
3f9137c57d Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'
* commit '32c8359093d1ff4f45ed19518b449b3ac3769d27':
  lavc: export the timestamps when decoding in AVFrame.pts

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-10-07 13:03:36 +02:00
Anton Khirnov
8385ba53f1 mmaldec: convert to stdatomic 2016-10-02 19:35:12 +02:00
Jens Ziller
bc7066fd5d libavcodec/mmaldec.c: set AVFrame interlaced_frame and top_field_first, AVCodecContext framerate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-12 01:14:07 +02:00
Anton Khirnov
32c8359093 lavc: export the timestamps when decoding in AVFrame.pts
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.
2016-06-21 19:54:42 +02:00
Clément Bœsch
d16aefee5c lavc/mmaldec: reduce some diffs with Libav missed in previous skipped merges 2016-06-21 13:35:36 +02:00
Clément Bœsch
ba5100ce84 Merge commit '74beead9bd596180bcac6108548fc0a86d8eb4ae'
* commit '74beead9bd596180bcac6108548fc0a86d8eb4ae':
  mmaldec: limit internal buffering

See 14a90c9ef0

The introduction of the MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS check is
merged.

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-21 13:32:57 +02:00
Derek Buitenhuis
f4c88eef95 Merge commit 'b8e899f4bf5f09900aa71552112d32a5566b6baf'
* commit 'b8e899f4bf5f09900aa71552112d32a5566b6baf':
  mmaldec: Use imgutils.h for copying frames

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:15:14 +01:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
wm4
74beead9bd mmaldec: limit internal buffering
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>
2016-04-30 08:31:08 +02:00
wm4
45a954f5aa mmaldec: print the MMAL format FourCC automatically
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>
2016-04-30 08:29:13 +02:00
wm4
ce589940c2 mmaldec: send only a single EOS packet on flushing
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>
2016-04-30 08:26:22 +02:00
wm4
46aaad78c3 mmaldec: correct package buffering accounting
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>
2016-04-30 08:19:58 +02:00
wm4
9a382f3639 mmaldec: add vc1 decoding support
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:19:53 +02:00
Julian Scheel
d52208e8d5 mmaldec: Add mpeg2 decoding support
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>
2016-04-30 08:11:13 +02:00
Julian Scheel
2689bb115c mmaldec: Fix avpriv_atomic_get usage
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>
2016-04-30 08:00:58 +02:00
Michael Niedermayer
366ba2dee1 mmaldec: Use av_assert0() instead of assert()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-30 08:00:02 +02:00
Martin Storsjö
b8e899f4bf mmaldec: Use imgutils.h for copying frames
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-04-12 13:50:54 +03:00
wm4
14a90c9ef0 mmaldec: limit internal buffering
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.)
2016-01-28 17:24:53 +01:00
wm4
7b1b53f3a4 mmaldec: support MPEG-4
I guess this means part 2 in both cases. Not sure which profiles exactly
are actually supported properly.
2016-01-28 17:24:40 +01:00
wm4
d27a12cb09 mmaldec: print the MMAL format FourCC automatically
Slight simplification. The result is the same. Also, change the
wording of the message as requested in patch review.
2016-01-28 17:23:46 +01:00
wm4
dafe4cd29c mmaldec: send only a single EOS packet on flushing
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.
2015-11-10 13:47:37 +01:00
wm4
a55fbfa4c4 mmaldec: correct package buffering accounting
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.
2015-11-07 19:24:49 +01:00
wm4
b07cbf6724 mmaldec: add vc1 decoding support 2015-11-07 19:24:49 +01:00
Julian Scheel
7ebe12fc55 mmaldec: Add mpeg2 decoding support
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>
2015-10-22 10:46:03 +02:00
Julian Scheel
da43e9e157 mmaldec: Fix avpriv_atomic_get usage
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>
2015-10-21 15:01:36 +02:00
Michael Niedermayer
c0152ebb9e avcodec/mmaldec: Use av_assert0() instead of assert()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-05 12:04:40 +02:00
Hendrik Leppkes
329a0e419e Merge commit '39f01e346cab464ef6c0d4ec58cc13b7123e60d8'
* commit '39f01e346cab464ef6c0d4ec58cc13b7123e60d8':
  mmaldec: be more tolerant against MMAL not returning decoded output

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-05 11:34:11 +02:00
Hendrik Leppkes
827d4b7942 Merge commit '65db4899fa8790049bec3af16ecdb75dd81051fd'
* commit '65db4899fa8790049bec3af16ecdb75dd81051fd':
  mmaldec: refactor to have more context per MMAL input buffer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-05 11:34:04 +02:00
wm4
39f01e346c mmaldec: be more tolerant against MMAL not returning decoded output
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>
2015-10-04 19:34:04 +02:00
wm4
65db4899fa mmaldec: refactor to have more context per MMAL input buffer
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>
2015-10-04 19:34:04 +02:00
Hendrik Leppkes
2b61cc4443 Merge commit 'a9b8c638cfe2f82191db65e3e3a39f3b35df81f5'
* commit 'a9b8c638cfe2f82191db65e3e3a39f3b35df81f5':
  mmal: Fix AVBufferRef usage

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-26 11:07:54 +02:00
Hendrik Leppkes
f3310df853 Merge commit '49623f531972be5dc2dd8c1b4b8748cad7c424ff'
* commit '49623f531972be5dc2dd8c1b4b8748cad7c424ff':
  mmal: Remove setting extradata on input format

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-26 11:07:44 +02:00
Hendrik Leppkes
c5a312dd6a Merge commit 'f290e48d86e10f34b5ddc519127636bcebec7c43'
* commit 'f290e48d86e10f34b5ddc519127636bcebec7c43':
  mmal: drop the h264 BSF

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-26 11:07:33 +02:00
wm4
a9b8c638cf mmal: Fix AVBufferRef usage
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>
2015-09-24 10:34:46 +02:00
wm4
49623f5319 mmal: Remove setting extradata on input format
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>
2015-09-24 10:34:38 +02:00