Commit graph

149 commits

Author SHA1 Message Date
Seungha Yang 72933810f5 avviddec: Don't return GST_FLOW_EOS from drain()/finish()
AVERROR_EOF means that it's fully drained, but it doesn't
mean that that end of stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
2020-09-16 03:13:09 +09:00
Sebastian Dröge 90a079cc8d avviddec: Forward flow returns from draining instead of assuming OK
It might be useful for upstream to know that draining/finishing didn't
succeed, and why.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/90>
2020-09-14 14:24:51 +03:00
Sebastian Dröge 6a9b42557e Update for gst_video_transfer_function_*() function renaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/89>
2020-09-07 12:15:17 +03:00
Vivia Nikolaidou 88fa030ab1 avviddec: Fix typo that duplicated closed caption meta
We examined the output buffer, instead of the input buffer, for
existence of cc meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/83>
2020-07-07 00:33:22 +03:00
Vivia Nikolaidou 83190c4ec0 gstavviddec: Only allow a single closed caption meta
Following discussion in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1396#note_556068

While it is technically possible to store multiple closed caption metas
in the same buffer, we don't currently do that anywhere and for
H264/MPEG2 both parts have to be stored in the same packet, and also the
number of CC bytes you can store per frame is rather limited. This
restriction might be relaxed later once we figured out how to do it
without breaking things.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/82>
2020-07-03 07:02:05 +00:00
Mathieu Duponchelle 1c436201ce plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:43:02 +02:00
Sebastian Dröge 5738a8c1d6 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-05-31 10:03:17 +03:00
Matej Knopp b1b49a0913 gstavviddec: only set range when actually reported by avcodec
otherwise we get incomplete colorimetry that video-info complains about

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/70>
2020-05-09 14:56:25 +02:00
Seungha Yang 39e6f846e0 avviddec: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
2020-04-01 14:07:48 +09:00
Alicia Boya García b7d450b118 gstavviddec: Limit default number of decoder threads
When the `max-threads` property is not specified, GStreamer defaults to
the amount of CPU threads in the system.

The number of threads used in avdec has a direct impact on the latency
of the decoder, which is of as many frames as threads. Therefore, big
numbers of threads can make latency levels that can be problematic in
some applications.

For this reason, ffmpeg emits a warning when more than 16 threads are
requested.

This patch limits the default number of threads to 16. This affects only
computers with more than 16 CPU threads when using avviddec without
setting `max-threads`.
2019-12-19 21:59:44 +00:00
Seungha Yang 07f33470b3 avviddec: Fix huge leak caused by circular reference
AVBufferRef -> GstFFMpegVideoDecVideoFrame -> GstVideoCodecFrame -> AVBufferRef

Instead of holding additional ref there, set read-only which would not be
reused by ff_reget_buffer()

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/63
2019-10-29 16:29:46 +09:00
Seungha Yang 30d0674e7d avvideenc,avvidedec: Filtering hardware en/decoder by flag
... instead of filtering them by hardcoded string compare.
2019-10-25 19:48:15 +09:00
Seungha Yang 80c8c05457 avviddec: Enforce allocate new AVFrame per input frame
... if ffmpeg would reuse the allocated AVBuffer. Reused AVFrame by
the ffmpeg seems to break our decoding flow since the reused AVFrame
holds the initial opaque data (GstVideoCodecFrame in this case), so
we couldn't trace the our in/out frames.
To enforce get_buffer() call per output frame, hold another reference
to the AVBuffer in order to mark the AVBuffer as not writable.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/62
2019-10-24 00:25:28 +09:00
Seungha Yang 40f5953828 avviddec,avcodemap: Use new helper function for map color space information
... between GStreamer and FFmpeg. Note that FFmpeg follows ISO/IEC 23001-8
defined color{matrix,transfer,primaries} values.
2019-09-24 23:52:11 +09:00
Mathieu Duponchelle 1e8e040fbc avviddec: improve latency calculation
When thread_type is set to FF_THREAD_FRAME, per the documentation
a latency of one frame per thread is introduced:

<https://ffmpeg.org/ffmpeg-codecs.html>, search for thread_type.

Additionally, we need in that case to calculate the automatic
number of threads ourselves, so as to accurately calculate the
latency.
2019-07-18 00:26:50 +02:00
Seungha Yang e8f21b510a avviddec: Add thread-type property
The thread-type property allows specifying preferred
multithreading methods by user. Note that FF_THREAD_FRAME
may introduce additional latency especially on non-filesrc usecase,
since it introduces a decoding delay of (number of threads) frames.

https://bugzilla.gnome.org/show_bug.cgi?id=797254
2019-07-18 00:05:21 +02:00
Guillaume Desmottes 2e59973cca avviddec: remove cdgraphics element
It was never usable as we don't have a parser and we now have 'cdgdec'
in gst-plugins-rs.
2019-05-29 11:49:38 +05:30
Seungha Yang 2b50a0ce93 avcodecmap,avviddec: Map bt2020-10, PQ and HLG transfer functions
Map more transfer functions between Gstreamer and ffmpeg
2019-05-24 20:44:12 +09:00
Seungha Yang 8d9b30695b avviddec: Extract HDR information if any
Convert mastering display information (a.k.a HDR static metadata) and
content light level information provided by FFMPEG to Gstreamer.
2019-05-01 23:24:56 +09:00
Yeongjin Jeong 93e2466115 avviddec: Ensure drain even if codec has not delay capabilities
There are decoders that need to be drained if they work on multi-threads,
even if AV_CODEC_CAP_DELAY is not set.
2019-04-29 15:38:42 +09:00
Aaron Boxer b2cc8a57d4 avviddec: do not add 708 caption meta if already exists
(this is only used for CEA 708 raw data). another element
such as mpegvideoparse may have already added the meta.
2019-04-01 17:11:36 -04:00
Edward Hervey 46cc79c43a avviddec: Remove unneeded check
frame is always valid in this function (but wasn't before the
refactoring from a few months ago).

CID #1439540
2018-09-21 16:01:53 +02:00
Mathieu Duponchelle ff3a8f6627 decoders: fix draining
https://bugzilla.gnome.org/show_bug.cgi?id=796900
2018-07-31 19:13:25 +02:00
Seungha Yang db82350245 libav: Fix symbol redefine build error
https://bugzilla.gnome.org/show_bug.cgi?id=796827
2018-07-19 12:21:01 +01:00
Mathieu Duponchelle dd37a553ac av*dec: Ignore decoding errors
We were ignoring these before the port to 4.0, interpreting them
as GST_FLOW_ERROR / GST_ELEMENT_ERROR causes check failures.

We should start using GST_*_DECODER_ERROR in latter commits,
for now simply restore the previous behaviour.
2018-07-13 17:24:07 +02:00
Mathieu Duponchelle be9b6969cb avviddec: fix invalid alignment calculations.
avcodec_align_dimensions2 uses context->pix_fmt to make its
calculations, we thus need to make sure it is adequately set
when calling it.

Fixes:

gst-launch-1.0 videotestsrc ! video/x-raw, width=1920, height=1080 \
! avenc_mpeg4 ! avdec_mpeg4 ! xvimagesink

This showed invalid writes under valgrind, then segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle 965cd81603 avviddec: fix signed/unsigned comparisons
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle d191fb2e50 avvidec: port to new decoding API
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Mathieu Duponchelle e4bf6147a0 av_codec_next (deprecated) -> av_codec_iterate
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:27 +02:00
Nicolas Dufresne d8dfa4657b avviddec: Stop using deperated EDGE API
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne aa724e2f14 Use AV_ namespace for all CODEC_ macro
The remaining use of CODEC_ are codec flags that has been moved into the
new codec private properties or have been deperated. Will be fixed in
later patches.

https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Nicolas Dufresne 7b3e41e20b Use AV_ namespace for INPUT_BUFFER_PADDING_SIZE
https://bugzilla.gnome.org/show_bug.cgi?id=792900
2018-07-13 00:53:26 +02:00
Edward Hervey 04b3867cb8 libav: Switch to common include 2018-05-11 14:24:03 +02:00
Edward Hervey b894bedeb3 avvidec: Expose Closed Caption as GstVideoCaptionMeta 2018-05-07 17:12:07 +02:00
Mathieu Duponchelle d5b0305241 Enable gif format, and make it so avdemux_gif and avdec_gif can autoplug
https://bugzilla.gnome.org/show_bug.cgi?id=784684
2018-02-12 08:27:53 +01:00
Edward Hervey 79bc255fa2 avvid*: Don't expose V4L2 mem-to-mem decoder and encoders
It's not going to work without special handling. Mask for now.
2018-02-10 15:18:11 +01:00
Sebastian Dröge 5b22802b35 Revert "avviddec: Remove usage of deprecated EDGE APIs"
This reverts commit 4284d791bc.

It causes crashes on various h264 and DNXHD/VC3 streams, where the
decoders write to arbitrary memory far after what we've allocated.
2017-08-10 18:55:29 +03:00
Nicolas Dufresne 4284d791bc avviddec: Remove usage of deprecated EDGE APIs
As a side effect, left/right green bars goes away when using
xvimagesink. I just think that xv cropping is broken, so this is
probably just hiding a bug.
2017-07-11 09:37:03 -04:00
Sebastian Dröge 15a17f3f8d avviddec: Don't expose NVIDIA CUVID decoder
It's not working without further changes on our side, like all hardware
decoders in ffmpeg.
2017-05-16 18:55:36 +03:00
Jan Schmidt 8e6fbe7f63 avviddec: Map any stereo3D info to multiview modes
Map any libav Stereo3D side data to GStreamer multiview
mode / flags for playback.

https://bugzilla.gnome.org/show_bug.cgi?id=767938
2017-03-16 15:23:01 +11:00
Garima Gaur 14dc964f0e Fix some caps leaks when creating pad templates
https://bugzilla.gnome.org/show_bug.cgi?id=776700
2017-01-02 12:41:20 +00:00
leigh123linux@googlemail.com 3c3be3125f avvidenc/dec: Disable more hardware encoder/decoders
Important when using a system ffmpeg/libav.

https://bugzilla.gnome.org/show_bug.cgi?id=774278
2016-11-12 10:33:51 +02:00
Sebastian Dröge 88da0fb956 avviddec: Fix comment to say interlace-mode instead of interlaced-mode 2016-11-04 16:27:59 +02:00
Sebastian Dröge 5e61a8999f avviddec: Use interlaced-mode=interleaved and set field-order if possible
https://bugzilla.gnome.org/show_bug.cgi?id=771376
2016-11-01 20:42:52 +02:00
Sebastian Dröge 5b40fb965b avviddec: Set colorimetry information from the context if known
But only if upstream did not provide that information.

https://bugzilla.gnome.org/show_bug.cgi?id=750882
2016-11-01 20:42:52 +02:00
Sebastian Dröge e3558d4d07 avviddec: Use enum instead of magic numbers for the chroma siting values 2016-09-29 12:01:59 +03:00
Iain Lane f5f32986b6 Only use AV_CODEC_ID_WRAPPED_AVFRAME on new enough libavcodecs
https://bugzilla.gnome.org/show_bug.cgi?id=770753
2016-09-03 14:20:26 +03:00
Edward Hervey 8b374b3f82 avvidec: Ensure skipping strategy gets properly reset
When switching playback modes, like from TRICKMODE or TRICKMODE_KEY_UNITS
back to regular playback, we need to make sure we set the skip mode
back to the default setting.

While this field would be properly reset when we *have* feedback from
downstream (i.e. diff != G_MAXINT64), it would not be reset during
the initial phase (i.e. when the decoder hasn't pushed a buffer yet,
and therefore the sink hasn't sent back QoS information).

This avoids dropping plenty of frames when going back to regular playback
2016-08-04 10:45:14 +02:00
Sebastian Dröge 3e93ad1bcd libav: Ignore more quasi-codecs 2016-07-22 14:54:21 +03:00
Sebastian Dröge 5f4bd291c1 libav: Ignore VAAPI decoders and VAAPI/nvenc encoders
These can show up when having a build against a system version of ffmpeg.
2016-07-22 14:42:59 +03:00