Commit graph

156 commits

Author SHA1 Message Date
Edward Hervey
8ba1fbbe64 h264parse: Remove dead code
The detection for missing format/alignment is done way before this
codepath is reached (at which point we have already decided of a
format and alignment).

CID #1232800
2015-04-20 14:35:19 +02:00
Sebastian Dröge
9b50a12b52 h264parse: Don't unref buffer that was unreffed just a few lines before already 2015-04-15 21:07:59 +02:00
Thiago Santos
14f6fcdbd8 h264parse: reset the parser information when caps changes
This prevents it from going into passthrough after receiving 2
byte-stream caps (different ones) as it would keep the have_pps and
have_sps set to true and would just go into passthrough without
updating its caps.

This patch makes it reset its stream information to restart properly
when new caps are received.

https://bugzilla.gnome.org/show_bug.cgi?id=745409
2015-03-04 08:00:52 -03:00
Víctor Manuel Jáquez Leal
654e2a0298 h264parse: expose stereo-high profile
Exposing stereo-high profile as a compatible profile of multiview-high
if the maximum number of encoded views in the stream is two.

https://bugzilla.gnome.org/show_bug.cgi?id=743174
2015-01-21 01:03:36 +11:00
Víctor Manuel Jáquez Leal
4fc3db1808 h264parse: parse SPS subset
This patch calls gst_h264_parser_parse_subset_sps() when a
SPS subset NAL type is found.

All the bits required for parsing the SPS subset in NALs were
already there, just we need to call them when the this NAL type
is found.

With this parsing, the number of views (minus 1) attribute is
filled, which was a requirement for negotiating the stereo-high
profile.

https://bugzilla.gnome.org/show_bug.cgi?id=743174
2015-01-21 01:03:36 +11:00
Sreerenj Balachandran
d8c2dd2da1 h264parse: add initial support for MVC NAL units.
Initial support for MVC NAL units. It is only needed to propagate the
complete set of NAL units downstream at this time.

https://bugzilla.gnome.org/show_bug.cgi?id=696135

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-01-21 00:18:44 +11:00
Sreerenj Balachandran
542c77ab38 h264parse: expose compatible profiles to downstream
Some video bitstreams report a too restrictive set of profiles. If a video
decoder was to strictly follow the indicated profile, it wouldn't support that
stream, whereas it could in theory and in practice. So we should relax the
profile restriction for allowing the decoder to get connected with parser.

https://bugzilla.gnome.org/show_bug.cgi?id=739992
2015-01-09 18:19:00 +01:00
Duncan Palmer
ef71b6178e h264parse: Fix periodic SPS/PPS sending work after a seek
Reset the interval variable to have SPS/PPS sending work after
 a (backwards) seek.

https://bugzilla.gnome.org/show_bug.cgi?id=742212
2015-01-06 09:14:48 -03:00
Mathieu Duponchelle
bd5688d1ee Revert "h264parse: expose compatible profiles to downstream"
This reverts commit 3910cbe7ce.
2014-12-09 04:28:17 +01:00
Sreerenj Balachandran
3910cbe7ce h264parse: expose compatible profiles to downstream
Some video bitstreams report a too restrictive set of profiles. If a video
decoder was to strictly follow the indicated profile, it wouldn't support that
stream, whereas it could in theory and in practice. So we should relax the
profile restriction for allowing the decoder to get connected with parser.

https://bugzilla.gnome.org/show_bug.cgi?id=739992
2014-12-05 09:36:02 +01:00
Josep Torra
d518033e77 h264parse: set the HEADER flag on buffers containing SPS or PPS 2014-11-07 15:51:48 +01:00
Matej Knopp
1f367764fc h264parse: don't unnecesarily set src_caps
https://bugzilla.gnome.org/show_bug.cgi?id=739374
2014-11-06 11:51:59 +01:00
Sreerenj Balachandran
3776e78ae6 codecparsers: h264: add support for Frame Packing Arrangement SEI message.
This parses the frame_packing_arragement() payload in SEI message.
This information can be used by decoders to appropriately rearrange the
samples which belong to Stereoscopic and Multiview High profiles.

https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-10-29 23:09:41 +11:00
Sreerenj Balachandran
51f003e469 codecparsers: h264: add support for Stereo Video Information SEI message.
Add the necessary payload parsing support for stereo_video_info.

https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2014-10-29 23:09:41 +11:00
Sreerenj Balachandran
b1a286cd7c h264parse: expose parsed profile and level to downstream
Set parsed profile and level in src caps.

https://bugzilla.gnome.org/show_bug.cgi?id=732239
2014-10-09 11:46:18 +03:00
Thibault Saunier
4c63326a7a h264parse: Return flushing if we get chained while being set to READY
Or not negotiated in the case we would be actually not negotiated

Currently we are getting assertions from
gst_pb_utils_add_codec_description_to_tag_list because of NULL
caps.

https://bugzilla.gnome.org/show_bug.cgi?id=737186
2014-09-24 19:21:18 +02:00
Tim-Philipp Müller
ea7d5027a0 h264parse: fix up handling of input caps corner cases
Do more elaborate validation of the input caps: what fields
are required and/or not allowed. Don't assume AVC3 format
input without codec_data field is byte-stream format. Fix
up some now-unreachable code (CID 1232800).
2014-08-28 20:18:17 +01:00
Thiago Santos
9b6c8a48b4 h264parse: don't consider unknown stream-format as avc
It should try to use bytestream in these cases that the format
is set to _FORMAT_NONE as it seems that is what the 'else' clause
for bytestream can handle (by defaulting to _FORMAT_BYTESTREAM).
2014-08-25 13:37:57 -03:00
Gwenole Beauchesne
7d44a51bfe h264parse: fix collection of access units to preserve config headers.
Always use a GstAdapter when collecting access units (alignment="au")
in either byte-stream or avcC format. This is required to properly
preserve config headers like SPS and PPS when invalid or broken NAL
units are subsequently parsed.

More precisely, this fixes scenario like:
<SPS> <PPS> <invalid-NAL> <slice>

where we used to reset the output frame buffer when an invalid or
broken NAL is parsed, i.e. SPS and PPS NAL units were lost, thus
preventing the next slice unit to be decoded, should this also
represent any valid data.

https://bugzilla.gnome.org/show_bug.cgi?id=732203

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
34c2cfd4dd h264parse: improve conditions for skipping NAL units.
Carefully track cases when skipping broken or invalid NAL units is
necessary. In particular, always allow NAL units to be processed
and let that gst_h264_parse_process_nal() function decide on whether
the current NAL needs to be dropped or not.

This fixes parsing of streams with SEI NAL buffering_period() message
inserted between SPS and PPS, or SPS-Ext NAL following a traditional
SPS NAL unit, among other cases too.

Practical examples from the H.264 AVC conformance suite include
alphaconformanceG, CVSE2_Sony_B, CVSE3_Sony_H, CVSEFDFT3_Sony_E
when parsing in stream-format=byte-stream,alignment=au mode.

https://bugzilla.gnome.org/show_bug.cgi?id=732203

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
7bb6443bfb h264parse: introduce new state tracking variables.
Improve parser state tracking by introducing new flags reflecting
it: "got-sps", "got-pps" and "got-slice". This is an addition for
robustness purposes.

Older have_sps and have_pps variables are kept because they have
a different meaning. i.e. they are used for deciding on when to
submit updated caps or not, and rather mean "have new SPS/PPS to
be submitted?"

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
5601c87598 h264parse: fix and optimize NAL collection function.
Use gst_h264_parser_identify_nalu_unchecked() to identify the next
NAL unit. We don't want to parse the full NAL unit, but only the
header bytes and possibly the first RBSP byte for identifying the
first_mb_in_slice syntax element.

Also fix check for failure when returning from that function. The
only success condition for that is GST_H264_PARSER_OK, so use it.

https://bugzilla.gnome.org/show_bug.cgi?id=732154

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-01 16:26:48 +02:00
Gwenole Beauchesne
9bd186a960 codecparsers: h264: fix memory leak in GstH264PPS.
The gst_h264_parse_pps() function dynamically allocates the slice
group ids map array, so that needs to be cleared before parsing a
new PPS NAL unit again, or when it is no longer needed.

Likewise, a clean copy to the internal NAL parser state needs to be
performed so that to avoid a double-free corruption.

https://bugzilla.gnome.org/show_bug.cgi?id=707282

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-27 14:00:10 +02:00
Aurélien Zanelli
67df207280 codecparsers: h264: add support for Recovery Point SEI message.
The recovery point SEI message helps a decoder in determining if the
decoding process would produce acceptable pictures for display after
the decoder initiates random access or after the encoder indicates
a broken link in the coded video sequence.

This is not used in the h264parse element, but it could help debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=723380
2014-06-26 17:22:26 +02:00
Aurélien Zanelli
2c3e7b6352 h264parse: use new gst_h264_video_calculate_framerate() to get framerate
https://bugzilla.gnome.org/show_bug.cgi?id=723352
2014-05-22 16:12:36 +02:00
Aurélien Zanelli
a9dfa354f6 h264parse: set field_pic_flag when parsing a slice header
field_pic_flag was used but never set to other value than its default

https://bugzilla.gnome.org/show_bug.cgi?id=730363
2014-05-22 15:54:04 +02:00
Haakon Sporsheim (ieei)
36a2acae45 h264parse: unref/replace force_key_unit_event in gst_h264_parse_reset
https://bugzilla.gnome.org/show_bug.cgi?id=729200
2014-04-29 12:17:51 -03:00
Sebastian Dröge
10ffa089a0 h264parse: Copy over DISCONT flag from input buffers 2014-03-29 10:33:45 +01:00
Thibault Saunier
5fd9b42f29 h264parse: Default framerate to 0/1 when no informations found
It is not perfect but it allows us to be sure that the mandatory 'framerate'
field is present in the caps.

As soon as some information is found in the stream, that will be
updated.

https://bugzilla.gnome.org/show_bug.cgi?id=723243
2014-01-31 09:28:58 +01:00
Aurélien Zanelli
af78b45979 h264parse: Fix multiple SEI messages in one SEI RBSP parsing.
An SEI RBSP could contains more than one SEI message as specified in
7.4.2.3.1.

This commit change the parser API: the gst_h264_parser_parse_sei()
function now create and fill a GArray containing GstH264SEIMessage.

https://bugzilla.gnome.org/show_bug.cgi?id=721715
2014-01-23 20:18:53 +01:00
Sebastian Dröge
6934c7e2fc h264parse: Post VIDEO_CODEC tag 2013-12-16 10:18:23 +01:00
Wim Taymans
9ac2cee2db videoparsers: use ACCEPT_INTERSECT
We can also accept caps with missing fields.
2013-12-04 09:49:20 +01:00
Wim Taymans
e9dd2df3f4 videoparsers: remove fields from filter
Don't filter out the caps properties we can convert between when
proxying the getcaps query to the downstream peer pad.
2013-12-04 09:49:20 +01:00
Wim Taymans
d5a16bccac videoparsers: refactor remove_fields in getcaps 2013-12-04 09:49:20 +01:00
Sebastian Dröge
1b747bfecb h264parse: Fix splitting of multiple NALU per buffer
Conversion to byte-stream/nal crashes without that because the
baseparse frame of all NALUs is finished for the first NALU, then
used again for parsing the second NALU. Just that now the buffer
of the frame is already gone. Instead we create temporary frames
for every NALU.
2013-11-28 15:10:16 +01:00
Sreerenj Balachandran
ab3f7d6096 h264parse: Remove the explicit PAR calculation based on VUI headers
The PAR calculation based on VUI headers is already doing by the
h264 codecparser and we does't need to duplicate those code.

https://bugzilla.gnome.org//show_bug.cgi?id=711009
2013-10-31 23:00:58 +01:00
Edward Hervey
0baac2ffb9 h264parse: Unify value setting
the initial par_n = par_d = 0; was always overwritten since the switch/case
handles all values

And remove the 0 case (it's the same handling as default)
2013-10-28 09:35:20 +01:00
Edward Hervey
77f254abb3 h264parse: Avoid ending up with undefined values
If caps aren't fixed, we'd end up with undefined values for format
and align.
2013-10-28 09:33:16 +01:00
Sebastian Dröge
4b5d560092 h264parse: Fix conversion to AVC if a SPS/PPS not from the first indizes is used
https://bugzilla.gnome.org/show_bug.cgi?id=707974
2013-10-03 13:26:06 +02:00
Matej Knopp
a41e8698b1 h264parse: don't update src caps if only codec_data differs
https://bugzilla.gnome.org/show_bug.cgi?id=705333
2013-09-09 15:09:10 +02:00
Alex Ashley
31d1c05871 h264parse: Add support for stream-format=avc3
When outputting in AVC3 stream format, the codec_data should not
contain any SPS or PPS, because they are embedded inside the stream.

In case of avc->bytestream h264parse will push the SPS and PPS from
codec_data downstream at the start of the stream, at intervals
controlled by "config-interval" and when there is a codec_data change.

In the case of avc3->bytstream h264parse detects that there is
already SPS/PPS in the stream and sets h264parse->push_codec to FALSE.
Therefore avc3->bytstream was already supported, except for the stream
type.

In the case of bystream->avc h264parse will generate codec_data caps
from the parsed SPS/PPS in the stream. However it does not remove these
SPS/PPS from the stream. bytestream->avc3 is the same as bytestream->avc
except that the codec_data must not have any SPS/PPS in it.

|--------------+-------------+-------------------|
|stream-format | SPS in-band | SPS in codec_data |
|--------------+-------------+-------------------|
| avc          | maybe       | always            |
|--------------+-------------+-------------------|
| avc3         | always      | never             |
|--------------+-------------+-------------------|

Amendment 2 of ISO/IEC 14496-15 (AVC file format) is defining a new
structure for fragmented MP4 called "avc3". The principal difference
between AVC1 and AVC3 is the location of the codec initialisation
data (e.g. SPS, PPS). In AVC1 this data is placed in the initial MOOV box
(moov.trak.mdia.minf.stbl.stsd.avc1) but in AVC3 this data goes in the
first sample of every fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=702004
2013-09-04 13:32:36 +02:00
Edward Hervey
865ad4cdad h264parse: Use codecparsers macros
note: I/SI also covers the S_I/S_SI variants
2013-08-30 09:05:43 +02:00
Matthieu Bouron
4b10f278b6 h264parse: only update src CAPS when it's necessary
https://bugzilla.gnome.org/show_bug.cgi?id=705452
2013-08-27 15:00:45 +02:00
Matthieu Bouron
43dcebe2a0 h264parse: do not set CAPS and passthrough mode if SPS/PPS have not been parsed
https://bugzilla.gnome.org/show_bug.cgi?id=705452
2013-08-27 15:00:35 +02:00
Edward Hervey
8074a48594 h264parse: Use slice type to determine if frame is keyframe
This is the same behaviour as pre-baseparse-refactoring

https://bugzilla.gnome.org/show_bug.cgi?id=705598
2013-08-09 08:42:43 +02:00
Edward Hervey
b17676a1d5 h264parse: Do not trigger caps update if we only have PPS updates
Updating caps results in downstream elements potentially reconfiguring themselves
(such as decoders). If we do this in the middle of keyframes, we would result
in those elements being reconfigured and handling garbage until the next keyframe.

Instead of this only send (potentially) new codec_data when we have *both* SPS and
PPS.

https://bugzilla.gnome.org/show_bug.cgi?id=705333
2013-08-04 12:08:57 +02:00
Edward Hervey
97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Edward Hervey
3ee8aa2c2d h264parse: Show NALU string type in debug messages
If you know the NALU type by heart I tip my hat to you, for the rest of
us mere mortals this is a bit more helpful
2013-07-29 09:42:12 +02:00
Olivier Crête
6a1896d805 h264parse: Don't abort on invalid streams
Just return an error
2013-07-22 16:27:16 +02:00
Gwenole Beauchesne
18984f98dd h264parser: fix size caps to report cropped dimensions.
Restore the original h264parser behaviour to report cropped dimensions
in size caps.

https://bugzilla.gnome.org/show_bug.cgi?id=694068

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-09 12:15:07 +02:00