From f905598d2e3b4406961c81e898c85789cf404a66 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 1 Apr 2023 16:38:08 +0200 Subject: [PATCH] link to mediacommon (#223) * move codecs and bits to mediacommon * add SafeSetParams() to H264 and H265 * update README --- README.md | 3 - client_play_test.go | 2 +- .../client-publish-format-mpeg4audio/main.go | 2 +- .../main.go | 10 +- .../main.go | 2 +- .../mpegtsmuxer.go | 2 +- examples/client-read-format-h264/main.go | 10 +- examples/server-h264-save-to-disk/main.go | 2 +- .../server-h264-save-to-disk/mpegtsmuxer.go | 2 +- go.mod | 1 + go.sum | 2 + pkg/bits/read.go | 123 --- pkg/bits/read_test.go | 88 -- pkg/bits/write.go | 26 - pkg/bits/write_test.go | 18 - pkg/codecs/codecs.go | 2 - pkg/codecs/h264/annexb.go | 134 --- pkg/codecs/h264/annexb_test.go | 127 --- pkg/codecs/h264/avcc.go | 74 -- pkg/codecs/h264/avcc_test.go | 69 -- pkg/codecs/h264/dts_extractor.go | 193 ---- pkg/codecs/h264/dts_extractor_test.go | 222 ----- pkg/codecs/h264/emulation_prevention.go | 33 - pkg/codecs/h264/emulation_prevention_test.go | 65 -- pkg/codecs/h264/h264.go | 11 - pkg/codecs/h264/idrpresent.go | 12 - pkg/codecs/h264/idrpresent_test.go | 17 - pkg/codecs/h264/nalu_type.go | 83 -- pkg/codecs/h264/nalu_type_test.go | 13 - pkg/codecs/h264/sps.go | 728 --------------- pkg/codecs/h264/sps_test.go | 462 ---------- ...6a6db8644720a23ad912d7be68bf441e186095f7fe | 2 - ...2987e270fe2488d4d58ecd712db136a3e011071253 | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...c7ec4be5cffca97bbe1c447ed47eda11adfd7ab0cc | 2 - ...6a6db8644720a23ad912d7be68bf441e186095f7fe | 2 - ...edd305e7f281b04eeb75cc2339d58c64d6618e8702 | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...00be4f0a4b1969c5386f513788f118019a7e9e32b1 | 2 - ...17aa5604d9b3910ddfa989bdb6bc7323714fda66b3 | 2 - ...a8267b56951b5b6ec2fa924f1e8d8fcab394abc2d3 | 2 - ...a8dc649a0c711445e6307ee02a65b0a4322e758021 | 3 - ...85a3b44c94a8135edafbbd664bd8e2eca808ca5ebc | 3 - ...c2c37a8459445dd9279b725d7243c3341e8e5bc746 | 3 - ...c840715796c9540b4942476167f0b4db164b52ce56 | 3 - ...a8877b465cf77c9425c65d3e2cf6f314d6cbd0050e | 3 - ...e86badcea42b216770d5fc4629d036eb04cfef9ae7 | 3 - ...530fb6f91bc8a0f066193f73e2d2fc35b282b88839 | 3 - ...c07d133559251d8a4697da418218cbaf077650f873 | 3 - ...7161402f7e12129cbe32cf765847b4377867ebc9b5 | 3 - ...59c9e32f26eec2d69bb3aff1746a521786027b732c | 3 - ...bb019dc1ad59d072065ef32935d09b5de28f5d77e0 | 2 - ...2987e270fe2488d4d58ecd712db136a3e011071253 | 2 - ...56d5527be7cf004a2b2c42d9299813c7dc88e9bbd2 | 2 - ...47e60a6c7775cdab6db0e3295029427b18ae2ae747 | 2 - ...e4f1a3ffeacee9738e4c3408a600c24a80de240bac | 2 - ...c7dbc448244bfd66bb4f85d90722653942fdcb60e4 | 2 - ...d88ff2ffdd68dd18d6ca5b1074722884e7d4e4c6a2 | 2 - ...28ffeb9d6cdb51781f98d2cda015995753a7f716e9 | 2 - ...343a15d1ea8c4a7baf8b95bdad79903d47a2af568f | 2 - ...1e23922b7370f4b03e776cd4710bb197715d05e106 | 2 - ...b01d25c4d2b9bc91621d5107b91a9ae3ee676b3b69 | 2 - ...f2256411e7c7e865bf4d2fa2417cf15621a0aa6c68 | 2 - ...81c3939268fda76b1a29a64b67fa65580babb9f310 | 2 - ...793c9f06a763063a089bb7c6f5486331ca9426a898 | 2 - ...0d329a844bc5b06ba24530daafe2fb23707ec73f56 | 2 - ...3edece8150d02d0f28a7f580c26847d3e6eae19f8e | 2 - ...c5bb714ab20766839e07e11d6e1a2e92d8c70a60a2 | 2 - ...dafde531d4280c980c2676ab030e7163f4d618869b | 2 - ...aded44531acaea8e1d19f18bd99730de3df81dc2b4 | 2 - ...05a60ccb56dc5bc1db0bae2a12a115443d39d93c6e | 2 - ...570d1373ce2a6d116dfaa39c1ee11befed0cd82e61 | 2 - ...1ce9339664c952ce93ff20e89aee08b4c432aab3a7 | 2 - ...c8c8c532ea89b2ae61816b13f86ea486572215e81d | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...d590dd27179dd0760a53aa6ee2a1ea2cb7a42ce506 | 2 - ...cc5038559d6ae38e23c23db2a0d82eca058e125166 | 2 - ...aa4a53e4de01a04efc02ac9cfda60f9815f80e9b9d | 2 - ...7d0ef76b78172fc99dddd4299e86d13b79b984cb9e | 2 - ...239abd268cf254b3a983a6b7379293611f56ebe74d | 2 - ...d2e1d77b9ed0ab99094562759738971883b12b5ff5 | 2 - ...1ad92e13ad3f99e6ceec8052bfecbee3596422d48a | 2 - ...a593a050d7f842605f017d5e43a0d31b35e66f28fe | 2 - ...246f4b66a05d5841569f9c5f1a4f19d081050b3747 | 2 - ...f55a2d14c8d4dc2d9a4726c8f7806df12bda102326 | 2 - ...0cdf552d94e12df5f835eb9e06e6815957dc2d5fb2 | 2 - ...6e8f008894ef1b0398cbc1d3d72966d26bed74234b | 2 - ...8a45cb1d387b0a5b3ad6f2cdd861badd887f810b45 | 2 - ...b4a38798ea2c723e1d88ab5fb6e144320b2314d6fe | 2 - ...650ec9424c1b3b183dea47cea96cb89b3f9fd36986 | 2 - ...8a8853d53517cfe49f51dc89f688d445d1265e5d7d | 2 - ...795764e75469e2585518502b400bfee0afd89b5d15 | 2 - ...ed9e7162b114412251df6e662ab63a07b1009b5393 | 2 - ...dfdf57dca91dd1a9512911d96d203aa6d135193c07 | 2 - ...f3c68480c0e27cc08808b74a1f30d2a39126ad9576 | 2 - ...16cacabdc3b33e8bb1c3090e8da7bf331caf899fad | 2 - ...5cb6e9222c1a8c685c578eabe92ddab77a56fbda91 | 2 - ...a53f855490a6d93cbb08be7a1f70d7b7f0a237763c | 2 - ...2ba67c34539a4cd854b3de89394f8049e27672f7d5 | 2 - ...14318381ec19d9aa59a1fff4952c4b6aeb741ba02d | 2 - ...2e061280d14af17e8b0075043f1c822533b41ef9ff | 2 - ...36dde3d97fcda3593310c32dcd8cb6981e36d54538 | 2 - ...07881bdc20e3f5c473749397a8c84bd168f9ac799d | 2 - ...387777290f3d60da89055d4df8529dcf6afad9beca | 2 - ...d1822671be4ac721f297e14dcc4a7900d15c7fff7f | 2 - ...4bacf15e50903f836d7c550504188c55ab37cfde4f | 2 - ...a4b039b822e97cd317c07fc97337da68f023d563a2 | 2 - ...36d0278039659036029592195e8a9acf94ffd70546 | 2 - ...fe83479d6e5eba77143048cca05f00e56a244a8066 | 2 - ...4df230fdfbb9ce3abceb662ee5e714a6e1d94ec0ac | 2 - ...927c5c1e65d159b70f39cd161da0dba348c1221ab3 | 2 - ...398f3cfa98589a431137e9dc72ec5a8bb5cc4cd5da | 2 - ...cd56f2ebaa77ed1632549d98dd78ee0348f68554b3 | 2 - ...ca9adc81513ebf3a55d8a8a053ddb5cf87f9f98524 | 2 - pkg/codecs/h265/dts_extractor.go | 242 ----- pkg/codecs/h265/dts_extractor_test.go | 84 -- pkg/codecs/h265/h265.go | 11 - pkg/codecs/h265/nalu_type.go | 99 -- pkg/codecs/h265/nalu_type_test.go | 13 - pkg/codecs/h265/pps.go | 51 -- pkg/codecs/h265/pps_test.go | 40 - pkg/codecs/h265/sps.go | 861 ------------------ pkg/codecs/h265/sps_test.go | 446 --------- ...3c26cda412817aa65ef38cdeb3aaed76db1c0379a4 | 3 - ...090e339b08e446b5f9e4f7fff7e448ae377664edb0 | 3 - ...e09cb55a3a35b9dd081ab4959ba7a35d04c5f91cb8 | 3 - ...3fd9ec0f57bfe84533014a058f89ed320caceb13a9 | 3 - ...4b872ad99a77e5d04e1472db9455c4b1b5bd8b7073 | 3 - ...e8a166e7a25bbaa5d4431a3900f509c70b756a06fb | 3 - ...e6fff78d2fcadf6942a62141398df17b6cbe61f0b7 | 3 - ...88b42b4e913a44408f4dfb4e496550c34cb92c93fc | 3 - ...ece5f2d2bce19860a7c060445225adcf3dab189bc4 | 3 - ...4aeaf70d8194277f53bc68eb6255f52278d879d48c | 3 - ...9cff0054b22899ced04b7aa1fddf0c96c76937d0fd | 3 - ...f39f20a5ddcdb857a09391b3e18e55376b8155e3a8 | 3 - ...2987e270fe2488d4d58ecd712db136a3e011071253 | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...7c42f3dbe1518bc2481859740855ab13d8abdd88b1 | 2 - ...33f3a90099024e580a6ba319ea2bf539880c50bd7c | 2 - ...be5ef9389790e33ed1886073dec445d4cf05bcd4b4 | 2 - ...c5d1385a967f0634a2573162c00ba67a01fd806919 | 2 - ...7503859a5680dfceb99c4fb98344d87f884ef731ba | 2 - ...aa9d28d80a409c350d4900c88ab2647be4492f25ee | 2 - ...08e0e0d56b83156fd4d8de02c03bda9a96b85679e0 | 2 - ...cfc92d30a0fd17a6f4aa63a8005253a16205b4e3c6 | 2 - ...8bd1b55bf7bc54ee36279dc9f09567d675c044d58f | 2 - ...a2589536a695487fba02686e2130ed0a5b880d52dc | 2 - ...98640e83c09fecc453519c426cc0b446d43a1cbd73 | 2 - ...c5f38a1199e9777ffe846bba3468737defafd094e7 | 2 - ...07f815b5af2a08d4e6406f173702c88b6a86862437 | 2 - ...9aee956d40195ff289a44da3296d0c88ac02fc67bc | 2 - ...a86b406b9f2565987a4a3b6d7660ddc308b5b2fae2 | 2 - ...1328eb2c82c55cb593824ddfe49742696889e520d5 | 2 - ...d2162c9c6aac1e8bf42d252c18b6f766ec1858aaff | 2 - ...4af476bb9fa1d01a47a46bed9bae42c10b18e21594 | 2 - ...2d5f9c0d4cb61ea2d4533f554abd52b0df93bbbc4a | 2 - ...45d10ea3068aa66a765d26b383f9848a4881c6c170 | 2 - ...ee1833e960dc84706396c38db6be2c71c772230bf3 | 2 - ...b69b6cc79e8df25b2ae99c5caf497906ea47c87401 | 2 - ...5eb8f86e8dcfe862c5cd7d187c082598daaba1c047 | 2 - ...feeae612a8916981964640a34384b1ade4316e8038 | 2 - ...b495b99b128071c41b8527d5e3dbaab0fa75aa703f | 2 - ...486c43e23d21d3d1709f5d6e909f809e316eef3ad0 | 2 - ...cea909e28289cca73cd868ab29f13674040fbc6744 | 2 - ...30bae3c6d948e0abe6541fd423fdc4415f863329a8 | 2 - ...77b5a21ace6348d0ab462a9bd03318f936ec14cf9c | 2 - ...694b8ae1044f19e4d98d2048c1aefa8efd2d61658b | 2 - ...72286c58d406629607f197524d518d77ba7f8f9b54 | 2 - ...ba9b37e5295eda2a415d5a61533385124723c2e9db | 2 - ...add573756caf6da8dd8aeb7051bc88bc3e954f2901 | 2 - ...d6c35a75cc7c744b63b33f37286bc716604e68ce45 | 2 - ...c371865fb09f7c7a27d7a2cd40809060e804600dc9 | 2 - ...4a627f3b900ee7248a10ebd94afec3bbaa59022126 | 2 - ...73269d7275bdd943870b45d5737a04da49f394c31f | 2 - ...e144f2c1deeed8fa10349a851b491ccae0e134ffd1 | 2 - ...7963cb1ea96e1cb9c3656e1c9b694d58227f4d168a | 2 - ...0eda93b678543c653946f0e4c5205a9a6e688b6aa3 | 2 - ...c9ec11a112f9530cf5b7c018987e1e56d0cb32e364 | 2 - ...33f3a90099024e580a6ba319ea2bf539880c50bd7c | 2 - ...d5f6fafc362a71d1b716bc02d268998df08364ac37 | 2 - ...5f4fba0037165933ebe9e760a70b1de81b23aadc4a | 2 - ...9c488cb91c7451ec0b22ab74c64548531f5d6633c9 | 2 - ...f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 | 2 - ...a86991f4b3a9d92f038aae8a9341a41fda80f92af5 | 2 - ...21a4027055e3ba59c25615a5e96165c0bbb36b33bb | 2 - ...086b9e76dc2b02e9bc964370d3106dbaef5aa6d37a | 2 - ...6b9e36b2cf5ecacc6d3ad9d926ab5ec64ecdad7b96 | 2 - ...e189fc384bd323efd7280990a5ecd6516cacd4cf61 | 2 - ...5f3e298f34ca63022bd4010acb6635278bc742398a | 2 - ...5012d1df6b6197436ce860641d55e275cc228da321 | 2 - ...1574ea92274cb4a498b3c7cb1189a419d2ba7f1ead | 2 - ...c92eec4f50a828baecca4c6fffde8522632e90f847 | 2 - ...7a460823559d30cdd652309d2002ba745ae6bca0f1 | 2 - ...08322871d93f995b41a108e987151365c3924b6372 | 2 - ...bd143cf2da5b1e1c9d921c0410faae807f3360caa2 | 2 - ...d18c13cdabc383fa5bae32cc853a1b3224893458ce | 2 - ...28d441737cc637962c2d057a5647bd4d4174c657c6 | 2 - ...be5ef9389790e33ed1886073dec445d4cf05bcd4b4 | 2 - ...79ce268a18421e73253c9f97cce75e02466a475d6a | 2 - ...4498e9124c6b1459802c7de9dcf18ad058a1688bb9 | 2 - ...5da5b33dda1692c8289162a1e61d5764dee9ba5344 | 2 - ...e8571748c8293bff3c37419ec4f86e0f93b5c6f7ce | 2 - ...c88c0beebc915cd3c7ed985106c7274dd6bf601991 | 2 - ...7708863c7edb8fa90b6973c421b32e45df6e98c897 | 2 - ...d39bb792d28fb9d23bfbf5b241a62a63ebeb36b591 | 2 - ...6bef44bf6bcda1265ee9e83adb021dd883717e44ff | 2 - ...32fa4fc65e7ee28921fd808119a9350650c2889fbb | 2 - ...7f03f4a64a9673fcbabcfd3d8b831163cf26e08257 | 2 - ...2ae9aefa295debe1f892fe6bae3538651459654512 | 2 - ...63a3526fd967ee0df216749b9ef13ed0fd5041b2b4 | 2 - ...7ce2b3ab19075eeda630aa67817acd128712faf440 | 2 - ...fbc157c0cdb2ecfc1a41b2b0c2b2f0adeb78a33412 | 2 - ...90897e25ffbc50c2a2beafe1a090fd5059936f3a44 | 2 - ...0ed4cfa0c873900d9311619e6590fa18cf8b28ef04 | 2 - ...a511af6fb98889143acd71e18ff6adfca0aa3054cf | 2 - ...bdfb3f39bfd2105a931ef0118b72eb1eca4aeddad9 | 2 - ...43f1f81a2a50d46036a1da3d5844117036f78416ab | 2 - ...13848811b2a66fea56a377d3aea5a0a7ffb53952ba | 2 - pkg/codecs/jpeg/define_huffman_table.go | 20 - pkg/codecs/jpeg/define_huffman_table_test.go | 35 - pkg/codecs/jpeg/define_quantization_table.go | 61 -- .../jpeg/define_quantization_table_test.go | 79 -- pkg/codecs/jpeg/define_restart_interval.go | 20 - .../jpeg/define_restart_interval_test.go | 44 - pkg/codecs/jpeg/jpeg.go | 14 - pkg/codecs/jpeg/start_of_frame1.go | 83 -- pkg/codecs/jpeg/start_of_frame1_test.go | 59 -- pkg/codecs/jpeg/start_of_image.go | 10 - pkg/codecs/jpeg/start_of_image_test.go | 12 - pkg/codecs/jpeg/start_of_scan.go | 28 - pkg/codecs/jpeg/start_of_scan_test.go | 52 -- ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...4cfaac68bab4e2c2a4c5a0ab953e27ba6b006ffd56 | 2 - ...bf537d4d81f389524539f402d13aa01f93a65ac7e9 | 2 - ...a1342df84c161a53135a7a8e93511489e6b51c0afe | 2 - ...e9ef0f4984e89ae5c891d08a2ad3c917fe77b94408 | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 | 2 - ...7c7ea359c531218826a6db07cf1a68e91f15b540c8 | 2 - ...5bad24c2bc0283177676e17ac5abeb131a80a38ef5 | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - pkg/codecs/mpeg4audio/adts.go | 147 --- pkg/codecs/mpeg4audio/adts_test.go | 124 --- pkg/codecs/mpeg4audio/config.go | 235 ----- pkg/codecs/mpeg4audio/config_test.go | 166 ---- pkg/codecs/mpeg4audio/mpeg4audio.go | 10 - pkg/codecs/mpeg4audio/object_type.go | 11 - pkg/codecs/mpeg4audio/sample_rates.go | 33 - ...eb00f6097b53b4250a097ff80e498ceb3f0bfb18e0 | 2 - ...a3f8a5bb9528c50c25e5ff75ee285eb272027491b2 | 2 - ...a940cc0ee647a444fa09ed6839dac31246ff1d5a19 | 2 - ...4393d1b16838280d9c256f3f5819ffea4dcfa87db1 | 2 - ...0155c259a95700b8fd3c3ada7d0cee9d8a99ad413f | 2 - ...9a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 | 2 - ...394ad6eb8127068a73f80ea005094fbe9e69874e65 | 2 - ...af6831ec6ab83dcc1f3ab1d748b0abe8ed3211bcda | 2 - ...db8312dc2e64752791e45fec451533b5706f56bed9 | 2 - ...bf537d4d81f389524539f402d13aa01f93a65ac7e9 | 2 - ...497a25b23b2568d3c08b1d2b49a1ae857b6497f223 | 2 - ...d0b7548511decda24d17c05fa7ddeccb3b0b049518 | 2 - ...510424748f46929ac0e89aca9dc59096b7c2d59dc7 | 2 - pkg/formats/format_test.go | 2 +- pkg/formats/g711.go | 24 +- pkg/formats/g722.go | 16 +- pkg/formats/generic.go | 30 +- pkg/formats/h264.go | 105 +-- pkg/formats/h264_test.go | 15 +- pkg/formats/h265.go | 120 +-- pkg/formats/h265_test.go | 20 +- pkg/formats/lpcm.go | 54 +- pkg/formats/mjpeg.go | 16 +- pkg/formats/mpeg2_audio.go | 12 +- pkg/formats/mpeg2_video.go | 12 +- pkg/formats/mpeg4_audio.go | 78 +- pkg/formats/mpeg4_audio_test.go | 2 +- pkg/formats/opus.go | 26 +- pkg/formats/rtph264/decoder.go | 2 +- pkg/formats/rtph264/encoder.go | 2 +- pkg/formats/rtph265/decoder.go | 2 +- pkg/formats/rtpmjpeg/decoder.go | 2 +- pkg/formats/rtpmjpeg/encoder.go | 2 +- pkg/formats/rtpmpeg4audio/decoder.go | 4 +- pkg/formats/rtpmpeg4audio/decoder_test.go | 2 +- pkg/formats/rtpmpeg4audio/encoder.go | 4 +- pkg/formats/vorbis.go | 32 +- pkg/formats/vp8.go | 34 +- pkg/formats/vp9.go | 40 +- 287 files changed, 329 insertions(+), 6381 deletions(-) delete mode 100644 pkg/bits/read.go delete mode 100644 pkg/bits/read_test.go delete mode 100644 pkg/bits/write.go delete mode 100644 pkg/bits/write_test.go delete mode 100644 pkg/codecs/codecs.go delete mode 100644 pkg/codecs/h264/annexb.go delete mode 100644 pkg/codecs/h264/annexb_test.go delete mode 100644 pkg/codecs/h264/avcc.go delete mode 100644 pkg/codecs/h264/avcc_test.go delete mode 100644 pkg/codecs/h264/dts_extractor.go delete mode 100644 pkg/codecs/h264/dts_extractor_test.go delete mode 100644 pkg/codecs/h264/emulation_prevention.go delete mode 100644 pkg/codecs/h264/emulation_prevention_test.go delete mode 100644 pkg/codecs/h264/h264.go delete mode 100644 pkg/codecs/h264/idrpresent.go delete mode 100644 pkg/codecs/h264/idrpresent_test.go delete mode 100644 pkg/codecs/h264/nalu_type.go delete mode 100644 pkg/codecs/h264/nalu_type_test.go delete mode 100644 pkg/codecs/h264/sps.go delete mode 100644 pkg/codecs/h264/sps_test.go delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/dad1340efc3fed8006eb91c7ec4be5cffca97bbe1c447ed47eda11adfd7ab0cc delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/2ce2df4de457e581f3404dedd305e7f281b04eeb75cc2339d58c64d6618e8702 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/f0b7708a3a98029bd20ee500be4f0a4b1969c5386f513788f118019a7e9e32b1 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb2cff69a3eec4b1a50ea017aa5604d9b3910ddfa989bdb6bc7323714fda66b3 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb5317ecce56275a254428a8267b56951b5b6ec2fa924f1e8d8fcab394abc2d3 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1222d4cb572fa515ca7b8ba8dc649a0c711445e6307ee02a65b0a4322e758021 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1223ae83b4925a9f1ade3b85a3b44c94a8135edafbbd664bd8e2eca808ca5ebc delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/262c62a888c4d2e7f51c8ac2c37a8459445dd9279b725d7243c3341e8e5bc746 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3b9a2adc3e27d7bc69f2eac840715796c9540b4942476167f0b4db164b52ce56 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3cb3e1217d3d42a93448aba8877b465cf77c9425c65d3e2cf6f314d6cbd0050e delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/676f114d18955cd69fb374e86badcea42b216770d5fc4629d036eb04cfef9ae7 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/b1d032bee609ec2a117b65530fb6f91bc8a0f066193f73e2d2fc35b282b88839 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/be0df8dc8259c6db1f7fe9c07d133559251d8a4697da418218cbaf077650f873 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c43c2cabc7b2a36f19a4717161402f7e12129cbe32cf765847b4377867ebc9b5 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c624d6d8804714db4b342d59c9e32f26eec2d69bb3aff1746a521786027b732c delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/01288c9efae1307be2542dbb019dc1ad59d072065ef32935d09b5de28f5d77e0 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0af83188e9b1670a268e5a56d5527be7cf004a2b2c42d9299813c7dc88e9bbd2 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0be6d2f66de27526159e6e47e60a6c7775cdab6db0e3295029427b18ae2ae747 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0d87aecf7d4f3648538400e4f1a3ffeacee9738e4c3408a600c24a80de240bac delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0fb8db11e671e6fa6be3b8c7dbc448244bfd66bb4f85d90722653942fdcb60e4 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/139370ab0793372c99ea8cd88ff2ffdd68dd18d6ca5b1074722884e7d4e4c6a2 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/13b2a92583c8d6ab7b595428ffeb9d6cdb51781f98d2cda015995753a7f716e9 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1c8bbab9d5312be1b60753343a15d1ea8c4a7baf8b95bdad79903d47a2af568f delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1f21b9a6112f67bc666a661e23922b7370f4b03e776cd4710bb197715d05e106 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/20599bffc63db3162d9e18b01d25c4d2b9bc91621d5107b91a9ae3ee676b3b69 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2113482bfc82431ab4769ff2256411e7c7e865bf4d2fa2417cf15621a0aa6c68 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/24ee50d0b17798d827100581c3939268fda76b1a29a64b67fa65580babb9f310 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/277b8e88b43c52e9676253793c9f06a763063a089bb7c6f5486331ca9426a898 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/28f06b087ff4d71f788eb50d329a844bc5b06ba24530daafe2fb23707ec73f56 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2ab5ed4810474c02d699123edece8150d02d0f28a7f580c26847d3e6eae19f8e delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/368b44f70bb50f9d3c1bc1c5bb714ab20766839e07e11d6e1a2e92d8c70a60a2 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/3b0f149b796c531a8ae4efdafde531d4280c980c2676ab030e7163f4d618869b delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/41d70545c8a84390058018aded44531acaea8e1d19f18bd99730de3df81dc2b4 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/43b8a2672cd59b21a57bdb05a60ccb56dc5bc1db0bae2a12a115443d39d93c6e delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/452e524b55a29f1fe6f448570d1373ce2a6d116dfaa39c1ee11befed0cd82e61 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/4a9f730d882605508b45b71ce9339664c952ce93ff20e89aee08b4c432aab3a7 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/50b649fe52d479d41725cdc8c8c532ea89b2ae61816b13f86ea486572215e81d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/5f47d452162ac208dcb3afd590dd27179dd0760a53aa6ee2a1ea2cb7a42ce506 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/641f6b7efc39fdef370a2bcc5038559d6ae38e23c23db2a0d82eca058e125166 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/66498f377f38b53eebe1ceaa4a53e4de01a04efc02ac9cfda60f9815f80e9b9d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/67be690eb46ab3e15c9e157d0ef76b78172fc99dddd4299e86d13b79b984cb9e delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6842f656bc0b9621f03f7e239abd268cf254b3a983a6b7379293611f56ebe74d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6bbb3f597bab8e6e67e8cbd2e1d77b9ed0ab99094562759738971883b12b5ff5 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/706f49c5b21047ed26fe721ad92e13ad3f99e6ceec8052bfecbee3596422d48a delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/7fc443da4b835c24546da2a593a050d7f842605f017d5e43a0d31b35e66f28fe delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/829fde2929450193ab3c21246f4b66a05d5841569f9c5f1a4f19d081050b3747 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/8a25aa52c31a312b339dd3f55a2d14c8d4dc2d9a4726c8f7806df12bda102326 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9095bee7552e53e949500f0cdf552d94e12df5f835eb9e06e6815957dc2d5fb2 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9bed7ad10156a846b730b66e8f008894ef1b0398cbc1d3d72966d26bed74234b delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a068243fd4565e08237d9e8a45cb1d387b0a5b3ad6f2cdd861badd887f810b45 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a1f57473c1cf3a081b94f3b4a38798ea2c723e1d88ab5fb6e144320b2314d6fe delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a4c914c327ff2fa03d0bd9650ec9424c1b3b183dea47cea96cb89b3f9fd36986 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a6f6a9bf667499515f0c228a8853d53517cfe49f51dc89f688d445d1265e5d7d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac3507052c142f5628eada795764e75469e2585518502b400bfee0afd89b5d15 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac47ca534e00877b146ef2ed9e7162b114412251df6e662ab63a07b1009b5393 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b01759614e8bc591068e73dfdf57dca91dd1a9512911d96d203aa6d135193c07 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b2d4d630d9e57dd4ec6030f3c68480c0e27cc08808b74a1f30d2a39126ad9576 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/bb0b3e83bb11594f77b10e16cacabdc3b33e8bb1c3090e8da7bf331caf899fad delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/be193709a33faf69c6616e5cb6e9222c1a8c685c578eabe92ddab77a56fbda91 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c0cf8af892101f975a635da53f855490a6d93cbb08be7a1f70d7b7f0a237763c delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c17af5c152fb10506043072ba67c34539a4cd854b3de89394f8049e27672f7d5 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c1faaebf2f51b9bd7ef64114318381ec19d9aa59a1fff4952c4b6aeb741ba02d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c522f0b5427ed0a18a6b692e061280d14af17e8b0075043f1c822533b41ef9ff delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cad20d5efdb493f9d3c53736dde3d97fcda3593310c32dcd8cb6981e36d54538 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cf3cad2c9f63327a060ace07881bdc20e3f5c473749397a8c84bd168f9ac799d delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/d78a814513f866a302c16d387777290f3d60da89055d4df8529dcf6afad9beca delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/db1c54995fe7b8d0e9628dd1822671be4ac721f297e14dcc4a7900d15c7fff7f delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e0636a49e255b40346c2f44bacf15e50903f836d7c550504188c55ab37cfde4f delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e20f6e43de3d954ca5b920a4b039b822e97cd317c07fc97337da68f023d563a2 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e562907a18f4186251820f36d0278039659036029592195e8a9acf94ffd70546 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e9918f5c3ff4ccead70a7bfe83479d6e5eba77143048cca05f00e56a244a8066 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f235dbad7715685b1e83484df230fdfbb9ce3abceb662ee5e714a6e1d94ec0ac delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f34630c44c11bb13d27531927c5c1e65d159b70f39cd161da0dba348c1221ab3 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f351a5a9537462ce1b8d69398f3cfa98589a431137e9dc72ec5a8bb5cc4cd5da delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/fc7904c804b00a74ab63bacd56f2ebaa77ed1632549d98dd78ee0348f68554b3 delete mode 100644 pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/feba85bf0ea4d5f2e9ba1aca9adc81513ebf3a55d8a8a053ddb5cf87f9f98524 delete mode 100644 pkg/codecs/h265/dts_extractor.go delete mode 100644 pkg/codecs/h265/dts_extractor_test.go delete mode 100644 pkg/codecs/h265/h265.go delete mode 100644 pkg/codecs/h265/nalu_type.go delete mode 100644 pkg/codecs/h265/nalu_type_test.go delete mode 100644 pkg/codecs/h265/pps.go delete mode 100644 pkg/codecs/h265/pps_test.go delete mode 100644 pkg/codecs/h265/sps.go delete mode 100644 pkg/codecs/h265/sps_test.go delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/0e888f462a3598bba3429e3c26cda412817aa65ef38cdeb3aaed76db1c0379a4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/1c4d7707525a482640e7c5090e339b08e446b5f9e4f7fff7e448ae377664edb0 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/355f66d5cd294d34483b9be09cb55a3a35b9dd081ab4959ba7a35d04c5f91cb8 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/3c6b851fbf8b3435e3757b3fd9ec0f57bfe84533014a058f89ed320caceb13a9 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/53955e13efd39f08be15944b872ad99a77e5d04e1472db9455c4b1b5bd8b7073 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/6004440a439db44ebabbaee8a166e7a25bbaa5d4431a3900f509c70b756a06fb delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8bf21706c418e930c7b972e6fff78d2fcadf6942a62141398df17b6cbe61f0b7 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8e78b3e3511102b0b24e8f88b42b4e913a44408f4dfb4e496550c34cb92c93fc delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/b467576cf8e0115542bddaece5f2d2bce19860a7c060445225adcf3dab189bc4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f45d427ed4a5ea4af4846b4aeaf70d8194277f53bc68eb6255f52278d879d48c delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f6aa371594073591a2888e9cff0054b22899ced04b7aa1fddf0c96c76937d0fd delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/fd6f09d0654e93abb8d685f39f20a5ddcdb857a09391b3e18e55376b8155e3a8 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/76c06f7399f3b1781289b37c42f3dbe1518bc2481859740855ab13d8abdd88b1 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/00d6da076abf399523d37cc5d1385a967f0634a2573162c00ba67a01fd806919 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/019839a18a6e47ed73c11a7503859a5680dfceb99c4fb98344d87f884ef731ba delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/039e575e749a676e0037b8aa9d28d80a409c350d4900c88ab2647be4492f25ee delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/05c89dc905ecc2ca9fc8fa08e0e0d56b83156fd4d8de02c03bda9a96b85679e0 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/0f8f18804076a2178ba242cfc92d30a0fd17a6f4aa63a8005253a16205b4e3c6 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/123492a203ec37c506b8768bd1b55bf7bc54ee36279dc9f09567d675c044d58f delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/182a4fb401185659940bf9a2589536a695487fba02686e2130ed0a5b880d52dc delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/1ced60e9d7b0105858590098640e83c09fecc453519c426cc0b446d43a1cbd73 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/20c0dd82574437b8f5caaac5f38a1199e9777ffe846bba3468737defafd094e7 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/27052827203b64be7e464d07f815b5af2a08d4e6406f173702c88b6a86862437 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d13274250a51272648fb79aee956d40195ff289a44da3296d0c88ac02fc67bc delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d49311ef22319f70a3590a86b406b9f2565987a4a3b6d7660ddc308b5b2fae2 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3067c11d51b8a2666368161328eb2c82c55cb593824ddfe49742696889e520d5 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/343dd7a6b769cfbc11b8ffd2162c9c6aac1e8bf42d252c18b6f766ec1858aaff delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3742076c487d68aab77f194af476bb9fa1d01a47a46bed9bae42c10b18e21594 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3765cdec1f28e3f1f6f3f32d5f9c0d4cb61ea2d4533f554abd52b0df93bbbc4a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/38f534b19ae62787a091d045d10ea3068aa66a765d26b383f9848a4881c6c170 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3aaf3f930d2b6f555533d7ee1833e960dc84706396c38db6be2c71c772230bf3 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3dc305666b84e8f7b04c66b69b6cc79e8df25b2ae99c5caf497906ea47c87401 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/40ea349cafd1592da4cd915eb8f86e8dcfe862c5cd7d187c082598daaba1c047 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4205343f82a7d78102d7bcfeeae612a8916981964640a34384b1ade4316e8038 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/458604b691a14a0f80c142b495b99b128071c41b8527d5e3dbaab0fa75aa703f delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/475bdf3daec7839816b18b486c43e23d21d3d1709f5d6e909f809e316eef3ad0 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4a3b46c8074373cb032eadcea909e28289cca73cd868ab29f13674040fbc6744 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4d32bcb6507cca15717e5d30bae3c6d948e0abe6541fd423fdc4415f863329a8 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/547803e15ea20edd45d87377b5a21ace6348d0ab462a9bd03318f936ec14cf9c delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/60d5d2f797c1cc11b7698f694b8ae1044f19e4d98d2048c1aefa8efd2d61658b delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/615cfc8866bc1a828694f072286c58d406629607f197524d518d77ba7f8f9b54 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/649679f2d355f61f168ec2ba9b37e5295eda2a415d5a61533385124723c2e9db delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/653a4111f80a68c2f197f0add573756caf6da8dd8aeb7051bc88bc3e954f2901 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f82af969dfcb94acaf2cfd6c35a75cc7c744b63b33f37286bc716604e68ce45 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f8f56484ea8b20c24fe9dc371865fb09f7c7a27d7a2cd40809060e804600dc9 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/766677dfa01586ac8ad7954a627f3b900ee7248a10ebd94afec3bbaa59022126 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7b6521a56664b1cbb97f5073269d7275bdd943870b45d5737a04da49f394c31f delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7c9233ac7979facf283efce144f2c1deeed8fa10349a851b491ccae0e134ffd1 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8281575bdc3265faffed6f7963cb1ea96e1cb9c3656e1c9b694d58227f4d168a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/863c5cc1f718d5d6e39c6f0eda93b678543c653946f0e4c5205a9a6e688b6aa3 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8703c0328c7aa4fe9e463dc9ec11a112f9530cf5b7c018987e1e56d0cb32e364 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8b8a68c6d9b801391c5df3d5f6fafc362a71d1b716bc02d268998df08364ac37 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8ba5fa6497afeb040d96665f4fba0037165933ebe9e760a70b1de81b23aadc4a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8bb95d053ae9f84b2bc99c9c488cb91c7451ec0b22ab74c64548531f5d6633c9 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/943e3fb12606845898909ba86991f4b3a9d92f038aae8a9341a41fda80f92af5 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9450509d117f96d6008adb21a4027055e3ba59c25615a5e96165c0bbb36b33bb delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/94e4dcd86c2e09aac9c790086b9e76dc2b02e9bc964370d3106dbaef5aa6d37a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9c6e2641e293d6bffef8b06b9e36b2cf5ecacc6d3ad9d926ab5ec64ecdad7b96 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d560010faa7ada26ac70ae189fc384bd323efd7280990a5ecd6516cacd4cf61 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d9abe934c8d92838c18705f3e298f34ca63022bd4010acb6635278bc742398a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a35edfe853b408a7c225af5012d1df6b6197436ce860641d55e275cc228da321 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a5d467a1921f1f1395d0bc1574ea92274cb4a498b3c7cb1189a419d2ba7f1ead delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ab559ccd961e02992fd953c92eec4f50a828baecca4c6fffde8522632e90f847 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/acf6271d3e87a7fc18dc947a460823559d30cdd652309d2002ba745ae6bca0f1 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ada5d60ffad1e135ecbc4f08322871d93f995b41a108e987151365c3924b6372 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/afb972a0b1cfbd4181a062bd143cf2da5b1e1c9d921c0410faae807f3360caa2 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/b3b203da514589b7cc4ed7d18c13cdabc383fa5bae32cc853a1b3224893458ce delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/bfdfa1a6e4892d045614bd28d441737cc637962c2d057a5647bd4d4174c657c6 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c3d5e611c2447ae2d18cf179ce268a18421e73253c9f97cce75e02466a475d6a delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd4f7e682b02a30bc433044498e9124c6b1459802c7de9dcf18ad058a1688bb9 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd939a83576d663b9de5c75da5b33dda1692c8289162a1e61d5764dee9ba5344 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ceb8cba9187af176dab482e8571748c8293bff3c37419ec4f86e0f93b5c6f7ce delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d09dfd7e6702ed14f3d16dc88c0beebc915cd3c7ed985106c7274dd6bf601991 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d2b8f6ff13c57a6493cc417708863c7edb8fa90b6973c421b32e45df6e98c897 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d3c6efd87c63850e112528d39bb792d28fb9d23bfbf5b241a62a63ebeb36b591 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d8729013defaf4cf5833f86bef44bf6bcda1265ee9e83adb021dd883717e44ff delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d9f26138c54e610b9535ad32fa4fc65e7ee28921fd808119a9350650c2889fbb delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/dc2a4cb2325c492ca2a0787f03f4a64a9673fcbabcfd3d8b831163cf26e08257 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e1d156e4fa7380afa414b12ae9aefa295debe1f892fe6bae3538651459654512 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e4a6272c0ccae23d9ff40b63a3526fd967ee0df216749b9ef13ed0fd5041b2b4 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e6a754dcc2747eb5e3225d7ce2b3ab19075eeda630aa67817acd128712faf440 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e7020cfc8cfc8a340f41aafbc157c0cdb2ecfc1a41b2b0c2b2f0adeb78a33412 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e80085c26c10f735691d6790897e25ffbc50c2a2beafe1a090fd5059936f3a44 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ed6952414b61c4c80820200ed4cfa0c873900d9311619e6590fa18cf8b28ef04 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f6872527132c3a2c994316a511af6fb98889143acd71e18ff6adfca0aa3054cf delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f7ffd151838837c215f9bcbdfb3f39bfd2105a931ef0118b72eb1eca4aeddad9 delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f9043ef7bfaf2fdebf518743f1f81a2a50d46036a1da3d5844117036f78416ab delete mode 100644 pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ff354e5d8975a43060c65913848811b2a66fea56a377d3aea5a0a7ffb53952ba delete mode 100644 pkg/codecs/jpeg/define_huffman_table.go delete mode 100644 pkg/codecs/jpeg/define_huffman_table_test.go delete mode 100644 pkg/codecs/jpeg/define_quantization_table.go delete mode 100644 pkg/codecs/jpeg/define_quantization_table_test.go delete mode 100644 pkg/codecs/jpeg/define_restart_interval.go delete mode 100644 pkg/codecs/jpeg/define_restart_interval_test.go delete mode 100644 pkg/codecs/jpeg/jpeg.go delete mode 100644 pkg/codecs/jpeg/start_of_frame1.go delete mode 100644 pkg/codecs/jpeg/start_of_frame1_test.go delete mode 100644 pkg/codecs/jpeg/start_of_image.go delete mode 100644 pkg/codecs/jpeg/start_of_image_test.go delete mode 100644 pkg/codecs/jpeg/start_of_scan.go delete mode 100644 pkg/codecs/jpeg/start_of_scan_test.go delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/97dc7172b48e6ffd89dfa34cfaac68bab4e2c2a4c5a0ab953e27ba6b006ffd56 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzDefineRestartIntervalUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/04069695460a25181d94bba1342df84c161a53135a7a8e93511489e6b51c0afe delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/52bcb082e28f6e0e4007bae9ef0f4984e89ae5c891d08a2ad3c917fe77b94408 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/9aaf79656de4e8166797e57c7ea359c531218826a6db07cf1a68e91f15b540c8 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/f032221efa2df5f3a4eedd5bad24c2bc0283177676e17ac5abeb131a80a38ef5 delete mode 100644 pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfScanUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/mpeg4audio/adts.go delete mode 100644 pkg/codecs/mpeg4audio/adts_test.go delete mode 100644 pkg/codecs/mpeg4audio/config.go delete mode 100644 pkg/codecs/mpeg4audio/config_test.go delete mode 100644 pkg/codecs/mpeg4audio/mpeg4audio.go delete mode 100644 pkg/codecs/mpeg4audio/object_type.go delete mode 100644 pkg/codecs/mpeg4audio/sample_rates.go delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/0de38b892c93cde2f2b32eeb00f6097b53b4250a097ff80e498ceb3f0bfb18e0 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2407269c6f2b6741b662b2a3f8a5bb9528c50c25e5ff75ee285eb272027491b2 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2f1e03b45b2a93962108e8a940cc0ee647a444fa09ed6839dac31246ff1d5a19 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/41b96153add60a0a300ad04393d1b16838280d9c256f3f5819ffea4dcfa87db1 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/4e84166ad43e1c5846255d0155c259a95700b8fd3c3ada7d0cee9d8a99ad413f delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/6962f04b357ab1240e26ab394ad6eb8127068a73f80ea005094fbe9e69874e65 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/bbffbee953abbb79185a8caf6831ec6ab83dcc1f3ab1d748b0abe8ed3211bcda delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/c12d7ec300bda22f7db490db8312dc2e64752791e45fec451533b5706f56bed9 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/d00ea3865173809d88de52497a25b23b2568d3c08b1d2b49a1ae857b6497f223 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/f5da56f6a7a5431290dccfd0b7548511decda24d17c05fa7ddeccb3b0b049518 delete mode 100644 pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/fca08d22f8534499db40e6510424748f46929ac0e89aca9dc59096b7c2d59dc7 diff --git a/README.md b/README.md index 9f8bc7d6..47be56e4 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,6 @@ Features: * Encode/decode format-specific frames into/from RTP packets. The following formats are supported: * Video: H264, H265, M-JPEG, VP8, VP9 * Audio: G711 (PCMA, PCMU), G722, LPCM, MPEG4 Audio (AAC), Opus - * Parse codec-specific elements. The following codecs are supported: - * Video: H264, H265, M-JPEG - * Audio: MPEG4 Audio (AAC) ## Table of contents diff --git a/client_play_test.go b/client_play_test.go index d6ee9b86..dc79ead9 100644 --- a/client_play_test.go +++ b/client_play_test.go @@ -18,12 +18,12 @@ import ( "github.com/bluenviron/gortsplib/v3/pkg/auth" "github.com/bluenviron/gortsplib/v3/pkg/base" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" "github.com/bluenviron/gortsplib/v3/pkg/conn" "github.com/bluenviron/gortsplib/v3/pkg/formats" "github.com/bluenviron/gortsplib/v3/pkg/headers" "github.com/bluenviron/gortsplib/v3/pkg/media" "github.com/bluenviron/gortsplib/v3/pkg/url" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) func mustMarshalMedias(medias media.Medias) []byte { diff --git a/examples/client-publish-format-mpeg4audio/main.go b/examples/client-publish-format-mpeg4audio/main.go index 3b622766..994300e6 100644 --- a/examples/client-publish-format-mpeg4audio/main.go +++ b/examples/client-publish-format-mpeg4audio/main.go @@ -5,9 +5,9 @@ import ( "net" "github.com/bluenviron/gortsplib/v3" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" "github.com/bluenviron/gortsplib/v3/pkg/formats" "github.com/bluenviron/gortsplib/v3/pkg/media" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" "github.com/pion/rtp" ) diff --git a/examples/client-read-format-h264-convert-to-jpeg/main.go b/examples/client-read-format-h264-convert-to-jpeg/main.go index 09cb83ee..b67dce6d 100644 --- a/examples/client-read-format-h264-convert-to-jpeg/main.go +++ b/examples/client-read-format-h264-convert-to-jpeg/main.go @@ -81,13 +81,11 @@ func main() { defer h264RawDec.close() // if SPS and PPS are present into the SDP, send them to the decoder - sps := forma.SafeSPS() - if sps != nil { - h264RawDec.decode(sps) + if forma.SPS != nil { + h264RawDec.decode(forma.SPS) } - pps := forma.SafePPS() - if pps != nil { - h264RawDec.decode(pps) + if forma.PPS != nil { + h264RawDec.decode(forma.PPS) } // setup a single media diff --git a/examples/client-read-format-h264-save-to-disk/main.go b/examples/client-read-format-h264-save-to-disk/main.go index 35279afe..20dbe70b 100644 --- a/examples/client-read-format-h264-save-to-disk/main.go +++ b/examples/client-read-format-h264-save-to-disk/main.go @@ -48,7 +48,7 @@ func main() { rtpDec := forma.CreateDecoder() // setup H264->MPEGTS muxer - mpegtsMuxer, err := newMPEGTSMuxer(forma.SafeSPS(), forma.SafePPS()) + mpegtsMuxer, err := newMPEGTSMuxer(forma.SPS, forma.PPS) if err != nil { panic(err) } diff --git a/examples/client-read-format-h264-save-to-disk/mpegtsmuxer.go b/examples/client-read-format-h264-save-to-disk/mpegtsmuxer.go index a79610ee..3fd5a965 100644 --- a/examples/client-read-format-h264-save-to-disk/mpegtsmuxer.go +++ b/examples/client-read-format-h264-save-to-disk/mpegtsmuxer.go @@ -8,7 +8,7 @@ import ( "time" "github.com/asticode/go-astits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" + "github.com/bluenviron/mediacommon/pkg/codecs/h264" ) // mpegtsMuxer allows to save a H264 stream into a MPEG-TS file. diff --git a/examples/client-read-format-h264/main.go b/examples/client-read-format-h264/main.go index bd3f68a2..7056b00d 100644 --- a/examples/client-read-format-h264/main.go +++ b/examples/client-read-format-h264/main.go @@ -58,13 +58,11 @@ func main() { defer h264RawDec.close() // if SPS and PPS are present into the SDP, send them to the decoder - sps := forma.SafeSPS() - if sps != nil { - h264RawDec.decode(sps) + if forma.SPS != nil { + h264RawDec.decode(forma.SPS) } - pps := forma.SafePPS() - if pps != nil { - h264RawDec.decode(pps) + if forma.PPS != nil { + h264RawDec.decode(forma.PPS) } // setup a single media diff --git a/examples/server-h264-save-to-disk/main.go b/examples/server-h264-save-to-disk/main.go index 2684a568..53838e8f 100644 --- a/examples/server-h264-save-to-disk/main.go +++ b/examples/server-h264-save-to-disk/main.go @@ -79,7 +79,7 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) ( rtpDec := forma.CreateDecoder() // setup H264->MPEGTS muxer - mpegtsMuxer, err := newMPEGTSMuxer(forma.SafeSPS(), forma.SafePPS()) + mpegtsMuxer, err := newMPEGTSMuxer(forma.SPS, forma.PPS) if err != nil { return &base.Response{ StatusCode: base.StatusBadRequest, diff --git a/examples/server-h264-save-to-disk/mpegtsmuxer.go b/examples/server-h264-save-to-disk/mpegtsmuxer.go index a79610ee..3fd5a965 100644 --- a/examples/server-h264-save-to-disk/mpegtsmuxer.go +++ b/examples/server-h264-save-to-disk/mpegtsmuxer.go @@ -8,7 +8,7 @@ import ( "time" "github.com/asticode/go-astits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" + "github.com/bluenviron/mediacommon/pkg/codecs/h264" ) // mpegtsMuxer allows to save a H264 stream into a MPEG-TS file. diff --git a/go.mod b/go.mod index 9f2aa388..ba5c09d5 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.18 require ( github.com/asticode/go-astits v1.11.0 + github.com/bluenviron/mediacommon v0.2.0 github.com/google/uuid v1.3.0 github.com/pion/rtcp v1.2.10 github.com/pion/rtp v0.0.0-20230107162714-c3ea6851e25b diff --git a/go.sum b/go.sum index 0ace9630..0de66cca 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflx github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0= github.com/asticode/go-astits v1.11.0 h1:GTHUXht0ZXAJXsVbsLIcyfHr1Bchi4QQwMARw2ZWAng= github.com/asticode/go-astits v1.11.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI= +github.com/bluenviron/mediacommon v0.2.0 h1:XEuIr8FA5bfzjsQhrITd6ILgN9JCl0e0Cu8IVFEp5Hk= +github.com/bluenviron/mediacommon v0.2.0/go.mod h1:t0dqPsWUTchyvib0MhixIwXEgvDX4V9G+I0GzWLQRb8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/pkg/bits/read.go b/pkg/bits/read.go deleted file mode 100644 index 6d925b42..00000000 --- a/pkg/bits/read.go +++ /dev/null @@ -1,123 +0,0 @@ -// Package bits contains functions to read/write bits from/to buffers. -package bits - -import ( - "fmt" -) - -// HasSpace checks whether buffer has space for N bits. -func HasSpace(buf []byte, pos int, n int) error { - if n > ((len(buf) * 8) - pos) { - return fmt.Errorf("not enough bits") - } - return nil -} - -// ReadBits reads N bits. -func ReadBits(buf []byte, pos *int, n int) (uint64, error) { - err := HasSpace(buf, *pos, n) - if err != nil { - return 0, err - } - - return ReadBitsUnsafe(buf, pos, n), nil -} - -// ReadBitsUnsafe reads N bits. -func ReadBitsUnsafe(buf []byte, pos *int, n int) uint64 { - v := uint64(0) - - res := 8 - (*pos & 0x07) - if n < res { - v := uint64((buf[*pos>>0x03] >> (res - n)) & (1<>0x03]&(1<= 8 { - v = (v << 8) | uint64(buf[*pos>>0x03]) - *pos += 8 - n -= 8 - } - - if n > 0 { - v = (v << n) | uint64(buf[*pos>>0x03]>>(8-n)) - *pos += n - } - - return v -} - -// ReadGolombUnsigned reads an unsigned golomb-encoded value. -func ReadGolombUnsigned(buf []byte, pos *int) (uint32, error) { - buflen := len(buf) - leadingZeroBits := uint32(0) - - for { - if (buflen*8 - *pos) == 0 { - return 0, fmt.Errorf("not enough bits") - } - - b := (buf[*pos>>0x03] >> (7 - (*pos & 0x07))) & 0x01 - *pos++ - if b != 0 { - break - } - - leadingZeroBits++ - if leadingZeroBits > 32 { - return 0, fmt.Errorf("invalid value") - } - } - - if (buflen*8 - *pos) < int(leadingZeroBits) { - return 0, fmt.Errorf("not enough bits") - } - - codeNum := uint32(0) - - for n := leadingZeroBits; n > 0; n-- { - b := (buf[*pos>>0x03] >> (7 - (*pos & 0x07))) & 0x01 - *pos++ - codeNum |= uint32(b) << (n - 1) - } - - codeNum = (1 << leadingZeroBits) - 1 + codeNum - - return codeNum, nil -} - -// ReadGolombSigned reads a signed golomb-encoded value. -func ReadGolombSigned(buf []byte, pos *int) (int32, error) { - v, err := ReadGolombUnsigned(buf, pos) - if err != nil { - return 0, err - } - - vi := int32(v) - if (vi & 0x01) != 0 { - return (vi + 1) / 2, nil - } - return -vi / 2, nil -} - -// ReadFlag reads a boolean flag. -func ReadFlag(buf []byte, pos *int) (bool, error) { - err := HasSpace(buf, *pos, 1) - if err != nil { - return false, err - } - - return ReadFlagUnsafe(buf, pos), nil -} - -// ReadFlagUnsafe reads a boolean flag. -func ReadFlagUnsafe(buf []byte, pos *int) bool { - b := (buf[*pos>>0x03] >> (7 - (*pos & 0x07))) & 0x01 - *pos++ - return b == 1 -} diff --git a/pkg/bits/read_test.go b/pkg/bits/read_test.go deleted file mode 100644 index 6a72c8ae..00000000 --- a/pkg/bits/read_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package bits - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestReadBits(t *testing.T) { - buf := []byte{0xA8, 0xC7, 0xD6, 0xAA, 0xBB, 0x10} - pos := 0 - v, _ := ReadBits(buf, &pos, 6) - require.Equal(t, uint64(0x2a), v) - v, _ = ReadBits(buf, &pos, 6) - require.Equal(t, uint64(0x0c), v) - v, _ = ReadBits(buf, &pos, 6) - require.Equal(t, uint64(0x1f), v) - v, _ = ReadBits(buf, &pos, 8) - require.Equal(t, uint64(0x5a), v) - v, _ = ReadBits(buf, &pos, 20) - require.Equal(t, uint64(0xaaec4), v) -} - -func TestReadBitsError(t *testing.T) { - buf := []byte{0xA8} - pos := 0 - _, err := ReadBits(buf, &pos, 6) - require.NoError(t, err) - _, err = ReadBits(buf, &pos, 6) - require.EqualError(t, err, "not enough bits") -} - -func TestReadGolombUnsigned(t *testing.T) { - buf := []byte{0x38} - pos := 0 - v, _ := ReadGolombUnsigned(buf, &pos) - require.Equal(t, uint32(6), v) -} - -func TestReadGolombUnsignedErrors(t *testing.T) { - buf := []byte{0x00} - pos := 0 - _, err := ReadGolombUnsigned(buf, &pos) - require.EqualError(t, err, "not enough bits") - - buf = []byte{0x00, 0x01} - pos = 0 - _, err = ReadGolombUnsigned(buf, &pos) - require.EqualError(t, err, "not enough bits") - - buf = []byte{0x00, 0x00, 0x00, 0x00, 0x01} - pos = 0 - _, err = ReadGolombUnsigned(buf, &pos) - require.EqualError(t, err, "invalid value") -} - -func TestReadGolombSigned(t *testing.T) { - buf := []byte{0x38} - pos := 0 - v, _ := ReadGolombSigned(buf, &pos) - require.Equal(t, int32(-3), v) - - buf = []byte{0b00100100} - pos = 0 - v, _ = ReadGolombSigned(buf, &pos) - require.Equal(t, int32(2), v) -} - -func TestReadGolombSignedErrors(t *testing.T) { - buf := []byte{0x00} - pos := 0 - _, err := ReadGolombSigned(buf, &pos) - require.EqualError(t, err, "not enough bits") -} - -func TestReadFlag(t *testing.T) { - buf := []byte{0xFF} - pos := 0 - v, _ := ReadFlag(buf, &pos) - require.Equal(t, true, v) -} - -func TestReadFlagError(t *testing.T) { - buf := []byte{} - pos := 0 - _, err := ReadFlag(buf, &pos) - require.EqualError(t, err, "not enough bits") -} diff --git a/pkg/bits/write.go b/pkg/bits/write.go deleted file mode 100644 index 4c71275e..00000000 --- a/pkg/bits/write.go +++ /dev/null @@ -1,26 +0,0 @@ -package bits - -// WriteBits writes N bits. -func WriteBits(buf []byte, pos *int, bits uint64, n int) { - res := 8 - (*pos & 0x07) - if n < res { - buf[*pos>>0x03] |= byte(bits << (res - n)) - *pos += n - return - } - - buf[*pos>>3] |= byte(bits >> (n - res)) - *pos += res - n -= res - - for n >= 8 { - buf[*pos>>3] = byte(bits >> (n - 8)) - *pos += 8 - n -= 8 - } - - if n > 0 { - buf[*pos>>3] = byte((bits & (1<= bl || start >= 4 { - return nil, fmt.Errorf("initial delimiter not found") - } - - switch initZeroCount { - case 0, 1: - if byts[start] != 0 { - return nil, fmt.Errorf("initial delimiter not found") - } - initZeroCount++ - - case 2, 3: - switch byts[start] { - case 1: - start++ - break outer - - case 0: - - default: - return nil, fmt.Errorf("initial delimiter not found") - } - initZeroCount++ - } - - start++ - } - - zeroCount := 0 - n := 0 - - for i := start; i < bl; i++ { - switch byts[i] { - case 0: - zeroCount++ - - case 1: - if zeroCount == 2 || zeroCount == 3 { - n++ - } - zeroCount = 0 - - default: - zeroCount = 0 - } - } - - if (n + 1) > MaxNALUsPerGroup { - return nil, fmt.Errorf("NALU count (%d) exceeds maximum allowed (%d)", - n+1, MaxNALUsPerGroup) - } - - ret := make([][]byte, n+1) - pos := 0 - start = initZeroCount + 1 - zeroCount = 0 - delimStart := 0 - - for i := start; i < bl; i++ { - switch byts[i] { - case 0: - if zeroCount == 0 { - delimStart = i - } - zeroCount++ - - case 1: - if zeroCount == 2 || zeroCount == 3 { - l := delimStart - start - if l == 0 { - return nil, fmt.Errorf("invalid NALU") - } - if l > MaxNALUSize { - return nil, fmt.Errorf("NALU size (%d) is too big (maximum is %d)", l, MaxNALUSize) - } - - ret[pos] = byts[start:delimStart] - pos++ - start = i + 1 - } - zeroCount = 0 - - default: - zeroCount = 0 - } - } - - l := bl - start - if l == 0 { - return nil, fmt.Errorf("invalid NALU") - } - if l > MaxNALUSize { - return nil, fmt.Errorf("NALU size (%d) is too big (maximum is %d)", l, MaxNALUSize) - } - - ret[pos] = byts[start:bl] - - return ret, nil -} - -func annexBMarshalSize(nalus [][]byte) int { - n := 0 - for _, nalu := range nalus { - n += 4 + len(nalu) - } - return n -} - -// AnnexBMarshal encodes NALUs into the Annex-B stream format. -func AnnexBMarshal(nalus [][]byte) ([]byte, error) { - buf := make([]byte, annexBMarshalSize(nalus)) - pos := 0 - - for _, nalu := range nalus { - pos += copy(buf[pos:], []byte{0x00, 0x00, 0x00, 0x01}) - pos += copy(buf[pos:], nalu) - } - - return buf, nil -} diff --git a/pkg/codecs/h264/annexb_test.go b/pkg/codecs/h264/annexb_test.go deleted file mode 100644 index ae9030c5..00000000 --- a/pkg/codecs/h264/annexb_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h264 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesAnnexB = []struct { - name string - encin []byte - encout []byte - dec [][]byte -}{ - { - "2 zeros", - []byte{ - 0x00, 0x00, 0x01, 0xaa, 0xbb, 0x00, 0x00, 0x01, - 0xcc, 0xdd, 0x00, 0x00, 0x01, 0xee, 0xff, - }, - []byte{ - 0x00, 0x00, 0x00, 0x01, 0xaa, 0xbb, - 0x00, 0x00, 0x00, 0x01, 0xcc, 0xdd, - 0x00, 0x00, 0x00, 0x01, 0xee, 0xff, - }, - [][]byte{ - {0xaa, 0xbb}, - {0xcc, 0xdd}, - {0xee, 0xff}, - }, - }, - { - "3 zeros", - []byte{ - 0x00, 0x00, 0x00, 0x01, 0xaa, 0xbb, - 0x00, 0x00, 0x00, 0x01, 0xcc, 0xdd, - 0x00, 0x00, 0x00, 0x01, 0xee, 0xff, - }, - []byte{ - 0x00, 0x00, 0x00, 0x01, 0xaa, 0xbb, - 0x00, 0x00, 0x00, 0x01, 0xcc, 0xdd, - 0x00, 0x00, 0x00, 0x01, 0xee, 0xff, - }, - [][]byte{ - {0xaa, 0xbb}, - {0xcc, 0xdd}, - {0xee, 0xff}, - }, - }, - { - // used by Apple inside HLS test streams - "2 or 3 zeros", - []byte{ - 0, 0, 0, 1, 9, 240, - 0, 0, 0, 1, 39, 66, 224, 21, 169, 24, 60, 23, 252, 184, 3, 80, 96, 16, 107, 108, 43, 94, 247, 192, 64, - 0, 0, 0, 1, 40, 222, 9, 200, - 0, 0, 1, 6, 0, 7, 131, 236, 119, 0, 0, 0, 0, 1, 3, 0, 64, 128, - 0, 0, 1, 6, 5, 17, 3, 135, 244, 78, 205, 10, 75, 220, 161, 148, 58, 195, 212, 155, 23, 31, 0, 128, - }, - []byte{ - 0, 0, 0, 1, 9, 240, - 0, 0, 0, 1, 39, 66, 224, 21, 169, 24, 60, 23, 252, 184, 3, 80, 96, 16, 107, 108, 43, 94, 247, 192, 64, - 0, 0, 0, 1, 40, 222, 9, 200, - 0, 0, 0, 1, 6, 0, 7, 131, 236, 119, 0, 0, 0, 0, 1, 3, 0, 64, 128, - 0, 0, 0, 1, 6, 5, 17, 3, 135, 244, 78, 205, 10, 75, 220, 161, 148, 58, 195, 212, 155, 23, 31, 0, 128, - }, - [][]byte{ - {9, 240}, - {39, 66, 224, 21, 169, 24, 60, 23, 252, 184, 3, 80, 96, 16, 107, 108, 43, 94, 247, 192, 64}, - {40, 222, 9, 200}, - {6, 0, 7, 131, 236, 119, 0, 0, 0, 0, 1, 3, 0, 64, 128}, - {6, 5, 17, 3, 135, 244, 78, 205, 10, 75, 220, 161, 148, 58, 195, 212, 155, 23, 31, 0, 128}, - }, - }, -} - -func TestAnnexBUnmarshal(t *testing.T) { - for _, ca := range casesAnnexB { - t.Run(ca.name, func(t *testing.T) { - dec, err := AnnexBUnmarshal(ca.encin) - require.NoError(t, err) - require.Equal(t, ca.dec, dec) - }) - } -} - -func TestAnnexBMarshal(t *testing.T) { - for _, ca := range casesAnnexB { - t.Run(ca.name, func(t *testing.T) { - enc, err := AnnexBMarshal(ca.dec) - require.NoError(t, err) - require.Equal(t, ca.encout, enc) - }) - } -} - -func BenchmarkAnnexBUnmarshal(b *testing.B) { - for i := 0; i < b.N; i++ { - AnnexBUnmarshal([]byte{ - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04, - }) - } -} - -func FuzzAnnexBUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - AnnexBUnmarshal(b) - }) -} diff --git a/pkg/codecs/h264/avcc.go b/pkg/codecs/h264/avcc.go deleted file mode 100644 index 52afe00b..00000000 --- a/pkg/codecs/h264/avcc.go +++ /dev/null @@ -1,74 +0,0 @@ -package h264 - -import ( - "fmt" -) - -// AVCCUnmarshal decodes NALUs from the AVCC stream format. -func AVCCUnmarshal(buf []byte) ([][]byte, error) { - bl := len(buf) - pos := 0 - var ret [][]byte - - for { - if (bl - pos) < 4 { - return nil, fmt.Errorf("invalid length") - } - - l := int(uint32(buf[pos])<<24 | uint32(buf[pos+1])<<16 | uint32(buf[pos+2])<<8 | uint32(buf[pos+3])) - pos += 4 - - if l == 0 { - return nil, fmt.Errorf("invalid NALU") - } - - if l > MaxNALUSize { - return nil, fmt.Errorf("NALU size (%d) is too big (maximum is %d)", l, MaxNALUSize) - } - - if (len(ret) + 1) > MaxNALUsPerGroup { - return nil, fmt.Errorf("NALU count (%d) exceeds maximum allowed (%d)", - len(ret)+1, MaxNALUsPerGroup) - } - - if (bl - pos) < l { - return nil, fmt.Errorf("invalid length") - } - - ret = append(ret, buf[pos:pos+l]) - pos += l - - if (bl - pos) == 0 { - break - } - } - - return ret, nil -} - -func avccMarshalSize(nalus [][]byte) int { - n := 0 - for _, nalu := range nalus { - n += 4 + len(nalu) - } - return n -} - -// AVCCMarshal encodes NALUs into the AVCC stream format. -func AVCCMarshal(nalus [][]byte) ([]byte, error) { - buf := make([]byte, avccMarshalSize(nalus)) - pos := 0 - - for _, nalu := range nalus { - naluLen := len(nalu) - buf[pos] = byte(naluLen >> 24) - buf[pos+1] = byte(naluLen >> 16) - buf[pos+2] = byte(naluLen >> 8) - buf[pos+3] = byte(naluLen) - pos += 4 - - pos += copy(buf[pos:], nalu) - } - - return buf, nil -} diff --git a/pkg/codecs/h264/avcc_test.go b/pkg/codecs/h264/avcc_test.go deleted file mode 100644 index 8d44337c..00000000 --- a/pkg/codecs/h264/avcc_test.go +++ /dev/null @@ -1,69 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h264 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesAVCC = []struct { - name string - enc []byte - dec [][]byte -}{ - { - "single", - []byte{ - 0x00, 0x00, 0x00, 0x03, - 0xaa, 0xbb, 0xcc, - }, - [][]byte{ - {0xaa, 0xbb, 0xcc}, - }, - }, - { - "multiple", - []byte{ - 0x00, 0x00, 0x00, 0x02, - 0xaa, 0xbb, - 0x00, 0x00, 0x00, 0x02, - 0xcc, 0xdd, - 0x00, 0x00, 0x00, 0x02, - 0xee, 0xff, - }, - [][]byte{ - {0xaa, 0xbb}, - {0xcc, 0xdd}, - {0xee, 0xff}, - }, - }, -} - -func TestAVCCUnmarshal(t *testing.T) { - for _, ca := range casesAVCC { - t.Run(ca.name, func(t *testing.T) { - dec, err := AVCCUnmarshal(ca.enc) - require.NoError(t, err) - require.Equal(t, ca.dec, dec) - }) - } -} - -func TestAVCCMarshal(t *testing.T) { - for _, ca := range casesAVCC { - t.Run(ca.name, func(t *testing.T) { - enc, err := AVCCMarshal(ca.dec) - require.NoError(t, err) - require.Equal(t, ca.enc, enc) - }) - } -} - -func FuzzAVCCUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - AVCCUnmarshal(b) - }) -} diff --git a/pkg/codecs/h264/dts_extractor.go b/pkg/codecs/h264/dts_extractor.go deleted file mode 100644 index 026944ad..00000000 --- a/pkg/codecs/h264/dts_extractor.go +++ /dev/null @@ -1,193 +0,0 @@ -package h264 - -import ( - "fmt" - "time" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" -) - -func getPictureOrderCount(buf []byte, sps *SPS) (uint32, error) { - if len(buf) < 6 { - return 0, fmt.Errorf("not enough bits") - } - - buf = EmulationPreventionRemove(buf[:6]) - - buf = buf[1:] - pos := 0 - - _, err := bits.ReadGolombUnsigned(buf, &pos) // first_mb_in_slice - if err != nil { - return 0, err - } - - _, err = bits.ReadGolombUnsigned(buf, &pos) // slice_type - if err != nil { - return 0, err - } - - _, err = bits.ReadGolombUnsigned(buf, &pos) // pic_parameter_set_id - if err != nil { - return 0, err - } - - _, err = bits.ReadBits(buf, &pos, int(sps.Log2MaxFrameNumMinus4+4)) // frame_num - if err != nil { - return 0, err - } - - if !sps.FrameMbsOnlyFlag { - return 0, fmt.Errorf("frame_mbs_only_flag = 0 is not supported") - } - - picOrderCntLsb, err := bits.ReadBits(buf, &pos, int(sps.Log2MaxPicOrderCntLsbMinus4+4)) - if err != nil { - return 0, err - } - - return uint32(picOrderCntLsb), nil -} - -func findPictureOrderCount(au [][]byte, sps *SPS) (uint32, error) { - for _, nalu := range au { - typ := NALUType(nalu[0] & 0x1F) - if typ == NALUTypeNonIDR { - poc, err := getPictureOrderCount(nalu, sps) - if err != nil { - return 0, err - } - return poc, nil - } - } - return 0, fmt.Errorf("POC not found") -} - -func getPictureOrderCountDiff(poc1 uint32, poc2 uint32, sps *SPS) int32 { - diff := int32(poc1) - int32(poc2) - switch { - case diff < -((1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 3)) - 1): - diff += (1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 4)) - - case diff > ((1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 3)) - 1): - diff -= (1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 4)) - } - return diff -} - -// DTSExtractor allows to extract DTS from PTS. -type DTSExtractor struct { - spsp *SPS - prevDTSFilled bool - prevDTS time.Duration - expectedPOC uint32 - reorderedFrames int - pauseDTS int - pocIncrement int -} - -// NewDTSExtractor allocates a DTSExtractor. -func NewDTSExtractor() *DTSExtractor { - return &DTSExtractor{ - pocIncrement: 2, - } -} - -func (d *DTSExtractor) extractInner(au [][]byte, pts time.Duration) (time.Duration, error) { - idrPresent := false - - for _, nalu := range au { - typ := NALUType(nalu[0] & 0x1F) - switch typ { - case NALUTypeSPS: - var spsp SPS - err := spsp.Unmarshal(nalu) - if err != nil { - return 0, fmt.Errorf("invalid SPS: %v", err) - } - d.spsp = &spsp - - case NALUTypeIDR: - idrPresent = true - } - } - - if d.spsp == nil { - return 0, fmt.Errorf("SPS not received yet") - } - - if d.spsp.PicOrderCntType == 2 { - return pts, nil - } - - if d.spsp.PicOrderCntType == 1 { - return 0, fmt.Errorf("pic_order_cnt_type = 1 is not supported yet") - } - - if idrPresent { - d.expectedPOC = 0 - d.reorderedFrames = 0 - d.pauseDTS = 0 - d.pocIncrement = 2 - return pts, nil - } - - d.expectedPOC += uint32(d.pocIncrement) - d.expectedPOC &= ((1 << (d.spsp.Log2MaxPicOrderCntLsbMinus4 + 4)) - 1) - - if d.pauseDTS > 0 { - d.pauseDTS-- - return d.prevDTS + 1*time.Millisecond, nil - } - - poc, err := findPictureOrderCount(au, d.spsp) - if err != nil { - return 0, err - } - - if d.pocIncrement == 2 && (poc%2) != 0 { - d.pocIncrement = 1 - d.expectedPOC /= 2 - } - - pocDiff := int(getPictureOrderCountDiff(poc, d.expectedPOC, d.spsp)) + d.reorderedFrames*d.pocIncrement - - if pocDiff < 0 { - return 0, fmt.Errorf("invalid POC") - } - - if pocDiff == 0 { - return pts, nil - } - - reorderedFrames := (pocDiff - d.reorderedFrames*d.pocIncrement) / d.pocIncrement - if reorderedFrames > d.reorderedFrames { - d.pauseDTS = (reorderedFrames - d.reorderedFrames - 1) - d.reorderedFrames = reorderedFrames - return d.prevDTS + 1*time.Millisecond, nil - } - - return d.prevDTS + ((pts - d.prevDTS) * time.Duration(d.pocIncrement) / time.Duration(pocDiff+d.pocIncrement)), nil -} - -// Extract extracts the DTS of a access unit. -func (d *DTSExtractor) Extract(au [][]byte, pts time.Duration) (time.Duration, error) { - dts, err := d.extractInner(au, pts) - if err != nil { - return 0, err - } - - if dts > pts { - return 0, fmt.Errorf("DTS is greater than PTS") - } - - if d.prevDTSFilled && dts <= d.prevDTS { - return 0, fmt.Errorf("DTS is not monotonically increasing, was %v, now is %v", - d.prevDTS, dts) - } - - d.prevDTS = dts - d.prevDTSFilled = true - - return dts, err -} diff --git a/pkg/codecs/h264/dts_extractor_test.go b/pkg/codecs/h264/dts_extractor_test.go deleted file mode 100644 index e5b73f03..00000000 --- a/pkg/codecs/h264/dts_extractor_test.go +++ /dev/null @@ -1,222 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h264 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func TestDTSExtractor(t *testing.T) { - type sequenceSample struct { - nalus [][]byte - dts time.Duration - pts time.Duration - } - - for _, ca := range []struct { - name string - sequence []sequenceSample - }{ - { - "with timing info", - []sequenceSample{ - { - [][]byte{ - { // SPS - 0x67, 0x64, 0x00, 0x28, 0xac, 0xd9, 0x40, 0x78, - 0x02, 0x27, 0xe5, 0x84, 0x00, 0x00, 0x03, 0x00, - 0x04, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x3c, 0x60, - 0xc6, 0x58, - }, - { // IDR - 0x65, 0x88, 0x84, 0x00, 0x33, 0xff, - }, - }, - 33333333333 * time.Nanosecond, - 33333333333 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9a, 0x21, 0x6c, 0x45, 0xff}}, - 33366666666 * time.Nanosecond, - 33366666666 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9a, 0x42, 0x3c, 0x21, 0x93}}, - 33400000000 * time.Nanosecond, - 33400000000 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9a, 0x63, 0x49, 0xe1, 0x0f}}, - 33433333333 * time.Nanosecond, - 33433333333 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9a, 0x86, 0x49, 0xe1, 0x0f}}, - 33434333333 * time.Nanosecond, - 33533333333 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9e, 0xa5, 0x42, 0x7f, 0xf9}}, - 33435333333 * time.Nanosecond, - 33500000000 * time.Nanosecond, - }, - { - [][]byte{{0x01, 0x9e, 0xc4, 0x69, 0x13, 0xff}}, - 33466666666 * time.Nanosecond, - 33466666666 * time.Nanosecond, - }, - { - [][]byte{{0x41, 0x9a, 0xc8, 0x4b, 0xa8, 0x42}}, - 33499999999 * time.Nanosecond, - 33600000000 * time.Nanosecond, - }, - }, - }, - { - "no timing info", - []sequenceSample{ - { - [][]byte{ - { // SPS - 0x27, 0x64, 0x00, 0x20, 0xac, 0x52, 0x18, 0x0f, - 0x01, 0x17, 0xef, 0xff, 0x00, 0x01, 0x00, 0x01, - 0x6a, 0x02, 0x02, 0x03, 0x6d, 0x85, 0x6b, 0xde, - 0xf8, 0x08, - }, - { // IDR - 0x25, 0xb8, 0x08, 0x02, 0x1f, 0xff, - }, - }, - 850000000 * time.Nanosecond, - 850000000 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe1, 0x05, 0xc7, 0x38, 0xbf}}, - 866666667 * time.Nanosecond, - 866666667 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe2, 0x09, 0xa1, 0xce, 0x0b}}, - 883333334 * time.Nanosecond, - 883333334 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe3, 0x0d, 0xb1, 0xce, 0x02}}, - 900000000 * time.Nanosecond, - 900000000 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe4, 0x11, 0x90, 0x73, 0x80}}, - 916666667 * time.Nanosecond, - 916666667 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe5, 0x19, 0x0e, 0x70, 0x01}}, - 917666667 * time.Nanosecond, - 950000000 * time.Nanosecond, - }, - { - [][]byte{{0x01, 0xa9, 0x85, 0x7c, 0x93, 0xff}}, - 933333334 * time.Nanosecond, - 933333334 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe6, 0x1d, 0x0e, 0x70, 0x01}}, - 950000000 * time.Nanosecond, - 966666667 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe7, 0x21, 0x0e, 0x70, 0x01}}, - 966666667 * time.Nanosecond, - 983333334 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe8, 0x25, 0x0e, 0x70, 0x01}}, - 983333333 * time.Nanosecond, - 1000000000 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xe9, 0x29, 0x0e, 0x70, 0x01}}, - 1000000000 * time.Nanosecond, - 1016666667 * time.Nanosecond, - }, - { - [][]byte{{0x21, 0xea, 0x31, 0x0e, 0x70, 0x01}}, - 1016666666 * time.Nanosecond, - 1050000000 * time.Nanosecond, - }, - { - [][]byte{{0x01, 0xaa, 0xcb, 0x7c, 0x93, 0xff}}, - 1033333334 * time.Nanosecond, - 1033333334 * time.Nanosecond, - }, - }, - }, - { - "poc increment = 1", - []sequenceSample{ - { - [][]byte{ - { // SPS - 0x67, 0x64, 0x00, 0x2a, 0xac, 0x2c, 0x6a, 0x81, - 0xe0, 0x08, 0x9f, 0x96, 0x6e, 0x02, 0x02, 0x02, - 0x80, 0x00, 0x03, 0x84, 0x00, 0x00, 0xaf, 0xc8, - 0x02, - }, - { // IDR - 0x65, 0xb8, 0x00, 0x00, 0x0b, 0xc8, - }, - }, - 61 * time.Millisecond, - 61 * time.Millisecond, - }, - { - [][]byte{{0x61, 0xe0, 0x20, 0x00, 0x39, 0x37}}, - 101 * time.Millisecond, - 101 * time.Millisecond, - }, - { - [][]byte{{0x61, 0xe0, 0x40, 0x00, 0x59, 0x37}}, - 141 * time.Millisecond, - 141 * time.Millisecond, - }, - { - [][]byte{{0x61, 0xe0, 0x60, 0x00, 0x79, 0x37}}, - 181 * time.Millisecond, - 181 * time.Millisecond, - }, - }, - }, - } { - t.Run(ca.name, func(t *testing.T) { - ex := NewDTSExtractor() - for _, sample := range ca.sequence { - dts, err := ex.Extract(sample.nalus, sample.pts) - require.NoError(t, err) - require.Equal(t, sample.dts, dts) - } - }) - } -} - -func FuzzDTSExtractor(f *testing.F) { - ex := NewDTSExtractor() - f.Fuzz(func(t *testing.T, b []byte, p uint64) { - if len(b) < 1 { - return - } - ex.Extract([][]byte{ - { // SPS - 0x27, 0x64, 0x00, 0x20, 0xac, 0x52, 0x18, 0x0f, - 0x01, 0x17, 0xef, 0xff, 0x00, 0x01, 0x00, 0x01, - 0x6a, 0x02, 0x02, 0x03, 0x6d, 0x85, 0x6b, 0xde, - 0xf8, 0x08, - }, - b, - }, time.Duration(p)) - }) -} diff --git a/pkg/codecs/h264/emulation_prevention.go b/pkg/codecs/h264/emulation_prevention.go deleted file mode 100644 index 611a080b..00000000 --- a/pkg/codecs/h264/emulation_prevention.go +++ /dev/null @@ -1,33 +0,0 @@ -package h264 - -// EmulationPreventionRemove removes emulation prevention bytes from a NALU. -func EmulationPreventionRemove(nalu []byte) []byte { - // 0x00 0x00 0x03 0x00 -> 0x00 0x00 0x00 - // 0x00 0x00 0x03 0x01 -> 0x00 0x00 0x01 - // 0x00 0x00 0x03 0x02 -> 0x00 0x00 0x02 - // 0x00 0x00 0x03 0x03 -> 0x00 0x00 0x03 - - l := len(nalu) - n := l - - for i := 2; i < l; i++ { - if nalu[i-2] == 0 && nalu[i-1] == 0 && nalu[i] == 3 { - n-- - } - } - - ret := make([]byte, n) - pos := 0 - start := 0 - - for i := 2; i < l; i++ { - if nalu[i-2] == 0 && nalu[i-1] == 0 && nalu[i] == 3 { - pos += copy(ret[pos:], nalu[start:i]) - start = i + 1 - } - } - - copy(ret[pos:], nalu[start:]) - - return ret -} diff --git a/pkg/codecs/h264/emulation_prevention_test.go b/pkg/codecs/h264/emulation_prevention_test.go deleted file mode 100644 index bd54ded6..00000000 --- a/pkg/codecs/h264/emulation_prevention_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h264 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestEmulationPreventionRemove(t *testing.T) { - for _, ca := range []struct { - name string - unproc []byte - proc []byte - }{ - { - "base", - []byte{ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, - 0x00, 0x00, 0x02, - 0x00, 0x00, 0x03, - }, - []byte{ - 0x00, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x03, 0x01, - 0x00, 0x00, 0x03, 0x02, - 0x00, 0x00, 0x03, 0x03, - }, - }, - { - "double emulation byte", - []byte{ - 0x00, 0x00, 0x00, - 0x00, 0x00, - }, - []byte{ - 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, - }, - }, - { - "terminal emulation byte", - []byte{ - 0x00, 0x00, - }, - []byte{ - 0x00, 0x00, 0x03, - }, - }, - } { - t.Run(ca.name, func(t *testing.T) { - unproc := EmulationPreventionRemove(ca.proc) - require.Equal(t, ca.unproc, unproc) - }) - } -} - -func FuzzEmulationPreventionRemove(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - EmulationPreventionRemove(b) - }) -} diff --git a/pkg/codecs/h264/h264.go b/pkg/codecs/h264/h264.go deleted file mode 100644 index e2cf793b..00000000 --- a/pkg/codecs/h264/h264.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package h264 contains utilities to work with the H264 codec. -package h264 - -const ( - // MaxNALUSize is the maximum size of a NALU. - // with a 250 Mbps H264 video, the maximum NALU size is 2.2MB - MaxNALUSize = 3 * 1024 * 1024 - - // MaxNALUsPerGroup is the maximum number of NALUs per group. - MaxNALUsPerGroup = 20 -) diff --git a/pkg/codecs/h264/idrpresent.go b/pkg/codecs/h264/idrpresent.go deleted file mode 100644 index 9c329d49..00000000 --- a/pkg/codecs/h264/idrpresent.go +++ /dev/null @@ -1,12 +0,0 @@ -package h264 - -// IDRPresent check if there's an IDR inside provided NALUs. -func IDRPresent(nalus [][]byte) bool { - for _, nalu := range nalus { - typ := NALUType(nalu[0] & 0x1F) - if typ == NALUTypeIDR { - return true - } - } - return false -} diff --git a/pkg/codecs/h264/idrpresent_test.go b/pkg/codecs/h264/idrpresent_test.go deleted file mode 100644 index 209f9c80..00000000 --- a/pkg/codecs/h264/idrpresent_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package h264 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestIDRPresent(t *testing.T) { - require.Equal(t, true, IDRPresent([][]byte{ - {0x05}, - {0x07}, - })) - require.Equal(t, false, IDRPresent([][]byte{ - {0x01}, - })) -} diff --git a/pkg/codecs/h264/nalu_type.go b/pkg/codecs/h264/nalu_type.go deleted file mode 100644 index 5c5a86a9..00000000 --- a/pkg/codecs/h264/nalu_type.go +++ /dev/null @@ -1,83 +0,0 @@ -package h264 - -import ( - "fmt" -) - -// NALUType is the type of a NALU. -type NALUType uint8 - -// NALU types. -const ( - NALUTypeNonIDR NALUType = 1 - NALUTypeDataPartitionA NALUType = 2 - NALUTypeDataPartitionB NALUType = 3 - NALUTypeDataPartitionC NALUType = 4 - NALUTypeIDR NALUType = 5 - NALUTypeSEI NALUType = 6 - NALUTypeSPS NALUType = 7 - NALUTypePPS NALUType = 8 - NALUTypeAccessUnitDelimiter NALUType = 9 - NALUTypeEndOfSequence NALUType = 10 - NALUTypeEndOfStream NALUType = 11 - NALUTypeFillerData NALUType = 12 - NALUTypeSPSExtension NALUType = 13 - NALUTypePrefix NALUType = 14 - NALUTypeSubsetSPS NALUType = 15 - NALUTypeReserved16 NALUType = 16 - NALUTypeReserved17 NALUType = 17 - NALUTypeReserved18 NALUType = 18 - NALUTypeSliceLayerWithoutPartitioning NALUType = 19 - NALUTypeSliceExtension NALUType = 20 - NALUTypeSliceExtensionDepth NALUType = 21 - NALUTypeReserved22 NALUType = 22 - NALUTypeReserved23 NALUType = 23 - - // additional NALU types for RTP/H264 - NALUTypeSTAPA NALUType = 24 - NALUTypeSTAPB NALUType = 25 - NALUTypeMTAP16 NALUType = 26 - NALUTypeMTAP24 NALUType = 27 - NALUTypeFUA NALUType = 28 - NALUTypeFUB NALUType = 29 -) - -var naluTypeLabels = map[NALUType]string{ - NALUTypeNonIDR: "NonIDR", - NALUTypeDataPartitionA: "DataPartitionA", - NALUTypeDataPartitionB: "DataPartitionB", - NALUTypeDataPartitionC: "DataPartitionC", - NALUTypeIDR: "IDR", - NALUTypeSEI: "SEI", - NALUTypeSPS: "SPS", - NALUTypePPS: "PPS", - NALUTypeAccessUnitDelimiter: "AccessUnitDelimiter", - NALUTypeEndOfSequence: "EndOfSequence", - NALUTypeEndOfStream: "EndOfStream", - NALUTypeFillerData: "FillerData", - NALUTypeSPSExtension: "SPSExtension", - NALUTypePrefix: "Prefix", - NALUTypeSubsetSPS: "SubsetSPS", - NALUTypeReserved16: "Reserved16", - NALUTypeReserved17: "Reserved17", - NALUTypeReserved18: "Reserved18", - NALUTypeSliceLayerWithoutPartitioning: "SliceLayerWithoutPartitioning", - NALUTypeSliceExtension: "SliceExtension", - NALUTypeSliceExtensionDepth: "SliceExtensionDepth", - NALUTypeReserved22: "Reserved22", - NALUTypeReserved23: "Reserved23", - NALUTypeSTAPA: "STAP-A", - NALUTypeSTAPB: "STAP-B", - NALUTypeMTAP16: "MTAP-16", - NALUTypeMTAP24: "MTAP-24", - NALUTypeFUA: "FU-A", - NALUTypeFUB: "FU-B", -} - -// String implements fmt.Stringer. -func (nt NALUType) String() string { - if l, ok := naluTypeLabels[nt]; ok { - return l - } - return fmt.Sprintf("unknown (%d)", nt) -} diff --git a/pkg/codecs/h264/nalu_type_test.go b/pkg/codecs/h264/nalu_type_test.go deleted file mode 100644 index 8602e0ac..00000000 --- a/pkg/codecs/h264/nalu_type_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package h264 - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestNALUType(t *testing.T) { - require.NotEqual(t, true, strings.HasPrefix(NALUType(10).String(), "unknown")) - require.Equal(t, true, strings.HasPrefix(NALUType(50).String(), "unknown")) -} diff --git a/pkg/codecs/h264/sps.go b/pkg/codecs/h264/sps.go deleted file mode 100644 index f19f243b..00000000 --- a/pkg/codecs/h264/sps.go +++ /dev/null @@ -1,728 +0,0 @@ -package h264 - -import ( - "fmt" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" -) - -const ( - maxRefFrames = 255 -) - -func readScalingList(buf []byte, pos *int, size int) ([]int32, bool, error) { - lastScale := int32(8) - nextScale := int32(8) - scalingList := make([]int32, size) - var useDefaultScalingMatrixFlag bool - - for j := 0; j < size; j++ { - if nextScale != 0 { - deltaScale, err := bits.ReadGolombSigned(buf, pos) - if err != nil { - return nil, false, err - } - - nextScale = (lastScale + deltaScale + 256) % 256 - useDefaultScalingMatrixFlag = (j == 0 && nextScale == 0) - } - - if nextScale == 0 { - scalingList[j] = lastScale - } else { - scalingList[j] = nextScale - } - - lastScale = scalingList[j] - } - - return scalingList, useDefaultScalingMatrixFlag, nil -} - -// SPS_HRD is a hypotetical reference decoder. -type SPS_HRD struct { //nolint:revive - CpbCntMinus1 uint32 - BitRateScale uint8 - CpbSizeScale uint8 - BitRateValueMinus1 []uint32 - CpbSizeValueMinus1 []uint32 - CbrFlag []bool - InitialCpbRemovalDelayLengthMinus1 uint8 - CpbRemovalDelayLengthMinus1 uint8 - DpbOutputDelayLengthMinus1 uint8 - TimeOffsetLength uint8 -} - -func (h *SPS_HRD) unmarshal(buf []byte, pos *int) error { - var err error - h.CpbCntMinus1, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - err = bits.HasSpace(buf, *pos, 8) - if err != nil { - return err - } - - h.BitRateScale = uint8(bits.ReadBitsUnsafe(buf, pos, 4)) - h.CpbSizeScale = uint8(bits.ReadBitsUnsafe(buf, pos, 4)) - - for i := uint32(0); i <= h.CpbCntMinus1; i++ { - v, err := bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - h.BitRateValueMinus1 = append(h.BitRateValueMinus1, v) - - v, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - h.CpbSizeValueMinus1 = append(h.CpbSizeValueMinus1, v) - - vb, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - h.CbrFlag = append(h.CbrFlag, vb) - } - - err = bits.HasSpace(buf, *pos, 5+5+5+5) - if err != nil { - return err - } - - h.InitialCpbRemovalDelayLengthMinus1 = uint8(bits.ReadBitsUnsafe(buf, pos, 5)) - h.CpbRemovalDelayLengthMinus1 = uint8(bits.ReadBitsUnsafe(buf, pos, 5)) - h.DpbOutputDelayLengthMinus1 = uint8(bits.ReadBitsUnsafe(buf, pos, 5)) - h.TimeOffsetLength = uint8(bits.ReadBitsUnsafe(buf, pos, 5)) - - return nil -} - -// SPS_TimingInfo is a timing info. -type SPS_TimingInfo struct { //nolint:revive - NumUnitsInTick uint32 - TimeScale uint32 - FixedFrameRateFlag bool -} - -func (t *SPS_TimingInfo) unmarshal(buf []byte, pos *int) error { - err := bits.HasSpace(buf, *pos, 32+32+1) - if err != nil { - return err - } - - t.NumUnitsInTick = uint32(bits.ReadBitsUnsafe(buf, pos, 32)) - t.TimeScale = uint32(bits.ReadBitsUnsafe(buf, pos, 32)) - t.FixedFrameRateFlag = bits.ReadFlagUnsafe(buf, pos) - - return nil -} - -// SPS_BitstreamRestriction are bitstream restriction infos. -type SPS_BitstreamRestriction struct { //nolint:revive - MotionVectorsOverPicBoundariesFlag bool - MaxBytesPerPicDenom uint32 - MaxBitsPerMbDenom uint32 - Log2MaxMvLengthHorizontal uint32 - Log2MaxMvLengthVertical uint32 - MaxNumReorderFrames uint32 - MaxDecFrameBuffering uint32 -} - -func (r *SPS_BitstreamRestriction) unmarshal(buf []byte, pos *int) error { - var err error - r.MotionVectorsOverPicBoundariesFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - r.MaxBytesPerPicDenom, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.MaxBitsPerMbDenom, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.Log2MaxMvLengthHorizontal, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.Log2MaxMvLengthVertical, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.MaxNumReorderFrames, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.MaxDecFrameBuffering, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - return nil -} - -// SPS_VUI is a video usability information. -type SPS_VUI struct { //nolint:revive - AspectRatioInfoPresentFlag bool - - // AspectRatioInfoPresentFlag == true - AspectRatioIdc uint8 - SarWidth uint16 - SarHeight uint16 - - OverscanInfoPresentFlag bool - - // OverscanInfoPresentFlag == true - OverscanAppropriateFlag bool - VideoSignalTypePresentFlag bool - - // VideoSignalTypePresentFlag == true - VideoFormat uint8 - VideoFullRangeFlag bool - ColourDescriptionPresentFlag bool - - // ColourDescriptionPresentFlag == true - ColourPrimaries uint8 - TransferCharacteristics uint8 - MatrixCoefficients uint8 - - ChromaLocInfoPresentFlag bool - - // ChromaLocInfoPresentFlag == true - ChromaSampleLocTypeTopField uint32 - ChromaSampleLocTypeBottomField uint32 - - TimingInfo *SPS_TimingInfo - NalHRD *SPS_HRD - VclHRD *SPS_HRD - - LowDelayHrdFlag bool - PicStructPresentFlag bool - BitstreamRestriction *SPS_BitstreamRestriction -} - -func (v *SPS_VUI) unmarshal(buf []byte, pos *int) error { - var err error - v.AspectRatioInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.AspectRatioInfoPresentFlag { - tmp, err := bits.ReadBits(buf, pos, 8) - if err != nil { - return err - } - v.AspectRatioIdc = uint8(tmp) - - if v.AspectRatioIdc == 255 { // Extended_SAR - err := bits.HasSpace(buf, *pos, 32) - if err != nil { - return err - } - - v.SarWidth = uint16(bits.ReadBitsUnsafe(buf, pos, 16)) - v.SarHeight = uint16(bits.ReadBitsUnsafe(buf, pos, 16)) - } - } - - v.OverscanInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.OverscanInfoPresentFlag { - v.OverscanAppropriateFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - - v.VideoSignalTypePresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.VideoSignalTypePresentFlag { - err := bits.HasSpace(buf, *pos, 5) - if err != nil { - return err - } - - v.VideoFormat = uint8(bits.ReadBitsUnsafe(buf, pos, 3)) - v.VideoFullRangeFlag = bits.ReadFlagUnsafe(buf, pos) - v.ColourDescriptionPresentFlag = bits.ReadFlagUnsafe(buf, pos) - - if v.ColourDescriptionPresentFlag { - err := bits.HasSpace(buf, *pos, 24) - if err != nil { - return err - } - - v.ColourPrimaries = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - v.TransferCharacteristics = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - v.MatrixCoefficients = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - } - } - - v.ChromaLocInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.ChromaLocInfoPresentFlag { - v.ChromaSampleLocTypeTopField, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - v.ChromaSampleLocTypeBottomField, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - } - - timingInfoPresentFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if timingInfoPresentFlag { - v.TimingInfo = &SPS_TimingInfo{} - err := v.TimingInfo.unmarshal(buf, pos) - if err != nil { - return err - } - } - - nalHrdParametersPresentFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if nalHrdParametersPresentFlag { - v.NalHRD = &SPS_HRD{} - err := v.NalHRD.unmarshal(buf, pos) - if err != nil { - return err - } - } - - vclHrdParametersPresentFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if vclHrdParametersPresentFlag { - v.VclHRD = &SPS_HRD{} - err := v.VclHRD.unmarshal(buf, pos) - if err != nil { - return err - } - } - - if nalHrdParametersPresentFlag || vclHrdParametersPresentFlag { - v.LowDelayHrdFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - - v.PicStructPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - bitstreamRestrictionFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if bitstreamRestrictionFlag { - v.BitstreamRestriction = &SPS_BitstreamRestriction{} - err := v.BitstreamRestriction.unmarshal(buf, pos) - if err != nil { - return err - } - } - - return nil -} - -// SPS_FrameCropping is the frame cropping part of a SPS. -type SPS_FrameCropping struct { //nolint:revive - LeftOffset uint32 - RightOffset uint32 - TopOffset uint32 - BottomOffset uint32 -} - -func (c *SPS_FrameCropping) unmarshal(buf []byte, pos *int) error { - var err error - c.LeftOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.RightOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.TopOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.BottomOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - return nil -} - -// SPS is a H264 sequence parameter set. -type SPS struct { - ProfileIdc uint8 - ConstraintSet0Flag bool - ConstraintSet1Flag bool - ConstraintSet2Flag bool - ConstraintSet3Flag bool - ConstraintSet4Flag bool - ConstraintSet5Flag bool - LevelIdc uint8 - ID uint32 - - // only for selected ProfileIdcs - ChromeFormatIdc uint32 - SeparateColourPlaneFlag bool - BitDepthLumaMinus8 uint32 - BitDepthChromaMinus8 uint32 - QpprimeYZeroTransformBypassFlag bool - - // seqScalingListPresentFlag == true - ScalingList4x4 [][]int32 - UseDefaultScalingMatrix4x4Flag []bool - ScalingList8x8 [][]int32 - UseDefaultScalingMatrix8x8Flag []bool - - Log2MaxFrameNumMinus4 uint32 - PicOrderCntType uint32 - - // PicOrderCntType == 0 - Log2MaxPicOrderCntLsbMinus4 uint32 - - // PicOrderCntType == 1 - DeltaPicOrderAlwaysZeroFlag bool - OffsetForNonRefPic int32 - OffsetForTopToBottomField int32 - OffsetForRefFrames []int32 - - MaxNumRefFrames uint32 - GapsInFrameNumValueAllowedFlag bool - PicWidthInMbsMinus1 uint32 - PicHeightInMapUnitsMinus1 uint32 - FrameMbsOnlyFlag bool - - // FrameMbsOnlyFlag == false - MbAdaptiveFrameFieldFlag bool - - Direct8x8InferenceFlag bool - FrameCropping *SPS_FrameCropping - VUI *SPS_VUI -} - -// Unmarshal decodes a SPS from bytes. -func (s *SPS) Unmarshal(buf []byte) error { - buf = EmulationPreventionRemove(buf) - - if len(buf) < 4 { - return fmt.Errorf("not enough bits") - } - - s.ProfileIdc = buf[1] - s.ConstraintSet0Flag = (buf[2] >> 7) == 1 - s.ConstraintSet1Flag = (buf[2] >> 6 & 0x01) == 1 - s.ConstraintSet2Flag = (buf[2] >> 5 & 0x01) == 1 - s.ConstraintSet3Flag = (buf[2] >> 4 & 0x01) == 1 - s.ConstraintSet4Flag = (buf[2] >> 3 & 0x01) == 1 - s.ConstraintSet5Flag = (buf[2] >> 2 & 0x01) == 1 - s.LevelIdc = buf[3] - - buf = buf[4:] - pos := 0 - - var err error - s.ID, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - switch s.ProfileIdc { - case 100, 110, 122, 244, 44, 83, 86, 118, 128, 138, 139, 134, 135: - s.ChromeFormatIdc, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - if s.ChromeFormatIdc == 3 { - s.SeparateColourPlaneFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - } else { - s.SeparateColourPlaneFlag = false - } - - s.BitDepthLumaMinus8, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.BitDepthChromaMinus8, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.QpprimeYZeroTransformBypassFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - seqScalingMatrixPresentFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if seqScalingMatrixPresentFlag { - var lim int - if s.ChromeFormatIdc != 3 { - lim = 8 - } else { - lim = 12 - } - - for i := 0; i < lim; i++ { - seqScalingListPresentFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if seqScalingListPresentFlag { - if i < 6 { - scalingList, useDefaultScalingMatrixFlag, err := readScalingList(buf, &pos, 16) - if err != nil { - return err - } - - s.ScalingList4x4 = append(s.ScalingList4x4, scalingList) - s.UseDefaultScalingMatrix4x4Flag = append(s.UseDefaultScalingMatrix4x4Flag, - useDefaultScalingMatrixFlag) - } else { - scalingList, useDefaultScalingMatrixFlag, err := readScalingList(buf, &pos, 64) - if err != nil { - return err - } - - s.ScalingList8x8 = append(s.ScalingList8x8, scalingList) - s.UseDefaultScalingMatrix8x8Flag = append(s.UseDefaultScalingMatrix8x8Flag, - useDefaultScalingMatrixFlag) - } - } - } - } - - default: - s.ChromeFormatIdc = 0 - s.SeparateColourPlaneFlag = false - s.BitDepthLumaMinus8 = 0 - s.BitDepthChromaMinus8 = 0 - s.QpprimeYZeroTransformBypassFlag = false - } - - s.Log2MaxFrameNumMinus4, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.PicOrderCntType, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - switch s.PicOrderCntType { - case 0: - s.Log2MaxPicOrderCntLsbMinus4, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.DeltaPicOrderAlwaysZeroFlag = false - s.OffsetForNonRefPic = 0 - s.OffsetForTopToBottomField = 0 - s.OffsetForRefFrames = nil - - case 1: - s.Log2MaxPicOrderCntLsbMinus4 = 0 - - s.DeltaPicOrderAlwaysZeroFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - s.OffsetForNonRefPic, err = bits.ReadGolombSigned(buf, &pos) - if err != nil { - return err - } - - s.OffsetForTopToBottomField, err = bits.ReadGolombSigned(buf, &pos) - if err != nil { - return err - } - - numRefFramesInPicOrderCntCycle, err := bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - if numRefFramesInPicOrderCntCycle > maxRefFrames { - return fmt.Errorf("num_ref_frames_in_pic_order_cnt_cycle exceeds %d", maxRefFrames) - } - - s.OffsetForRefFrames = make([]int32, numRefFramesInPicOrderCntCycle) - for i := uint32(0); i < numRefFramesInPicOrderCntCycle; i++ { - v, err := bits.ReadGolombSigned(buf, &pos) - if err != nil { - return err - } - - s.OffsetForRefFrames[i] = v - } - - case 2: - s.Log2MaxPicOrderCntLsbMinus4 = 0 - s.DeltaPicOrderAlwaysZeroFlag = false - s.OffsetForNonRefPic = 0 - s.OffsetForTopToBottomField = 0 - s.OffsetForRefFrames = nil - - default: - return fmt.Errorf("invalid pic_order_cnt_type: %d", s.PicOrderCntType) - } - - s.MaxNumRefFrames, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.GapsInFrameNumValueAllowedFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - s.PicWidthInMbsMinus1, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.PicHeightInMapUnitsMinus1, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.FrameMbsOnlyFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if !s.FrameMbsOnlyFlag { - s.MbAdaptiveFrameFieldFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - } else { - s.MbAdaptiveFrameFieldFlag = false - } - - s.Direct8x8InferenceFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - frameCroppingFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if frameCroppingFlag { - s.FrameCropping = &SPS_FrameCropping{} - err := s.FrameCropping.unmarshal(buf, &pos) - if err != nil { - return err - } - } else { - s.FrameCropping = nil - } - - vuiParametersPresentFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if vuiParametersPresentFlag { - s.VUI = &SPS_VUI{} - err := s.VUI.unmarshal(buf, &pos) - if err != nil { - return err - } - } else { - s.VUI = nil - } - - return nil -} - -// Width returns the video width. -func (s SPS) Width() int { - if s.FrameCropping != nil { - return int(((s.PicWidthInMbsMinus1 + 1) * 16) - (s.FrameCropping.LeftOffset+s.FrameCropping.RightOffset)*2) - } - - return int((s.PicWidthInMbsMinus1 + 1) * 16) -} - -// Height returns the video height. -func (s SPS) Height() int { - f := uint32(0) - if s.FrameMbsOnlyFlag { - f = 1 - } - - if s.FrameCropping != nil { - return int(((2 - f) * (s.PicHeightInMapUnitsMinus1 + 1) * 16) - - (s.FrameCropping.TopOffset+s.FrameCropping.BottomOffset)*2) - } - - return int((2 - f) * (s.PicHeightInMapUnitsMinus1 + 1) * 16) -} - -// FPS returns the frames per second of the video. -func (s SPS) FPS() float64 { - if s.VUI == nil || s.VUI.TimingInfo == nil { - return 0 - } - - return float64(s.VUI.TimingInfo.TimeScale) / (2 * float64(s.VUI.TimingInfo.NumUnitsInTick)) -} diff --git a/pkg/codecs/h264/sps_test.go b/pkg/codecs/h264/sps_test.go deleted file mode 100644 index 0f47e657..00000000 --- a/pkg/codecs/h264/sps_test.go +++ /dev/null @@ -1,462 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h264 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestSPSUnmarshal(t *testing.T) { - for _, ca := range []struct { - name string - byts []byte - sps SPS - width int - height int - fps float64 - }{ - { - "352x288", - []byte{ - 0x67, 0x64, 0x00, 0x0c, 0xac, 0x3b, 0x50, 0xb0, - 0x4b, 0x42, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, - 0x00, 0x03, 0x00, 0x3d, 0x08, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 12, - ChromeFormatIdc: 1, - Log2MaxFrameNumMinus4: 6, - PicOrderCntType: 2, - MaxNumRefFrames: 1, - GapsInFrameNumValueAllowedFlag: true, - PicWidthInMbsMinus1: 21, - PicHeightInMapUnitsMinus1: 17, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 30, - FixedFrameRateFlag: true, - }, - }, - }, - 352, - 288, - 15, - }, - { - "1280x720", - []byte{ - 0x67, 0x64, 0x00, 0x1f, 0xac, 0xd9, 0x40, 0x50, - 0x05, 0xbb, 0x01, 0x6c, 0x80, 0x00, 0x00, 0x03, - 0x00, 0x80, 0x00, 0x00, 0x1e, 0x07, 0x8c, 0x18, - 0xcb, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 31, - ChromeFormatIdc: 1, - Log2MaxPicOrderCntLsbMinus4: 2, - MaxNumRefFrames: 4, - PicWidthInMbsMinus1: 79, - PicHeightInMapUnitsMinus1: 44, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - VideoFullRangeFlag: true, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 60, - }, - BitstreamRestriction: &SPS_BitstreamRestriction{ - MotionVectorsOverPicBoundariesFlag: true, - Log2MaxMvLengthHorizontal: 11, - Log2MaxMvLengthVertical: 11, - MaxNumReorderFrames: 2, - MaxDecFrameBuffering: 4, - }, - }, - }, - 1280, - 720, - 30, - }, - { - "1920x1080 baseline", - []byte{ - 0x67, 0x42, 0xc0, 0x28, 0xd9, 0x00, 0x78, 0x02, - 0x27, 0xe5, 0x84, 0x00, 0x00, 0x03, 0x00, 0x04, - 0x00, 0x00, 0x03, 0x00, 0xf0, 0x3c, 0x60, 0xc9, 0x20, - }, - SPS{ - ProfileIdc: 66, - ConstraintSet0Flag: true, - ConstraintSet1Flag: true, - LevelIdc: 40, - PicOrderCntType: 2, - MaxNumRefFrames: 3, - PicWidthInMbsMinus1: 119, - PicHeightInMapUnitsMinus1: 67, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - FrameCropping: &SPS_FrameCropping{ - BottomOffset: 4, - }, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 60, - }, - BitstreamRestriction: &SPS_BitstreamRestriction{ - MotionVectorsOverPicBoundariesFlag: true, - Log2MaxMvLengthHorizontal: 11, - Log2MaxMvLengthVertical: 11, - MaxDecFrameBuffering: 3, - }, - }, - }, - 1920, - 1080, - 30, - }, - { - "1920x1080 nvidia", - []byte{ - 0x67, 0x64, 0x00, 0x28, 0xac, 0xd9, 0x40, 0x78, - 0x02, 0x27, 0xe5, 0x84, 0x00, 0x00, 0x03, 0x00, - 0x04, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x3c, 0x60, - 0xc6, 0x58, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 40, - ChromeFormatIdc: 1, - Log2MaxPicOrderCntLsbMinus4: 2, - MaxNumRefFrames: 4, - PicWidthInMbsMinus1: 119, - PicHeightInMapUnitsMinus1: 67, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - FrameCropping: &SPS_FrameCropping{ - BottomOffset: 4, - }, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 60, - }, - BitstreamRestriction: &SPS_BitstreamRestriction{ - MotionVectorsOverPicBoundariesFlag: true, - Log2MaxMvLengthHorizontal: 11, - Log2MaxMvLengthVertical: 11, - MaxNumReorderFrames: 2, - MaxDecFrameBuffering: 4, - }, - }, - }, - 1920, - 1080, - 30, - }, - { - "1920x1080", - []byte{ - 0x67, 0x64, 0x00, 0x29, 0xac, 0x13, 0x31, 0x40, - 0x78, 0x04, 0x47, 0xde, 0x03, 0xea, 0x02, 0x02, - 0x03, 0xe0, 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, - 0x00, 0x06, 0x52, // 0x80, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 41, - ChromeFormatIdc: 1, - Log2MaxFrameNumMinus4: 8, - Log2MaxPicOrderCntLsbMinus4: 5, - MaxNumRefFrames: 4, - PicWidthInMbsMinus1: 119, - PicHeightInMapUnitsMinus1: 33, - Direct8x8InferenceFlag: true, - FrameCropping: &SPS_FrameCropping{ - BottomOffset: 2, - }, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - OverscanInfoPresentFlag: true, - OverscanAppropriateFlag: true, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - ChromaLocInfoPresentFlag: true, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 50, - FixedFrameRateFlag: true, - }, - PicStructPresentFlag: true, - }, - }, - 1920, - 1084, - 25, - }, - { - "hikvision", - []byte{103, 100, 0, 32, 172, 23, 42, 1, 64, 30, 104, 64, 0, 1, 194, 0, 0, 87, 228, 33}, - SPS{ - ProfileIdc: 100, - LevelIdc: 32, - ChromeFormatIdc: 1, - Log2MaxPicOrderCntLsbMinus4: 4, - MaxNumRefFrames: 1, - PicWidthInMbsMinus1: 79, - PicHeightInMapUnitsMinus1: 59, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - Log2MaxFrameNumMinus4: 10, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1800, - TimeScale: 90000, - FixedFrameRateFlag: true, - }, - }, - }, - 1280, - 960, - 25, - }, - { - "scaling matrix", - []byte{ - 103, 100, 0, 50, 173, 132, 1, 12, 32, 8, 97, 0, 67, 8, 2, - 24, 64, 16, 194, 0, 132, 59, 80, 20, 0, 90, 211, - 112, 16, 16, 20, 0, 0, 3, 0, 4, 0, 0, 3, 0, 162, 16, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 50, - ChromeFormatIdc: 1, - ScalingList4x4: [][]int32{ - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - }, - }, - UseDefaultScalingMatrix4x4Flag: []bool{ - false, false, false, false, false, false, - }, - Log2MaxFrameNumMinus4: 6, - PicOrderCntType: 2, - MaxNumRefFrames: 1, - GapsInFrameNumValueAllowedFlag: true, - PicWidthInMbsMinus1: 159, - PicHeightInMapUnitsMinus1: 89, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - VUI: &SPS_VUI{ - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - VideoFullRangeFlag: true, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 40, - FixedFrameRateFlag: true, - }, - }, - }, - 2560, - 1440, - 20, - }, - { - "1920x1080 nvenc hrd", - []byte{ - 103, 100, 0, 42, 172, 44, 172, 7, - 128, 34, 126, 92, 5, 168, 8, 8, - 10, 0, 0, 7, 208, 0, 3, 169, - 129, 192, 0, 0, 76, 75, 0, 0, - 38, 37, 173, 222, 92, 20, - }, - SPS{ - ProfileIdc: 100, - LevelIdc: 42, - ChromeFormatIdc: 1, - Log2MaxFrameNumMinus4: 4, - Log2MaxPicOrderCntLsbMinus4: 4, - MaxNumRefFrames: 2, - PicWidthInMbsMinus1: 119, - PicHeightInMapUnitsMinus1: 67, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - FrameCropping: &SPS_FrameCropping{ - BottomOffset: 4, - }, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1000, - TimeScale: 120000, - FixedFrameRateFlag: true, - }, - NalHRD: &SPS_HRD{ - BitRateValueMinus1: []uint32{39061}, - CpbSizeValueMinus1: []uint32{156249}, - CbrFlag: []bool{true}, - InitialCpbRemovalDelayLengthMinus1: 23, - CpbRemovalDelayLengthMinus1: 15, - DpbOutputDelayLengthMinus1: 5, - TimeOffsetLength: 24, - }, - PicStructPresentFlag: true, - }, - }, - 1920, - 1080, - 60, - }, - { - "1920x1080 hikvision nal hrd + vcl hrd", - []byte{ - 103, 77, 0, 41, 154, 100, 3, 192, - 17, 63, 46, 2, 220, 4, 4, 5, - 0, 0, 3, 3, 232, 0, 0, 195, - 80, 232, 96, 0, 186, 180, 0, 2, - 234, 196, 187, 203, 141, 12, 0, 23, - 86, 128, 0, 93, 88, 151, 121, 112, - 160, - }, - SPS{ - ProfileIdc: 77, - LevelIdc: 41, - Log2MaxFrameNumMinus4: 5, - Log2MaxPicOrderCntLsbMinus4: 5, - MaxNumRefFrames: 1, - PicWidthInMbsMinus1: 119, - PicHeightInMapUnitsMinus1: 67, - FrameMbsOnlyFlag: true, - Direct8x8InferenceFlag: true, - FrameCropping: &SPS_FrameCropping{ - BottomOffset: 4, - }, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - VideoFullRangeFlag: true, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1000, - TimeScale: 50000, - FixedFrameRateFlag: true, - }, - NalHRD: &SPS_HRD{ - BitRateScale: 4, - CpbSizeScale: 3, - BitRateValueMinus1: []uint32{11948}, - CpbSizeValueMinus1: []uint32{95585}, - CbrFlag: []bool{false}, - InitialCpbRemovalDelayLengthMinus1: 23, - CpbRemovalDelayLengthMinus1: 15, - DpbOutputDelayLengthMinus1: 5, - TimeOffsetLength: 24, - }, - VclHRD: &SPS_HRD{ - BitRateScale: 4, - CpbSizeScale: 3, - BitRateValueMinus1: []uint32{11948}, - CpbSizeValueMinus1: []uint32{95585}, - CbrFlag: []bool{false}, - InitialCpbRemovalDelayLengthMinus1: 23, - CpbRemovalDelayLengthMinus1: 15, - DpbOutputDelayLengthMinus1: 5, - TimeOffsetLength: 24, - }, - PicStructPresentFlag: true, - }, - }, - 1920, - 1080, - 25, - }, - } { - t.Run(ca.name, func(t *testing.T) { - var sps SPS - err := sps.Unmarshal(ca.byts) - require.NoError(t, err) - require.Equal(t, ca.sps, sps) - require.Equal(t, ca.width, sps.Width()) - require.Equal(t, ca.height, sps.Height()) - require.Equal(t, ca.fps, sps.FPS()) - }) - } -} - -func BenchmarkSPSUnmarshal(b *testing.B) { - for i := 0; i < b.N; i++ { - var sps SPS - sps.Unmarshal([]byte{ - 103, 77, 0, 41, 154, 100, 3, 192, - 17, 63, 46, 2, 220, 4, 4, 5, - 0, 0, 3, 3, 232, 0, 0, 195, - 80, 232, 96, 0, 186, 180, 0, 2, - 234, 196, 187, 203, 141, 12, 0, 23, - 86, 128, 0, 93, 88, 151, 121, 112, - 160, - }) - } -} - -func FuzzSPSUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var sps SPS - sps.Unmarshal(b) - }) -} diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe b/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe deleted file mode 100644 index 6dd36a2e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x00\x00\x00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 b/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 deleted file mode 100644 index 7fd7a20e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/dad1340efc3fed8006eb91c7ec4be5cffca97bbe1c447ed47eda11adfd7ab0cc b/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/dad1340efc3fed8006eb91c7ec4be5cffca97bbe1c447ed47eda11adfd7ab0cc deleted file mode 100644 index 3252f4a7..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAVCCUnmarshal/dad1340efc3fed8006eb91c7ec4be5cffca97bbe1c447ed47eda11adfd7ab0cc +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x000\x00\x00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe deleted file mode 100644 index 6dd36a2e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/002e276d0123e6698e29b86a6db8644720a23ad912d7be68bf441e186095f7fe +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x00\x00\x00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/2ce2df4de457e581f3404dedd305e7f281b04eeb75cc2339d58c64d6618e8702 b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/2ce2df4de457e581f3404dedd305e7f281b04eeb75cc2339d58c64d6618e8702 deleted file mode 100644 index 40e38238..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/2ce2df4de457e581f3404dedd305e7f281b04eeb75cc2339d58c64d6618e8702 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/f0b7708a3a98029bd20ee500be4f0a4b1969c5386f513788f118019a7e9e32b1 b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/f0b7708a3a98029bd20ee500be4f0a4b1969c5386f513788f118019a7e9e32b1 deleted file mode 100644 index 2fc528c4..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/f0b7708a3a98029bd20ee500be4f0a4b1969c5386f513788f118019a7e9e32b1 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x00\x01") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb2cff69a3eec4b1a50ea017aa5604d9b3910ddfa989bdb6bc7323714fda66b3 b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb2cff69a3eec4b1a50ea017aa5604d9b3910ddfa989bdb6bc7323714fda66b3 deleted file mode 100644 index d19fb075..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb2cff69a3eec4b1a50ea017aa5604d9b3910ddfa989bdb6bc7323714fda66b3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x00\x01\x00\x00\x01") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb5317ecce56275a254428a8267b56951b5b6ec2fa924f1e8d8fcab394abc2d3 b/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb5317ecce56275a254428a8267b56951b5b6ec2fa924f1e8d8fcab394abc2d3 deleted file mode 100644 index 31044222..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzAnnexBUnmarshal/fb5317ecce56275a254428a8267b56951b5b6ec2fa924f1e8d8fcab394abc2d3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x00\x00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1222d4cb572fa515ca7b8ba8dc649a0c711445e6307ee02a65b0a4322e758021 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1222d4cb572fa515ca7b8ba8dc649a0c711445e6307ee02a65b0a4322e758021 deleted file mode 100644 index 5f832595..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1222d4cb572fa515ca7b8ba8dc649a0c711445e6307ee02a65b0a4322e758021 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A0\x00\x0000") -uint64(122) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1223ae83b4925a9f1ade3b85a3b44c94a8135edafbbd664bd8e2eca808ca5ebc b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1223ae83b4925a9f1ade3b85a3b44c94a8135edafbbd664bd8e2eca808ca5ebc deleted file mode 100644 index 486c699c..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/1223ae83b4925a9f1ade3b85a3b44c94a8135edafbbd664bd8e2eca808ca5ebc +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("'000\xdc10") -uint64(23) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/262c62a888c4d2e7f51c8ac2c37a8459445dd9279b725d7243c3341e8e5bc746 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/262c62a888c4d2e7f51c8ac2c37a8459445dd9279b725d7243c3341e8e5bc746 deleted file mode 100644 index 793a6b84..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/262c62a888c4d2e7f51c8ac2c37a8459445dd9279b725d7243c3341e8e5bc746 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A00\x0000") -uint64(122) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3b9a2adc3e27d7bc69f2eac840715796c9540b4942476167f0b4db164b52ce56 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3b9a2adc3e27d7bc69f2eac840715796c9540b4942476167f0b4db164b52ce56 deleted file mode 100644 index d6720e50..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3b9a2adc3e27d7bc69f2eac840715796c9540b4942476167f0b4db164b52ce56 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A\x0001\x000") -uint64(188) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3cb3e1217d3d42a93448aba8877b465cf77c9425c65d3e2cf6f314d6cbd0050e b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3cb3e1217d3d42a93448aba8877b465cf77c9425c65d3e2cf6f314d6cbd0050e deleted file mode 100644 index f754490e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/3cb3e1217d3d42a93448aba8877b465cf77c9425c65d3e2cf6f314d6cbd0050e +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A00000") -uint64(122) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/676f114d18955cd69fb374e86badcea42b216770d5fc4629d036eb04cfef9ae7 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/676f114d18955cd69fb374e86badcea42b216770d5fc4629d036eb04cfef9ae7 deleted file mode 100644 index 84f7c331..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/676f114d18955cd69fb374e86badcea42b216770d5fc4629d036eb04cfef9ae7 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("%") -uint64(14) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/b1d032bee609ec2a117b65530fb6f91bc8a0f066193f73e2d2fc35b282b88839 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/b1d032bee609ec2a117b65530fb6f91bc8a0f066193f73e2d2fc35b282b88839 deleted file mode 100644 index 798dfde7..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/b1d032bee609ec2a117b65530fb6f91bc8a0f066193f73e2d2fc35b282b88839 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("\x01\f") -uint64(60) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/be0df8dc8259c6db1f7fe9c07d133559251d8a4697da418218cbaf077650f873 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/be0df8dc8259c6db1f7fe9c07d133559251d8a4697da418218cbaf077650f873 deleted file mode 100644 index 2df246fb..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/be0df8dc8259c6db1f7fe9c07d133559251d8a4697da418218cbaf077650f873 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A\x00\x00\x0000") -uint64(70) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c43c2cabc7b2a36f19a4717161402f7e12129cbe32cf765847b4377867ebc9b5 b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c43c2cabc7b2a36f19a4717161402f7e12129cbe32cf765847b4377867ebc9b5 deleted file mode 100644 index 1c0b9c74..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c43c2cabc7b2a36f19a4717161402f7e12129cbe32cf765847b4377867ebc9b5 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("A\x0001B0") -uint64(188) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c624d6d8804714db4b342d59c9e32f26eec2d69bb3aff1746a521786027b732c b/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c624d6d8804714db4b342d59c9e32f26eec2d69bb3aff1746a521786027b732c deleted file mode 100644 index ce8b813a..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzDTSExtractor/c624d6d8804714db4b342d59c9e32f26eec2d69bb3aff1746a521786027b732c +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("'000%9000") -uint64(23) diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/01288c9efae1307be2542dbb019dc1ad59d072065ef32935d09b5de28f5d77e0 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/01288c9efae1307be2542dbb019dc1ad59d072065ef32935d09b5de28f5d77e0 deleted file mode 100644 index 23ff647b..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/01288c9efae1307be2542dbb019dc1ad59d072065ef32935d09b5de28f5d77e0 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 deleted file mode 100644 index 7fd7a20e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0af83188e9b1670a268e5a56d5527be7cf004a2b2c42d9299813c7dc88e9bbd2 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0af83188e9b1670a268e5a56d5527be7cf004a2b2c42d9299813c7dc88e9bbd2 deleted file mode 100644 index 092d4ef1..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0af83188e9b1670a268e5a56d5527be7cf004a2b2c42d9299813c7dc88e9bbd2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf31Y08\xf7000000000\xd7") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0be6d2f66de27526159e6e47e60a6c7775cdab6db0e3295029427b18ae2ae747 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0be6d2f66de27526159e6e47e60a6c7775cdab6db0e3295029427b18ae2ae747 deleted file mode 100644 index bab326fb..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0be6d2f66de27526159e6e47e60a6c7775cdab6db0e3295029427b18ae2ae747 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff2\xff0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0d87aecf7d4f3648538400e4f1a3ffeacee9738e4c3408a600c24a80de240bac b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0d87aecf7d4f3648538400e4f1a3ffeacee9738e4c3408a600c24a80de240bac deleted file mode 100644 index 7aa01643..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0d87aecf7d4f3648538400e4f1a3ffeacee9738e4c3408a600c24a80de240bac +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000B19") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0fb8db11e671e6fa6be3b8c7dbc448244bfd66bb4f85d90722653942fdcb60e4 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0fb8db11e671e6fa6be3b8c7dbc448244bfd66bb4f85d90722653942fdcb60e4 deleted file mode 100644 index 648feee6..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/0fb8db11e671e6fa6be3b8c7dbc448244bfd66bb4f85d90722653942fdcb60e4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z0010") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/139370ab0793372c99ea8cd88ff2ffdd68dd18d6ca5b1074722884e7d4e4c6a2 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/139370ab0793372c99ea8cd88ff2ffdd68dd18d6ca5b1074722884e7d4e4c6a2 deleted file mode 100644 index 4795b887..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/139370ab0793372c99ea8cd88ff2ffdd68dd18d6ca5b1074722884e7d4e4c6a2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf60000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/13b2a92583c8d6ab7b595428ffeb9d6cdb51781f98d2cda015995753a7f716e9 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/13b2a92583c8d6ab7b595428ffeb9d6cdb51781f98d2cda015995753a7f716e9 deleted file mode 100644 index ee7aa5f9..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/13b2a92583c8d6ab7b595428ffeb9d6cdb51781f98d2cda015995753a7f716e9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000772.B001") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1c8bbab9d5312be1b60753343a15d1ea8c4a7baf8b95bdad79903d47a2af568f b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1c8bbab9d5312be1b60753343a15d1ea8c4a7baf8b95bdad79903d47a2af568f deleted file mode 100644 index 40dd932e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1c8bbab9d5312be1b60753343a15d1ea8c4a7baf8b95bdad79903d47a2af568f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z00002") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1f21b9a6112f67bc666a661e23922b7370f4b03e776cd4710bb197715d05e106 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1f21b9a6112f67bc666a661e23922b7370f4b03e776cd4710bb197715d05e106 deleted file mode 100644 index ea01a676..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/1f21b9a6112f67bc666a661e23922b7370f4b03e776cd4710bb197715d05e106 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf6A") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/20599bffc63db3162d9e18b01d25c4d2b9bc91621d5107b91a9ae3ee676b3b69 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/20599bffc63db3162d9e18b01d25c4d2b9bc91621d5107b91a9ae3ee676b3b69 deleted file mode 100644 index dcd59c76..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/20599bffc63db3162d9e18b01d25c4d2b9bc91621d5107b91a9ae3ee676b3b69 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z00$A0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2113482bfc82431ab4769ff2256411e7c7e865bf4d2fa2417cf15621a0aa6c68 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2113482bfc82431ab4769ff2256411e7c7e865bf4d2fa2417cf15621a0aa6c68 deleted file mode 100644 index 06ab2390..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2113482bfc82431ab4769ff2256411e7c7e865bf4d2fa2417cf15621a0aa6c68 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017Y1") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/24ee50d0b17798d827100581c3939268fda76b1a29a64b67fa65580babb9f310 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/24ee50d0b17798d827100581c3939268fda76b1a29a64b67fa65580babb9f310 deleted file mode 100644 index ab64a376..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/24ee50d0b17798d827100581c3939268fda76b1a29a64b67fa65580babb9f310 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A10") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/277b8e88b43c52e9676253793c9f06a763063a089bb7c6f5486331ca9426a898 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/277b8e88b43c52e9676253793c9f06a763063a089bb7c6f5486331ca9426a898 deleted file mode 100644 index bf239ee6..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/277b8e88b43c52e9676253793c9f06a763063a089bb7c6f5486331ca9426a898 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000777Z\x0e2\x0e000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/28f06b087ff4d71f788eb50d329a844bc5b06ba24530daafe2fb23707ec73f56 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/28f06b087ff4d71f788eb50d329a844bc5b06ba24530daafe2fb23707ec73f56 deleted file mode 100644 index a72a66e7..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/28f06b087ff4d71f788eb50d329a844bc5b06ba24530daafe2fb23707ec73f56 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2ab5ed4810474c02d699123edece8150d02d0f28a7f580c26847d3e6eae19f8e b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2ab5ed4810474c02d699123edece8150d02d0f28a7f580c26847d3e6eae19f8e deleted file mode 100644 index b3ecbfc5..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/2ab5ed4810474c02d699123edece8150d02d0f28a7f580c26847d3e6eae19f8e +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000%0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/368b44f70bb50f9d3c1bc1c5bb714ab20766839e07e11d6e1a2e92d8c70a60a2 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/368b44f70bb50f9d3c1bc1c5bb714ab20766839e07e11d6e1a2e92d8c70a60a2 deleted file mode 100644 index cf007b07..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/368b44f70bb50f9d3c1bc1c5bb714ab20766839e07e11d6e1a2e92d8c70a60a2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z007A") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/3b0f149b796c531a8ae4efdafde531d4280c980c2676ab030e7163f4d618869b b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/3b0f149b796c531a8ae4efdafde531d4280c980c2676ab030e7163f4d618869b deleted file mode 100644 index 4d95d66c..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/3b0f149b796c531a8ae4efdafde531d4280c980c2676ab030e7163f4d618869b +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017Y0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/41d70545c8a84390058018aded44531acaea8e1d19f18bd99730de3df81dc2b4 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/41d70545c8a84390058018aded44531acaea8e1d19f18bd99730de3df81dc2b4 deleted file mode 100644 index 474090ba..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/41d70545c8a84390058018aded44531acaea8e1d19f18bd99730de3df81dc2b4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000177A000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/43b8a2672cd59b21a57bdb05a60ccb56dc5bc1db0bae2a12a115443d39d93c6e b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/43b8a2672cd59b21a57bdb05a60ccb56dc5bc1db0bae2a12a115443d39d93c6e deleted file mode 100644 index a8099785..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/43b8a2672cd59b21a57bdb05a60ccb56dc5bc1db0bae2a12a115443d39d93c6e +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z007B000000771B$00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/452e524b55a29f1fe6f448570d1373ce2a6d116dfaa39c1ee11befed0cd82e61 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/452e524b55a29f1fe6f448570d1373ce2a6d116dfaa39c1ee11befed0cd82e61 deleted file mode 100644 index 2a33d83e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/452e524b55a29f1fe6f448570d1373ce2a6d116dfaa39c1ee11befed0cd82e61 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000\xff2") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/4a9f730d882605508b45b71ce9339664c952ce93ff20e89aee08b4c432aab3a7 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/4a9f730d882605508b45b71ce9339664c952ce93ff20e89aee08b4c432aab3a7 deleted file mode 100644 index 3ce72960..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/4a9f730d882605508b45b71ce9339664c952ce93ff20e89aee08b4c432aab3a7 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000%A") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/50b649fe52d479d41725cdc8c8c532ea89b2ae61816b13f86ea486572215e81d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/50b649fe52d479d41725cdc8c8c532ea89b2ae61816b13f86ea486572215e81d deleted file mode 100644 index a2806e2c..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/50b649fe52d479d41725cdc8c8c532ea89b2ae61816b13f86ea486572215e81d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff2") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/5f47d452162ac208dcb3afd590dd27179dd0760a53aa6ee2a1ea2cb7a42ce506 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/5f47d452162ac208dcb3afd590dd27179dd0760a53aa6ee2a1ea2cb7a42ce506 deleted file mode 100644 index 63f6f5a7..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/5f47d452162ac208dcb3afd590dd27179dd0760a53aa6ee2a1ea2cb7a42ce506 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf6017") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/641f6b7efc39fdef370a2bcc5038559d6ae38e23c23db2a0d82eca058e125166 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/641f6b7efc39fdef370a2bcc5038559d6ae38e23c23db2a0d82eca058e125166 deleted file mode 100644 index 94335c23..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/641f6b7efc39fdef370a2bcc5038559d6ae38e23c23db2a0d82eca058e125166 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z0017") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/66498f377f38b53eebe1ceaa4a53e4de01a04efc02ac9cfda60f9815f80e9b9d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/66498f377f38b53eebe1ceaa4a53e4de01a04efc02ac9cfda60f9815f80e9b9d deleted file mode 100644 index 959401e5..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/66498f377f38b53eebe1ceaa4a53e4de01a04efc02ac9cfda60f9815f80e9b9d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/67be690eb46ab3e15c9e157d0ef76b78172fc99dddd4299e86d13b79b984cb9e b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/67be690eb46ab3e15c9e157d0ef76b78172fc99dddd4299e86d13b79b984cb9e deleted file mode 100644 index b6a3810f..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/67be690eb46ab3e15c9e157d0ef76b78172fc99dddd4299e86d13b79b984cb9e +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf61") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6842f656bc0b9621f03f7e239abd268cf254b3a983a6b7379293611f56ebe74d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6842f656bc0b9621f03f7e239abd268cf254b3a983a6b7379293611f56ebe74d deleted file mode 100644 index faa3aa4a..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6842f656bc0b9621f03f7e239abd268cf254b3a983a6b7379293611f56ebe74d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00001\x17\x0000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6bbb3f597bab8e6e67e8cbd2e1d77b9ed0ab99094562759738971883b12b5ff5 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6bbb3f597bab8e6e67e8cbd2e1d77b9ed0ab99094562759738971883b12b5ff5 deleted file mode 100644 index 80008851..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/6bbb3f597bab8e6e67e8cbd2e1d77b9ed0ab99094562759738971883b12b5ff5 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff0\xff0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/706f49c5b21047ed26fe721ad92e13ad3f99e6ceec8052bfecbee3596422d48a b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/706f49c5b21047ed26fe721ad92e13ad3f99e6ceec8052bfecbee3596422d48a deleted file mode 100644 index 1911a8ca..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/706f49c5b21047ed26fe721ad92e13ad3f99e6ceec8052bfecbee3596422d48a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z002") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/7fc443da4b835c24546da2a593a050d7f842605f017d5e43a0d31b35e66f28fe b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/7fc443da4b835c24546da2a593a050d7f842605f017d5e43a0d31b35e66f28fe deleted file mode 100644 index 7488c6ec..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/7fc443da4b835c24546da2a593a050d7f842605f017d5e43a0d31b35e66f28fe +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000X") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/829fde2929450193ab3c21246f4b66a05d5841569f9c5f1a4f19d081050b3747 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/829fde2929450193ab3c21246f4b66a05d5841569f9c5f1a4f19d081050b3747 deleted file mode 100644 index 15b51624..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/829fde2929450193ab3c21246f4b66a05d5841569f9c5f1a4f19d081050b3747 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000072") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/8a25aa52c31a312b339dd3f55a2d14c8d4dc2d9a4726c8f7806df12bda102326 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/8a25aa52c31a312b339dd3f55a2d14c8d4dc2d9a4726c8f7806df12bda102326 deleted file mode 100644 index 2a95651f..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/8a25aa52c31a312b339dd3f55a2d14c8d4dc2d9a4726c8f7806df12bda102326 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017\xf60") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9095bee7552e53e949500f0cdf552d94e12df5f835eb9e06e6815957dc2d5fb2 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9095bee7552e53e949500f0cdf552d94e12df5f835eb9e06e6815957dc2d5fb2 deleted file mode 100644 index e65369c4..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9095bee7552e53e949500f0cdf552d94e12df5f835eb9e06e6815957dc2d5fb2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017\xf61") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9bed7ad10156a846b730b66e8f008894ef1b0398cbc1d3d72966d26bed74234b b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9bed7ad10156a846b730b66e8f008894ef1b0398cbc1d3d72966d26bed74234b deleted file mode 100644 index a79f7d25..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/9bed7ad10156a846b730b66e8f008894ef1b0398cbc1d3d72966d26bed74234b +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017Y00") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a068243fd4565e08237d9e8a45cb1d387b0a5b3ad6f2cdd861badd887f810b45 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a068243fd4565e08237d9e8a45cb1d387b0a5b3ad6f2cdd861badd887f810b45 deleted file mode 100644 index 555f9351..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a068243fd4565e08237d9e8a45cb1d387b0a5b3ad6f2cdd861badd887f810b45 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf310\xff00007000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a1f57473c1cf3a081b94f3b4a38798ea2c723e1d88ab5fb6e144320b2314d6fe b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a1f57473c1cf3a081b94f3b4a38798ea2c723e1d88ab5fb6e144320b2314d6fe deleted file mode 100644 index 8d7e4f03..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a1f57473c1cf3a081b94f3b4a38798ea2c723e1d88ab5fb6e144320b2314d6fe +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf68") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a4c914c327ff2fa03d0bd9650ec9424c1b3b183dea47cea96cb89b3f9fd36986 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a4c914c327ff2fa03d0bd9650ec9424c1b3b183dea47cea96cb89b3f9fd36986 deleted file mode 100644 index 770e9cbe..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a4c914c327ff2fa03d0bd9650ec9424c1b3b183dea47cea96cb89b3f9fd36986 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000\xff\xff\xff0a1000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a6f6a9bf667499515f0c228a8853d53517cfe49f51dc89f688d445d1265e5d7d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a6f6a9bf667499515f0c228a8853d53517cfe49f51dc89f688d445d1265e5d7d deleted file mode 100644 index d5ff4cb2..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/a6f6a9bf667499515f0c228a8853d53517cfe49f51dc89f688d445d1265e5d7d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A72") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac3507052c142f5628eada795764e75469e2585518502b400bfee0afd89b5d15 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac3507052c142f5628eada795764e75469e2585518502b400bfee0afd89b5d15 deleted file mode 100644 index 27a2027a..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac3507052c142f5628eada795764e75469e2585518502b400bfee0afd89b5d15 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff2&0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac47ca534e00877b146ef2ed9e7162b114412251df6e662ab63a07b1009b5393 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac47ca534e00877b146ef2ed9e7162b114412251df6e662ab63a07b1009b5393 deleted file mode 100644 index 724b773f..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/ac47ca534e00877b146ef2ed9e7162b114412251df6e662ab63a07b1009b5393 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf310\xff00007") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b01759614e8bc591068e73dfdf57dca91dd1a9512911d96d203aa6d135193c07 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b01759614e8bc591068e73dfdf57dca91dd1a9512911d96d203aa6d135193c07 deleted file mode 100644 index a2eb5ae5..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b01759614e8bc591068e73dfdf57dca91dd1a9512911d96d203aa6d135193c07 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A 0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b2d4d630d9e57dd4ec6030f3c68480c0e27cc08808b74a1f30d2a39126ad9576 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b2d4d630d9e57dd4ec6030f3c68480c0e27cc08808b74a1f30d2a39126ad9576 deleted file mode 100644 index 0935648e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/b2d4d630d9e57dd4ec6030f3c68480c0e27cc08808b74a1f30d2a39126ad9576 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf67") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/bb0b3e83bb11594f77b10e16cacabdc3b33e8bb1c3090e8da7bf331caf899fad b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/bb0b3e83bb11594f77b10e16cacabdc3b33e8bb1c3090e8da7bf331caf899fad deleted file mode 100644 index b7d74a85..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/bb0b3e83bb11594f77b10e16cacabdc3b33e8bb1c3090e8da7bf331caf899fad +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000177Z100") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/be193709a33faf69c6616e5cb6e9222c1a8c685c578eabe92ddab77a56fbda91 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/be193709a33faf69c6616e5cb6e9222c1a8c685c578eabe92ddab77a56fbda91 deleted file mode 100644 index 933fc993..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/be193709a33faf69c6616e5cb6e9222c1a8c685c578eabe92ddab77a56fbda91 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf30") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c0cf8af892101f975a635da53f855490a6d93cbb08be7a1f70d7b7f0a237763c b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c0cf8af892101f975a635da53f855490a6d93cbb08be7a1f70d7b7f0a237763c deleted file mode 100644 index 7444d5e5..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c0cf8af892101f975a635da53f855490a6d93cbb08be7a1f70d7b7f0a237763c +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000A78X0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c17af5c152fb10506043072ba67c34539a4cd854b3de89394f8049e27672f7d5 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c17af5c152fb10506043072ba67c34539a4cd854b3de89394f8049e27672f7d5 deleted file mode 100644 index b4064130..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c17af5c152fb10506043072ba67c34539a4cd854b3de89394f8049e27672f7d5 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf60") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c1faaebf2f51b9bd7ef64114318381ec19d9aa59a1fff4952c4b6aeb741ba02d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c1faaebf2f51b9bd7ef64114318381ec19d9aa59a1fff4952c4b6aeb741ba02d deleted file mode 100644 index f42b655a..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c1faaebf2f51b9bd7ef64114318381ec19d9aa59a1fff4952c4b6aeb741ba02d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z00d") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c522f0b5427ed0a18a6b692e061280d14af17e8b0075043f1c822533b41ef9ff b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c522f0b5427ed0a18a6b692e061280d14af17e8b0075043f1c822533b41ef9ff deleted file mode 100644 index e85f34f1..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/c522f0b5427ed0a18a6b692e061280d14af17e8b0075043f1c822533b41ef9ff +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000070") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cad20d5efdb493f9d3c53736dde3d97fcda3593310c32dcd8cb6981e36d54538 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cad20d5efdb493f9d3c53736dde3d97fcda3593310c32dcd8cb6981e36d54538 deleted file mode 100644 index 01dfd3f5..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cad20d5efdb493f9d3c53736dde3d97fcda3593310c32dcd8cb6981e36d54538 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000\xff0A0000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cf3cad2c9f63327a060ace07881bdc20e3f5c473749397a8c84bd168f9ac799d b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cf3cad2c9f63327a060ace07881bdc20e3f5c473749397a8c84bd168f9ac799d deleted file mode 100644 index fdad433e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/cf3cad2c9f63327a060ace07881bdc20e3f5c473749397a8c84bd168f9ac799d +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf31") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/d78a814513f866a302c16d387777290f3d60da89055d4df8529dcf6afad9beca b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/d78a814513f866a302c16d387777290f3d60da89055d4df8529dcf6afad9beca deleted file mode 100644 index cda28054..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/d78a814513f866a302c16d387777290f3d60da89055d4df8529dcf6afad9beca +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf6\xf60000000001") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/db1c54995fe7b8d0e9628dd1822671be4ac721f297e14dcc4a7900d15c7fff7f b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/db1c54995fe7b8d0e9628dd1822671be4ac721f297e14dcc4a7900d15c7fff7f deleted file mode 100644 index fe874a1e..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/db1c54995fe7b8d0e9628dd1822671be4ac721f297e14dcc4a7900d15c7fff7f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00007\xb6\xf6018") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e0636a49e255b40346c2f44bacf15e50903f836d7c550504188c55ab37cfde4f b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e0636a49e255b40346c2f44bacf15e50903f836d7c550504188c55ab37cfde4f deleted file mode 100644 index bfeaab61..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e0636a49e255b40346c2f44bacf15e50903f836d7c550504188c55ab37cfde4f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff20") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e20f6e43de3d954ca5b920a4b039b822e97cd317c07fc97337da68f023d563a2 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e20f6e43de3d954ca5b920a4b039b822e97cd317c07fc97337da68f023d563a2 deleted file mode 100644 index 84b31fd9..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e20f6e43de3d954ca5b920a4b039b822e97cd317c07fc97337da68f023d563a2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017\xf6") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e562907a18f4186251820f36d0278039659036029592195e8a9acf94ffd70546 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e562907a18f4186251820f36d0278039659036029592195e8a9acf94ffd70546 deleted file mode 100644 index fff6fdde..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e562907a18f4186251820f36d0278039659036029592195e8a9acf94ffd70546 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e9918f5c3ff4ccead70a7bfe83479d6e5eba77143048cca05f00e56a244a8066 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e9918f5c3ff4ccead70a7bfe83479d6e5eba77143048cca05f00e56a244a8066 deleted file mode 100644 index 5b09b3f4..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/e9918f5c3ff4ccead70a7bfe83479d6e5eba77143048cca05f00e56a244a8066 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000%\xf6") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f235dbad7715685b1e83484df230fdfbb9ce3abceb662ee5e714a6e1d94ec0ac b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f235dbad7715685b1e83484df230fdfbb9ce3abceb662ee5e714a6e1d94ec0ac deleted file mode 100644 index aefb778b..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f235dbad7715685b1e83484df230fdfbb9ce3abceb662ee5e714a6e1d94ec0ac +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000\xf6\xf60\xf6000110") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f34630c44c11bb13d27531927c5c1e65d159b70f39cd161da0dba348c1221ab3 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f34630c44c11bb13d27531927c5c1e65d159b70f39cd161da0dba348c1221ab3 deleted file mode 100644 index a389d3c6..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f34630c44c11bb13d27531927c5c1e65d159b70f39cd161da0dba348c1221ab3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f351a5a9537462ce1b8d69398f3cfa98589a431137e9dc72ec5a8bb5cc4cd5da b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f351a5a9537462ce1b8d69398f3cfa98589a431137e9dc72ec5a8bb5cc4cd5da deleted file mode 100644 index 524e269c..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/f351a5a9537462ce1b8d69398f3cfa98589a431137e9dc72ec5a8bb5cc4cd5da +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0z00$002") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/fc7904c804b00a74ab63bacd56f2ebaa77ed1632549d98dd78ee0348f68554b3 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/fc7904c804b00a74ab63bacd56f2ebaa77ed1632549d98dd78ee0348f68554b3 deleted file mode 100644 index 8356152c..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/fc7904c804b00a74ab63bacd56f2ebaa77ed1632549d98dd78ee0348f68554b3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000A\xff2Z0") diff --git a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/feba85bf0ea4d5f2e9ba1aca9adc81513ebf3a55d8a8a053ddb5cf87f9f98524 b/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/feba85bf0ea4d5f2e9ba1aca9adc81513ebf3a55d8a8a053ddb5cf87f9f98524 deleted file mode 100644 index 6feeb591..00000000 --- a/pkg/codecs/h264/testdata/fuzz/FuzzSPSUnmarshal/feba85bf0ea4d5f2e9ba1aca9adc81513ebf3a55d8a8a053ddb5cf87f9f98524 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000017$") diff --git a/pkg/codecs/h265/dts_extractor.go b/pkg/codecs/h265/dts_extractor.go deleted file mode 100644 index e75fcd1c..00000000 --- a/pkg/codecs/h265/dts_extractor.go +++ /dev/null @@ -1,242 +0,0 @@ -package h265 - -import ( - "fmt" - "time" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" -) - -func getPictureOrderCount(buf []byte, sps *SPS, pps *PPS) (uint32, uint32, error) { - if len(buf) < 12 { - return 0, 0, fmt.Errorf("not enough bits") - } - - buf = h264.EmulationPreventionRemove(buf[:12]) - - typ := NALUType((buf[0] >> 1) & 0b111111) - - buf = buf[2:] - pos := 0 - - firstSliceSegmentInPicFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return 0, 0, err - } - - if !firstSliceSegmentInPicFlag { - return 0, 0, fmt.Errorf("first_slice_segment_in_pic_flag = 0 is not supported") - } - - if typ >= NALUType_BLA_W_LP && typ <= NALUType_RSV_IRAP_VCL23 { - _, err := bits.ReadFlag(buf, &pos) // no_output_of_prior_pics_flag - if err != nil { - return 0, 0, err - } - } - - _, err = bits.ReadGolombUnsigned(buf, &pos) // slice_pic_parameter_set_id - if err != nil { - return 0, 0, err - } - - if pps.NumExtraSliceHeaderBits > 0 { - err := bits.HasSpace(buf, pos, int(pps.NumExtraSliceHeaderBits)) - if err != nil { - return 0, 0, err - } - pos += int(pps.NumExtraSliceHeaderBits) - } - - sliceType, err := bits.ReadGolombUnsigned(buf, &pos) // slice_type - if err != nil { - return 0, 0, err - } - - if pps.OutputFlagPresentFlag { - _, err := bits.ReadFlag(buf, &pos) // pic_output_flag - if err != nil { - return 0, 0, err - } - } - - if sps.SeparateColourPlaneFlag { - _, err := bits.ReadBits(buf, &pos, 2) // colour_plane_id - if err != nil { - return 0, 0, err - } - } - - picOrderCntLsb, err := bits.ReadBits(buf, &pos, int(sps.Log2MaxPicOrderCntLsbMinus4+4)) - if err != nil { - return 0, 0, err - } - - shortTermRefPicSetSpsFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return 0, 0, err - } - - if shortTermRefPicSetSpsFlag { - return 0, 0, fmt.Errorf("short_term_ref_pic_set_sps_flag = true is not supported") - } - - var rps SPS_ShortTermRefPicSet - err = rps.unmarshal(buf, &pos, uint32(len(sps.ShortTermRefPicSets)), uint32(len(sps.ShortTermRefPicSets)), nil) - if err != nil { - return 0, 0, err - } - - var v uint32 - - if sliceType == 0 { // B-frame - if typ == NALUType_TRAIL_N || typ == NALUType_RASL_N { - v = sps.MaxNumReorderPics[0] - uint32(len(rps.DeltaPocS1Minus1)) - } else if typ == NALUType_TRAIL_R || typ == NALUType_RASL_R { - if len(rps.DeltaPocS0Minus1) == 0 { - return 0, 0, fmt.Errorf("invalid delta_poc_s0_minus1") - } - v = rps.DeltaPocS0Minus1[0] + sps.MaxNumReorderPics[0] - 1 - } - } else { // I or P-frame - if len(rps.DeltaPocS0Minus1) == 0 { - return 0, 0, fmt.Errorf("invalid delta_poc_s0_minus1") - } - v = rps.DeltaPocS0Minus1[0] + sps.MaxNumReorderPics[0] - } - - dtsPOC := uint32(picOrderCntLsb) - v - dtsPOC &= ((1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 4)) - 1) - - return uint32(picOrderCntLsb), dtsPOC, nil -} - -func findPictureOrderCount(au [][]byte, sps *SPS, pps *PPS) (uint32, uint32, error) { - for _, nalu := range au { - typ := NALUType((nalu[0] >> 1) & 0b111111) - switch typ { - case NALUType_TRAIL_N, NALUType_TRAIL_R, NALUType_CRA_NUT, NALUType_RASL_N, NALUType_RASL_R: - poc, dtsPOC, err := getPictureOrderCount(nalu, sps, pps) - if err != nil { - return 0, 0, err - } - return poc, dtsPOC, nil - } - } - return 0, 0, fmt.Errorf("POC not found") -} - -func getPictureOrderCountDiff(poc1 uint32, poc2 uint32, sps *SPS) int32 { - diff := int32(poc1) - int32(poc2) - switch { - case diff < -((1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 3)) - 1): - diff += (1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 4)) - - case diff > ((1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 3)) - 1): - diff -= (1 << (sps.Log2MaxPicOrderCntLsbMinus4 + 4)) - } - return diff -} - -// DTSExtractor allows to extract DTS from PTS. -type DTSExtractor struct { - spsp *SPS - ppsp *PPS - prevDTSFilled bool - prevDTS time.Duration -} - -// NewDTSExtractor allocates a DTSExtractor. -func NewDTSExtractor() *DTSExtractor { - return &DTSExtractor{} -} - -func (d *DTSExtractor) extractInner(au [][]byte, pts time.Duration) (time.Duration, error) { - idrPresent := false - - for _, nalu := range au { - typ := NALUType((nalu[0] >> 1) & 0b111111) - - switch typ { - case NALUType_SPS_NUT: - var spsp SPS - err := spsp.Unmarshal(nalu) - if err != nil { - return 0, fmt.Errorf("invalid SPS: %v", err) - } - d.spsp = &spsp - - case NALUType_PPS_NUT: - var ppsp PPS - err := ppsp.Unmarshal(nalu) - if err != nil { - return 0, fmt.Errorf("invalid PPS: %v", err) - } - d.ppsp = &ppsp - - case NALUType_IDR_W_RADL, NALUType_IDR_N_LP: - idrPresent = true - } - } - - if d.spsp == nil { - return 0, fmt.Errorf("SPS not received yet") - } - - if d.ppsp == nil { - return 0, fmt.Errorf("PPS not received yet") - } - - if len(d.spsp.MaxNumReorderPics) != 1 || d.spsp.MaxNumReorderPics[0] == 0 { - return pts, nil - } - - if d.spsp.VUI == nil || d.spsp.VUI.TimingInfo == nil { - return pts, nil - } - - var poc uint32 - var dtsPOC uint32 - - if idrPresent { - poc = 0 - dtsPOC = poc - 2 - dtsPOC &= ((1 << (d.spsp.Log2MaxPicOrderCntLsbMinus4 + 4)) - 1) - } else { - var err error - poc, dtsPOC, err = findPictureOrderCount(au, d.spsp, d.ppsp) - if err != nil { - return 0, err - } - } - - pocDiff := getPictureOrderCountDiff(poc, dtsPOC, d.spsp) - timeDiff := time.Duration(pocDiff) * time.Second * - time.Duration(d.spsp.VUI.TimingInfo.NumUnitsInTick) / time.Duration(d.spsp.VUI.TimingInfo.TimeScale) - dts := pts - timeDiff - - return dts, nil -} - -// Extract extracts the DTS of a access unit. -func (d *DTSExtractor) Extract(au [][]byte, pts time.Duration) (time.Duration, error) { - dts, err := d.extractInner(au, pts) - if err != nil { - return 0, err - } - - if dts > pts { - return 0, fmt.Errorf("DTS is greater than PTS") - } - - if d.prevDTSFilled && dts <= d.prevDTS { - return 0, fmt.Errorf("DTS is not monotonically increasing, was %v, now is %v", - d.prevDTS, dts) - } - - d.prevDTSFilled = true - d.prevDTS = dts - - return dts, err -} diff --git a/pkg/codecs/h265/dts_extractor_test.go b/pkg/codecs/h265/dts_extractor_test.go deleted file mode 100644 index bd3e0d24..00000000 --- a/pkg/codecs/h265/dts_extractor_test.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h265 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func TestDTSExtractor(t *testing.T) { - type sequenceSample struct { - nalus [][]byte - pts time.Duration - dts time.Duration - } - - for _, ca := range []struct { - name string - sequence []sequenceSample - }{ - { - "no timing info", - []sequenceSample{ - { - [][]byte{ - { // SPS - 0x42, 0x01, 0x01, 0x02, 0x20, 0x00, 0x00, 0x03, - 0x00, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x7b, 0xa0, 0x07, 0x82, 0x00, 0x88, 0x7d, - 0xb6, 0x71, 0x8b, 0x92, 0x44, 0x80, 0x53, 0x88, - 0x88, 0x92, 0xcf, 0x24, 0xa6, 0x92, 0x72, 0xc9, - 0x12, 0x49, 0x22, 0xdc, 0x91, 0xaa, 0x48, 0xfc, - 0xa2, 0x23, 0xff, 0x00, 0x01, 0x00, 0x01, 0x6a, - 0x02, 0x02, 0x02, 0x01, - }, - { // PPS - 0x44, 0x01, 0xc0, 0x25, 0x2f, 0x05, 0x32, 0x40, - }, - { - byte(NALUType_CRA_NUT) << 1, - }, - }, - 1 * time.Second, - 1 * time.Second, - }, - }, - }, - } { - t.Run(ca.name, func(t *testing.T) { - ex := NewDTSExtractor() - for _, sample := range ca.sequence { - dts, err := ex.Extract(sample.nalus, sample.pts) - require.NoError(t, err) - require.Equal(t, sample.dts, dts) - } - }) - } -} - -func FuzzDTSExtractor(f *testing.F) { - sps := []byte{ - 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, - 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x10, 0xe5, - 0x96, 0x66, 0x69, 0x24, 0xca, 0xe0, 0x10, 0x00, - 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x01, - 0xe0, 0x80, - } - - pps := []byte{ - 0x44, 0x01, 0xc1, 0x72, 0xb4, 0x62, 0x40, - } - - ex := NewDTSExtractor() - f.Fuzz(func(t *testing.T, b []byte, p uint64) { - if len(b) < 1 { - return - } - ex.Extract([][]byte{sps, pps, b}, time.Duration(p)) - }) -} diff --git a/pkg/codecs/h265/h265.go b/pkg/codecs/h265/h265.go deleted file mode 100644 index 6e06e5cd..00000000 --- a/pkg/codecs/h265/h265.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package h265 contains utilities to work with the H265 codec. -package h265 - -const ( - // MaxNALUSize is the maximum size of a NALU. - // with a 250 Mbps H265 video, the maximum NALU size is 2.2MB - MaxNALUSize = 3 * 1024 * 1024 - - // MaxNALUsPerGroup is the maximum number of NALUs per group. - MaxNALUsPerGroup = 20 -) diff --git a/pkg/codecs/h265/nalu_type.go b/pkg/codecs/h265/nalu_type.go deleted file mode 100644 index 87b705a3..00000000 --- a/pkg/codecs/h265/nalu_type.go +++ /dev/null @@ -1,99 +0,0 @@ -package h265 - -import ( - "fmt" -) - -// NALUType is the type of a NALU. -type NALUType uint8 - -// NALU types. -const ( - NALUType_TRAIL_N NALUType = 0 //nolint:revive - NALUType_TRAIL_R NALUType = 1 //nolint:revive - NALUType_TSA_N NALUType = 2 //nolint:revive - NALUType_TSA_R NALUType = 3 //nolint:revive - NALUType_STSA_N NALUType = 4 //nolint:revive - NALUType_STSA_R NALUType = 5 //nolint:revive - NALUType_RADL_N NALUType = 6 //nolint:revive - NALUType_RADL_R NALUType = 7 //nolint:revive - NALUType_RASL_N NALUType = 8 //nolint:revive - NALUType_RASL_R NALUType = 9 //nolint:revive - NALUType_RSV_VCL_N10 NALUType = 10 //nolint:revive - NALUType_RSV_VCL_N12 NALUType = 12 //nolint:revive - NALUType_RSV_VCL_N14 NALUType = 14 //nolint:revive - NALUType_RSV_VCL_R11 NALUType = 11 //nolint:revive - NALUType_RSV_VCL_R13 NALUType = 13 //nolint:revive - NALUType_RSV_VCL_R15 NALUType = 15 //nolint:revive - NALUType_BLA_W_LP NALUType = 16 //nolint:revive - NALUType_BLA_W_RADL NALUType = 17 //nolint:revive - NALUType_BLA_N_LP NALUType = 18 //nolint:revive - NALUType_IDR_W_RADL NALUType = 19 //nolint:revive - NALUType_IDR_N_LP NALUType = 20 //nolint:revive - NALUType_CRA_NUT NALUType = 21 //nolint:revive - NALUType_RSV_IRAP_VCL22 NALUType = 22 //nolint:revive - NALUType_RSV_IRAP_VCL23 NALUType = 23 //nolint:revive - NALUType_VPS_NUT NALUType = 32 //nolint:revive - NALUType_SPS_NUT NALUType = 33 //nolint:revive - NALUType_PPS_NUT NALUType = 34 //nolint:revive - NALUType_AUD_NUT NALUType = 35 //nolint:revive - NALUType_EOS_NUT NALUType = 36 //nolint:revive - NALUType_EOB_NUT NALUType = 37 //nolint:revive - NALUType_FD_NUT NALUType = 38 //nolint:revive - NALUType_PREFIX_SEI_NUT NALUType = 39 //nolint:revive - NALUType_SUFFIX_SEI_NUT NALUType = 40 //nolint:revive - - // additional NALU types for RTP/H265 - NALUType_AggregationUnit NALUType = 48 //nolint:revive - NALUType_FragmentationUnit NALUType = 49 //nolint:revive - NALUType_PACI NALUType = 50 //nolint:revive -) - -var naluTypeLabels = map[NALUType]string{ - NALUType_TRAIL_N: "TRAIL_N", - NALUType_TRAIL_R: "TRAIL_R", - NALUType_TSA_N: "TSA_N", - NALUType_TSA_R: "TSA_R", - NALUType_STSA_N: "STSA_N", - NALUType_STSA_R: "STSA_R:", - NALUType_RADL_N: "RADL_N", - NALUType_RADL_R: "RADL_R", - NALUType_RASL_N: "RASL_N", - NALUType_RASL_R: "RASL_R", - NALUType_RSV_VCL_N10: "RSV_VCL_N10", - NALUType_RSV_VCL_N12: "RSV_VCL_N12", - NALUType_RSV_VCL_N14: "RSV_VCL_N14", - NALUType_RSV_VCL_R11: "RSV_VCL_R11", - NALUType_RSV_VCL_R13: "RSV_VCL_R13", - NALUType_RSV_VCL_R15: "RSV_VCL_R15", - NALUType_BLA_W_LP: "BLA_W_LP", - NALUType_BLA_W_RADL: "BLA_W_RADL", - NALUType_BLA_N_LP: "BLA_N_LP", - NALUType_IDR_W_RADL: "IDR_W_RADL", - NALUType_IDR_N_LP: "IDR_N_LP", - NALUType_CRA_NUT: "CRA_NUT", - NALUType_RSV_IRAP_VCL22: "RSV_IRAP_VCL22", - NALUType_RSV_IRAP_VCL23: "RSV_IRAP_VCL23", - NALUType_VPS_NUT: "VPS_NUT", - NALUType_SPS_NUT: "SPS_NUT", - NALUType_PPS_NUT: "PPS_NUT", - NALUType_AUD_NUT: "AUD_NUT", - NALUType_EOS_NUT: "EOS_NUT", - NALUType_EOB_NUT: "EOB_NUT", - NALUType_FD_NUT: "FD_NUT", - NALUType_PREFIX_SEI_NUT: "PrefixSEINUT", - NALUType_SUFFIX_SEI_NUT: "SuffixSEINUT", - - // additional NALU types for RTP/H265 - NALUType_AggregationUnit: "AggregationUnit", - NALUType_FragmentationUnit: "FragmentationUnit", - NALUType_PACI: "PACI", -} - -// String implements fmt.Stringer. -func (nt NALUType) String() string { - if l, ok := naluTypeLabels[nt]; ok { - return l - } - return fmt.Sprintf("unknown (%d)", nt) -} diff --git a/pkg/codecs/h265/nalu_type_test.go b/pkg/codecs/h265/nalu_type_test.go deleted file mode 100644 index 3255ff7e..00000000 --- a/pkg/codecs/h265/nalu_type_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package h265 - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestNALUType(t *testing.T) { - require.NotEqual(t, true, strings.HasPrefix(NALUType(10).String(), "unknown")) - require.Equal(t, true, strings.HasPrefix(NALUType(60).String(), "unknown")) -} diff --git a/pkg/codecs/h265/pps.go b/pkg/codecs/h265/pps.go deleted file mode 100644 index 2a4fe3dd..00000000 --- a/pkg/codecs/h265/pps.go +++ /dev/null @@ -1,51 +0,0 @@ -package h265 - -import ( - "fmt" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" -) - -// PPS is a H265 picture parameter set. -type PPS struct { - ID uint32 - SPSID uint32 - DependentSliceSegmentsEnabledFlag bool - OutputFlagPresentFlag bool - NumExtraSliceHeaderBits uint8 -} - -// Unmarshal decodes a PPS. -func (p *PPS) Unmarshal(buf []byte) error { - if len(buf) < 2 { - return fmt.Errorf("not enough bits") - } - - buf = h264.EmulationPreventionRemove(buf) - - buf = buf[2:] - pos := 0 - - var err error - p.ID, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - p.SPSID, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - err = bits.HasSpace(buf, pos, 5) - if err != nil { - return err - } - - p.DependentSliceSegmentsEnabledFlag = bits.ReadFlagUnsafe(buf, &pos) - p.OutputFlagPresentFlag = bits.ReadFlagUnsafe(buf, &pos) - p.NumExtraSliceHeaderBits = uint8(bits.ReadBitsUnsafe(buf, &pos, 3)) - - return nil -} diff --git a/pkg/codecs/h265/pps_test.go b/pkg/codecs/h265/pps_test.go deleted file mode 100644 index d6de60a3..00000000 --- a/pkg/codecs/h265/pps_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h265 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestPPSUnmarshal(t *testing.T) { - for _, ca := range []struct { - name string - byts []byte - pps PPS - }{ - { - "default", - []byte{ - 0x44, 0x01, 0xc1, 0x72, 0xb4, 0x62, 0x40, - }, - PPS{}, - }, - } { - t.Run(ca.name, func(t *testing.T) { - var pps PPS - err := pps.Unmarshal(ca.byts) - require.NoError(t, err) - require.Equal(t, ca.pps, pps) - }) - } -} - -func FuzzPPSUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var pps PPS - pps.Unmarshal(b) - }) -} diff --git a/pkg/codecs/h265/sps.go b/pkg/codecs/h265/sps.go deleted file mode 100644 index 84d4c7f6..00000000 --- a/pkg/codecs/h265/sps.go +++ /dev/null @@ -1,861 +0,0 @@ -package h265 - -import ( - "fmt" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" -) - -const ( - maxNegativePics = 255 - maxPositivePics = 255 - maxShortTermRefPics = 64 -) - -var subWidthC = []uint32{ - 1, - 2, - 2, - 1, -} - -var subHeightC = []uint32{ - 1, - 2, - 1, - 1, -} - -// SPS_DefaultDisplayWindow is a default display window. -type SPS_DefaultDisplayWindow struct { //nolint:revive - LeftOffset uint32 - RightOffset uint32 - TopOffset uint32 - BottomOffset uint32 -} - -func (w *SPS_DefaultDisplayWindow) unmarshal(buf []byte, pos *int) error { - var err error - w.LeftOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - w.RightOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - w.TopOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - w.BottomOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - return nil -} - -// SPS_TimingInfo is a timing info. -type SPS_TimingInfo struct { //nolint:revive - NumUnitsInTick uint32 - TimeScale uint32 - POCProportionalToTimingFlag bool - - // POCProportionalToTimingFlag == true - NumTicksPOCDiffOneMinus1 uint32 -} - -func (t *SPS_TimingInfo) unmarshal(buf []byte, pos *int) error { - err := bits.HasSpace(buf, *pos, 32+32+1) - if err != nil { - return err - } - - t.NumUnitsInTick = uint32(bits.ReadBitsUnsafe(buf, pos, 32)) - t.TimeScale = uint32(bits.ReadBitsUnsafe(buf, pos, 32)) - t.POCProportionalToTimingFlag = bits.ReadFlagUnsafe(buf, pos) - - if t.POCProportionalToTimingFlag { - t.NumTicksPOCDiffOneMinus1, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - } - - return nil -} - -// SPS_VUI is a video usability information. -type SPS_VUI struct { //nolint:revive - AspectRatioInfoPresentFlag bool - - // AspectRatioInfoPresentFlag == true - AspectRatioIdc uint8 - SarWidth uint16 - SarHeight uint16 - - OverscanInfoPresentFlag bool - - // OverscanInfoPresentFlag == true - OverscanAppropriateFlag bool - VideoSignalTypePresentFlag bool - - // VideoSignalTypePresentFlag == true - VideoFormat uint8 - VideoFullRangeFlag bool - ColourDescriptionPresentFlag bool - - // ColourDescriptionPresentFlag == true - ColourPrimaries uint8 - TransferCharacteristics uint8 - MatrixCoefficients uint8 - - ChromaLocInfoPresentFlag bool - - // ChromaLocInfoPresentFlag == true - ChromaSampleLocTypeTopField uint32 - ChromaSampleLocTypeBottomField uint32 - - NeutralChromaIndicationFlag bool - FieldSeqFlag bool - FrameFieldInfoPresentFlag bool - DefaultDisplayWindow *SPS_DefaultDisplayWindow - TimingInfo *SPS_TimingInfo -} - -func (v *SPS_VUI) unmarshal(buf []byte, pos *int) error { - var err error - v.AspectRatioInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.AspectRatioInfoPresentFlag { - tmp, err := bits.ReadBits(buf, pos, 8) - if err != nil { - return err - } - v.AspectRatioIdc = uint8(tmp) - - if v.AspectRatioIdc == 255 { // EXTENDED_SAR - err := bits.HasSpace(buf, *pos, 32) - if err != nil { - return err - } - - v.SarWidth = uint16(bits.ReadBitsUnsafe(buf, pos, 16)) - v.SarHeight = uint16(bits.ReadBitsUnsafe(buf, pos, 16)) - } - } - - v.OverscanInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.OverscanInfoPresentFlag { - v.OverscanAppropriateFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - - v.VideoSignalTypePresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.VideoSignalTypePresentFlag { - err := bits.HasSpace(buf, *pos, 5) - if err != nil { - return err - } - - v.VideoFormat = uint8(bits.ReadBitsUnsafe(buf, pos, 3)) - v.VideoFullRangeFlag = bits.ReadFlagUnsafe(buf, pos) - v.ColourDescriptionPresentFlag = bits.ReadFlagUnsafe(buf, pos) - - if v.ColourDescriptionPresentFlag { - err := bits.HasSpace(buf, *pos, 24) - if err != nil { - return err - } - - v.ColourPrimaries = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - v.TransferCharacteristics = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - v.MatrixCoefficients = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - } - } - - v.ChromaLocInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if v.ChromaLocInfoPresentFlag { - v.ChromaSampleLocTypeTopField, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - v.ChromaSampleLocTypeBottomField, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - } - - v.NeutralChromaIndicationFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - v.FieldSeqFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - v.FrameFieldInfoPresentFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - defaultDisplayWindowFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if defaultDisplayWindowFlag { - v.DefaultDisplayWindow = &SPS_DefaultDisplayWindow{} - err := v.DefaultDisplayWindow.unmarshal(buf, pos) - if err != nil { - return err - } - } else { - v.DefaultDisplayWindow = nil - } - - timingInfoPresentFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if timingInfoPresentFlag { - v.TimingInfo = &SPS_TimingInfo{} - err := v.TimingInfo.unmarshal(buf, pos) - if err != nil { - return err - } - } else { - v.TimingInfo = nil - } - - return nil -} - -// SPS_ProfileTierLevel is a profile level tier of a SPS. -type SPS_ProfileTierLevel struct { //nolint:revive - GeneralProfileSpace uint8 - GeneralTierFlag uint8 - GeneralProfileIdc uint8 - GeneralProfileCompatibilityFlag [32]bool - GeneralProgressiveSourceFlag bool - GeneralInterlacedSourceFlag bool - GeneralNonPackedConstraintFlag bool - GeneralFrameOnlyConstraintFlag bool - GeneralMax12bitConstraintFlag bool - GeneralMax10bitConstraintFlag bool - GeneralMax8bitConstraintFlag bool - GeneralMax422ChromeConstraintFlag bool - GeneralMax420ChromaConstraintFlag bool - GeneralMaxMonochromeConstraintFlag bool - GeneralIntraConstraintFlag bool - GeneralOnePictureOnlyConstraintFlag bool - GeneralLowerBitRateConstraintFlag bool - GeneralMax14BitConstraintFlag bool - GeneralLevelIdc uint8 - SubLayerProfilePresentFlag []bool - SubLayerLevelPresentFlag []bool -} - -func (p *SPS_ProfileTierLevel) unmarshal(buf []byte, pos *int, maxSubLayersMinus1 uint8) error { - err := bits.HasSpace(buf, *pos, 8+32+12+34+8) - if err != nil { - return err - } - - p.GeneralProfileSpace = uint8(bits.ReadBitsUnsafe(buf, pos, 2)) - p.GeneralTierFlag = uint8(bits.ReadBitsUnsafe(buf, pos, 1)) - p.GeneralProfileIdc = uint8(bits.ReadBitsUnsafe(buf, pos, 5)) - - for j := 0; j < 32; j++ { - p.GeneralProfileCompatibilityFlag[j] = bits.ReadFlagUnsafe(buf, pos) - } - - p.GeneralProgressiveSourceFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralInterlacedSourceFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralNonPackedConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralFrameOnlyConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMax12bitConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMax10bitConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMax8bitConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMax422ChromeConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMax420ChromaConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralMaxMonochromeConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralIntraConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralOnePictureOnlyConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - p.GeneralLowerBitRateConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - - if p.GeneralProfileIdc == 5 || - p.GeneralProfileIdc == 9 || - p.GeneralProfileIdc == 10 || - p.GeneralProfileIdc == 11 || - p.GeneralProfileCompatibilityFlag[5] || - p.GeneralProfileCompatibilityFlag[9] || - p.GeneralProfileCompatibilityFlag[10] || - p.GeneralProfileCompatibilityFlag[11] { - p.GeneralMax14BitConstraintFlag = bits.ReadFlagUnsafe(buf, pos) - *pos += 34 - } else { - *pos += 35 - } - - p.GeneralLevelIdc = uint8(bits.ReadBitsUnsafe(buf, pos, 8)) - - if maxSubLayersMinus1 > 0 { - p.SubLayerProfilePresentFlag = make([]bool, maxSubLayersMinus1) - p.SubLayerLevelPresentFlag = make([]bool, maxSubLayersMinus1) - - err := bits.HasSpace(buf, *pos, int(2*maxSubLayersMinus1)) - if err != nil { - return err - } - - for j := uint8(0); j < maxSubLayersMinus1; j++ { - p.SubLayerProfilePresentFlag[j] = bits.ReadFlagUnsafe(buf, pos) - p.SubLayerLevelPresentFlag[j] = bits.ReadFlagUnsafe(buf, pos) - } - } - - if maxSubLayersMinus1 > 0 { - err := bits.HasSpace(buf, *pos, int(8-maxSubLayersMinus1)*2) - if err != nil { - return err - } - - *pos += int(8-maxSubLayersMinus1) * 2 - } - - for i := uint8(0); i < maxSubLayersMinus1; i++ { - if p.SubLayerProfilePresentFlag[i] { - return fmt.Errorf("SubLayerProfilePresentFlag not supported yet") - } - - if p.SubLayerLevelPresentFlag[i] { - return fmt.Errorf("SubLayerLevelPresentFlag not supported yet") - } - } - - return nil -} - -// SPS_ConformanceWindow is a conformance window of a SPS. -type SPS_ConformanceWindow struct { //nolint:revive - LeftOffset uint32 - RightOffset uint32 - TopOffset uint32 - BottomOffset uint32 -} - -func (c *SPS_ConformanceWindow) unmarshal(buf []byte, pos *int) error { - var err error - c.LeftOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.RightOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.TopOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - c.BottomOffset, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - return nil -} - -// SPS_ShortTermRefPicSet is a short-term reference picture set. -type SPS_ShortTermRefPicSet struct { //nolint:revive - InterRefPicSetPredictionFlag bool - DeltaIdxMinus1 uint32 - DeltaRpsSign bool - AbsDeltaRpsMinus1 uint32 - NumNegativePics uint32 - NumPositivePics uint32 - DeltaPocS0Minus1 []uint32 - UsedByCurrPicS0Flag []bool - DeltaPocS1Minus1 []uint32 - UsedByCurrPicS1Flag []bool -} - -func (r *SPS_ShortTermRefPicSet) unmarshal(buf []byte, pos *int, stRpsIdx uint32, - numShortTermRefPicSets uint32, shortTermRefPicSets []*SPS_ShortTermRefPicSet, -) error { - var err error - - if stRpsIdx != 0 { - r.InterRefPicSetPredictionFlag, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - - if r.InterRefPicSetPredictionFlag { - if stRpsIdx == numShortTermRefPicSets { - r.DeltaIdxMinus1, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - } - - r.DeltaRpsSign, err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - r.AbsDeltaRpsMinus1, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - refRpsIdx := stRpsIdx - (r.DeltaIdxMinus1 + 1) - numDeltaPocs := shortTermRefPicSets[refRpsIdx].NumNegativePics + shortTermRefPicSets[refRpsIdx].NumPositivePics - - for j := uint32(0); j <= numDeltaPocs; j++ { - usedByCurrPicFlag, err := bits.ReadFlag(buf, pos) - if err != nil { - return err - } - - if usedByCurrPicFlag { - _, err := bits.ReadGolombUnsigned(buf, pos) // use_delta_flag - if err != nil { - return err - } - } - } - } else { - r.NumNegativePics, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.NumPositivePics, err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - if r.NumNegativePics > 0 { - if r.NumNegativePics > maxNegativePics { - return fmt.Errorf("num_negative_pics exceeds %d", maxNegativePics) - } - - r.DeltaPocS0Minus1 = make([]uint32, r.NumNegativePics) - r.UsedByCurrPicS0Flag = make([]bool, r.NumNegativePics) - - for i := uint32(0); i < r.NumNegativePics; i++ { - r.DeltaPocS0Minus1[i], err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.UsedByCurrPicS0Flag[i], err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - } - - if r.NumPositivePics > 0 { - if r.NumPositivePics > maxPositivePics { - return fmt.Errorf("num_positive_pics exceeds %d", maxPositivePics) - } - - r.DeltaPocS1Minus1 = make([]uint32, r.NumPositivePics) - r.UsedByCurrPicS1Flag = make([]bool, r.NumPositivePics) - - for i := uint32(0); i < r.NumPositivePics; i++ { - r.DeltaPocS1Minus1[i], err = bits.ReadGolombUnsigned(buf, pos) - if err != nil { - return err - } - - r.UsedByCurrPicS1Flag[i], err = bits.ReadFlag(buf, pos) - if err != nil { - return err - } - } - } - } - - return nil -} - -// SPS is a H265 sequence parameter set. -type SPS struct { - VPSID uint8 - MaxSubLayersMinus1 uint8 - TemporalIDNestingFlag bool - ProfileTierLevel SPS_ProfileTierLevel - ID uint8 - ChromaFormatIdc uint32 - SeparateColourPlaneFlag bool - PicWidthInLumaSamples uint32 - PicHeightInLumaSamples uint32 - ConformanceWindow *SPS_ConformanceWindow - BitDepthLumaMinus8 uint32 - BitDepthChromaMinus8 uint32 - Log2MaxPicOrderCntLsbMinus4 uint32 - SubLayerOrderingInfoPresentFlag bool - MaxDecPicBufferingMinus1 []uint32 - MaxNumReorderPics []uint32 - MaxLatencyIncreasePlus1 []uint32 - Log2MinLumaCodingBlockSizeMinus3 uint32 - Log2DiffMaxMinLumaCodingBlockSize uint32 - Log2MinLumaTransformBlockSizeMinus2 uint32 - Log2DiffMaxMinLumaTransformBlockSize uint32 - MaxTransformHierarchyDepthInter uint32 - MaxTransformHierarchyDepthIntra uint32 - ScalingListEnabledFlag bool - ScalingListDataPresentFlag bool - AmpEnabledFlag bool - SampleAdaptiveOffsetEnabledFlag bool - PcmEnabledFlag bool - - // PcmEnabledFlag == true - PcmSampleBitDepthLumaMinus1 uint8 - PcmSampleBitDepthChromaMinus1 uint8 - Log2MinPcmLumaCodingBlockSizeMinus3 uint32 - Log2DiffMaxMinPcmLumaCodingBlockSize uint32 - PcmLoopFilterDisabledFlag bool - - ShortTermRefPicSets []*SPS_ShortTermRefPicSet - LongTermRefPicsPresentFlag bool - TemporalMvpEnabledFlag bool - StrongIntraSmoothingEnabledFlag bool - VUI *SPS_VUI -} - -// Unmarshal decodes a SPS from bytes. -func (s *SPS) Unmarshal(buf []byte) error { - buf = h264.EmulationPreventionRemove(buf) - - if len(buf) < 2 { - return fmt.Errorf("not enough bits") - } - - buf = buf[2:] - pos := 0 - - err := bits.HasSpace(buf, pos, 8) - if err != nil { - return err - } - - s.VPSID = uint8(bits.ReadBitsUnsafe(buf, &pos, 4)) - s.MaxSubLayersMinus1 = uint8(bits.ReadBitsUnsafe(buf, &pos, 3)) - s.TemporalIDNestingFlag = bits.ReadFlagUnsafe(buf, &pos) - - err = s.ProfileTierLevel.unmarshal(buf, &pos, s.MaxSubLayersMinus1) - if err != nil { - return err - } - - tmp2, err := bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - s.ID = uint8(tmp2) - - s.ChromaFormatIdc, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - if s.ChromaFormatIdc == 3 { - s.SeparateColourPlaneFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - } - - s.PicWidthInLumaSamples, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.PicHeightInLumaSamples, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - conformanceWindowFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if conformanceWindowFlag { - s.ConformanceWindow = &SPS_ConformanceWindow{} - err := s.ConformanceWindow.unmarshal(buf, &pos) - if err != nil { - return err - } - } else { - s.ConformanceWindow = nil - } - - s.BitDepthLumaMinus8, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.BitDepthChromaMinus8, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.Log2MaxPicOrderCntLsbMinus4, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.SubLayerOrderingInfoPresentFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - var start uint8 - if s.SubLayerOrderingInfoPresentFlag { - start = 0 - } else { - start = s.MaxSubLayersMinus1 - } - - s.MaxDecPicBufferingMinus1 = make([]uint32, s.MaxSubLayersMinus1+1) - s.MaxNumReorderPics = make([]uint32, s.MaxSubLayersMinus1+1) - s.MaxLatencyIncreasePlus1 = make([]uint32, s.MaxSubLayersMinus1+1) - - for i := start; i <= s.MaxSubLayersMinus1; i++ { - s.MaxDecPicBufferingMinus1[i], err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.MaxNumReorderPics[i], err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.MaxLatencyIncreasePlus1[i], err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - } - - s.Log2MinLumaCodingBlockSizeMinus3, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.Log2DiffMaxMinLumaCodingBlockSize, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.Log2MinLumaTransformBlockSizeMinus2, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.Log2DiffMaxMinLumaTransformBlockSize, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.MaxTransformHierarchyDepthInter, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.MaxTransformHierarchyDepthIntra, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.ScalingListEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if s.ScalingListEnabledFlag { - s.ScalingListDataPresentFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if s.ScalingListDataPresentFlag { - return fmt.Errorf("ScalingListDataPresentFlag not supported yet") - } - } - - s.AmpEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - s.SampleAdaptiveOffsetEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - s.PcmEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if s.PcmEnabledFlag { - err := bits.HasSpace(buf, pos, 8) - if err != nil { - return err - } - - s.PcmSampleBitDepthLumaMinus1 = uint8(bits.ReadBitsUnsafe(buf, &pos, 4)) - s.PcmSampleBitDepthChromaMinus1 = uint8(bits.ReadBitsUnsafe(buf, &pos, 4)) - - s.Log2MinPcmLumaCodingBlockSizeMinus3, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.Log2DiffMaxMinPcmLumaCodingBlockSize, err = bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - s.PcmLoopFilterDisabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - } - - numShortTermRefPicSets, err := bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - if numShortTermRefPicSets > 0 { - if numShortTermRefPicSets > maxShortTermRefPics { - return fmt.Errorf("num_short_term_ref_pic_sets exceeds %d", maxShortTermRefPics) - } - - s.ShortTermRefPicSets = make([]*SPS_ShortTermRefPicSet, numShortTermRefPicSets) - - for i := uint32(0); i < numShortTermRefPicSets; i++ { - s.ShortTermRefPicSets[i] = &SPS_ShortTermRefPicSet{} - err := s.ShortTermRefPicSets[i].unmarshal(buf, &pos, i, numShortTermRefPicSets, s.ShortTermRefPicSets) - if err != nil { - return err - } - } - } else { - s.ShortTermRefPicSets = nil - } - - s.LongTermRefPicsPresentFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if s.LongTermRefPicsPresentFlag { - numLongTermRefPicsSPS, err := bits.ReadGolombUnsigned(buf, &pos) - if err != nil { - return err - } - - if numLongTermRefPicsSPS > 0 { - return fmt.Errorf("long term ref pics inside SPS are not supported yet") - } - } - - s.TemporalMvpEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - s.StrongIntraSmoothingEnabledFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - vuiParametersPresentFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if vuiParametersPresentFlag { - s.VUI = &SPS_VUI{} - err := s.VUI.unmarshal(buf, &pos) - if err != nil { - return err - } - } else { - s.VUI = nil - } - - return nil -} - -// Width returns the video width. -func (s SPS) Width() int { - width := s.PicWidthInLumaSamples - - if s.ConformanceWindow != nil { - cropUnitX := subWidthC[s.ChromaFormatIdc] - width -= (s.ConformanceWindow.LeftOffset + s.ConformanceWindow.RightOffset) * cropUnitX - } - - return int(width) -} - -// Height returns the video height. -func (s SPS) Height() int { - height := s.PicHeightInLumaSamples - - if s.ConformanceWindow != nil { - cropUnitY := subHeightC[s.ChromaFormatIdc] - height -= (s.ConformanceWindow.TopOffset + s.ConformanceWindow.BottomOffset) * cropUnitY - } - - return int(height) -} - -// FPS returns the frames per second of the video. -func (s SPS) FPS() float64 { - if s.VUI == nil || s.VUI.TimingInfo == nil { - return 0 - } - - return float64(s.VUI.TimingInfo.TimeScale) / float64(s.VUI.TimingInfo.NumUnitsInTick) -} diff --git a/pkg/codecs/h265/sps_test.go b/pkg/codecs/h265/sps_test.go deleted file mode 100644 index eac88c16..00000000 --- a/pkg/codecs/h265/sps_test.go +++ /dev/null @@ -1,446 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package h265 - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestSPSUnmarshal(t *testing.T) { - for _, ca := range []struct { - name string - byts []byte - sps SPS - width int - height int - fps float64 - }{ - { - "1920x1080", - []byte{ - 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, - 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x10, 0xe5, - 0x96, 0x66, 0x69, 0x24, 0xca, 0xe0, 0x10, 0x00, - 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x01, - 0xe0, 0x80, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 1, - GeneralProfileCompatibilityFlag: [32]bool{ - false, true, true, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralFrameOnlyConstraintFlag: true, - GeneralLevelIdc: 120, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 1920, - PicHeightInLumaSamples: 1080, - Log2MaxPicOrderCntLsbMinus4: 4, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{5}, - MaxNumReorderPics: []uint32{2}, - MaxLatencyIncreasePlus1: []uint32{5}, - Log2DiffMaxMinLumaCodingBlockSize: 3, - Log2DiffMaxMinLumaTransformBlockSize: 3, - SampleAdaptiveOffsetEnabledFlag: true, - TemporalMvpEnabledFlag: true, - StrongIntraSmoothingEnabledFlag: true, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 30, - }, - }, - }, - 1920, - 1080, - 30, - }, - { - "1920x800", - []byte{ - 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, - 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x32, 0x16, - 0x59, 0x59, 0xa4, 0x93, 0x2b, 0xc0, 0x5a, 0x80, - 0x80, 0x80, 0x82, 0x00, 0x00, 0x07, 0xd2, 0x00, - 0x00, 0xbb, 0x80, 0x10, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 1, - GeneralProfileCompatibilityFlag: [32]bool{ - false, true, true, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralFrameOnlyConstraintFlag: true, - GeneralLevelIdc: 120, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 1920, - PicHeightInLumaSamples: 800, - Log2MaxPicOrderCntLsbMinus4: 4, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{4}, - MaxNumReorderPics: []uint32{2}, - MaxLatencyIncreasePlus1: []uint32{5}, - Log2DiffMaxMinLumaCodingBlockSize: 3, - Log2DiffMaxMinLumaTransformBlockSize: 3, - SampleAdaptiveOffsetEnabledFlag: true, - TemporalMvpEnabledFlag: true, - StrongIntraSmoothingEnabledFlag: true, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1001, - TimeScale: 24000, - }, - }, - }, - 1920, - 800, - 23.976023976023978, - }, - { - "1280x720", - []byte{ - 0x42, 0x01, 0x01, 0x04, 0x08, 0x00, 0x00, 0x03, - 0x00, 0x98, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x5d, 0x90, 0x00, 0x50, 0x10, 0x05, 0xa2, 0x29, - 0x4b, 0x74, 0x94, 0x98, 0x5f, 0xfe, 0x00, 0x02, - 0x00, 0x02, 0xd4, 0x04, 0x04, 0x04, 0x10, 0x00, - 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x01, - 0xe0, 0x80, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 4, - GeneralProfileCompatibilityFlag: [32]bool{ - false, false, false, false, true, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralFrameOnlyConstraintFlag: true, - GeneralMax12bitConstraintFlag: true, - GeneralLowerBitRateConstraintFlag: true, - GeneralLevelIdc: 93, - }, - ChromaFormatIdc: 3, - PicWidthInLumaSamples: 1280, - PicHeightInLumaSamples: 720, - BitDepthLumaMinus8: 4, - BitDepthChromaMinus8: 4, - Log2MaxPicOrderCntLsbMinus4: 4, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{2}, - MaxNumReorderPics: []uint32{0}, - MaxLatencyIncreasePlus1: []uint32{1}, - Log2MinLumaCodingBlockSizeMinus3: 1, - Log2DiffMaxMinLumaCodingBlockSize: 1, - Log2DiffMaxMinLumaTransformBlockSize: 3, - TemporalMvpEnabledFlag: true, - StrongIntraSmoothingEnabledFlag: true, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 255, - SarWidth: 1, - SarHeight: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 30, - }, - }, - }, - 1280, - 720, - 30, - }, - { - "10 bit", - []byte{ - 0x42, 0x01, 0x01, 0x22, 0x20, 0x00, 0x00, 0x03, - 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x78, 0xa0, 0x03, 0xc0, 0x80, 0x10, 0xe4, - 0xd9, 0x66, 0x66, 0x92, 0x4c, 0xaf, 0x01, 0x01, - 0x00, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, 0x0b, - 0xb5, 0x08, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralTierFlag: 1, - GeneralProfileIdc: 2, - GeneralProfileCompatibilityFlag: [32]bool{ - false, false, true, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralFrameOnlyConstraintFlag: true, - GeneralLevelIdc: 120, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 1920, - PicHeightInLumaSamples: 1080, - BitDepthLumaMinus8: 2, - BitDepthChromaMinus8: 2, - Log2MaxPicOrderCntLsbMinus4: 4, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{5}, - MaxNumReorderPics: []uint32{2}, - MaxLatencyIncreasePlus1: []uint32{5}, - Log2DiffMaxMinLumaCodingBlockSize: 3, - Log2DiffMaxMinLumaTransformBlockSize: 3, - SampleAdaptiveOffsetEnabledFlag: true, - TemporalMvpEnabledFlag: true, - StrongIntraSmoothingEnabledFlag: true, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 100, - TimeScale: 2997, - }, - }, - }, - 1920, - 1080, - 29.97, - }, - { - "nvenc", - []byte{ - 0x42, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x7b, 0xa0, 0x03, 0xc0, 0x80, 0x11, - 0x07, 0xcb, 0x96, 0xb4, 0xa4, 0x25, 0x92, 0xe3, - 0x01, 0x6a, 0x02, 0x02, 0x02, 0x08, 0x00, 0x00, - 0x03, 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0xe3, - 0x00, 0x2e, 0xf2, 0x88, 0x00, 0x07, 0x27, 0x0c, - 0x00, 0x00, 0x98, 0x96, 0x82, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 1, - GeneralProfileCompatibilityFlag: [32]bool{ - false, true, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralLevelIdc: 123, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 1920, - PicHeightInLumaSamples: 1088, - ConformanceWindow: &SPS_ConformanceWindow{ - BottomOffset: 4, - }, - Log2MaxPicOrderCntLsbMinus4: 4, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{1}, - MaxNumReorderPics: []uint32{0}, - MaxLatencyIncreasePlus1: []uint32{0}, - Log2MinLumaCodingBlockSizeMinus3: 1, - Log2DiffMaxMinLumaCodingBlockSize: 1, - Log2DiffMaxMinLumaTransformBlockSize: 3, - MaxTransformHierarchyDepthInter: 3, - AmpEnabledFlag: true, - SampleAdaptiveOffsetEnabledFlag: true, - ShortTermRefPicSets: []*SPS_ShortTermRefPicSet{{ - NumNegativePics: 1, - DeltaPocS0Minus1: []uint32{0}, - UsedByCurrPicS0Flag: []bool{true}, - }}, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 60, - }, - }, - }, - 1920, - 1080, - 60, - }, - { - "avigilon", - []byte{ - 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, - 0x00, 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x96, 0xa0, 0x01, 0x80, 0x20, 0x06, 0xc1, - 0xfe, 0x36, 0xbb, 0xb5, 0x37, 0x77, 0x25, 0xd6, - 0x02, 0xdc, 0x04, 0x04, 0x04, 0x10, 0x00, 0x00, - 0x3e, 0x80, 0x00, 0x04, 0x26, 0x87, 0x21, 0xde, - 0xe5, 0x10, 0x01, 0x6e, 0x20, 0x00, 0x66, 0xff, - 0x00, 0x0b, 0x71, 0x00, 0x03, 0x37, 0xf8, 0x80, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 1, - GeneralProfileCompatibilityFlag: [32]bool{ - false, true, true, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralLevelIdc: 150, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 3072, - PicHeightInLumaSamples: 1728, - ConformanceWindow: &SPS_ConformanceWindow{}, - Log2MaxPicOrderCntLsbMinus4: 12, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{1}, - MaxNumReorderPics: []uint32{0}, - MaxLatencyIncreasePlus1: []uint32{0}, - Log2DiffMaxMinLumaCodingBlockSize: 2, - SampleAdaptiveOffsetEnabledFlag: true, - PcmEnabledFlag: true, - PcmSampleBitDepthLumaMinus1: 7, - PcmSampleBitDepthChromaMinus1: 7, - Log2DiffMaxMinLumaTransformBlockSize: 2, - MaxTransformHierarchyDepthInter: 1, - Log2MinPcmLumaCodingBlockSizeMinus3: 2, - ShortTermRefPicSets: []*SPS_ShortTermRefPicSet{ - { - NumNegativePics: 1, - DeltaPocS0Minus1: []uint32{0}, - UsedByCurrPicS0Flag: []bool{true}, - }, - }, - TemporalMvpEnabledFlag: true, - VUI: &SPS_VUI{ - AspectRatioInfoPresentFlag: true, - AspectRatioIdc: 1, - VideoSignalTypePresentFlag: true, - VideoFormat: 5, - VideoFullRangeFlag: true, - ColourDescriptionPresentFlag: true, - ColourPrimaries: 1, - TransferCharacteristics: 1, - MatrixCoefficients: 1, - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1000, - TimeScale: 17000, - }, - }, - }, - 3072, - 1728, - 17, - }, - { - "long_term_ref_pics_present_flag", - []byte{ - 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, - 0x00, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x5d, 0xa0, 0x02, 0x80, 0x80, 0x2d, 0x16, - 0x36, 0xb9, 0x24, 0xcb, 0xf0, 0x08, 0x00, 0x00, - 0x03, 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x95, - 0x08, - }, - SPS{ - TemporalIDNestingFlag: true, - ProfileTierLevel: SPS_ProfileTierLevel{ - GeneralProfileIdc: 1, - GeneralProfileCompatibilityFlag: [32]bool{ - false, true, true, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, - }, - GeneralProgressiveSourceFlag: true, - GeneralNonPackedConstraintFlag: true, - GeneralFrameOnlyConstraintFlag: true, - GeneralLevelIdc: 93, - }, - ChromaFormatIdc: 1, - PicWidthInLumaSamples: 1280, - PicHeightInLumaSamples: 720, - Log2MaxPicOrderCntLsbMinus4: 12, - SubLayerOrderingInfoPresentFlag: true, - MaxDecPicBufferingMinus1: []uint32{1}, - MaxNumReorderPics: []uint32{0}, - MaxLatencyIncreasePlus1: []uint32{0}, - Log2DiffMaxMinLumaCodingBlockSize: 3, - Log2DiffMaxMinLumaTransformBlockSize: 3, - SampleAdaptiveOffsetEnabledFlag: true, - LongTermRefPicsPresentFlag: true, - TemporalMvpEnabledFlag: true, - StrongIntraSmoothingEnabledFlag: true, - VUI: &SPS_VUI{ - TimingInfo: &SPS_TimingInfo{ - NumUnitsInTick: 1, - TimeScale: 50, - POCProportionalToTimingFlag: true, - NumTicksPOCDiffOneMinus1: 1, - }, - }, - }, - 1280, - 720, - 50, - }, - } { - t.Run(ca.name, func(t *testing.T) { - var sps SPS - err := sps.Unmarshal(ca.byts) - require.NoError(t, err) - require.Equal(t, ca.sps, sps) - require.Equal(t, ca.width, sps.Width()) - require.Equal(t, ca.height, sps.Height()) - require.Equal(t, ca.fps, sps.FPS()) - }) - } -} - -func FuzzSPSUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var sps SPS - sps.Unmarshal(b) - }) -} diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/0e888f462a3598bba3429e3c26cda412817aa65ef38cdeb3aaed76db1c0379a4 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/0e888f462a3598bba3429e3c26cda412817aa65ef38cdeb3aaed76db1c0379a4 deleted file mode 100644 index 8ca4d7c8..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/0e888f462a3598bba3429e3c26cda412817aa65ef38cdeb3aaed76db1c0379a4 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\xc6000000000") -uint64(87) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/1c4d7707525a482640e7c5090e339b08e446b5f9e4f7fff7e448ae377664edb0 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/1c4d7707525a482640e7c5090e339b08e446b5f9e4f7fff7e448ae377664edb0 deleted file mode 100644 index eaa28f7f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/1c4d7707525a482640e7c5090e339b08e446b5f9e4f7fff7e448ae377664edb0 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\x80\x00\x00\x00\x0000000") -uint64(2) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/355f66d5cd294d34483b9be09cb55a3a35b9dd081ab4959ba7a35d04c5f91cb8 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/355f66d5cd294d34483b9be09cb55a3a35b9dd081ab4959ba7a35d04c5f91cb8 deleted file mode 100644 index cee8eb15..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/355f66d5cd294d34483b9be09cb55a3a35b9dd081ab4959ba7a35d04c5f91cb8 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("0") -uint64(0) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/3c6b851fbf8b3435e3757b3fd9ec0f57bfe84533014a058f89ed320caceb13a9 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/3c6b851fbf8b3435e3757b3fd9ec0f57bfe84533014a058f89ed320caceb13a9 deleted file mode 100644 index 20221918..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/3c6b851fbf8b3435e3757b3fd9ec0f57bfe84533014a058f89ed320caceb13a9 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("\x000\x920!0000000") -uint64(156) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/53955e13efd39f08be15944b872ad99a77e5d04e1472db9455c4b1b5bd8b7073 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/53955e13efd39f08be15944b872ad99a77e5d04e1472db9455c4b1b5bd8b7073 deleted file mode 100644 index 39b9df06..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/53955e13efd39f08be15944b872ad99a77e5d04e1472db9455c4b1b5bd8b7073 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*") -uint64(34) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/6004440a439db44ebabbaee8a166e7a25bbaa5d4431a3900f509c70b756a06fb b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/6004440a439db44ebabbaee8a166e7a25bbaa5d4431a3900f509c70b756a06fb deleted file mode 100644 index 69daea5f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/6004440a439db44ebabbaee8a166e7a25bbaa5d4431a3900f509c70b756a06fb +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\x80\x00\x00\x000000 0") -uint64(3) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8bf21706c418e930c7b972e6fff78d2fcadf6942a62141398df17b6cbe61f0b7 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8bf21706c418e930c7b972e6fff78d2fcadf6942a62141398df17b6cbe61f0b7 deleted file mode 100644 index fba610d9..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8bf21706c418e930c7b972e6fff78d2fcadf6942a62141398df17b6cbe61f0b7 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\xc6A00000000") -uint64(130) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8e78b3e3511102b0b24e8f88b42b4e913a44408f4dfb4e496550c34cb92c93fc b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8e78b3e3511102b0b24e8f88b42b4e913a44408f4dfb4e496550c34cb92c93fc deleted file mode 100644 index 0a7d5d15..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/8e78b3e3511102b0b24e8f88b42b4e913a44408f4dfb4e496550c34cb92c93fc +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("\x000\xb3000000000") -uint64(18) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/b467576cf8e0115542bddaece5f2d2bce19860a7c060445225adcf3dab189bc4 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/b467576cf8e0115542bddaece5f2d2bce19860a7c060445225adcf3dab189bc4 deleted file mode 100644 index f093f297..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/b467576cf8e0115542bddaece5f2d2bce19860a7c060445225adcf3dab189bc4 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\x80\x00\x00\x000000$0") -uint64(9) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f45d427ed4a5ea4af4846b4aeaf70d8194277f53bc68eb6255f52278d879d48c b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f45d427ed4a5ea4af4846b4aeaf70d8194277f53bc68eb6255f52278d879d48c deleted file mode 100644 index 8d9c858e..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f45d427ed4a5ea4af4846b4aeaf70d8194277f53bc68eb6255f52278d879d48c +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*00000000000") -uint64(6) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f6aa371594073591a2888e9cff0054b22899ced04b7aa1fddf0c96c76937d0fd b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f6aa371594073591a2888e9cff0054b22899ced04b7aa1fddf0c96c76937d0fd deleted file mode 100644 index 45ffc859..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/f6aa371594073591a2888e9cff0054b22899ced04b7aa1fddf0c96c76937d0fd +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("0") -uint64(200) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/fd6f09d0654e93abb8d685f39f20a5ddcdb857a09391b3e18e55376b8155e3a8 b/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/fd6f09d0654e93abb8d685f39f20a5ddcdb857a09391b3e18e55376b8155e3a8 deleted file mode 100644 index ea4f9f83..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzDTSExtractor/fd6f09d0654e93abb8d685f39f20a5ddcdb857a09391b3e18e55376b8155e3a8 +++ /dev/null @@ -1,3 +0,0 @@ -go test fuzz v1 -[]byte("*0\x80\x00\x00\x000000A0") -uint64(18) diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 b/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 deleted file mode 100644 index 7fd7a20e..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/06ba4bdb19de593e669c642987e270fe2488d4d58ecd712db136a3e011071253 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/76c06f7399f3b1781289b37c42f3dbe1518bc2481859740855ab13d8abdd88b1 b/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/76c06f7399f3b1781289b37c42f3dbe1518bc2481859740855ab13d8abdd88b1 deleted file mode 100644 index 7c938032..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/76c06f7399f3b1781289b37c42f3dbe1518bc2481859740855ab13d8abdd88b1 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c b/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c deleted file mode 100644 index e8000f30..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 b/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 deleted file mode 100644 index ef9f9d4f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzPPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/00d6da076abf399523d37cc5d1385a967f0634a2573162c00ba67a01fd806919 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/00d6da076abf399523d37cc5d1385a967f0634a2573162c00ba67a01fd806919 deleted file mode 100644 index a33f3908..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/00d6da076abf399523d37cc5d1385a967f0634a2573162c00ba67a01fd806919 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/019839a18a6e47ed73c11a7503859a5680dfceb99c4fb98344d87f884ef731ba b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/019839a18a6e47ed73c11a7503859a5680dfceb99c4fb98344d87f884ef731ba deleted file mode 100644 index a9b9365d..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/019839a18a6e47ed73c11a7503859a5680dfceb99c4fb98344d87f884ef731ba +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000007808000000000000ZCz700") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/039e575e749a676e0037b8aa9d28d80a409c350d4900c88ab2647be4492f25ee b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/039e575e749a676e0037b8aa9d28d80a409c350d4900c88ab2647be4492f25ee deleted file mode 100644 index 0842b2a3..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/039e575e749a676e0037b8aa9d28d80a409c350d4900c88ab2647be4492f25ee +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000002111007000000a00000017ZZZZ\xf9000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/05c89dc905ecc2ca9fc8fa08e0e0d56b83156fd4d8de02c03bda9a96b85679e0 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/05c89dc905ecc2ca9fc8fa08e0e0d56b83156fd4d8de02c03bda9a96b85679e0 deleted file mode 100644 index a26d2945..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/05c89dc905ecc2ca9fc8fa08e0e0d56b83156fd4d8de02c03bda9a96b85679e0 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000C11110010000\x00000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/0f8f18804076a2178ba242cfc92d30a0fd17a6f4aa63a8005253a16205b4e3c6 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/0f8f18804076a2178ba242cfc92d30a0fd17a6f4aa63a8005253a16205b4e3c6 deleted file mode 100644 index 7c50150a..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/0f8f18804076a2178ba242cfc92d30a0fd17a6f4aa63a8005253a16205b4e3c6 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000\xf571*07") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/123492a203ec37c506b8768bd1b55bf7bc54ee36279dc9f09567d675c044d58f b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/123492a203ec37c506b8768bd1b55bf7bc54ee36279dc9f09567d675c044d58f deleted file mode 100644 index 6616d84d..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/123492a203ec37c506b8768bd1b55bf7bc54ee36279dc9f09567d675c044d58f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000y710") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/182a4fb401185659940bf9a2589536a695487fba02686e2130ed0a5b880d52dc b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/182a4fb401185659940bf9a2589536a695487fba02686e2130ed0a5b880d52dc deleted file mode 100644 index 291cec88..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/182a4fb401185659940bf9a2589536a695487fba02686e2130ed0a5b880d52dc +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/1ced60e9d7b0105858590098640e83c09fecc453519c426cc0b446d43a1cbd73 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/1ced60e9d7b0105858590098640e83c09fecc453519c426cc0b446d43a1cbd73 deleted file mode 100644 index de096035..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/1ced60e9d7b0105858590098640e83c09fecc453519c426cc0b446d43a1cbd73 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000077y2B000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/20c0dd82574437b8f5caaac5f38a1199e9777ffe846bba3468737defafd094e7 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/20c0dd82574437b8f5caaac5f38a1199e9777ffe846bba3468737defafd094e7 deleted file mode 100644 index b0810585..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/20c0dd82574437b8f5caaac5f38a1199e9777ffe846bba3468737defafd094e7 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000000000170") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/27052827203b64be7e464d07f815b5af2a08d4e6406f173702c88b6a86862437 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/27052827203b64be7e464d07f815b5af2a08d4e6406f173702c88b6a86862437 deleted file mode 100644 index 4e6a55ef..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/27052827203b64be7e464d07f815b5af2a08d4e6406f173702c88b6a86862437 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000\xf571707\x80\x00\x00\x00\xea\xea\xea\xea\xea\xea0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d13274250a51272648fb79aee956d40195ff289a44da3296d0c88ac02fc67bc b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d13274250a51272648fb79aee956d40195ff289a44da3296d0c88ac02fc67bc deleted file mode 100644 index 4583c5aa..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d13274250a51272648fb79aee956d40195ff289a44da3296d0c88ac02fc67bc +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000007100\xf8A102") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d49311ef22319f70a3590a86b406b9f2565987a4a3b6d7660ddc308b5b2fae2 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d49311ef22319f70a3590a86b406b9f2565987a4a3b6d7660ddc308b5b2fae2 deleted file mode 100644 index 3d32e14c..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/2d49311ef22319f70a3590a86b406b9f2565987a4a3b6d7660ddc308b5b2fae2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3067c11d51b8a2666368161328eb2c82c55cb593824ddfe49742696889e520d5 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3067c11d51b8a2666368161328eb2c82c55cb593824ddfe49742696889e520d5 deleted file mode 100644 index f1e39d7d..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3067c11d51b8a2666368161328eb2c82c55cb593824ddfe49742696889e520d5 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000017") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/343dd7a6b769cfbc11b8ffd2162c9c6aac1e8bf42d252c18b6f766ec1858aaff b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/343dd7a6b769cfbc11b8ffd2162c9c6aac1e8bf42d252c18b6f766ec1858aaff deleted file mode 100644 index 503702fb..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/343dd7a6b769cfbc11b8ffd2162c9c6aac1e8bf42d252c18b6f766ec1858aaff +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3742076c487d68aab77f194af476bb9fa1d01a47a46bed9bae42c10b18e21594 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3742076c487d68aab77f194af476bb9fa1d01a47a46bed9bae42c10b18e21594 deleted file mode 100644 index 2ad014ba..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3742076c487d68aab77f194af476bb9fa1d01a47a46bed9bae42c10b18e21594 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000012Z") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3765cdec1f28e3f1f6f3f32d5f9c0d4cb61ea2d4533f554abd52b0df93bbbc4a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3765cdec1f28e3f1f6f3f32d5f9c0d4cb61ea2d4533f554abd52b0df93bbbc4a deleted file mode 100644 index 48e4760c..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3765cdec1f28e3f1f6f3f32d5f9c0d4cb61ea2d4533f554abd52b0df93bbbc4a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000077y2B0C") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/38f534b19ae62787a091d045d10ea3068aa66a765d26b383f9848a4881c6c170 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/38f534b19ae62787a091d045d10ea3068aa66a765d26b383f9848a4881c6c170 deleted file mode 100644 index 9c1c38ac..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/38f534b19ae62787a091d045d10ea3068aa66a765d26b383f9848a4881c6c170 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000070A\xfdv\xad100") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3aaf3f930d2b6f555533d7ee1833e960dc84706396c38db6be2c71c772230bf3 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3aaf3f930d2b6f555533d7ee1833e960dc84706396c38db6be2c71c772230bf3 deleted file mode 100644 index bd9e18b1..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3aaf3f930d2b6f555533d7ee1833e960dc84706396c38db6be2c71c772230bf3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000711720A") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3dc305666b84e8f7b04c66b69b6cc79e8df25b2ae99c5caf497906ea47c87401 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3dc305666b84e8f7b04c66b69b6cc79e8df25b2ae99c5caf497906ea47c87401 deleted file mode 100644 index d763cb77..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/3dc305666b84e8f7b04c66b69b6cc79e8df25b2ae99c5caf497906ea47c87401 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000A00807XG0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/40ea349cafd1592da4cd915eb8f86e8dcfe862c5cd7d187c082598daaba1c047 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/40ea349cafd1592da4cd915eb8f86e8dcfe862c5cd7d187c082598daaba1c047 deleted file mode 100644 index 1e4ca771..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/40ea349cafd1592da4cd915eb8f86e8dcfe862c5cd7d187c082598daaba1c047 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071172X7") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4205343f82a7d78102d7bcfeeae612a8916981964640a34384b1ade4316e8038 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4205343f82a7d78102d7bcfeeae612a8916981964640a34384b1ade4316e8038 deleted file mode 100644 index 505fda83..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4205343f82a7d78102d7bcfeeae612a8916981964640a34384b1ade4316e8038 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000\x111") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/458604b691a14a0f80c142b495b99b128071c41b8527d5e3dbaab0fa75aa703f b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/458604b691a14a0f80c142b495b99b128071c41b8527d5e3dbaab0fa75aa703f deleted file mode 100644 index a71665b0..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/458604b691a14a0f80c142b495b99b128071c41b8527d5e3dbaab0fa75aa703f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000011170B0927$") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/475bdf3daec7839816b18b486c43e23d21d3d1709f5d6e909f809e316eef3ad0 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/475bdf3daec7839816b18b486c43e23d21d3d1709f5d6e909f809e316eef3ad0 deleted file mode 100644 index 37aeb09e..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/475bdf3daec7839816b18b486c43e23d21d3d1709f5d6e909f809e316eef3ad0 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000711720\xcb") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4a3b46c8074373cb032eadcea909e28289cca73cd868ab29f13674040fbc6744 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4a3b46c8074373cb032eadcea909e28289cca73cd868ab29f13674040fbc6744 deleted file mode 100644 index fcac5894..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4a3b46c8074373cb032eadcea909e28289cca73cd868ab29f13674040fbc6744 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4d32bcb6507cca15717e5d30bae3c6d948e0abe6541fd423fdc4415f863329a8 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4d32bcb6507cca15717e5d30bae3c6d948e0abe6541fd423fdc4415f863329a8 deleted file mode 100644 index bf661232..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/4d32bcb6507cca15717e5d30bae3c6d948e0abe6541fd423fdc4415f863329a8 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000y7100") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/547803e15ea20edd45d87377b5a21ace6348d0ab462a9bd03318f936ec14cf9c b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/547803e15ea20edd45d87377b5a21ace6348d0ab462a9bd03318f936ec14cf9c deleted file mode 100644 index 5bf15046..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/547803e15ea20edd45d87377b5a21ace6348d0ab462a9bd03318f936ec14cf9c +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000010\xcb") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/60d5d2f797c1cc11b7698f694b8ae1044f19e4d98d2048c1aefa8efd2d61658b b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/60d5d2f797c1cc11b7698f694b8ae1044f19e4d98d2048c1aefa8efd2d61658b deleted file mode 100644 index 1b09a3e4..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/60d5d2f797c1cc11b7698f694b8ae1044f19e4d98d2048c1aefa8efd2d61658b +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000002007\xffA0200771") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/615cfc8866bc1a828694f072286c58d406629607f197524d518d77ba7f8f9b54 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/615cfc8866bc1a828694f072286c58d406629607f197524d518d77ba7f8f9b54 deleted file mode 100644 index 49ee93ec..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/615cfc8866bc1a828694f072286c58d406629607f197524d518d77ba7f8f9b54 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000002111007B71BC0000007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/649679f2d355f61f168ec2ba9b37e5295eda2a415d5a61533385124723c2e9db b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/649679f2d355f61f168ec2ba9b37e5295eda2a415d5a61533385124723c2e9db deleted file mode 100644 index ba4fe29e..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/649679f2d355f61f168ec2ba9b37e5295eda2a415d5a61533385124723c2e9db +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000$X") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/653a4111f80a68c2f197f0add573756caf6da8dd8aeb7051bc88bc3e954f2901 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/653a4111f80a68c2f197f0add573756caf6da8dd8aeb7051bc88bc3e954f2901 deleted file mode 100644 index c6152031..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/653a4111f80a68c2f197f0add573756caf6da8dd8aeb7051bc88bc3e954f2901 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000070000000000000,1\x0007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f82af969dfcb94acaf2cfd6c35a75cc7c744b63b33f37286bc716604e68ce45 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f82af969dfcb94acaf2cfd6c35a75cc7c744b63b33f37286bc716604e68ce45 deleted file mode 100644 index 44021d0b..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f82af969dfcb94acaf2cfd6c35a75cc7c744b63b33f37286bc716604e68ce45 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000070000007\xc1002") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f8f56484ea8b20c24fe9dc371865fb09f7c7a27d7a2cd40809060e804600dc9 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f8f56484ea8b20c24fe9dc371865fb09f7c7a27d7a2cd40809060e804600dc9 deleted file mode 100644 index 9f8eb6bf..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/6f8f56484ea8b20c24fe9dc371865fb09f7c7a27d7a2cd40809060e804600dc9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000A\xfdya00") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/766677dfa01586ac8ad7954a627f3b900ee7248a10ebd94afec3bbaa59022126 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/766677dfa01586ac8ad7954a627f3b900ee7248a10ebd94afec3bbaa59022126 deleted file mode 100644 index 7c6f7285..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/766677dfa01586ac8ad7954a627f3b900ee7248a10ebd94afec3bbaa59022126 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000y1000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7b6521a56664b1cbb97f5073269d7275bdd943870b45d5737a04da49f394c31f b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7b6521a56664b1cbb97f5073269d7275bdd943870b45d5737a04da49f394c31f deleted file mode 100644 index 1eee4c72..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7b6521a56664b1cbb97f5073269d7275bdd943870b45d5737a04da49f394c31f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000000000C2\xc77\xc71") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7c9233ac7979facf283efce144f2c1deeed8fa10349a851b491ccae0e134ffd1 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7c9233ac7979facf283efce144f2c1deeed8fa10349a851b491ccae0e134ffd1 deleted file mode 100644 index 36c244a8..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/7c9233ac7979facf283efce144f2c1deeed8fa10349a851b491ccae0e134ffd1 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000B2700100020A") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8281575bdc3265faffed6f7963cb1ea96e1cb9c3656e1c9b694d58227f4d168a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8281575bdc3265faffed6f7963cb1ea96e1cb9c3656e1c9b694d58227f4d168a deleted file mode 100644 index 9f9a7b93..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8281575bdc3265faffed6f7963cb1ea96e1cb9c3656e1c9b694d58227f4d168a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("002000000000000002Y7$") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/863c5cc1f718d5d6e39c6f0eda93b678543c653946f0e4c5205a9a6e688b6aa3 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/863c5cc1f718d5d6e39c6f0eda93b678543c653946f0e4c5205a9a6e688b6aa3 deleted file mode 100644 index 1663e76d..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/863c5cc1f718d5d6e39c6f0eda93b678543c653946f0e4c5205a9a6e688b6aa3 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000711720B") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8703c0328c7aa4fe9e463dc9ec11a112f9530cf5b7c018987e1e56d0cb32e364 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8703c0328c7aa4fe9e463dc9ec11a112f9530cf5b7c018987e1e56d0cb32e364 deleted file mode 100644 index 51a6628a..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8703c0328c7aa4fe9e463dc9ec11a112f9530cf5b7c018987e1e56d0cb32e364 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000007171708A") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c deleted file mode 100644 index e8000f30..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8727b16d337d7b8187433233f3a90099024e580a6ba319ea2bf539880c50bd7c +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8b8a68c6d9b801391c5df3d5f6fafc362a71d1b716bc02d268998df08364ac37 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8b8a68c6d9b801391c5df3d5f6fafc362a71d1b716bc02d268998df08364ac37 deleted file mode 100644 index a2fe629f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8b8a68c6d9b801391c5df3d5f6fafc362a71d1b716bc02d268998df08364ac37 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000017") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8ba5fa6497afeb040d96665f4fba0037165933ebe9e760a70b1de81b23aadc4a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8ba5fa6497afeb040d96665f4fba0037165933ebe9e760a70b1de81b23aadc4a deleted file mode 100644 index 78101460..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8ba5fa6497afeb040d96665f4fba0037165933ebe9e760a70b1de81b23aadc4a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000717170002X") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8bb95d053ae9f84b2bc99c9c488cb91c7451ec0b22ab74c64548531f5d6633c9 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8bb95d053ae9f84b2bc99c9c488cb91c7451ec0b22ab74c64548531f5d6633c9 deleted file mode 100644 index f6515cd0..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/8bb95d053ae9f84b2bc99c9c488cb91c7451ec0b22ab74c64548531f5d6633c9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000\x118") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 deleted file mode 100644 index 896722f3..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/943e3fb12606845898909ba86991f4b3a9d92f038aae8a9341a41fda80f92af5 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/943e3fb12606845898909ba86991f4b3a9d92f038aae8a9341a41fda80f92af5 deleted file mode 100644 index 0042af08..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/943e3fb12606845898909ba86991f4b3a9d92f038aae8a9341a41fda80f92af5 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000070A\xfdv\xad0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9450509d117f96d6008adb21a4027055e3ba59c25615a5e96165c0bbb36b33bb b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9450509d117f96d6008adb21a4027055e3ba59c25615a5e96165c0bbb36b33bb deleted file mode 100644 index b7d773b8..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9450509d117f96d6008adb21a4027055e3ba59c25615a5e96165c0bbb36b33bb +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000000000017") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/94e4dcd86c2e09aac9c790086b9e76dc2b02e9bc964370d3106dbaef5aa6d37a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/94e4dcd86c2e09aac9c790086b9e76dc2b02e9bc964370d3106dbaef5aa6d37a deleted file mode 100644 index 7b86d644..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/94e4dcd86c2e09aac9c790086b9e76dc2b02e9bc964370d3106dbaef5aa6d37a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000077y2B0C0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9c6e2641e293d6bffef8b06b9e36b2cf5ecacc6d3ad9d926ab5ec64ecdad7b96 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9c6e2641e293d6bffef8b06b9e36b2cf5ecacc6d3ad9d926ab5ec64ecdad7b96 deleted file mode 100644 index 0c2a90d1..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9c6e2641e293d6bffef8b06b9e36b2cf5ecacc6d3ad9d926ab5ec64ecdad7b96 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000077y2B\xff\xff") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d560010faa7ada26ac70ae189fc384bd323efd7280990a5ecd6516cacd4cf61 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d560010faa7ada26ac70ae189fc384bd323efd7280990a5ecd6516cacd4cf61 deleted file mode 100644 index b91ea1ca..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d560010faa7ada26ac70ae189fc384bd323efd7280990a5ecd6516cacd4cf61 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000127001000A") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d9abe934c8d92838c18705f3e298f34ca63022bd4010acb6635278bc742398a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d9abe934c8d92838c18705f3e298f34ca63022bd4010acb6635278bc742398a deleted file mode 100644 index f62bc1d1..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/9d9abe934c8d92838c18705f3e298f34ca63022bd4010acb6635278bc742398a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("002000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a35edfe853b408a7c225af5012d1df6b6197436ce860641d55e275cc228da321 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a35edfe853b408a7c225af5012d1df6b6197436ce860641d55e275cc228da321 deleted file mode 100644 index 6e4c4273..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a35edfe853b408a7c225af5012d1df6b6197436ce860641d55e275cc228da321 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000077y2B070") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a5d467a1921f1f1395d0bc1574ea92274cb4a498b3c7cb1189a419d2ba7f1ead b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a5d467a1921f1f1395d0bc1574ea92274cb4a498b3c7cb1189a419d2ba7f1ead deleted file mode 100644 index f526e987..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/a5d467a1921f1f1395d0bc1574ea92274cb4a498b3c7cb1189a419d2ba7f1ead +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000011$0071110") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ab559ccd961e02992fd953c92eec4f50a828baecca4c6fffde8522632e90f847 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ab559ccd961e02992fd953c92eec4f50a828baecca4c6fffde8522632e90f847 deleted file mode 100644 index 37439c63..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ab559ccd961e02992fd953c92eec4f50a828baecca4c6fffde8522632e90f847 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000B27001000210") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/acf6271d3e87a7fc18dc947a460823559d30cdd652309d2002ba745ae6bca0f1 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/acf6271d3e87a7fc18dc947a460823559d30cdd652309d2002ba745ae6bca0f1 deleted file mode 100644 index d15a96f5..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/acf6271d3e87a7fc18dc947a460823559d30cdd652309d2002ba745ae6bca0f1 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000002Wy2B00000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ada5d60ffad1e135ecbc4f08322871d93f995b41a108e987151365c3924b6372 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ada5d60ffad1e135ecbc4f08322871d93f995b41a108e987151365c3924b6372 deleted file mode 100644 index cf66e3e1..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ada5d60ffad1e135ecbc4f08322871d93f995b41a108e987151365c3924b6372 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000B270010007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/afb972a0b1cfbd4181a062bd143cf2da5b1e1c9d921c0410faae807f3360caa2 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/afb972a0b1cfbd4181a062bd143cf2da5b1e1c9d921c0410faae807f3360caa2 deleted file mode 100644 index baf96141..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/afb972a0b1cfbd4181a062bd143cf2da5b1e1c9d921c0410faae807f3360caa2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000020A\xd5Y8G0x") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/b3b203da514589b7cc4ed7d18c13cdabc383fa5bae32cc853a1b3224893458ce b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/b3b203da514589b7cc4ed7d18c13cdabc383fa5bae32cc853a1b3224893458ce deleted file mode 100644 index bfa4e18b..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/b3b203da514589b7cc4ed7d18c13cdabc383fa5bae32cc853a1b3224893458ce +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0020000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/bfdfa1a6e4892d045614bd28d441737cc637962c2d057a5647bd4d4174c657c6 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/bfdfa1a6e4892d045614bd28d441737cc637962c2d057a5647bd4d4174c657c6 deleted file mode 100644 index 5cf2fec9..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/bfdfa1a6e4892d045614bd28d441737cc637962c2d057a5647bd4d4174c657c6 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000000000001872c0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 deleted file mode 100644 index ef9f9d4f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c2501043394e49f2477408be5ef9389790e33ed1886073dec445d4cf05bcd4b4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c3d5e611c2447ae2d18cf179ce268a18421e73253c9f97cce75e02466a475d6a b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c3d5e611c2447ae2d18cf179ce268a18421e73253c9f97cce75e02466a475d6a deleted file mode 100644 index 493a56ca..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/c3d5e611c2447ae2d18cf179ce268a18421e73253c9f97cce75e02466a475d6a +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000120A27") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd4f7e682b02a30bc433044498e9124c6b1459802c7de9dcf18ad058a1688bb9 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd4f7e682b02a30bc433044498e9124c6b1459802c7de9dcf18ad058a1688bb9 deleted file mode 100644 index 19ce95b4..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd4f7e682b02a30bc433044498e9124c6b1459802c7de9dcf18ad058a1688bb9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000070A\xfdv\xad10000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd939a83576d663b9de5c75da5b33dda1692c8289162a1e61d5764dee9ba5344 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd939a83576d663b9de5c75da5b33dda1692c8289162a1e61d5764dee9ba5344 deleted file mode 100644 index c3ceb416..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/cd939a83576d663b9de5c75da5b33dda1692c8289162a1e61d5764dee9ba5344 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000000y720") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ceb8cba9187af176dab482e8571748c8293bff3c37419ec4f86e0f93b5c6f7ce b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ceb8cba9187af176dab482e8571748c8293bff3c37419ec4f86e0f93b5c6f7ce deleted file mode 100644 index a3160d96..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ceb8cba9187af176dab482e8571748c8293bff3c37419ec4f86e0f93b5c6f7ce +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000\x112") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d09dfd7e6702ed14f3d16dc88c0beebc915cd3c7ed985106c7274dd6bf601991 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d09dfd7e6702ed14f3d16dc88c0beebc915cd3c7ed985106c7274dd6bf601991 deleted file mode 100644 index 73e06918..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d09dfd7e6702ed14f3d16dc88c0beebc915cd3c7ed985106c7274dd6bf601991 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000011100101177") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d2b8f6ff13c57a6493cc417708863c7edb8fa90b6973c421b32e45df6e98c897 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d2b8f6ff13c57a6493cc417708863c7edb8fa90b6973c421b32e45df6e98c897 deleted file mode 100644 index 8bb7738a..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d2b8f6ff13c57a6493cc417708863c7edb8fa90b6973c421b32e45df6e98c897 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000$") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d3c6efd87c63850e112528d39bb792d28fb9d23bfbf5b241a62a63ebeb36b591 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d3c6efd87c63850e112528d39bb792d28fb9d23bfbf5b241a62a63ebeb36b591 deleted file mode 100644 index 2b1733f1..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d3c6efd87c63850e112528d39bb792d28fb9d23bfbf5b241a62a63ebeb36b591 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000007100\xf8A100") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d8729013defaf4cf5833f86bef44bf6bcda1265ee9e83adb021dd883717e44ff b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d8729013defaf4cf5833f86bef44bf6bcda1265ee9e83adb021dd883717e44ff deleted file mode 100644 index fe4fd54b..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d8729013defaf4cf5833f86bef44bf6bcda1265ee9e83adb021dd883717e44ff +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d9f26138c54e610b9535ad32fa4fc65e7ee28921fd808119a9350650c2889fbb b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d9f26138c54e610b9535ad32fa4fc65e7ee28921fd808119a9350650c2889fbb deleted file mode 100644 index c8139456..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/d9f26138c54e610b9535ad32fa4fc65e7ee28921fd808119a9350650c2889fbb +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/dc2a4cb2325c492ca2a0787f03f4a64a9673fcbabcfd3d8b831163cf26e08257 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/dc2a4cb2325c492ca2a0787f03f4a64a9673fcbabcfd3d8b831163cf26e08257 deleted file mode 100644 index 845edc6b..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/dc2a4cb2325c492ca2a0787f03f4a64a9673fcbabcfd3d8b831163cf26e08257 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000020A\xd5Y8G07") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e1d156e4fa7380afa414b12ae9aefa295debe1f892fe6bae3538651459654512 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e1d156e4fa7380afa414b12ae9aefa295debe1f892fe6bae3538651459654512 deleted file mode 100644 index bda271e9..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e1d156e4fa7380afa414b12ae9aefa295debe1f892fe6bae3538651459654512 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000\x00\x040$") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e4a6272c0ccae23d9ff40b63a3526fd967ee0df216749b9ef13ed0fd5041b2b4 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e4a6272c0ccae23d9ff40b63a3526fd967ee0df216749b9ef13ed0fd5041b2b4 deleted file mode 100644 index 5587c6e8..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e4a6272c0ccae23d9ff40b63a3526fd967ee0df216749b9ef13ed0fd5041b2b4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000$A") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e6a754dcc2747eb5e3225d7ce2b3ab19075eeda630aa67817acd128712faf440 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e6a754dcc2747eb5e3225d7ce2b3ab19075eeda630aa67817acd128712faf440 deleted file mode 100644 index 98661f0c..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e6a754dcc2747eb5e3225d7ce2b3ab19075eeda630aa67817acd128712faf440 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000B27001000X") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e7020cfc8cfc8a340f41aafbc157c0cdb2ecfc1a41b2b0c2b2f0adeb78a33412 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e7020cfc8cfc8a340f41aafbc157c0cdb2ecfc1a41b2b0c2b2f0adeb78a33412 deleted file mode 100644 index 3fa85f2f..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e7020cfc8cfc8a340f41aafbc157c0cdb2ecfc1a41b2b0c2b2f0adeb78a33412 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000000A177\xb3011") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e80085c26c10f735691d6790897e25ffbc50c2a2beafe1a090fd5059936f3a44 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e80085c26c10f735691d6790897e25ffbc50c2a2beafe1a090fd5059936f3a44 deleted file mode 100644 index 4762d3d9..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/e80085c26c10f735691d6790897e25ffbc50c2a2beafe1a090fd5059936f3a44 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000007") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ed6952414b61c4c80820200ed4cfa0c873900d9311619e6590fa18cf8b28ef04 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ed6952414b61c4c80820200ed4cfa0c873900d9311619e6590fa18cf8b28ef04 deleted file mode 100644 index f89ca5ce..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ed6952414b61c4c80820200ed4cfa0c873900d9311619e6590fa18cf8b28ef04 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000000%00000000A$0") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f6872527132c3a2c994316a511af6fb98889143acd71e18ff6adfca0aa3054cf b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f6872527132c3a2c994316a511af6fb98889143acd71e18ff6adfca0aa3054cf deleted file mode 100644 index a996363d..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f6872527132c3a2c994316a511af6fb98889143acd71e18ff6adfca0aa3054cf +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000120A7") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f7ffd151838837c215f9bcbdfb3f39bfd2105a931ef0118b72eb1eca4aeddad9 b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f7ffd151838837c215f9bcbdfb3f39bfd2105a931ef0118b72eb1eca4aeddad9 deleted file mode 100644 index 7e9923ad..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f7ffd151838837c215f9bcbdfb3f39bfd2105a931ef0118b72eb1eca4aeddad9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000000") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f9043ef7bfaf2fdebf518743f1f81a2a50d46036a1da3d5844117036f78416ab b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f9043ef7bfaf2fdebf518743f1f81a2a50d46036a1da3d5844117036f78416ab deleted file mode 100644 index 0d057514..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/f9043ef7bfaf2fdebf518743f1f81a2a50d46036a1da3d5844117036f78416ab +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("00000000000000071717000\x110") diff --git a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ff354e5d8975a43060c65913848811b2a66fea56a377d3aea5a0a7ffb53952ba b/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ff354e5d8975a43060c65913848811b2a66fea56a377d3aea5a0a7ffb53952ba deleted file mode 100644 index 30a4c0fe..00000000 --- a/pkg/codecs/h265/testdata/fuzz/FuzzSPSUnmarshal/ff354e5d8975a43060c65913848811b2a66fea56a377d3aea5a0a7ffb53952ba +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0000000000000001Y7") diff --git a/pkg/codecs/jpeg/define_huffman_table.go b/pkg/codecs/jpeg/define_huffman_table.go deleted file mode 100644 index bc46dac3..00000000 --- a/pkg/codecs/jpeg/define_huffman_table.go +++ /dev/null @@ -1,20 +0,0 @@ -package jpeg - -// DefineHuffmanTable is a DHT marker. -type DefineHuffmanTable struct { - Codes []byte - Symbols []byte - TableNumber int - TableClass int -} - -// Marshal encodes the marker. -func (m DefineHuffmanTable) Marshal(buf []byte) []byte { - buf = append(buf, []byte{0xFF, MarkerDefineHuffmanTable}...) - s := 3 + len(m.Codes) + len(m.Symbols) - buf = append(buf, []byte{byte(s >> 8), byte(s)}...) // length - buf = append(buf, []byte{byte(m.TableClass<<4) | byte(m.TableNumber)}...) - buf = append(buf, m.Codes...) - buf = append(buf, m.Symbols...) - return buf -} diff --git a/pkg/codecs/jpeg/define_huffman_table_test.go b/pkg/codecs/jpeg/define_huffman_table_test.go deleted file mode 100644 index b00a640a..00000000 --- a/pkg/codecs/jpeg/define_huffman_table_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package jpeg - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesDefineHuffmanTable = []struct { - name string - enc []byte - dec DefineHuffmanTable -}{ - { - "base", - []byte{ - 0xff, 0xc4, 0x0, 0x7, 0x43, 0x1, 0x2, 0x3, 0x4, - }, - DefineHuffmanTable{ - Codes: []byte{0x01, 0x02}, - Symbols: []byte{0x03, 0x04}, - TableNumber: 3, - TableClass: 4, - }, - }, -} - -func TestDefineHuffmanTableMarshal(t *testing.T) { - for _, ca := range casesDefineHuffmanTable { - t.Run(ca.name, func(t *testing.T) { - byts := ca.dec.Marshal(nil) - require.Equal(t, ca.enc, byts) - }) - } -} diff --git a/pkg/codecs/jpeg/define_quantization_table.go b/pkg/codecs/jpeg/define_quantization_table.go deleted file mode 100644 index b141fc69..00000000 --- a/pkg/codecs/jpeg/define_quantization_table.go +++ /dev/null @@ -1,61 +0,0 @@ -package jpeg - -import ( - "fmt" -) - -// QuantizationTable is a DQT quantization table. -type QuantizationTable struct { - ID uint8 - Precision uint8 - Data []byte -} - -// DefineQuantizationTable is a DQT marker. -type DefineQuantizationTable struct { - Tables []QuantizationTable -} - -// Unmarshal decodes the marker. -func (m *DefineQuantizationTable) Unmarshal(buf []byte) error { - for len(buf) != 0 { - id := buf[0] & 0x0F - precision := buf[0] >> 4 - buf = buf[1:] - if precision != 0 { - return fmt.Errorf("Precision %d is not supported", precision) - } - - if len(buf) < 64 { - return fmt.Errorf("image is too short") - } - - m.Tables = append(m.Tables, QuantizationTable{ - ID: id, - Precision: precision, - Data: buf[:64], - }) - buf = buf[64:] - } - - return nil -} - -// Marshal encodes the marker. -func (m DefineQuantizationTable) Marshal(buf []byte) []byte { - buf = append(buf, []byte{0xFF, MarkerDefineQuantizationTable}...) - - // length - s := 2 - for _, t := range m.Tables { - s += 1 + len(t.Data) - } - buf = append(buf, []byte{byte(s >> 8), byte(s)}...) - - for _, t := range m.Tables { - buf = append(buf, []byte{(t.ID)}...) - buf = append(buf, t.Data...) - } - - return buf -} diff --git a/pkg/codecs/jpeg/define_quantization_table_test.go b/pkg/codecs/jpeg/define_quantization_table_test.go deleted file mode 100644 index d0810171..00000000 --- a/pkg/codecs/jpeg/define_quantization_table_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package jpeg - -import ( - "bytes" - "testing" - - "github.com/stretchr/testify/require" -) - -var casesDefineQuantizationTable = []struct { - name string - enc []byte - dec DefineQuantizationTable -}{ - { - "base", - []byte{ - 0xff, 0xdb, 0x0, 0x84, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, - 0x4, 0x1, 0x2, 0x3, 0x4, 0x5, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, - 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, - }, - DefineQuantizationTable{ - Tables: []QuantizationTable{ - { - ID: 4, - Data: bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 64/4), - }, - { - ID: 5, - Data: bytes.Repeat([]byte{0x05, 0x06, 0x07, 0x08}, 64/4), - }, - }, - }, - }, -} - -func TestDefineQuantizationTableUnmarshal(t *testing.T) { - for _, ca := range casesDefineQuantizationTable { - t.Run(ca.name, func(t *testing.T) { - var h DefineQuantizationTable - err := h.Unmarshal(ca.enc[4:]) - require.NoError(t, err) - require.Equal(t, ca.dec, h) - }) - } -} - -func TestDefineQuantizationTableMarshal(t *testing.T) { - for _, ca := range casesDefineQuantizationTable { - t.Run(ca.name, func(t *testing.T) { - byts := ca.dec.Marshal(nil) - require.Equal(t, ca.enc, byts) - }) - } -} - -func FuzzDefineQuantizationTableUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var h DefineQuantizationTable - h.Unmarshal(b) - }) -} diff --git a/pkg/codecs/jpeg/define_restart_interval.go b/pkg/codecs/jpeg/define_restart_interval.go deleted file mode 100644 index 50a3026a..00000000 --- a/pkg/codecs/jpeg/define_restart_interval.go +++ /dev/null @@ -1,20 +0,0 @@ -package jpeg - -import ( - "fmt" -) - -// DefineRestartInterval is a DRI marker. -type DefineRestartInterval struct { - Interval uint16 -} - -// Unmarshal decodes the marker. -func (m *DefineRestartInterval) Unmarshal(buf []byte) error { - if len(buf) != 2 { - return fmt.Errorf("unsupported DRI size of %d", len(buf)) - } - - m.Interval = uint16(buf[0])<<8 | uint16(buf[1]) - return nil -} diff --git a/pkg/codecs/jpeg/define_restart_interval_test.go b/pkg/codecs/jpeg/define_restart_interval_test.go deleted file mode 100644 index 35251c8d..00000000 --- a/pkg/codecs/jpeg/define_restart_interval_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package jpeg - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesDefineRestartInterval = []struct { - name string - enc []byte - dec DefineRestartInterval -}{ - { - "base", - []byte{ - 0xff, MarkerDefineRestartInterval, 0x00, 0x04, 0xd0, 0xc7, - }, - DefineRestartInterval{ - Interval: 53447, - }, - }, -} - -func TestDefineRestartIntervalUnmarshal(t *testing.T) { - for _, ca := range casesDefineRestartInterval { - t.Run(ca.name, func(t *testing.T) { - var h DefineRestartInterval - err := h.Unmarshal(ca.enc[4:]) - require.NoError(t, err) - require.Equal(t, ca.dec, h) - }) - } -} - -func FuzzDefineRestartIntervalUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var h DefineRestartInterval - h.Unmarshal(b) - }) -} diff --git a/pkg/codecs/jpeg/jpeg.go b/pkg/codecs/jpeg/jpeg.go deleted file mode 100644 index db626674..00000000 --- a/pkg/codecs/jpeg/jpeg.go +++ /dev/null @@ -1,14 +0,0 @@ -// Package jpeg contains JPEG/JFIF markers. -package jpeg - -// standard JPEG markers. -const ( - MarkerStartOfImage = 0xD8 - MarkerDefineQuantizationTable = 0xDB - MarkerDefineHuffmanTable = 0xC4 - MarkerDefineRestartInterval = 0xDD - MarkerStartOfFrame1 = 0xC0 - MarkerStartOfScan = 0xDA - MarkerEndOfImage = 0xD9 - MarkerComment = 0xFE -) diff --git a/pkg/codecs/jpeg/start_of_frame1.go b/pkg/codecs/jpeg/start_of_frame1.go deleted file mode 100644 index 8eb2a25e..00000000 --- a/pkg/codecs/jpeg/start_of_frame1.go +++ /dev/null @@ -1,83 +0,0 @@ -package jpeg - -import ( - "fmt" -) - -// StartOfFrame1 is a SOF1 marker. -type StartOfFrame1 struct { - Type uint8 - Width int - Height int - QuantizationTableCount uint8 // write only -} - -// Unmarshal decodes the marker. -func (m *StartOfFrame1) Unmarshal(buf []byte) error { - if len(buf) != 15 { - return fmt.Errorf("unsupported SOF size of %d", len(buf)) - } - - precision := buf[0] - if precision != 8 { - return fmt.Errorf("precision %d is not supported", precision) - } - - m.Height = int(buf[1])<<8 | int(buf[2]) - m.Width = int(buf[3])<<8 | int(buf[4]) - - components := buf[5] - if components != 3 { - return fmt.Errorf("number of components = %d is not supported", components) - } - - samp0 := buf[7] - switch samp0 { - case 0x21: - m.Type = 0 - - case 0x22: - m.Type = 1 - - default: - return fmt.Errorf("samp0 %x is not supported", samp0) - } - - samp1 := buf[10] - if samp1 != 0x11 { - return fmt.Errorf("samp1 %x is not supported", samp1) - } - - samp2 := buf[13] - if samp2 != 0x11 { - return fmt.Errorf("samp2 %x is not supported", samp2) - } - - return nil -} - -// Marshal encodes the marker. -func (m StartOfFrame1) Marshal(buf []byte) []byte { - buf = append(buf, []byte{0xFF, MarkerStartOfFrame1}...) - buf = append(buf, []byte{0, 17}...) // length - buf = append(buf, []byte{8}...) // precision - buf = append(buf, []byte{byte(m.Height >> 8), byte(m.Height)}...) // height - buf = append(buf, []byte{byte(m.Width >> 8), byte(m.Width)}...) // width - buf = append(buf, []byte{3}...) // components - if (m.Type & 0x3f) == 0 { // component 0 - buf = append(buf, []byte{0x00, 0x21, 0}...) - } else { - buf = append(buf, []byte{0x00, 0x22, 0}...) - } - - var secondQuantizationTable byte - if m.QuantizationTableCount == 2 { - secondQuantizationTable = 1 - } else { - secondQuantizationTable = 0 - } - - buf = append(buf, []byte{1, 0x11, secondQuantizationTable}...) // component 1 - buf = append(buf, []byte{2, 0x11, secondQuantizationTable}...) // component 2 - return buf -} diff --git a/pkg/codecs/jpeg/start_of_frame1_test.go b/pkg/codecs/jpeg/start_of_frame1_test.go deleted file mode 100644 index 56ff3135..00000000 --- a/pkg/codecs/jpeg/start_of_frame1_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package jpeg - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesStartOfFrame1 = []struct { - name string - enc []byte - dec StartOfFrame1 -}{ - { - "base", - []byte{ - 0xff, 0xc0, 0x0, 0x11, 0x8, 0x2, 0x58, 0x3, - 0x20, 0x3, 0x0, 0x22, 0x0, 0x1, 0x11, 0x1, - 0x2, 0x11, 0x1, - }, - StartOfFrame1{ - Type: 1, - Width: 800, - Height: 600, - QuantizationTableCount: 2, - }, - }, -} - -func TestStartOfFrame1Unmarshal(t *testing.T) { - for _, ca := range casesStartOfFrame1 { - t.Run(ca.name, func(t *testing.T) { - var h StartOfFrame1 - err := h.Unmarshal(ca.enc[4:]) - require.NoError(t, err) - h.QuantizationTableCount = 2 - require.Equal(t, ca.dec, h) - }) - } -} - -func TestStartOfFrame1Marshal(t *testing.T) { - for _, ca := range casesStartOfFrame1 { - t.Run(ca.name, func(t *testing.T) { - byts := ca.dec.Marshal(nil) - require.Equal(t, ca.enc, byts) - }) - } -} - -func FuzzStartOfFrame1Unmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var h StartOfFrame1 - h.Unmarshal(b) - }) -} diff --git a/pkg/codecs/jpeg/start_of_image.go b/pkg/codecs/jpeg/start_of_image.go deleted file mode 100644 index 9a6ea7a5..00000000 --- a/pkg/codecs/jpeg/start_of_image.go +++ /dev/null @@ -1,10 +0,0 @@ -package jpeg - -// StartOfImage is a SOI marker. -type StartOfImage struct{} - -// Marshal encodes the marker. -func (StartOfImage) Marshal(buf []byte) []byte { - buf = append(buf, []byte{0xFF, MarkerStartOfImage}...) - return buf -} diff --git a/pkg/codecs/jpeg/start_of_image_test.go b/pkg/codecs/jpeg/start_of_image_test.go deleted file mode 100644 index 070cf153..00000000 --- a/pkg/codecs/jpeg/start_of_image_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package jpeg - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestStartOfImageMarshal(t *testing.T) { - buf := StartOfImage{}.Marshal(nil) - require.Equal(t, []byte{0xff, 0xd8}, buf) -} diff --git a/pkg/codecs/jpeg/start_of_scan.go b/pkg/codecs/jpeg/start_of_scan.go deleted file mode 100644 index da78cb74..00000000 --- a/pkg/codecs/jpeg/start_of_scan.go +++ /dev/null @@ -1,28 +0,0 @@ -package jpeg - -import ( - "fmt" -) - -// StartOfScan is a SOS marker. -type StartOfScan struct{} - -// Unmarshal decodes the marker. -func (StartOfScan) Unmarshal(buf []byte) error { - if len(buf) != 10 { - return fmt.Errorf("unsupported SOS size of %d", len(buf)) - } - return nil -} - -// Marshal encodes the marker. -func (StartOfScan) Marshal(buf []byte) []byte { - buf = append(buf, []byte{0xFF, MarkerStartOfScan}...) - buf = append(buf, []byte{0, 12}...) // length - buf = append(buf, []byte{3}...) // components - buf = append(buf, []byte{0, 0}...) // component 0 - buf = append(buf, []byte{1, 0x11}...) // component 1 - buf = append(buf, []byte{2, 0x11}...) // component 2 - buf = append(buf, []byte{0, 63, 0}...) - return buf -} diff --git a/pkg/codecs/jpeg/start_of_scan_test.go b/pkg/codecs/jpeg/start_of_scan_test.go deleted file mode 100644 index 1910ddd2..00000000 --- a/pkg/codecs/jpeg/start_of_scan_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package jpeg - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesStartOfScan = []struct { - name string - enc []byte - dec StartOfScan -}{ - { - "base", - []byte{ - 0xff, 0xda, 0x0, 0xc, 0x3, 0x0, 0x0, 0x1, - 0x11, 0x2, 0x11, 0x0, 0x3f, 0x0, - }, - StartOfScan{}, - }, -} - -func TestStartOfScanUnmarshal(t *testing.T) { - for _, ca := range casesStartOfScan { - t.Run(ca.name, func(t *testing.T) { - var h StartOfScan - err := h.Unmarshal(ca.enc[4:]) - require.NoError(t, err) - require.Equal(t, ca.dec, h) - }) - } -} - -func TestStartOfScanMarshal(t *testing.T) { - for _, ca := range casesStartOfScan { - t.Run(ca.name, func(t *testing.T) { - byts := ca.dec.Marshal(nil) - require.Equal(t, ca.enc, byts) - }) - } -} - -func FuzzStartOfScanUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var h StartOfScan - h.Unmarshal(b) - }) -} diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/97dc7172b48e6ffd89dfa34cfaac68bab4e2c2a4c5a0ab953e27ba6b006ffd56 b/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/97dc7172b48e6ffd89dfa34cfaac68bab4e2c2a4c5a0ab953e27ba6b006ffd56 deleted file mode 100644 index 4fbe4165..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineQuantizationTableUnmarshal/97dc7172b48e6ffd89dfa34cfaac68bab4e2c2a4c5a0ab953e27ba6b006ffd56 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x01") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineRestartIntervalUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 b/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineRestartIntervalUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 deleted file mode 100644 index 67322c70..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzDefineRestartIntervalUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/04069695460a25181d94bba1342df84c161a53135a7a8e93511489e6b51c0afe b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/04069695460a25181d94bba1342df84c161a53135a7a8e93511489e6b51c0afe deleted file mode 100644 index 98474d5b..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/04069695460a25181d94bba1342df84c161a53135a7a8e93511489e6b51c0afe +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\b0000\x030!00\x110000") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/52bcb082e28f6e0e4007bae9ef0f4984e89ae5c891d08a2ad3c917fe77b94408 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/52bcb082e28f6e0e4007bae9ef0f4984e89ae5c891d08a2ad3c917fe77b94408 deleted file mode 100644 index c0bab187..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/52bcb082e28f6e0e4007bae9ef0f4984e89ae5c891d08a2ad3c917fe77b94408 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\b0000\x030!0000000") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 deleted file mode 100644 index 896722f3..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/93e3bc3735a837c70603d7f0bb7ec05fb087fd4db33e0ee855d9b225ca8f2511 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("000000000000000") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/9aaf79656de4e8166797e57c7ea359c531218826a6db07cf1a68e91f15b540c8 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/9aaf79656de4e8166797e57c7ea359c531218826a6db07cf1a68e91f15b540c8 deleted file mode 100644 index 83a124d2..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/9aaf79656de4e8166797e57c7ea359c531218826a6db07cf1a68e91f15b540c8 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\b0000\x03000000000") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/f032221efa2df5f3a4eedd5bad24c2bc0283177676e17ac5abeb131a80a38ef5 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/f032221efa2df5f3a4eedd5bad24c2bc0283177676e17ac5abeb131a80a38ef5 deleted file mode 100644 index 9bda36b8..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfFrame1Unmarshal/f032221efa2df5f3a4eedd5bad24c2bc0283177676e17ac5abeb131a80a38ef5 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\b00000000000000") diff --git a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfScanUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfScanUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/jpeg/testdata/fuzz/FuzzStartOfScanUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/mpeg4audio/adts.go b/pkg/codecs/mpeg4audio/adts.go deleted file mode 100644 index 8922991e..00000000 --- a/pkg/codecs/mpeg4audio/adts.go +++ /dev/null @@ -1,147 +0,0 @@ -package mpeg4audio - -import ( - "fmt" -) - -// ADTSPacket is an ADTS packet. -type ADTSPacket struct { - Type ObjectType - SampleRate int - ChannelCount int - AU []byte -} - -// ADTSPackets is a group od ADTS packets. -type ADTSPackets []*ADTSPacket - -// Unmarshal decodes an ADTS stream into ADTS packets. -func (ps *ADTSPackets) Unmarshal(buf []byte) error { - // refs: https://wiki.multimedia.cx/index.php/ADTS - - bl := len(buf) - pos := 0 - - for { - if (bl - pos) < 8 { - return fmt.Errorf("invalid length") - } - - syncWord := (uint16(buf[pos]) << 4) | (uint16(buf[pos+1]) >> 4) - if syncWord != 0xfff { - return fmt.Errorf("invalid syncword") - } - - protectionAbsent := buf[pos+1] & 0x01 - if protectionAbsent != 1 { - return fmt.Errorf("CRC is not supported") - } - - pkt := &ADTSPacket{} - - pkt.Type = ObjectType((buf[pos+2] >> 6) + 1) - switch pkt.Type { - case ObjectTypeAACLC: - default: - return fmt.Errorf("unsupported audio type: %d", pkt.Type) - } - - sampleRateIndex := (buf[pos+2] >> 2) & 0x0F - switch { - case sampleRateIndex <= 12: - pkt.SampleRate = sampleRates[sampleRateIndex] - - default: - return fmt.Errorf("invalid sample rate index: %d", sampleRateIndex) - } - - channelConfig := ((buf[pos+2] & 0x01) << 2) | ((buf[pos+3] >> 6) & 0x03) - switch { - case channelConfig >= 1 && channelConfig <= 6: - pkt.ChannelCount = int(channelConfig) - - case channelConfig == 7: - pkt.ChannelCount = 8 - - default: - return fmt.Errorf("invalid channel configuration: %d", channelConfig) - } - - frameLen := int(((uint16(buf[pos+3])&0x03)<<11)| - (uint16(buf[pos+4])<<3)| - ((uint16(buf[pos+5])>>5)&0x07)) - 7 - if frameLen > MaxAccessUnitSize { - return fmt.Errorf("AU size (%d) is too big (maximum is %d)", frameLen, MaxAccessUnitSize) - } - - frameCount := buf[pos+6] & 0x03 - if frameCount != 0 { - return fmt.Errorf("frame count greater than 1 is not supported") - } - - if len(buf[pos+7:]) < frameLen { - return fmt.Errorf("invalid frame length") - } - - pkt.AU = buf[pos+7 : pos+7+frameLen] - pos += 7 + frameLen - - *ps = append(*ps, pkt) - - if (bl - pos) == 0 { - break - } - } - - return nil -} - -func (ps ADTSPackets) marshalSize() int { - n := 0 - for _, pkt := range ps { - n += 7 + len(pkt.AU) - } - return n -} - -// Marshal encodes ADTS packets into an ADTS stream. -func (ps ADTSPackets) Marshal() ([]byte, error) { - buf := make([]byte, ps.marshalSize()) - pos := 0 - - for _, pkt := range ps { - sampleRateIndex, ok := reverseSampleRates[pkt.SampleRate] - if !ok { - return nil, fmt.Errorf("invalid sample rate: %d", pkt.SampleRate) - } - - var channelConfig int - switch { - case pkt.ChannelCount >= 1 && pkt.ChannelCount <= 6: - channelConfig = pkt.ChannelCount - - case pkt.ChannelCount == 8: - channelConfig = 7 - - default: - return nil, fmt.Errorf("invalid channel count (%d)", pkt.ChannelCount) - } - - frameLen := len(pkt.AU) + 7 - - fullness := 0x07FF // like ffmpeg does - - buf[pos+0] = 0xFF - buf[pos+1] = 0xF1 - buf[pos+2] = uint8((int(pkt.Type-1) << 6) | (sampleRateIndex << 2) | ((channelConfig >> 2) & 0x01)) - buf[pos+3] = uint8((channelConfig&0x03)<<6 | (frameLen>>11)&0x03) - buf[pos+4] = uint8((frameLen >> 3) & 0xFF) - buf[pos+5] = uint8((frameLen&0x07)<<5 | ((fullness >> 6) & 0x1F)) - buf[pos+6] = uint8((fullness & 0x3F) << 2) - pos += 7 - - pos += copy(buf[pos:], pkt.AU) - } - - return buf, nil -} diff --git a/pkg/codecs/mpeg4audio/adts_test.go b/pkg/codecs/mpeg4audio/adts_test.go deleted file mode 100644 index c2212c1d..00000000 --- a/pkg/codecs/mpeg4audio/adts_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package mpeg4audio - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var casesADTS = []struct { - name string - byts []byte - pkts ADTSPackets -}{ - { - "single", - []byte{0xff, 0xf1, 0x4c, 0x80, 0x1, 0x3f, 0xfc, 0xaa, 0xbb}, - ADTSPackets{ - { - Type: ObjectTypeAACLC, - SampleRate: 48000, - ChannelCount: 2, - AU: []byte{0xaa, 0xbb}, - }, - }, - }, - { - "multiple", - []byte{ - 0xff, 0xf1, 0x50, 0x40, 0x1, 0x3f, 0xfc, 0xaa, - 0xbb, 0xff, 0xf1, 0x4c, 0x80, 0x1, 0x3f, 0xfc, - 0xcc, 0xdd, - }, - ADTSPackets{ - { - Type: ObjectTypeAACLC, - SampleRate: 44100, - ChannelCount: 1, - AU: []byte{0xaa, 0xbb}, - }, - { - Type: ObjectTypeAACLC, - SampleRate: 48000, - ChannelCount: 2, - AU: []byte{0xcc, 0xdd}, - }, - }, - }, -} - -func TestADTSUnmarshal(t *testing.T) { - for _, ca := range casesADTS { - t.Run(ca.name, func(t *testing.T) { - var pkts ADTSPackets - err := pkts.Unmarshal(ca.byts) - require.NoError(t, err) - require.Equal(t, ca.pkts, pkts) - }) - } -} - -func TestADTSMarshal(t *testing.T) { - for _, ca := range casesADTS { - t.Run(ca.name, func(t *testing.T) { - byts, err := ca.pkts.Marshal() - require.NoError(t, err) - require.Equal(t, ca.byts, byts) - }) - } -} - -func TestADTSUnmarshalErrors(t *testing.T) { - for _, ca := range []struct { - name string - byts []byte - err string - }{ - { - "invalid length", - []byte{0x01}, - "invalid length", - }, - { - "invalid syncword", - []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - "invalid syncword", - }, - { - "crc", - []byte{0xff, 0xF0, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - "CRC is not supported", - }, - { - "invalid audio type", - []byte{0xff, 0xf1, 0x8c, 0x80, 0x1, 0x3f, 0xfc, 0xaa}, - "unsupported audio type: 3", - }, - { - "invalid sample rate index", - []byte{0xff, 0xf1, 0x74, 0x80, 0x1, 0x3f, 0xfc, 0xaa}, - "invalid sample rate index: 13", - }, - { - "invalid channel configuration", - []byte{0xff, 0xf1, 0x4c, 0x00, 0x1, 0x3f, 0xfc, 0xaa}, - "invalid channel configuration: 0", - }, - { - "multiple frame count", - []byte{0xff, 0xf1, 0x4c, 0x80, 0x1, 0x3f, 0xfd, 0xaa}, - "frame count greater than 1 is not supported", - }, - { - "invalid frame length", - []byte{0xff, 0xf1, 0x4c, 0x80, 0x1, 0x3f, 0xfc, 0xaa}, - "invalid frame length", - }, - } { - t.Run(ca.name, func(t *testing.T) { - var pkts ADTSPackets - err := pkts.Unmarshal(ca.byts) - require.EqualError(t, err, ca.err) - }) - } -} diff --git a/pkg/codecs/mpeg4audio/config.go b/pkg/codecs/mpeg4audio/config.go deleted file mode 100644 index 8a65c31f..00000000 --- a/pkg/codecs/mpeg4audio/config.go +++ /dev/null @@ -1,235 +0,0 @@ -package mpeg4audio - -import ( - "fmt" - - "github.com/bluenviron/gortsplib/v3/pkg/bits" -) - -// Config is a MPEG-4 Audio configuration. -type Config struct { - Type ObjectType - SampleRate int - ChannelCount int - - // SBR / PS specific - ExtensionType ObjectType - ExtensionSampleRate int - - // AAC-LC specific - FrameLengthFlag bool - DependsOnCoreCoder bool - CoreCoderDelay uint16 -} - -// Unmarshal decodes a Config. -func (c *Config) Unmarshal(buf []byte) error { - pos := 0 - - tmp, err := bits.ReadBits(buf, &pos, 5) - if err != nil { - return err - } - c.Type = ObjectType(tmp) - - switch c.Type { - case ObjectTypeAACLC: - case ObjectTypeSBR: - case ObjectTypePS: - default: - return fmt.Errorf("unsupported object type: %d", c.Type) - } - - sampleRateIndex, err := bits.ReadBits(buf, &pos, 4) - if err != nil { - return err - } - - switch { - case sampleRateIndex <= 12: - c.SampleRate = sampleRates[sampleRateIndex] - - case sampleRateIndex == 0x0F: - tmp, err := bits.ReadBits(buf, &pos, 24) - if err != nil { - return err - } - c.SampleRate = int(tmp) - - default: - return fmt.Errorf("invalid sample rate index (%d)", sampleRateIndex) - } - - channelConfig, err := bits.ReadBits(buf, &pos, 4) - if err != nil { - return err - } - - switch { - case channelConfig == 0: - return fmt.Errorf("not yet supported") - - case channelConfig >= 1 && channelConfig <= 6: - c.ChannelCount = int(channelConfig) - - case channelConfig == 7: - c.ChannelCount = 8 - - default: - return fmt.Errorf("invalid channel configuration (%d)", channelConfig) - } - - if c.Type == ObjectTypeSBR || c.Type == ObjectTypePS { - c.ExtensionType = c.Type - extensionSamplingFrequencyIndex, err := bits.ReadBits(buf, &pos, 4) - if err != nil { - return err - } - - switch { - case extensionSamplingFrequencyIndex <= 12: - c.ExtensionSampleRate = sampleRates[extensionSamplingFrequencyIndex] - - case extensionSamplingFrequencyIndex == 0x0F: - tmp, err := bits.ReadBits(buf, &pos, 24) - if err != nil { - return err - } - c.ExtensionSampleRate = int(tmp) - - default: - return fmt.Errorf("invalid extension sample rate index (%d)", extensionSamplingFrequencyIndex) - } - - tmp, err = bits.ReadBits(buf, &pos, 5) - if err != nil { - return err - } - c.Type = ObjectType(tmp) - - if c.Type != ObjectTypeAACLC { - return fmt.Errorf("unsupported object type: %d", c.Type) - } - } - - c.FrameLengthFlag, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - c.DependsOnCoreCoder, err = bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if c.DependsOnCoreCoder { - tmp, err := bits.ReadBits(buf, &pos, 14) - if err != nil { - return err - } - c.CoreCoderDelay = uint16(tmp) - } - - extensionFlag, err := bits.ReadFlag(buf, &pos) - if err != nil { - return err - } - - if extensionFlag { - return fmt.Errorf("unsupported") - } - - return nil -} - -func (c Config) marshalSize() int { - n := 5 + 4 + 3 - - _, ok := reverseSampleRates[c.SampleRate] - if !ok { - n += 28 - } else { - n += 4 - } - - if c.ExtensionType == ObjectTypeSBR || c.ExtensionType == ObjectTypePS { - _, ok := reverseSampleRates[c.ExtensionSampleRate] - if !ok { - n += 28 - } else { - n += 4 - } - n += 5 - } else if c.DependsOnCoreCoder { - n += 14 - } - - ret := n / 8 - if (n % 8) != 0 { - ret++ - } - - return ret -} - -// Marshal encodes a Config. -func (c Config) Marshal() ([]byte, error) { - buf := make([]byte, c.marshalSize()) - pos := 0 - - if c.ExtensionType == ObjectTypeSBR || c.ExtensionType == ObjectTypePS { - bits.WriteBits(buf, &pos, uint64(c.ExtensionType), 5) - } else { - bits.WriteBits(buf, &pos, uint64(c.Type), 5) - } - - sampleRateIndex, ok := reverseSampleRates[c.SampleRate] - if !ok { - bits.WriteBits(buf, &pos, uint64(15), 4) - bits.WriteBits(buf, &pos, uint64(c.SampleRate), 24) - } else { - bits.WriteBits(buf, &pos, uint64(sampleRateIndex), 4) - } - - var channelConfig int - switch { - case c.ChannelCount >= 1 && c.ChannelCount <= 6: - channelConfig = c.ChannelCount - - case c.ChannelCount == 8: - channelConfig = 7 - - default: - return nil, fmt.Errorf("invalid channel count (%d)", c.ChannelCount) - } - bits.WriteBits(buf, &pos, uint64(channelConfig), 4) - - if c.ExtensionType == ObjectTypeSBR || c.ExtensionType == ObjectTypePS { - sampleRateIndex, ok := reverseSampleRates[c.ExtensionSampleRate] - if !ok { - bits.WriteBits(buf, &pos, uint64(0x0F), 4) - bits.WriteBits(buf, &pos, uint64(c.ExtensionSampleRate), 24) - } else { - bits.WriteBits(buf, &pos, uint64(sampleRateIndex), 4) - } - bits.WriteBits(buf, &pos, uint64(c.Type), 5) - } else { - if c.FrameLengthFlag { - bits.WriteBits(buf, &pos, 1, 1) - } else { - bits.WriteBits(buf, &pos, 0, 1) - } - - if c.DependsOnCoreCoder { - bits.WriteBits(buf, &pos, 1, 1) - } else { - bits.WriteBits(buf, &pos, 0, 1) - } - - if c.DependsOnCoreCoder { - bits.WriteBits(buf, &pos, uint64(c.CoreCoderDelay), 14) - } - } - - return buf, nil -} diff --git a/pkg/codecs/mpeg4audio/config_test.go b/pkg/codecs/mpeg4audio/config_test.go deleted file mode 100644 index d6c01ff3..00000000 --- a/pkg/codecs/mpeg4audio/config_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package mpeg4audio - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var configCases = []struct { - name string - enc []byte - dec Config -}{ - { - "aac-lc 16khz mono", - []byte{0x14, 0x08}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 16000, - ChannelCount: 1, - }, - }, - { - "aac-lc 44.1khz mono", - []byte{0x12, 0x08}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 44100, - ChannelCount: 1, - }, - }, - { - "aac-lc 44.1khz 5.1", - []byte{0x12, 0x30}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 44100, - ChannelCount: 6, - }, - }, - { - "aac-lc 48khz stereo", - []byte{17, 144}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 48000, - ChannelCount: 2, - }, - }, - { - "aac-lc 53khz stereo", - []byte{0x17, 0x80, 0x67, 0x84, 0x10}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 53000, - ChannelCount: 2, - }, - }, - { - "aac-lc 96khz stereo delay", - []byte{0x10, 0x12, 0x0c, 0x08}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 96000, - ChannelCount: 2, - DependsOnCoreCoder: true, - CoreCoderDelay: 385, - }, - }, - { - "aac-lc 44.1khz 8 chans", - []byte{0x12, 0x38}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 44100, - ChannelCount: 8, - }, - }, - { - "sbr (he-aac v1) 44.1khz mono", - []byte{0x2b, 0x8a, 0x08, 0x00}, - Config{ - Type: ObjectTypeAACLC, - SampleRate: 22050, - ChannelCount: 1, - ExtensionSampleRate: 44100, - ExtensionType: ObjectTypeSBR, - }, - }, - { - "sbr (he-aac v1) 44.1khz stereo", - []byte{0x2b, 0x92, 0x08, 0x00}, // the data from fdk_aac - Config{ - Type: ObjectTypeAACLC, - SampleRate: 22050, - ChannelCount: 2, - ExtensionSampleRate: 44100, - ExtensionType: ObjectTypeSBR, - }, - }, - { - "ps (he-aac v2) 48khz stereo", - []byte{0xeb, 0x09, 0x88, 0x00}, // the data from fdk_aac - Config{ - Type: ObjectTypeAACLC, - SampleRate: 24000, - ChannelCount: 1, // for he_aac v2, ChannelCount only set to 1 ? - ExtensionSampleRate: 48000, - ExtensionType: ObjectTypePS, - }, - }, -} - -func TestConfigUnmarshal(t *testing.T) { - for _, ca := range configCases { - t.Run(ca.name, func(t *testing.T) { - var dec Config - err := dec.Unmarshal(ca.enc) - require.NoError(t, err) - require.Equal(t, ca.dec, dec) - }) - } -} - -func TestConfigMarshal(t *testing.T) { - for _, ca := range configCases { - t.Run(ca.name, func(t *testing.T) { - enc, err := ca.dec.Marshal() - require.NoError(t, err) - require.Equal(t, ca.enc, enc) - }) - } -} - -func TestConfigMarshalErrors(t *testing.T) { - for _, ca := range []struct { - name string - conf Config - err string - }{ - { - "invalid channel config", - Config{ - Type: ObjectTypeAACLC, - SampleRate: 44100, - ChannelCount: 0, - }, - "invalid channel count (0)", - }, - } { - t.Run(ca.name, func(t *testing.T) { - _, err := ca.conf.Marshal() - require.EqualError(t, err, ca.err) - }) - } -} - -func FuzzConfigUnmarshal(f *testing.F) { - f.Fuzz(func(t *testing.T, b []byte) { - var conf Config - conf.Unmarshal(b) - }) -} diff --git a/pkg/codecs/mpeg4audio/mpeg4audio.go b/pkg/codecs/mpeg4audio/mpeg4audio.go deleted file mode 100644 index 62261185..00000000 --- a/pkg/codecs/mpeg4audio/mpeg4audio.go +++ /dev/null @@ -1,10 +0,0 @@ -// Package mpeg4audio contains utilities to work with MPEG-4 audio codecs. -package mpeg4audio - -const ( - // MaxAccessUnitSize is the maximum size of an Access Unit (AU). - MaxAccessUnitSize = 5 * 1024 - - // SamplesPerAccessUnit is the number of samples contained by a single AAC AU. - SamplesPerAccessUnit = 1024 -) diff --git a/pkg/codecs/mpeg4audio/object_type.go b/pkg/codecs/mpeg4audio/object_type.go deleted file mode 100644 index 7051c7fa..00000000 --- a/pkg/codecs/mpeg4audio/object_type.go +++ /dev/null @@ -1,11 +0,0 @@ -package mpeg4audio - -// ObjectType is a MPEG-4 Audio object type. -type ObjectType int - -// supported types. -const ( - ObjectTypeAACLC ObjectType = 2 - ObjectTypeSBR ObjectType = 5 - ObjectTypePS ObjectType = 29 -) diff --git a/pkg/codecs/mpeg4audio/sample_rates.go b/pkg/codecs/mpeg4audio/sample_rates.go deleted file mode 100644 index 660b86e2..00000000 --- a/pkg/codecs/mpeg4audio/sample_rates.go +++ /dev/null @@ -1,33 +0,0 @@ -package mpeg4audio - -var sampleRates = []int{ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350, -} - -var reverseSampleRates = map[int]int{ - 96000: 0, - 88200: 1, - 64000: 2, - 48000: 3, - 44100: 4, - 32000: 5, - 24000: 6, - 22050: 7, - 16000: 8, - 12000: 9, - 11025: 10, - 8000: 11, - 7350: 12, -} diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/0de38b892c93cde2f2b32eeb00f6097b53b4250a097ff80e498ceb3f0bfb18e0 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/0de38b892c93cde2f2b32eeb00f6097b53b4250a097ff80e498ceb3f0bfb18e0 deleted file mode 100644 index 86f2599d..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/0de38b892c93cde2f2b32eeb00f6097b53b4250a097ff80e498ceb3f0bfb18e0 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x102") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2407269c6f2b6741b662b2a3f8a5bb9528c50c25e5ff75ee285eb272027491b2 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2407269c6f2b6741b662b2a3f8a5bb9528c50c25e5ff75ee285eb272027491b2 deleted file mode 100644 index c5cd837f..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2407269c6f2b6741b662b2a3f8a5bb9528c50c25e5ff75ee285eb272027491b2 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2f1e03b45b2a93962108e8a940cc0ee647a444fa09ed6839dac31246ff1d5a19 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2f1e03b45b2a93962108e8a940cc0ee647a444fa09ed6839dac31246ff1d5a19 deleted file mode 100644 index d82bac9a..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/2f1e03b45b2a93962108e8a940cc0ee647a444fa09ed6839dac31246ff1d5a19 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\xef\xef") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/41b96153add60a0a300ad04393d1b16838280d9c256f3f5819ffea4dcfa87db1 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/41b96153add60a0a300ad04393d1b16838280d9c256f3f5819ffea4dcfa87db1 deleted file mode 100644 index faf2f312..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/41b96153add60a0a300ad04393d1b16838280d9c256f3f5819ffea4dcfa87db1 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(\x00") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/4e84166ad43e1c5846255d0155c259a95700b8fd3c3ada7d0cee9d8a99ad413f b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/4e84166ad43e1c5846255d0155c259a95700b8fd3c3ada7d0cee9d8a99ad413f deleted file mode 100644 index c0584ba8..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/4e84166ad43e1c5846255d0155c259a95700b8fd3c3ada7d0cee9d8a99ad413f +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(0\b") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 deleted file mode 100644 index a96f5599..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("0") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/6962f04b357ab1240e26ab394ad6eb8127068a73f80ea005094fbe9e69874e65 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/6962f04b357ab1240e26ab394ad6eb8127068a73f80ea005094fbe9e69874e65 deleted file mode 100644 index 2d7d6066..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/6962f04b357ab1240e26ab394ad6eb8127068a73f80ea005094fbe9e69874e65 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(00") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/bbffbee953abbb79185a8caf6831ec6ab83dcc1f3ab1d748b0abe8ed3211bcda b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/bbffbee953abbb79185a8caf6831ec6ab83dcc1f3ab1d748b0abe8ed3211bcda deleted file mode 100644 index f7a5b493..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/bbffbee953abbb79185a8caf6831ec6ab83dcc1f3ab1d748b0abe8ed3211bcda +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(0") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/c12d7ec300bda22f7db490db8312dc2e64752791e45fec451533b5706f56bed9 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/c12d7ec300bda22f7db490db8312dc2e64752791e45fec451533b5706f56bed9 deleted file mode 100644 index 2cc8e6b5..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/c12d7ec300bda22f7db490db8312dc2e64752791e45fec451533b5706f56bed9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("\x101") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 deleted file mode 100644 index 67322c70..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/d00ea3865173809d88de52497a25b23b2568d3c08b1d2b49a1ae857b6497f223 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/d00ea3865173809d88de52497a25b23b2568d3c08b1d2b49a1ae857b6497f223 deleted file mode 100644 index 8cd503bd..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/d00ea3865173809d88de52497a25b23b2568d3c08b1d2b49a1ae857b6497f223 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(A") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/f5da56f6a7a5431290dccfd0b7548511decda24d17c05fa7ddeccb3b0b049518 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/f5da56f6a7a5431290dccfd0b7548511decda24d17c05fa7ddeccb3b0b049518 deleted file mode 100644 index f885c041..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/f5da56f6a7a5431290dccfd0b7548511decda24d17c05fa7ddeccb3b0b049518 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte(".\xef") diff --git a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/fca08d22f8534499db40e6510424748f46929ac0e89aca9dc59096b7c2d59dc7 b/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/fca08d22f8534499db40e6510424748f46929ac0e89aca9dc59096b7c2d59dc7 deleted file mode 100644 index 39ccc7c5..00000000 --- a/pkg/codecs/mpeg4audio/testdata/fuzz/FuzzConfigUnmarshal/fca08d22f8534499db40e6510424748f46929ac0e89aca9dc59096b7c2d59dc7 +++ /dev/null @@ -1,2 +0,0 @@ -go test fuzz v1 -[]byte("(7\xed") diff --git a/pkg/formats/format_test.go b/pkg/formats/format_test.go index 359c60d9..79d8d5bf 100644 --- a/pkg/formats/format_test.go +++ b/pkg/formats/format_test.go @@ -6,7 +6,7 @@ import ( psdp "github.com/pion/sdp/v3" "github.com/stretchr/testify/require" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) func TestNewFromMediaDescription(t *testing.T) { diff --git a/pkg/formats/g711.go b/pkg/formats/g711.go index 1fd907a7..4879e5ab 100644 --- a/pkg/formats/g711.go +++ b/pkg/formats/g711.go @@ -13,43 +13,43 @@ type G711 struct { } // String implements Format. -func (t *G711) String() string { +func (f *G711) String() string { return "G711" } // ClockRate implements Format. -func (t *G711) ClockRate() int { +func (f *G711) ClockRate() int { return 8000 } // PayloadType implements Format. -func (t *G711) PayloadType() uint8 { - if t.MULaw { +func (f *G711) PayloadType() uint8 { + if f.MULaw { return 0 } return 8 } -func (t *G711) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.MULaw = (payloadType == 0) +func (f *G711) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.MULaw = (payloadType == 0) return nil } // Marshal implements Format. -func (t *G711) Marshal() (string, map[string]string) { - if t.MULaw { +func (f *G711) Marshal() (string, map[string]string) { + if f.MULaw { return "PCMU/8000", nil } return "PCMA/8000", nil } // PTSEqualsDTS implements Format. -func (t *G711) PTSEqualsDTS(*rtp.Packet) bool { +func (f *G711) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *G711) CreateDecoder() *rtpsimpleaudio.Decoder { +func (f *G711) CreateDecoder() *rtpsimpleaudio.Decoder { d := &rtpsimpleaudio.Decoder{ SampleRate: 8000, } @@ -58,9 +58,9 @@ func (t *G711) CreateDecoder() *rtpsimpleaudio.Decoder { } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *G711) CreateEncoder() *rtpsimpleaudio.Encoder { +func (f *G711) CreateEncoder() *rtpsimpleaudio.Encoder { e := &rtpsimpleaudio.Encoder{ - PayloadType: t.PayloadType(), + PayloadType: f.PayloadType(), SampleRate: 8000, } e.Init() diff --git a/pkg/formats/g722.go b/pkg/formats/g722.go index 195f4d06..230195dd 100644 --- a/pkg/formats/g722.go +++ b/pkg/formats/g722.go @@ -10,36 +10,36 @@ import ( type G722 struct{} // String implements Format. -func (t *G722) String() string { +func (f *G722) String() string { return "G722" } // ClockRate implements Format. -func (t *G722) ClockRate() int { +func (f *G722) ClockRate() int { return 8000 } // PayloadType implements Format. -func (t *G722) PayloadType() uint8 { +func (f *G722) PayloadType() uint8 { return 9 } -func (t *G722) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { +func (f *G722) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { return nil } // Marshal implements Format. -func (t *G722) Marshal() (string, map[string]string) { +func (f *G722) Marshal() (string, map[string]string) { return "G722/8000", nil } // PTSEqualsDTS implements Format. -func (t *G722) PTSEqualsDTS(*rtp.Packet) bool { +func (f *G722) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *G722) CreateDecoder() *rtpsimpleaudio.Decoder { +func (f *G722) CreateDecoder() *rtpsimpleaudio.Decoder { d := &rtpsimpleaudio.Decoder{ SampleRate: 8000, } @@ -48,7 +48,7 @@ func (t *G722) CreateDecoder() *rtpsimpleaudio.Decoder { } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *G722) CreateEncoder() *rtpsimpleaudio.Encoder { +func (f *G722) CreateEncoder() *rtpsimpleaudio.Encoder { e := &rtpsimpleaudio.Encoder{ PayloadType: 9, SampleRate: 8000, diff --git a/pkg/formats/generic.go b/pkg/formats/generic.go index 6e74ce23..c29b34c6 100644 --- a/pkg/formats/generic.go +++ b/pkg/formats/generic.go @@ -62,43 +62,43 @@ type Generic struct { } // Init computes the clock rate of the format. It it mandatory to call it. -func (t *Generic) Init() error { - t.ClockRat, _ = findClockRate(t.PayloadTyp, t.RTPMap) +func (f *Generic) Init() error { + f.ClockRat, _ = findClockRate(f.PayloadTyp, f.RTPMap) return nil } // String returns a description of the format. -func (t *Generic) String() string { +func (f *Generic) String() string { return "Generic" } // ClockRate implements Format. -func (t *Generic) ClockRate() int { - return t.ClockRat +func (f *Generic) ClockRate() int { + return f.ClockRat } // PayloadType implements Format. -func (t *Generic) PayloadType() uint8 { - return t.PayloadTyp +func (f *Generic) PayloadType() uint8 { + return f.PayloadTyp } -func (t *Generic) unmarshal( +func (f *Generic) unmarshal( payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string, ) error { - t.PayloadTyp = payloadType - t.RTPMap = rtpmap - t.FMTP = fmtp + f.PayloadTyp = payloadType + f.RTPMap = rtpmap + f.FMTP = fmtp - return t.Init() + return f.Init() } // Marshal implements Format. -func (t *Generic) Marshal() (string, map[string]string) { - return t.RTPMap, t.FMTP +func (f *Generic) Marshal() (string, map[string]string) { + return f.RTPMap, f.FMTP } // PTSEqualsDTS implements Format. -func (t *Generic) PTSEqualsDTS(*rtp.Packet) bool { +func (f *Generic) PTSEqualsDTS(*rtp.Packet) bool { return true } diff --git a/pkg/formats/h264.go b/pkg/formats/h264.go index 2e0e550a..aa2ae3b5 100644 --- a/pkg/formats/h264.go +++ b/pkg/formats/h264.go @@ -10,8 +10,8 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" "github.com/bluenviron/gortsplib/v3/pkg/formats/rtph264" + "github.com/bluenviron/mediacommon/pkg/codecs/h264" ) // check whether a RTP/H264 packet contains a IDR, without decoding the packet. @@ -70,7 +70,7 @@ func rtpH264ContainsIDR(pkt *rtp.Packet) bool { } } -// H264 is a format that uses the H264 codec. +// H264 is a format that uses the H264 codef. type H264 struct { PayloadTyp uint8 SPS []byte @@ -80,23 +80,23 @@ type H264 struct { mutex sync.RWMutex } -// String implements Format. -func (t *H264) String() string { +// String implements Formaf. +func (f *H264) String() string { return "H264" } -// ClockRate implements Format. -func (t *H264) ClockRate() int { +// ClockRate implements Formaf. +func (f *H264) ClockRate() int { return 90000 } -// PayloadType implements Format. -func (t *H264) PayloadType() uint8 { - return t.PayloadTyp +// PayloadType implements Formaf. +func (f *H264) PayloadType() uint8 { + return f.PayloadTyp } -func (t *H264) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *H264) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType for key, val := range fmtp { switch key { @@ -113,8 +113,8 @@ func (t *H264) unmarshal(payloadType uint8, clock string, codec string, rtpmap s return fmt.Errorf("invalid sprop-parameter-sets (%v)", val) } - t.SPS = sps - t.PPS = pps + f.SPS = sps + f.PPS = pps } case "packetization-mode": @@ -123,89 +123,76 @@ func (t *H264) unmarshal(payloadType uint8, clock string, codec string, rtpmap s return fmt.Errorf("invalid packetization-mode (%v)", val) } - t.PacketizationMode = int(tmp2) + f.PacketizationMode = int(tmp2) } } return nil } -// Marshal implements Format. -func (t *H264) Marshal() (string, map[string]string) { - t.mutex.RLock() - defer t.mutex.RUnlock() +// Marshal implements Formaf. +func (f *H264) Marshal() (string, map[string]string) { + f.mutex.RLock() + defer f.mutex.RUnlock() fmtp := make(map[string]string) - if t.PacketizationMode != 0 { - fmtp["packetization-mode"] = strconv.FormatInt(int64(t.PacketizationMode), 10) + if f.PacketizationMode != 0 { + fmtp["packetization-mode"] = strconv.FormatInt(int64(f.PacketizationMode), 10) } var tmp2 []string - if t.SPS != nil { - tmp2 = append(tmp2, base64.StdEncoding.EncodeToString(t.SPS)) + if f.SPS != nil { + tmp2 = append(tmp2, base64.StdEncoding.EncodeToString(f.SPS)) } - if t.PPS != nil { - tmp2 = append(tmp2, base64.StdEncoding.EncodeToString(t.PPS)) + if f.PPS != nil { + tmp2 = append(tmp2, base64.StdEncoding.EncodeToString(f.PPS)) } if tmp2 != nil { fmtp["sprop-parameter-sets"] = strings.Join(tmp2, ",") } - if len(t.SPS) >= 4 { - fmtp["profile-level-id"] = strings.ToUpper(hex.EncodeToString(t.SPS[1:4])) + if len(f.SPS) >= 4 { + fmtp["profile-level-id"] = strings.ToUpper(hex.EncodeToString(f.SPS[1:4])) } return "H264/90000", fmtp } -// PTSEqualsDTS implements Format. -func (t *H264) PTSEqualsDTS(pkt *rtp.Packet) bool { +// PTSEqualsDTS implements Formaf. +func (f *H264) PTSEqualsDTS(pkt *rtp.Packet) bool { return rtpH264ContainsIDR(pkt) } -// CreateDecoder creates a decoder able to decode the content of the format. -func (t *H264) CreateDecoder() *rtph264.Decoder { +// CreateDecoder creates a decoder able to decode the content of the formaf. +func (f *H264) CreateDecoder() *rtph264.Decoder { d := &rtph264.Decoder{ - PacketizationMode: t.PacketizationMode, + PacketizationMode: f.PacketizationMode, } d.Init() return d } -// CreateEncoder creates an encoder able to encode the content of the format. -func (t *H264) CreateEncoder() *rtph264.Encoder { +// CreateEncoder creates an encoder able to encode the content of the formaf. +func (f *H264) CreateEncoder() *rtph264.Encoder { e := &rtph264.Encoder{ - PayloadType: t.PayloadTyp, - PacketizationMode: t.PacketizationMode, + PayloadType: f.PayloadTyp, + PacketizationMode: f.PacketizationMode, } e.Init() return e } -// SafeSPS returns the format SPS. -func (t *H264) SafeSPS() []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - return t.SPS +// SafeSetParams sets the codec parameters. +func (f *H264) SafeSetParams(sps []byte, pps []byte) { + f.mutex.Lock() + defer f.mutex.Unlock() + f.SPS = sps + f.PPS = pps } -// SafePPS returns the format PPS. -func (t *H264) SafePPS() []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - return t.PPS -} - -// SafeSetSPS sets the format SPS. -func (t *H264) SafeSetSPS(v []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.SPS = v -} - -// SafeSetPPS sets the format PPS. -func (t *H264) SafeSetPPS(v []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.PPS = v +// SafeParams returns the codec parameters. +func (f *H264) SafeParams() ([]byte, []byte) { + f.mutex.RLock() + defer f.mutex.RUnlock() + return f.SPS, f.PPS } diff --git a/pkg/formats/h264_test.go b/pkg/formats/h264_test.go index 46be4d51..c174d28d 100644 --- a/pkg/formats/h264_test.go +++ b/pkg/formats/h264_test.go @@ -17,13 +17,16 @@ func TestH264Attributes(t *testing.T) { require.Equal(t, "H264", format.String()) require.Equal(t, 90000, format.ClockRate()) require.Equal(t, uint8(96), format.PayloadType()) - require.Equal(t, []byte{0x01, 0x02}, format.SafeSPS()) - require.Equal(t, []byte{0x03, 0x04}, format.SafePPS()) - format.SafeSetSPS([]byte{0x07, 0x08}) - format.SafeSetPPS([]byte{0x09, 0x0A}) - require.Equal(t, []byte{0x07, 0x08}, format.SafeSPS()) - require.Equal(t, []byte{0x09, 0x0A}, format.SafePPS()) + sps, pps := format.SafeParams() + require.Equal(t, []byte{0x01, 0x02}, sps) + require.Equal(t, []byte{0x03, 0x04}, pps) + + format.SafeSetParams([]byte{0x07, 0x08}, []byte{0x09, 0x0A}) + + sps, pps = format.SafeParams() + require.Equal(t, []byte{0x07, 0x08}, sps) + require.Equal(t, []byte{0x09, 0x0A}, pps) } func TestH264PTSEqualsDTS(t *testing.T) { diff --git a/pkg/formats/h265.go b/pkg/formats/h265.go index ad73239c..271c43e0 100644 --- a/pkg/formats/h265.go +++ b/pkg/formats/h265.go @@ -11,7 +11,7 @@ import ( "github.com/bluenviron/gortsplib/v3/pkg/formats/rtph265" ) -// H265 is a format that uses the H265 codec. +// H265 is a format that uses the H265 codef. type H265 struct { PayloadTyp uint8 VPS []byte @@ -22,43 +22,43 @@ type H265 struct { mutex sync.RWMutex } -// String implements Format. -func (t *H265) String() string { +// String implements Formaf. +func (f *H265) String() string { return "H265" } -// ClockRate implements Format. -func (t *H265) ClockRate() int { +// ClockRate implements Formaf. +func (f *H265) ClockRate() int { return 90000 } -// PayloadType implements Format. -func (t *H265) PayloadType() uint8 { - return t.PayloadTyp +// PayloadType implements Formaf. +func (f *H265) PayloadType() uint8 { + return f.PayloadTyp } -func (t *H265) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *H265) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType for key, val := range fmtp { switch key { case "sprop-vps": var err error - t.VPS, err = base64.StdEncoding.DecodeString(val) + f.VPS, err = base64.StdEncoding.DecodeString(val) if err != nil { return fmt.Errorf("invalid sprop-vps (%v)", fmtp) } case "sprop-sps": var err error - t.SPS, err = base64.StdEncoding.DecodeString(val) + f.SPS, err = base64.StdEncoding.DecodeString(val) if err != nil { return fmt.Errorf("invalid sprop-sps (%v)", fmtp) } case "sprop-pps": var err error - t.PPS, err = base64.StdEncoding.DecodeString(val) + f.PPS, err = base64.StdEncoding.DecodeString(val) if err != nil { return fmt.Errorf("invalid sprop-pps (%v)", fmtp) } @@ -68,97 +68,71 @@ func (t *H265) unmarshal(payloadType uint8, clock string, codec string, rtpmap s if err != nil { return fmt.Errorf("invalid sprop-max-don-diff (%v)", fmtp) } - t.MaxDONDiff = int(tmp) + f.MaxDONDiff = int(tmp) } } return nil } -// Marshal implements Format. -func (t *H265) Marshal() (string, map[string]string) { - t.mutex.RLock() - defer t.mutex.RUnlock() +// Marshal implements Formaf. +func (f *H265) Marshal() (string, map[string]string) { + f.mutex.RLock() + defer f.mutex.RUnlock() fmtp := make(map[string]string) - if t.VPS != nil { - fmtp["sprop-vps"] = base64.StdEncoding.EncodeToString(t.VPS) + if f.VPS != nil { + fmtp["sprop-vps"] = base64.StdEncoding.EncodeToString(f.VPS) } - if t.SPS != nil { - fmtp["sprop-sps"] = base64.StdEncoding.EncodeToString(t.SPS) + if f.SPS != nil { + fmtp["sprop-sps"] = base64.StdEncoding.EncodeToString(f.SPS) } - if t.PPS != nil { - fmtp["sprop-pps"] = base64.StdEncoding.EncodeToString(t.PPS) + if f.PPS != nil { + fmtp["sprop-pps"] = base64.StdEncoding.EncodeToString(f.PPS) } - if t.MaxDONDiff != 0 { - fmtp["sprop-max-don-diff"] = strconv.FormatInt(int64(t.MaxDONDiff), 10) + if f.MaxDONDiff != 0 { + fmtp["sprop-max-don-diff"] = strconv.FormatInt(int64(f.MaxDONDiff), 10) } return "H265/90000", fmtp } -// PTSEqualsDTS implements Format. -func (t *H265) PTSEqualsDTS(*rtp.Packet) bool { +// PTSEqualsDTS implements Formaf. +func (f *H265) PTSEqualsDTS(*rtp.Packet) bool { return true } -// CreateDecoder creates a decoder able to decode the content of the format. -func (t *H265) CreateDecoder() *rtph265.Decoder { +// CreateDecoder creates a decoder able to decode the content of the formaf. +func (f *H265) CreateDecoder() *rtph265.Decoder { d := &rtph265.Decoder{ - MaxDONDiff: t.MaxDONDiff, + MaxDONDiff: f.MaxDONDiff, } d.Init() return d } -// CreateEncoder creates an encoder able to encode the content of the format. -func (t *H265) CreateEncoder() *rtph265.Encoder { +// CreateEncoder creates an encoder able to encode the content of the formaf. +func (f *H265) CreateEncoder() *rtph265.Encoder { e := &rtph265.Encoder{ - PayloadType: t.PayloadTyp, - MaxDONDiff: t.MaxDONDiff, + PayloadType: f.PayloadTyp, + MaxDONDiff: f.MaxDONDiff, } e.Init() return e } -// SafeVPS returns the format VPS. -func (t *H265) SafeVPS() []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - return t.VPS +// SafeSetParams sets the codec parameters. +func (f *H265) SafeSetParams(vps []byte, sps []byte, pps []byte) { + f.mutex.Lock() + defer f.mutex.Unlock() + f.VPS = vps + f.SPS = sps + f.PPS = pps } -// SafeSPS returns the format SPS. -func (t *H265) SafeSPS() []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - return t.SPS -} - -// SafePPS returns the format PPS. -func (t *H265) SafePPS() []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - return t.PPS -} - -// SafeSetVPS sets the format VPS. -func (t *H265) SafeSetVPS(v []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.VPS = v -} - -// SafeSetSPS sets the format SPS. -func (t *H265) SafeSetSPS(v []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.SPS = v -} - -// SafeSetPPS sets the format PPS. -func (t *H265) SafeSetPPS(v []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.PPS = v +// SafeParams returns the codec parameters. +func (f *H265) SafeParams() ([]byte, []byte, []byte) { + f.mutex.RLock() + defer f.mutex.RUnlock() + return f.VPS, f.SPS, f.PPS } diff --git a/pkg/formats/h265_test.go b/pkg/formats/h265_test.go index 02b4d8eb..fcc2117b 100644 --- a/pkg/formats/h265_test.go +++ b/pkg/formats/h265_test.go @@ -18,16 +18,18 @@ func TestH265Attributes(t *testing.T) { require.Equal(t, 90000, format.ClockRate()) require.Equal(t, uint8(96), format.PayloadType()) require.Equal(t, true, format.PTSEqualsDTS(&rtp.Packet{})) - require.Equal(t, []byte{0x01, 0x02}, format.SafeVPS()) - require.Equal(t, []byte{0x03, 0x04}, format.SafeSPS()) - require.Equal(t, []byte{0x05, 0x06}, format.SafePPS()) - format.SafeSetVPS([]byte{0x07, 0x08}) - format.SafeSetSPS([]byte{0x09, 0x0A}) - format.SafeSetPPS([]byte{0x0B, 0x0C}) - require.Equal(t, []byte{0x07, 0x08}, format.SafeVPS()) - require.Equal(t, []byte{0x09, 0x0A}, format.SafeSPS()) - require.Equal(t, []byte{0x0B, 0x0C}, format.SafePPS()) + vps, sps, pps := format.SafeParams() + require.Equal(t, []byte{0x01, 0x02}, vps) + require.Equal(t, []byte{0x03, 0x04}, sps) + require.Equal(t, []byte{0x05, 0x06}, pps) + + format.SafeSetParams([]byte{0x07, 0x08}, []byte{0x09, 0x0A}, []byte{0x0B, 0x0C}) + + vps, sps, pps = format.SafeParams() + require.Equal(t, []byte{0x07, 0x08}, vps) + require.Equal(t, []byte{0x09, 0x0A}, sps) + require.Equal(t, []byte{0x0B, 0x0C}, pps) } func TestH265MediaDescription(t *testing.T) { diff --git a/pkg/formats/lpcm.go b/pkg/formats/lpcm.go index 670580d0..f791eb7d 100644 --- a/pkg/formats/lpcm.go +++ b/pkg/formats/lpcm.go @@ -18,32 +18,32 @@ type LPCM struct { } // String implements Format. -func (t *LPCM) String() string { +func (f *LPCM) String() string { return "LPCM" } // ClockRate implements Format. -func (t *LPCM) ClockRate() int { - return t.SampleRate +func (f *LPCM) ClockRate() int { + return f.SampleRate } // PayloadType implements Format. -func (t *LPCM) PayloadType() uint8 { - return t.PayloadTyp +func (f *LPCM) PayloadType() uint8 { + return f.PayloadTyp } -func (t *LPCM) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *LPCM) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType switch codec { case "l8": - t.BitDepth = 8 + f.BitDepth = 8 case "l16": - t.BitDepth = 16 + f.BitDepth = 16 case "l24": - t.BitDepth = 24 + f.BitDepth = 24 } tmp := strings.SplitN(clock, "/", 2) @@ -52,25 +52,25 @@ func (t *LPCM) unmarshal(payloadType uint8, clock string, codec string, rtpmap s if err != nil { return err } - t.SampleRate = int(tmp1) + f.SampleRate = int(tmp1) if len(tmp) >= 2 { tmp1, err := strconv.ParseInt(tmp[1], 10, 64) if err != nil { return err } - t.ChannelCount = int(tmp1) + f.ChannelCount = int(tmp1) } else { - t.ChannelCount = 1 + f.ChannelCount = 1 } return nil } // Marshal implements Format. -func (t *LPCM) Marshal() (string, map[string]string) { +func (f *LPCM) Marshal() (string, map[string]string) { var codec string - switch t.BitDepth { + switch f.BitDepth { case 8: codec = "L8" @@ -81,33 +81,33 @@ func (t *LPCM) Marshal() (string, map[string]string) { codec = "L24" } - return codec + "/" + strconv.FormatInt(int64(t.SampleRate), 10) + - "/" + strconv.FormatInt(int64(t.ChannelCount), 10), nil + return codec + "/" + strconv.FormatInt(int64(f.SampleRate), 10) + + "/" + strconv.FormatInt(int64(f.ChannelCount), 10), nil } // PTSEqualsDTS implements Format. -func (t *LPCM) PTSEqualsDTS(*rtp.Packet) bool { +func (f *LPCM) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *LPCM) CreateDecoder() *rtplpcm.Decoder { +func (f *LPCM) CreateDecoder() *rtplpcm.Decoder { d := &rtplpcm.Decoder{ - BitDepth: t.BitDepth, - SampleRate: t.SampleRate, - ChannelCount: t.ChannelCount, + BitDepth: f.BitDepth, + SampleRate: f.SampleRate, + ChannelCount: f.ChannelCount, } d.Init() return d } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *LPCM) CreateEncoder() *rtplpcm.Encoder { +func (f *LPCM) CreateEncoder() *rtplpcm.Encoder { e := &rtplpcm.Encoder{ - PayloadType: t.PayloadTyp, - BitDepth: t.BitDepth, - SampleRate: t.SampleRate, - ChannelCount: t.ChannelCount, + PayloadType: f.PayloadTyp, + BitDepth: f.BitDepth, + SampleRate: f.SampleRate, + ChannelCount: f.ChannelCount, } e.Init() return e diff --git a/pkg/formats/mjpeg.go b/pkg/formats/mjpeg.go index 16d07546..2f607210 100644 --- a/pkg/formats/mjpeg.go +++ b/pkg/formats/mjpeg.go @@ -10,43 +10,43 @@ import ( type MJPEG struct{} // String implements Format. -func (t *MJPEG) String() string { +func (f *MJPEG) String() string { return "M-JPEG" } // ClockRate implements Format. -func (t *MJPEG) ClockRate() int { +func (f *MJPEG) ClockRate() int { return 90000 } // PayloadType implements Format. -func (t *MJPEG) PayloadType() uint8 { +func (f *MJPEG) PayloadType() uint8 { return 26 } -func (t *MJPEG) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { +func (f *MJPEG) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { return nil } // Marshal implements Format. -func (t *MJPEG) Marshal() (string, map[string]string) { +func (f *MJPEG) Marshal() (string, map[string]string) { return "JPEG/90000", nil } // PTSEqualsDTS implements Format. -func (t *MJPEG) PTSEqualsDTS(*rtp.Packet) bool { +func (f *MJPEG) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *MJPEG) CreateDecoder() *rtpmjpeg.Decoder { +func (f *MJPEG) CreateDecoder() *rtpmjpeg.Decoder { d := &rtpmjpeg.Decoder{} d.Init() return d } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *MJPEG) CreateEncoder() *rtpmjpeg.Encoder { +func (f *MJPEG) CreateEncoder() *rtpmjpeg.Encoder { e := &rtpmjpeg.Encoder{} e.Init() return e diff --git a/pkg/formats/mpeg2_audio.go b/pkg/formats/mpeg2_audio.go index 85cff24a..3a651696 100644 --- a/pkg/formats/mpeg2_audio.go +++ b/pkg/formats/mpeg2_audio.go @@ -8,21 +8,21 @@ import ( type MPEG2Audio struct{} // String implements Format. -func (t *MPEG2Audio) String() string { +func (f *MPEG2Audio) String() string { return "MPEG2-audio" } // ClockRate implements Format. -func (t *MPEG2Audio) ClockRate() int { +func (f *MPEG2Audio) ClockRate() int { return 90000 } // PayloadType implements Format. -func (t *MPEG2Audio) PayloadType() uint8 { +func (f *MPEG2Audio) PayloadType() uint8 { return 14 } -func (t *MPEG2Audio) unmarshal( +func (f *MPEG2Audio) unmarshal( payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string, ) error { @@ -30,11 +30,11 @@ func (t *MPEG2Audio) unmarshal( } // Marshal implements Format. -func (t *MPEG2Audio) Marshal() (string, map[string]string) { +func (f *MPEG2Audio) Marshal() (string, map[string]string) { return "", nil } // PTSEqualsDTS implements Format. -func (t *MPEG2Audio) PTSEqualsDTS(*rtp.Packet) bool { +func (f *MPEG2Audio) PTSEqualsDTS(*rtp.Packet) bool { return true } diff --git a/pkg/formats/mpeg2_video.go b/pkg/formats/mpeg2_video.go index 18bb8bbe..90457836 100644 --- a/pkg/formats/mpeg2_video.go +++ b/pkg/formats/mpeg2_video.go @@ -8,21 +8,21 @@ import ( type MPEG2Video struct{} // String implements Format. -func (t *MPEG2Video) String() string { +func (f *MPEG2Video) String() string { return "MPEG2-video" } // ClockRate implements Format. -func (t *MPEG2Video) ClockRate() int { +func (f *MPEG2Video) ClockRate() int { return 90000 } // PayloadType implements Format. -func (t *MPEG2Video) PayloadType() uint8 { +func (f *MPEG2Video) PayloadType() uint8 { return 32 } -func (t *MPEG2Video) unmarshal( +func (f *MPEG2Video) unmarshal( payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string, ) error { @@ -30,11 +30,11 @@ func (t *MPEG2Video) unmarshal( } // Marshal implements Format. -func (t *MPEG2Video) Marshal() (string, map[string]string) { +func (f *MPEG2Video) Marshal() (string, map[string]string) { return "", nil } // PTSEqualsDTS implements Format. -func (t *MPEG2Video) PTSEqualsDTS(*rtp.Packet) bool { +func (f *MPEG2Video) PTSEqualsDTS(*rtp.Packet) bool { return true } diff --git a/pkg/formats/mpeg4_audio.go b/pkg/formats/mpeg4_audio.go index 7da4f8d5..7bd216db 100644 --- a/pkg/formats/mpeg4_audio.go +++ b/pkg/formats/mpeg4_audio.go @@ -7,8 +7,8 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" "github.com/bluenviron/gortsplib/v3/pkg/formats/rtpmpeg4audio" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) // MPEG4Audio is a format that uses a MPEG-4 audio codec. @@ -21,25 +21,25 @@ type MPEG4Audio struct { } // String implements Format. -func (t *MPEG4Audio) String() string { +func (f *MPEG4Audio) String() string { return "MPEG4-audio" } // ClockRate implements Format. -func (t *MPEG4Audio) ClockRate() int { - return t.Config.SampleRate +func (f *MPEG4Audio) ClockRate() int { + return f.Config.SampleRate } // PayloadType implements Format. -func (t *MPEG4Audio) PayloadType() uint8 { - return t.PayloadTyp +func (f *MPEG4Audio) PayloadType() uint8 { + return f.PayloadTyp } -func (t *MPEG4Audio) unmarshal( +func (f *MPEG4Audio) unmarshal( payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string, ) error { - t.PayloadTyp = payloadType + f.PayloadTyp = payloadType for key, val := range fmtp { switch key { @@ -49,8 +49,8 @@ func (t *MPEG4Audio) unmarshal( return fmt.Errorf("invalid AAC config (%v)", val) } - t.Config = &mpeg4audio.Config{} - err = t.Config.Unmarshal(enc) + f.Config = &mpeg4audio.Config{} + err = f.Config.Unmarshal(enc) if err != nil { return fmt.Errorf("invalid AAC config (%v)", val) } @@ -60,29 +60,29 @@ func (t *MPEG4Audio) unmarshal( if err != nil { return fmt.Errorf("invalid AAC SizeLength (%v)", val) } - t.SizeLength = int(n) + f.SizeLength = int(n) case "indexlength": n, err := strconv.ParseUint(val, 10, 64) if err != nil { return fmt.Errorf("invalid AAC IndexLength (%v)", val) } - t.IndexLength = int(n) + f.IndexLength = int(n) case "indexdeltalength": n, err := strconv.ParseUint(val, 10, 64) if err != nil { return fmt.Errorf("invalid AAC IndexDeltaLength (%v)", val) } - t.IndexDeltaLength = int(n) + f.IndexDeltaLength = int(n) } } - if t.Config == nil { + if f.Config == nil { return fmt.Errorf("config is missing") } - if t.SizeLength == 0 { + if f.SizeLength == 0 { return fmt.Errorf("sizelength is missing") } @@ -90,61 +90,61 @@ func (t *MPEG4Audio) unmarshal( } // Marshal implements Format. -func (t *MPEG4Audio) Marshal() (string, map[string]string) { - enc, err := t.Config.Marshal() +func (f *MPEG4Audio) Marshal() (string, map[string]string) { + enc, err := f.Config.Marshal() if err != nil { return "", nil } - sampleRate := t.Config.SampleRate - if t.Config.ExtensionSampleRate != 0 { - sampleRate = t.Config.ExtensionSampleRate + sampleRate := f.Config.SampleRate + if f.Config.ExtensionSampleRate != 0 { + sampleRate = f.Config.ExtensionSampleRate } fmtp := make(map[string]string) fmtp["profile-level-id"] = "1" fmtp["mode"] = "AAC-hbr" - if t.SizeLength > 0 { - fmtp["sizelength"] = strconv.FormatInt(int64(t.SizeLength), 10) + if f.SizeLength > 0 { + fmtp["sizelength"] = strconv.FormatInt(int64(f.SizeLength), 10) } - if t.IndexLength > 0 { - fmtp["indexlength"] = strconv.FormatInt(int64(t.IndexLength), 10) + if f.IndexLength > 0 { + fmtp["indexlength"] = strconv.FormatInt(int64(f.IndexLength), 10) } - if t.IndexDeltaLength > 0 { - fmtp["indexdeltalength"] = strconv.FormatInt(int64(t.IndexDeltaLength), 10) + if f.IndexDeltaLength > 0 { + fmtp["indexdeltalength"] = strconv.FormatInt(int64(f.IndexDeltaLength), 10) } fmtp["config"] = hex.EncodeToString(enc) return "mpeg4-generic/" + strconv.FormatInt(int64(sampleRate), 10) + - "/" + strconv.FormatInt(int64(t.Config.ChannelCount), 10), fmtp + "/" + strconv.FormatInt(int64(f.Config.ChannelCount), 10), fmtp } // PTSEqualsDTS implements Format. -func (t *MPEG4Audio) PTSEqualsDTS(*rtp.Packet) bool { +func (f *MPEG4Audio) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *MPEG4Audio) CreateDecoder() *rtpmpeg4audio.Decoder { +func (f *MPEG4Audio) CreateDecoder() *rtpmpeg4audio.Decoder { d := &rtpmpeg4audio.Decoder{ - SampleRate: t.Config.SampleRate, - SizeLength: t.SizeLength, - IndexLength: t.IndexLength, - IndexDeltaLength: t.IndexDeltaLength, + SampleRate: f.Config.SampleRate, + SizeLength: f.SizeLength, + IndexLength: f.IndexLength, + IndexDeltaLength: f.IndexDeltaLength, } d.Init() return d } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *MPEG4Audio) CreateEncoder() *rtpmpeg4audio.Encoder { +func (f *MPEG4Audio) CreateEncoder() *rtpmpeg4audio.Encoder { e := &rtpmpeg4audio.Encoder{ - PayloadType: t.PayloadTyp, - SampleRate: t.Config.SampleRate, - SizeLength: t.SizeLength, - IndexLength: t.IndexLength, - IndexDeltaLength: t.IndexDeltaLength, + PayloadType: f.PayloadTyp, + SampleRate: f.Config.SampleRate, + SizeLength: f.SizeLength, + IndexLength: f.IndexLength, + IndexDeltaLength: f.IndexDeltaLength, } e.Init() return e diff --git a/pkg/formats/mpeg4_audio_test.go b/pkg/formats/mpeg4_audio_test.go index 68296e46..47c6f6e7 100644 --- a/pkg/formats/mpeg4_audio_test.go +++ b/pkg/formats/mpeg4_audio_test.go @@ -6,7 +6,7 @@ import ( "github.com/pion/rtp" "github.com/stretchr/testify/require" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) func TestMPEG4AudioAttributes(t *testing.T) { diff --git a/pkg/formats/opus.go b/pkg/formats/opus.go index 22431db0..583836a0 100644 --- a/pkg/formats/opus.go +++ b/pkg/formats/opus.go @@ -17,24 +17,24 @@ type Opus struct { } // String implements Format. -func (t *Opus) String() string { +func (f *Opus) String() string { return "Opus" } // ClockRate implements Format. -func (t *Opus) ClockRate() int { +func (f *Opus) ClockRate() int { // RFC7587: the RTP timestamp is incremented with a 48000 Hz // clock rate for all modes of Opus and all sampling rates. return 48000 } // PayloadType implements Format. -func (t *Opus) PayloadType() uint8 { - return t.PayloadTyp +func (f *Opus) PayloadType() uint8 { + return f.PayloadTyp } -func (t *Opus) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *Opus) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType tmp := strings.SplitN(clock, "/", 2) if len(tmp) != 2 { @@ -59,7 +59,7 @@ func (t *Opus) unmarshal(payloadType uint8, clock string, codec string, rtpmap s for key, val := range fmtp { if key == "sprop-stereo" { - t.IsStereo = (val == "1") + f.IsStereo = (val == "1") } } @@ -67,10 +67,10 @@ func (t *Opus) unmarshal(payloadType uint8, clock string, codec string, rtpmap s } // Marshal implements Format. -func (t *Opus) Marshal() (string, map[string]string) { +func (f *Opus) Marshal() (string, map[string]string) { fmtp := map[string]string{ "sprop-stereo": func() string { - if t.IsStereo { + if f.IsStereo { return "1" } return "0" @@ -83,12 +83,12 @@ func (t *Opus) Marshal() (string, map[string]string) { } // PTSEqualsDTS implements Format. -func (t *Opus) PTSEqualsDTS(*rtp.Packet) bool { +func (f *Opus) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *Opus) CreateDecoder() *rtpsimpleaudio.Decoder { +func (f *Opus) CreateDecoder() *rtpsimpleaudio.Decoder { d := &rtpsimpleaudio.Decoder{ SampleRate: 48000, } @@ -97,9 +97,9 @@ func (t *Opus) CreateDecoder() *rtpsimpleaudio.Decoder { } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *Opus) CreateEncoder() *rtpsimpleaudio.Encoder { +func (f *Opus) CreateEncoder() *rtpsimpleaudio.Encoder { e := &rtpsimpleaudio.Encoder{ - PayloadType: t.PayloadTyp, + PayloadType: f.PayloadTyp, SampleRate: 48000, } e.Init() diff --git a/pkg/formats/rtph264/decoder.go b/pkg/formats/rtph264/decoder.go index 62d66a8b..52f039dd 100644 --- a/pkg/formats/rtph264/decoder.go +++ b/pkg/formats/rtph264/decoder.go @@ -8,8 +8,8 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/codecs/h264" ) // ErrMorePacketsNeeded is returned when more packets are needed. diff --git a/pkg/formats/rtph264/encoder.go b/pkg/formats/rtph264/encoder.go index ac657003..acba1bf5 100644 --- a/pkg/formats/rtph264/encoder.go +++ b/pkg/formats/rtph264/encoder.go @@ -7,8 +7,8 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h264" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/codecs/h264" ) const ( diff --git a/pkg/formats/rtph265/decoder.go b/pkg/formats/rtph265/decoder.go index b4ec566f..34580c88 100644 --- a/pkg/formats/rtph265/decoder.go +++ b/pkg/formats/rtph265/decoder.go @@ -7,8 +7,8 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/h265" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/codecs/h265" ) // ErrMorePacketsNeeded is returned when more packets are needed. diff --git a/pkg/formats/rtpmjpeg/decoder.go b/pkg/formats/rtpmjpeg/decoder.go index 1876ee66..ee88f94a 100644 --- a/pkg/formats/rtpmjpeg/decoder.go +++ b/pkg/formats/rtpmjpeg/decoder.go @@ -7,9 +7,9 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/jpeg" "github.com/bluenviron/gortsplib/v3/pkg/formats/rtpmjpeg/headers" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/codecs/jpeg" ) // ErrMorePacketsNeeded is returned when more packets are needed. diff --git a/pkg/formats/rtpmjpeg/encoder.go b/pkg/formats/rtpmjpeg/encoder.go index 2c7572d0..98f490b0 100644 --- a/pkg/formats/rtpmjpeg/encoder.go +++ b/pkg/formats/rtpmjpeg/encoder.go @@ -8,9 +8,9 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/jpeg" "github.com/bluenviron/gortsplib/v3/pkg/formats/rtpmjpeg/headers" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/codecs/jpeg" ) const ( diff --git a/pkg/formats/rtpmpeg4audio/decoder.go b/pkg/formats/rtpmpeg4audio/decoder.go index d6dc8cab..61c4422c 100644 --- a/pkg/formats/rtpmpeg4audio/decoder.go +++ b/pkg/formats/rtpmpeg4audio/decoder.go @@ -7,9 +7,9 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/bits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/bits" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) // ErrMorePacketsNeeded is returned when more packets are needed. diff --git a/pkg/formats/rtpmpeg4audio/decoder_test.go b/pkg/formats/rtpmpeg4audio/decoder_test.go index db76abc1..36ba3915 100644 --- a/pkg/formats/rtpmpeg4audio/decoder_test.go +++ b/pkg/formats/rtpmpeg4audio/decoder_test.go @@ -10,7 +10,7 @@ import ( "github.com/pion/rtp" "github.com/stretchr/testify/require" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) func TestDecode(t *testing.T) { diff --git a/pkg/formats/rtpmpeg4audio/encoder.go b/pkg/formats/rtpmpeg4audio/encoder.go index 0188e65d..a409aafe 100644 --- a/pkg/formats/rtpmpeg4audio/encoder.go +++ b/pkg/formats/rtpmpeg4audio/encoder.go @@ -6,9 +6,9 @@ import ( "github.com/pion/rtp" - "github.com/bluenviron/gortsplib/v3/pkg/bits" - "github.com/bluenviron/gortsplib/v3/pkg/codecs/mpeg4audio" "github.com/bluenviron/gortsplib/v3/pkg/rtptime" + "github.com/bluenviron/mediacommon/pkg/bits" + "github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" ) const ( diff --git a/pkg/formats/vorbis.go b/pkg/formats/vorbis.go index 86bbf056..9ef97f94 100644 --- a/pkg/formats/vorbis.go +++ b/pkg/formats/vorbis.go @@ -18,22 +18,22 @@ type Vorbis struct { } // String implements Format. -func (t *Vorbis) String() string { +func (f *Vorbis) String() string { return "Vorbis" } // ClockRate implements Format. -func (t *Vorbis) ClockRate() int { - return t.SampleRate +func (f *Vorbis) ClockRate() int { + return f.SampleRate } // PayloadType implements Format. -func (t *Vorbis) PayloadType() uint8 { - return t.PayloadTyp +func (f *Vorbis) PayloadType() uint8 { + return f.PayloadTyp } -func (t *Vorbis) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *Vorbis) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType tmp := strings.SplitN(clock, "/", 2) if len(tmp) != 2 { @@ -44,13 +44,13 @@ func (t *Vorbis) unmarshal(payloadType uint8, clock string, codec string, rtpmap if err != nil { return err } - t.SampleRate = int(sampleRate) + f.SampleRate = int(sampleRate) channelCount, err := strconv.ParseInt(tmp[1], 10, 64) if err != nil { return err } - t.ChannelCount = int(channelCount) + f.ChannelCount = int(channelCount) for key, val := range fmtp { if key == "configuration" { @@ -59,11 +59,11 @@ func (t *Vorbis) unmarshal(payloadType uint8, clock string, codec string, rtpmap return fmt.Errorf("invalid AAC config (%v)", val) } - t.Configuration = conf + f.Configuration = conf } } - if t.Configuration == nil { + if f.Configuration == nil { return fmt.Errorf("config is missing") } @@ -71,17 +71,17 @@ func (t *Vorbis) unmarshal(payloadType uint8, clock string, codec string, rtpmap } // Marshal implements Format. -func (t *Vorbis) Marshal() (string, map[string]string) { +func (f *Vorbis) Marshal() (string, map[string]string) { fmtp := map[string]string{ - "configuration": base64.StdEncoding.EncodeToString(t.Configuration), + "configuration": base64.StdEncoding.EncodeToString(f.Configuration), } - return "VORBIS/" + strconv.FormatInt(int64(t.SampleRate), 10) + - "/" + strconv.FormatInt(int64(t.ChannelCount), 10), + return "VORBIS/" + strconv.FormatInt(int64(f.SampleRate), 10) + + "/" + strconv.FormatInt(int64(f.ChannelCount), 10), fmtp } // PTSEqualsDTS implements Format. -func (t *Vorbis) PTSEqualsDTS(*rtp.Packet) bool { +func (f *Vorbis) PTSEqualsDTS(*rtp.Packet) bool { return true } diff --git a/pkg/formats/vp8.go b/pkg/formats/vp8.go index 49e47f64..880418ed 100644 --- a/pkg/formats/vp8.go +++ b/pkg/formats/vp8.go @@ -17,22 +17,22 @@ type VP8 struct { } // String implements Format. -func (t *VP8) String() string { +func (f *VP8) String() string { return "VP8" } // ClockRate implements Format. -func (t *VP8) ClockRate() int { +func (f *VP8) ClockRate() int { return 90000 } // PayloadType implements Format. -func (t *VP8) PayloadType() uint8 { - return t.PayloadTyp +func (f *VP8) PayloadType() uint8 { + return f.PayloadTyp } -func (t *VP8) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *VP8) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType for key, val := range fmtp { switch key { @@ -42,7 +42,7 @@ func (t *VP8) unmarshal(payloadType uint8, clock string, codec string, rtpmap st return fmt.Errorf("invalid max-fr (%v)", val) } v2 := int(n) - t.MaxFR = &v2 + f.MaxFR = &v2 case "max-fs": n, err := strconv.ParseUint(val, 10, 64) @@ -50,7 +50,7 @@ func (t *VP8) unmarshal(payloadType uint8, clock string, codec string, rtpmap st return fmt.Errorf("invalid max-fs (%v)", val) } v2 := int(n) - t.MaxFS = &v2 + f.MaxFS = &v2 } } @@ -58,34 +58,34 @@ func (t *VP8) unmarshal(payloadType uint8, clock string, codec string, rtpmap st } // Marshal implements Format. -func (t *VP8) Marshal() (string, map[string]string) { +func (f *VP8) Marshal() (string, map[string]string) { fmtp := make(map[string]string) - if t.MaxFR != nil { - fmtp["max-fr"] = strconv.FormatInt(int64(*t.MaxFR), 10) + if f.MaxFR != nil { + fmtp["max-fr"] = strconv.FormatInt(int64(*f.MaxFR), 10) } - if t.MaxFS != nil { - fmtp["max-fs"] = strconv.FormatInt(int64(*t.MaxFS), 10) + if f.MaxFS != nil { + fmtp["max-fs"] = strconv.FormatInt(int64(*f.MaxFS), 10) } return "VP8/90000", fmtp } // PTSEqualsDTS implements Format. -func (t *VP8) PTSEqualsDTS(*rtp.Packet) bool { +func (f *VP8) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *VP8) CreateDecoder() *rtpvp8.Decoder { +func (f *VP8) CreateDecoder() *rtpvp8.Decoder { d := &rtpvp8.Decoder{} d.Init() return d } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *VP8) CreateEncoder() *rtpvp8.Encoder { +func (f *VP8) CreateEncoder() *rtpvp8.Encoder { e := &rtpvp8.Encoder{ - PayloadType: t.PayloadTyp, + PayloadType: f.PayloadTyp, } e.Init() return e diff --git a/pkg/formats/vp9.go b/pkg/formats/vp9.go index cd3fc2f4..9860a2dc 100644 --- a/pkg/formats/vp9.go +++ b/pkg/formats/vp9.go @@ -18,22 +18,22 @@ type VP9 struct { } // String implements Format. -func (t *VP9) String() string { +func (f *VP9) String() string { return "VP9" } // ClockRate implements Format. -func (t *VP9) ClockRate() int { +func (f *VP9) ClockRate() int { return 90000 } // PayloadType implements Format. -func (t *VP9) PayloadType() uint8 { - return t.PayloadTyp +func (f *VP9) PayloadType() uint8 { + return f.PayloadTyp } -func (t *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { - t.PayloadTyp = payloadType +func (f *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error { + f.PayloadTyp = payloadType for key, val := range fmtp { switch key { @@ -43,7 +43,7 @@ func (t *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap st return fmt.Errorf("invalid max-fr (%v)", val) } v2 := int(n) - t.MaxFR = &v2 + f.MaxFR = &v2 case "max-fs": n, err := strconv.ParseUint(val, 10, 64) @@ -51,7 +51,7 @@ func (t *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap st return fmt.Errorf("invalid max-fs (%v)", val) } v2 := int(n) - t.MaxFS = &v2 + f.MaxFS = &v2 case "profile-id": n, err := strconv.ParseUint(val, 10, 64) @@ -59,7 +59,7 @@ func (t *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap st return fmt.Errorf("invalid profile-id (%v)", val) } v2 := int(n) - t.ProfileID = &v2 + f.ProfileID = &v2 } } @@ -67,37 +67,37 @@ func (t *VP9) unmarshal(payloadType uint8, clock string, codec string, rtpmap st } // Marshal implements Format. -func (t *VP9) Marshal() (string, map[string]string) { +func (f *VP9) Marshal() (string, map[string]string) { fmtp := make(map[string]string) - if t.MaxFR != nil { - fmtp["max-fr"] = strconv.FormatInt(int64(*t.MaxFR), 10) + if f.MaxFR != nil { + fmtp["max-fr"] = strconv.FormatInt(int64(*f.MaxFR), 10) } - if t.MaxFS != nil { - fmtp["max-fs"] = strconv.FormatInt(int64(*t.MaxFS), 10) + if f.MaxFS != nil { + fmtp["max-fs"] = strconv.FormatInt(int64(*f.MaxFS), 10) } - if t.ProfileID != nil { - fmtp["profile-id"] = strconv.FormatInt(int64(*t.ProfileID), 10) + if f.ProfileID != nil { + fmtp["profile-id"] = strconv.FormatInt(int64(*f.ProfileID), 10) } return "VP9/90000", fmtp } // PTSEqualsDTS implements Format. -func (t *VP9) PTSEqualsDTS(*rtp.Packet) bool { +func (f *VP9) PTSEqualsDTS(*rtp.Packet) bool { return true } // CreateDecoder creates a decoder able to decode the content of the format. -func (t *VP9) CreateDecoder() *rtpvp9.Decoder { +func (f *VP9) CreateDecoder() *rtpvp9.Decoder { d := &rtpvp9.Decoder{} d.Init() return d } // CreateEncoder creates an encoder able to encode the content of the format. -func (t *VP9) CreateEncoder() *rtpvp9.Encoder { +func (f *VP9) CreateEncoder() *rtpvp9.Encoder { e := &rtpvp9.Encoder{ - PayloadType: t.PayloadTyp, + PayloadType: f.PayloadTyp, } e.Init() return e