GNOME Bugzilla – Bug 736871
codecparsers_vc1: sequence-layer parser is broken due to endianness issue.
Last modified: 2014-09-19 06:50:43 UTC
Current sequence-layer vc1 parser is broken due to endianmness issue. Sequence-layer is serialized in little-endian byte-order except for STRUCT_C. STRUCT_A and STRUCT_B are therefore serialized in little-endian byte-order but their fields are defined as unsigned int msb first, so likely big-endian.
Created attachment 286463 [details] [review] codecparsers_vc1: take care of endianness when parsing sequence-layer This patch proposal use a GstByteReader instead of a GstBitReader to parse the sequence-layer. But since STRUCT_A and STRUCT_B fields are definied as unsigned integer msb first, I think we can't change struct_a and struct_b parsing, so I use two temporary structA and structB byte arrays and pass them to parsing functions. I'm not sure it's the best way to do this, so if you have some other idea, you're welcome. :)
Created attachment 286464 [details] [review] codecparsers_vc1: add unit test for sequence-layer parsing I also write a unit test for sequence-layer parsing. It obviously fail with the current vc1parser.
It's not beautiful but I can't think of a more beautiful way of doing that :) (also wtf!) commit bd050201babf995c16181d4ef3a3bd46c261b8be Author: Aurélien Zanelli <aurelien.zanelli@parrot.com> Date: Thu Sep 18 11:39:53 2014 +0200 vc1parser: add unit test for sequence-layer parsing Check that a sequence-layer header is successfully parsed. https://bugzilla.gnome.org/show_bug.cgi?id=736871 commit c9a196d54dd41b68473e5a15d17cc37713735147 Author: Aurélien Zanelli <aurelien.zanelli@parrot.com> Date: Thu Sep 18 11:49:13 2014 +0200 vc1parser: take care of endianness when parsing sequence-layer sequence-layer is serialized in little-endian byte order except for STRUCT_C which is serialized in big-endian byte order. But since STRUCT_A and STRUCT_B fields are defined as unsigned int msb first, we have to pass them as big-endian to their parsing function. So we basically use temporary buffers to convert them in big-endian. See SMPTE 421M Annex J and L. https://bugzilla.gnome.org/show_bug.cgi?id=736871
(In reply to comment #3) > It's not beautiful but I can't think of a more beautiful way of doing that :) > > (also wtf!) I think it's a good example of "defective by design" :-P