Commit graph

325 commits

Author SHA1 Message Date
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
Tim-Philipp Müller
6e3518dfd6 pngparse: optimise reading of png files
Read PNG data chunk in one go by letting the parser
base class know the size we need, so that it doesn't
drip-feed us small chunks of data (causing a lot of
reallocs and memcpy in the process) until we have
everything.

Improves parsing performance of very large PNG files
(65MB) from ~13 seconds to a couple of millisecs.

https://bugzilla.gnome.org/show_bug.cgi?id=736176
2014-11-09 21:02:15 +00:00
Aurélien Zanelli
6b5e950236 vc1parse: set seq_layer_sent to FALSE on reset()
https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Aurélien Zanelli
025f8b9129 vc1parse: implement asf to *-frame-layer stream-format
This commit add an helper to convert a frame to frame-layer format and
use it to implement these two stream-format conversion:
- asf --> sequence-layer-frame-layer
- asf --> frame-layer

In simple/main profile, we basically have a raw frame, so building a
frame layer isn't too complicated. But in advanced profile, the first
frame-layer should contain sequence-header, entrypoint, and frame and
each keyframe should contain entrypoint, so we have to handle these
carefully.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Aurélien Zanelli
7d76ba5731 vc1parse: check output format at negotiation time
Add an helper to check that output stream-format is coherent with
profile and header-format. It also check if we know how to do the
conversion if the input stream-format differs from selected
output-format.
So, in case output stream-format is not allowed, it will now fail at
negotiation rather than in pre_push_frame.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Aurélien Zanelli
5eadb05fab vc1parse: add some asf related stream-format conversions
This commit introduces an helper to convert an ASF frame to BDUs format with
startcodes and use this helper to implements following stream-format
conversions:
- asf --> bdu
- asf --> sequence-layer-bdu
- asf --> sequence-layer-raw-frame

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Aurélien Zanelli
f2c5900c6d vc1parse: add some simple stream-format conversion
It add the support of following stream-format conversion:
- bdu --> sequence-layer-bdu
- bdu-frame --> sequence-layer-bdu-frame
- frame-layer --> sequence-layer-frame-layer

For these conversion, the only requirements is to push a sequence-layer
buffer prior to data.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Aurélien Zanelli
cd500c5a06 vc1parse: prepare the stream-format conversion code and add the simplest ones
It prepares the template for stream-format conversion and it implements
the following conversion:
- sequence-layer-bdu --> bdu
- sequence-layer-bdu-frame --> bdu-frame
- sequence-layer-frame-layer --> frame-layer

Work is done in the pre_push_frame() method.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-11-08 19:01:10 +01:00
Josep Torra
d518033e77 h264parse: set the HEADER flag on buffers containing SPS or PPS 2014-11-07 15:51:48 +01:00
Josep Torra
4b43e95ebd h265parse: set the HEADER flag on buffers containing VPS, SPS or PPS 2014-11-07 15:51:48 +01:00
Sebastian Dröge
df64862ebe h265parse: don't unnecesarily set src_caps
https://bugzilla.gnome.org/show_bug.cgi?id=739374
2014-11-06 11:53:04 +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
Aurélien Zanelli
4cc6c7fe3b vc1parse: introduce a helper to make sequence-layer
It will be useful to implement stream-format conversion.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
2014-10-20 13:17:57 +02:00
Aurélien Zanelli
89455b7106 vc1parse: select caps according to wmv format at negotiation
Some VC1 decoder can have different caps according to wmv format, ie
WMV3 or WVC1.
So instead of keeping the first available caps, we interserct with
current WMV format.

https://bugzilla.gnome.org/show_bug.cgi?id=738532
2014-10-20 12:18:50 +02:00
Aurélien Zanelli
6375fce925 vc1parse: parse frame header when stream format is ASF/raw for simple/main profile
When stream-format is ASF or sequence-layer-raw-frame, we basically have
a raw frame so we can parse it to extract some information such the
keyframe flag. The only requirement is to have a valid sequence-header.

This commit parse the frame header and set the DELTA_UNIT buffer flag in
case the frame is not a keyframe.

https://bugzilla.gnome.org/show_bug.cgi?id=738519
2014-10-14 14:02:30 +02:00
Aurélien Zanelli
77453c8124 vc1parse: just assume none header-format when no codec_data is present
https://bugzilla.gnome.org/show_bug.cgi?id=738449
2014-10-14 10:23:28 +02:00
Aurélien Zanelli
6df477ff0d vc1parse: fix framesize when input is frame-layer
frame-layer header is represented as a sequence of 32 bit unsigned
integer serialized in little-endian byte order, so framesize is on the
first 3 bytes.

SMPTE 421M Annex L.

https://bugzilla.gnome.org/show_bug.cgi?id=738243
2014-10-10 11:51:14 +01:00
Sebastian Dröge
2817472b9e h265parse: expose parsed profile, tier and level to downstream
https://bugzilla.gnome.org/show_bug.cgi?id=732239
2014-10-09 11:46:23 +03: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
Vineeth T M
52ac7cf27a videoparser: comment unused GST_BASE_PARSE_FRAME_FLAG_PARSING
GST_BASE_PARSE_FRAME_FLAG_PARSING value is wrong, and the same flag is
not being used presently. Hence changing the value and commenting it out.
This needs to be included in baseparse.h later on

https://bugzilla.gnome.org/show_bug.cgi?id=737411
2014-10-06 11:48:08 +01:00
Aurélien Zanelli
677d052e84 vc1parse: unref caps when it is empty in renegotiate()
https://bugzilla.gnome.org/show_bug.cgi?id=737724
2014-10-02 10:43:49 +03:00
Luis de Bethencourt
efca04f23f style: remove unnecessary break statements
Code flow never arrives to these break statements due to the gotos preceding
them. So the breaks are unnecessary, as discussed in bug 736942.

https://bugzilla.gnome.org/show_bug.cgi?id=737370
2014-09-25 16:41:15 +01: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
Aurélien Zanelli
42167b0d1f vc1parse: initialize sent_codec_tag before using it
https://bugzilla.gnome.org/show_bug.cgi?id=736951
2014-09-23 19:50:26 +03:00
Aurélien Zanelli
7acf2fe5cb vc1parse: enable header-format conversion
In fact we support header-format conversion which is done in
update_caps() method.

https://bugzilla.gnome.org/show_bug.cgi?id=736786
2014-09-18 12:28:12 +03:00
Aurélien Zanelli
de141c3237 vc1parse: forge sequence-layer from seq_hdr instead of seq_layer
If we don't have a seq_layer_buffer, we also don't have a valid
seq_layer because there are set together in
gst_vc1_parse_handle_seq_layer().

So when output header format is sequence-layer and when we don't have a
seq_layer_buffer, we forge one from seq_hdr.

https://bugzilla.gnome.org/show_bug.cgi?id=736781
2014-09-17 11:37:44 +03:00
Aurélien Zanelli
d2847eaa09 vc1parse: fix sequence-layer/frame-layer endianness
Sequence-layer and frame-layer are serialized in little-endian byte
order except for STRUCT_C and framedata fields as described in SMPTE 421M Annex
L.

https://bugzilla.gnome.org/show_bug.cgi?id=736750
2014-09-16 17:40:55 +03:00
Aurélien Zanelli
2071c13936 vc1parse: fix malformed sequence layer header and STRUCT_C
This commit fix several issues with sequence layer header forging on
update_caps():
- 0x00000004 unsigned integer is before STRUCT_C.

- Set reserved bits of STRUCT_C to their values for simple/main
  profiles in sequence layer header format and ASF header format.

- Sequence layer shall be represented as a sequence of 32 bits unsigned
  integers and shall be serialized in little-endian byte order except
  for STRUCT_C which shall be serialized in big-endian byte-order.

See SMPTE 421M Annex L for more details about sequence layer format.

https://bugzilla.gnome.org/show_bug.cgi?id=736474
2014-09-12 16:10:50 +03: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
Sebastian Dröge
78ab2cdffd vc1parse: Fix compiler warnings when compiling with G_DISABLE_ASSERT 2014-06-29 20:11:58 +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
Chris Bass
d9d4a91c62 h265parse: fix hvcC size check
In ISO/IEC 14496-15, the minimum size of a HEVCDecoderConfigurationRecord
(i.e., the contents of a hvcC box) is 23 bytes. However, the code in h265parse
checks that the size of this data is not less than 28 bytes, and it refuses to
accept caps if the check fails. The result is that standards-conformant streams
that don't carry any parameter sets in their hvcC boxes won't play.

https://bugzilla.gnome.org//show_bug.cgi?id=731783
2014-06-22 21:57:28 +01: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
Vincent Penquerc'h
7659f3bec4 vc1parse: guard against dividing by zero
If framerate is unknown, we write the maximum framerate
allowed for this profile/level:

https://tools.ietf.org/html/draft-ietf-avt-rtp-vc1-06#section-6.1
http://wiki.multimedia.cx/index.php?title=VC-1#Setup_Data_.2F_Sequence_Layer

Coverity 1139694
2014-04-21 13:23:46 +01:00
Sebastian Dröge
10ffa089a0 h264parse: Copy over DISCONT flag from input buffers 2014-03-29 10:33:45 +01:00
Sreerenj Balachandran
4d17166b03 mpegvideoparse: Differentiate the mpeg-2 stream from mpeg-1 based on pic_ext
Presence of picture extension header identifies the stream as mpeg2.
We are supposed to set the mpegversion to 2 if there is a picextension
instead of blindly setting the version to 1

https://bugzilla.gnome.org/show_bug.cgi?id=726028
2014-03-12 08:46:41 +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
duhui.lee
cd8c0227c8 h265parse: Update caps when receive VPS/SPS/PPS
https://bugzilla.gnome.org/show_bug.cgi?id=722240
2014-01-20 10:05:18 +01:00