Commit graph

3989 commits

Author SHA1 Message Date
Seungha Yang 1d38728d05 h264decoder: Perform low-latency outputting only for live pipeline
Frequent outputting might drop throughput-wise performance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1211>
2020-04-28 13:23:53 +00:00
Seungha Yang 00ad871628 h264decoder: Output decoded pictures as soon as possible
In case of IDR, any previously decoded pictures must be drained
before the IDR and POC of IDR should be zero. So we can output
IDR immediately. Also, when POC of current picture is expected to be
the next output POC, decoder can output the picture as well
without waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1211>
2020-04-28 13:23:53 +00:00
Mathieu Duponchelle d3be83a26c gsth265parser.h: escape link-like syntax in doc 2020-04-28 00:29:52 +02:00
Víctor Manuel Jáquez Leal 851557af20 codecs: fix gir generation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1218>
2020-04-26 19:26:32 +02:00
Víctor Manuel Jáquez Leal 23e99a7a77 codecs: set sys frame num before new_picture()
Derive classes might need to operate on the current frame at their
new_picture() vmethod, so it would be needed to set system_frame_number
on picture before calling the vmethod.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1209>
2020-04-23 19:54:17 +00:00
Seungha Yang 8325e42ade codecs: Fix some documentation
Add missing "transfer full" annotation, etc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang a89b819191 codecs: Add new baseclass for VP8 decoder
This implemenation is similar to VP9 but much simpler than it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang 9524e6adec vp9decoder: Fix small typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang d72fcbe18a codecs: Reorganize the order of vfunc
... to the order in which it is actually called

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang ba07768ca4 h264decoder: Don't handle gap frame num for the first picture
If the first picture is not IDR, it would have non-zero frame_num
but it's not gap. We should skip gap frame handling in that case
2020-04-20 13:55:49 +00:00
Seungha Yang 6a7ea29084 h264decoder: Add some debug messages 2020-04-20 13:55:49 +00:00
Víctor Manuel Jáquez Leal a3395167a1 codecs: h264picture: typo in GstH264PictureField enum 2020-04-19 18:40:12 +02:00
Seungha Yang eeb3dd6605 h265parser: Fix some coverity issues
- Remove useless comparison
- Fix invalid memory access

CID: 1461477, 1461476, 1461475, 1461474, 1461279
2020-04-13 12:28:14 +00:00
Seungha Yang 5a29917a63 codecs: Add minimal state validation
... to prevent requesting decoding before the preparation.
For instance, baseclass should not request decoding a picture if there
is no parsed valid headers, since subclass is most likely
not ready to decoding it.
2020-04-09 19:33:56 +00:00
Seungha Yang a2f68762b0 h265parser: Add APIs to allow update VPS/SPS/PPS
gst_h265_parser_parse_{vps,sps,pps} APIs were used to parse VPS/SPS/PPS and
also in order to update parser's internal state at once. Meanwhile
gst_h265_parse_{vps,sps,pps} APIs are to parse VPS/SPS/PPS without state update.
This commit introduces new APIs so that only accepted VPS/SPS/PPS by user
can be updated to be used by parser.
2020-04-09 19:33:56 +00:00
Seungha Yang a61549cbde h264parser: Add APIs to allow update SPS/PPS
gst_h264_parser_parse_{sps,pps} APIs were used to parse SPS/PPS and
also in order to update parser's internal state at once. Meanwhile
gst_h264_parse_{sps,pps} APIs are to parse SPS/PPS without state update.
This commit introduces new APIs so that only accepted SPS/PPS by user
can be updated to be used by parser.
2020-04-09 19:33:56 +00:00
Seungha Yang 1a09251699 h264parser: Parse all SEI payload type even if it's not handled by parser
... so that user can handle it from outside of parser API
2020-04-08 15:39:12 +00:00
Seungha Yang db1ea18276 h264parser: Add support for creating picture timing SEI
This new method can make it possible to inject timecode meta into
h264 bitstream
2020-04-08 15:39:12 +00:00
Seungha Yang 28ce6c2a40 h264parser: Make GstH264PicTiming self-containing all the syntax information
... and store all parsed values.

We are storing pic_struct_present_flag although it's not part of
this SEI message but GstH264PicTiming includes it to clarify
following syntax values.
In addition to that, by adding CpbDpbDelaysPresentFlag, we don't need to
refer to VUI anymore.
2020-04-08 15:39:12 +00:00
Seungha Yang c272dd3462 h264parser: Fix some misleading debug messages 2020-04-08 15:39:12 +00:00
Seungha Yang 5a675080c5 h264parser: Fix mismatched argument of declaration and definition 2020-04-08 15:39:12 +00:00
Thibault Saunier b9e0ccd8b7 codecs: Add basic documentation stubs 2020-04-08 08:47:46 -04:00
Nicolas Dufresne b79c949789 codecs: h264: Fix DPB size calculation
As per specification in A.3.1 h) and A.3.2 f), the maximum size of the DPB is
16. Fix the maximum in the fine and fix the formula to use MIN instead of MAX
so that we no longer always use the maximum for the profile/level.
2020-04-07 07:53:27 +00:00
Jan Schmidt 46f994871f adaptivedemux: Handle instant rate change requests directly
Downstream demuxers will first send seek events upstream to us.
Do the right thing with instant rate change requests by handling them
immediately.
2020-04-02 11:26:46 +00:00
Jan Schmidt 1c79b39896 adaptivedemux: Don't ignore gst_segment_do_seek() return result
gst_segment_do_seek() can fail, so don't ignore the return result
2020-04-02 11:26:46 +00:00
Seungha Yang ce09ceb106 h265parser: Add a helper method to create SEI nal unit
Add an API to create raw SEI nal unit. This would be useful in case
an user want to create SEI nal data and inject the SEI nal data
into bitstream.
2020-04-02 09:20:11 +00:00
Nicolas Dufresne 7b8c071f9c codecs: h264dpb: Don't leak pic_list GArray
The contents was cleared, but the array was never released.
2020-03-31 09:34:05 -04:00
Nicolas Dufresne bd7db13412 codecs: h264: Do not ignore end_picture() return value
If decoding failed because end_picture() failed, set the picture to
nonexisting, this way output_picture() will be skipped. This avoids confusing
special cases in output_picture() implementation.
2020-03-31 09:34:05 -04:00
Seungha Yang a1e8109aa8 h264parser: Add a helper method to create and inject raw SEI data
Add an API to create raw SEI nal unit. This would be useful in case
an user want to create SEI nal data and inject the SEI nal data
into bitstream.
2020-03-30 07:59:10 +00:00
Seungha Yang f94157c949 nalutils: Introduce NAL writer helper methods
Add helper methods for writing h264 and h265 NAL
2020-03-30 07:59:10 +00:00
Seungha Yang 5f6884a1c0 h264parser: Expose SEI clear function to public
gsth265parser does it already. Although corresponding API of h265parser is
gst_h265_sei_free, _clear suffix is more consistent naming for h264parser
since there are gst_h264_{sps,pps}_clear().
2020-03-30 07:59:10 +00:00
Seungha Yang e65d06dc6a h265parser: Fix registered user data SEI leak
... and add fix for the SEI data in gst_h265_sei_copy()
2020-03-23 15:21:42 +00:00
Seungha Yang ef14a032c1 h265parser: Do not allocate too large size of memory for registered user data SEI
Don't be confused by the unit of payload size (i.e., bits and bytes)
Also this need a documentation with Since mark
2020-03-23 15:21:42 +00:00
Seungha Yang 9e429fad3e h264parser: Do not allocate too large size of memory for registered user data SEI
Don't be confused by the unit of payload size (i.e., bits and bytes)
Also this need a documentation with Since mark
2020-03-23 14:11:11 +00:00
Victor Manuel Jaquez Leal efcabce98e libs: codecparser: add missing unstable api warning
mpeg4 and vp8 parsers didn't show that compilation warning as the
others parsers.
2020-03-16 18:07:54 +01:00
yychao adc3d12741 tsdemux: Add support for AC4
According to following two specs, add support for AC4 in tsdemux.

1. ETSI TS 103 190-2 V1.2.1 (2018-02) : Annex D (normative): AC-4 in MPEG-2 transport streams
2. ETSI EN 300 468 V1.16.1 (2019-08) : Annex D (normative):Service information implementation of AC-3, EnhancedAC-3, and AC-4 audio in DVB systems
2020-03-09 21:54:09 +00:00
Seungha Yang 5609d8751c h265decoder: Pass max_dpb_size to new_sequence vfunc
same as we are doing in h264decoder
2020-03-08 16:11:35 +09:00
Seungha Yang 353013fcaa h265parser: Store NumDeltaPocs of reference for hardware accelerators
That's the value of NumDeltaPocs[RefRpsIdx] and we might be able to derive
the value from given sps and slice header.
Because well known hardware implementations refer to the value, however,
storing the value makes things easier.

Following is the list of hardware implementations
* DXVA2: ucNumDeltaPocsOfRefRpsIdx
* NVDEC/VDPAU: NumDeltaPocsOfRefRpsIdx
2020-03-07 12:20:03 +09:00
Seungha Yang ba3430a059 h265decoder: Fix for output and removal picture from DPB
See C.5.2.2 Output and removal of pictures from the DPB.

If the number of pictures in the DPB is greater than or equal to
sps_max_dec_pic_buffering_minus1[HighestTid] + 1, then the picture
should be outputted.
2020-03-07 12:20:03 +09:00
Seungha Yang 8b0d5e1272 meson: codecs: Don't install header
This library is not intended to be public. APIs are likely to
change over time and should not be disclosed to people yet.
2020-03-06 16:44:01 +09:00
Seungha Yang fdf06fa363 h264decoder: Rename some internals
No more a part of d3d11 implementation
2020-03-05 15:27:42 +00:00
Seungha Yang f487648b03 vp9decoder: Update document
s/GstH264Picture/GstVp9Picture/g and minor update since this baseclass
is no more d3d11 specific one.
2020-03-05 15:27:42 +00:00
Seungha Yang 82f1d5e8be codecs: Change output_picture() to mandatory implementation
GstVideoCodecFrame is expected to be consumed by subclass
per output_picture(). So the implementation cannot be optional.
2020-03-05 15:27:42 +00:00
Seungha Yang 83b056cb77 h265decoder: Port to nal type classification macro
... and remove namespaceless macro methods from baseclass
2020-03-05 23:22:39 +09:00
Seungha Yang 959320264a h265parser: Add helper macro for nal type classification
Add some macros to remove code duplication and to make it more readable
2020-03-05 23:22:34 +09:00
Nicolas Dufresne 56c3b40c30 h264picture: Add system_frame_num
This allow cross-referencing GstH264Picture and GstVideoCodecFrame.
2020-03-05 03:06:16 +00:00
Nicolas Dufresne 2b9ffa8f54 h264parser: Add some fixmes
Some of the syntax element do not use the spec name, which makes them harder
to find in the spec.
2020-03-05 03:06:16 +00:00
Nicolas Dufresne c6b8157dd6 codecs: Pass the max_dpb_size to new_segment virtual
On new_segment, the decoder is expected to negotiate. The decoder may want to
pre-allocate the needed buffers. Pass the max_dpb_size as this is needed to
determin how many buffers should be allocated.
2020-03-05 03:06:16 +00:00
Nicolas Dufresne f3f60f5a4c codecs: Add missing auto cleanup funcs 2020-03-05 03:06:16 +00:00
Nicolas Dufresne 00d04784d3 Move CODEC base classes into it's own library
This introduce a library which contains a set of base classes which
handles the parsing and the state tracking for the purpose of decoding
different CODECs. Currently H264, H265 and VP9 are supported. These
bases classes are used to decode with low level decoding API like DXVA,
NVDEC, VDPAU, VAAPI and V4L2 State Less decoders. The new library is
named gstreamer-codecs-1.0 / libgstcodecs.
2020-03-05 03:06:16 +00:00