mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Video is working!
This commit is contained in:
parent
8876b591bc
commit
6846d61fa2
6 changed files with 93 additions and 8 deletions
73
test/takion.c
Normal file
73
test/takion.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is part of Chiaki.
|
||||
*
|
||||
* Chiaki is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Chiaki is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <munit.h>
|
||||
|
||||
#include <chiaki/takion.h>
|
||||
|
||||
|
||||
static MunitResult test_av_packet_parse(const MunitParameter params[], void *user)
|
||||
{
|
||||
uint8_t packet[] = {
|
||||
0x2, 0x0, 0x2d, 0x0, 0x5, 0x0, 0xc0, 0x1c, 0x1, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xe4, 0x10, 0x3, 0x67, 0x0, 0x29, 0xf3, 0x2f, 0x98, 0xf6, 0x99, 0x82, 0x83, 0x78, 0xdb, 0x29,
|
||||
0x43, 0xa9, 0xe5, 0x88, 0xf2, 0x11, 0x4, 0x20, 0xe6, 0x20, 0x96, 0xe9, 0x6, 0xee, 0xd, 0x27,
|
||||
0xa1, 0x83, 0x82, 0x88, 0xe6, 0x21, 0x49, 0x2, 0x75, 0x74, 0x32, 0x5b, 0xf6, 0xe9, 0xdc, 0x93,
|
||||
0xea, 0x31, 0x88, 0xd, 0x2b, 0x4b, 0x34, 0xf9, 0xec, 0x1b, 0x26, 0xcc, 0xbb, 0xbb, 0x81, 0xf2,
|
||||
0xd9, 0x2d, 0x8e, 0xa1, 0xb9, 0xe2, 0xb3, 0xca, 0xb2, 0x7d, 0xa3, 0x31, 0xf0, 0x42, 0xb7, 0xb6,
|
||||
0x1e, 0x8f, 0x6d, 0xa2, 0x70, 0x46, 0xfd, 0x7e, 0x9b, 0x60, 0x85, 0xb0, 0xed, 0x4f, 0x20, 0xb5,
|
||||
0x1, 0x71, 0xa9, 0xaa, 0x18, 0x6b, 0x2a, 0x90, 0xf3, 0xa7, 0x84, 0x36, 0xfd, 0x6d, 0x14, 0x83,
|
||||
0x68, 0xa3, 0x9b, 0x3a, 0xc8, 0xd4, 0x3a, 0x31, 0xa0, 0x9b, 0x61, 0xde, 0xa7, 0xed, 0x46, 0xb4,
|
||||
0xa3, 0xdf, 0x3f, 0x44, 0x8f, 0xad, 0x64, 0x9, 0xfc, 0x7a, 0xe7, 0x24, 0xf0, 0xd2, 0x42, 0xd3,
|
||||
0x57, 0x5a, 0x76, 0x0, 0xc5, 0xe0, 0x93, 0xa9, 0xf5, 0x32, 0x5d, 0xee, 0xf7, 0x9d
|
||||
};
|
||||
|
||||
ChiakiTakionAVPacket av_packet;
|
||||
|
||||
ChiakiErrorCode err = chiaki_takion_av_packet_parse(&av_packet, 2, packet, sizeof(packet));
|
||||
munit_assert_int(err, ==, CHIAKI_ERR_SUCCESS);
|
||||
|
||||
munit_assert(av_packet.is_video);
|
||||
munit_assert_uint16(av_packet.packet_index, ==, 45);
|
||||
munit_assert_uint16(av_packet.frame_index, ==, 5);
|
||||
// TODO: uses_nalu_info_structs
|
||||
munit_assert_uint16(av_packet.unit_index, ==, 6);
|
||||
munit_assert_uint16(av_packet.units_in_frame_total, ==, 8);
|
||||
munit_assert_uint16(av_packet.units_in_frame_additional, ==, 1);
|
||||
munit_assert_uint32(av_packet.codec, ==, 3);
|
||||
// munit_assert_uint16(av_packet.word_at_0x18, ==, 871);
|
||||
munit_assert_uint8(av_packet.adaptive_stream_index, ==, 0);
|
||||
// munit_assert_uint8(av_packet.byte_at_0x2c, ==, 0);
|
||||
|
||||
munit_assert_ptr_equal(av_packet.data, packet + 0x15);
|
||||
munit_assert_size(av_packet.data_size, ==, 0x99);
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
|
||||
MunitTest tests_takion[] = {
|
||||
{
|
||||
"/av_packet_parse",
|
||||
test_av_packet_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
MUNIT_TEST_OPTION_NONE,
|
||||
NULL
|
||||
},
|
||||
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue