diff --git a/lib/include/chiaki/takion.h b/lib/include/chiaki/takion.h index 6533adb..84a0dfb 100644 --- a/lib/include/chiaki/takion.h +++ b/lib/include/chiaki/takion.h @@ -31,7 +31,7 @@ extern "C" { typedef void (*ChiakiTakionDataCallback)(uint8_t *buf, size_t buf_size, void *user); -typedef void (*ChiakiTakionAVCallback)(uint8_t *buf, size_t buf_size, uint32_t key_pos, void *user); +typedef void (*ChiakiTakionAVCallback)(uint8_t *buf, size_t buf_size, uint8_t base_type, uint32_t key_pos, void *user); typedef struct chiaki_takion_connect_info_t diff --git a/lib/src/nagare.c b/lib/src/nagare.c index 9a654c4..f8ed2be 100644 --- a/lib/src/nagare.c +++ b/lib/src/nagare.c @@ -58,7 +58,7 @@ static ChiakiErrorCode nagare_send_disconnect(ChiakiNagare *nagare); static void nagare_takion_data_expect_bang(ChiakiNagare *nagare, uint8_t *buf, size_t buf_size); static void nagare_takion_data_expect_streaminfo(ChiakiNagare *nagare, uint8_t *buf, size_t buf_size); static ChiakiErrorCode nagare_send_streaminfo_ack(ChiakiNagare *nagare); -static void nagare_takion_av(uint8_t *buf, size_t buf_size, uint32_t key_pos, void *user); +static void nagare_takion_av(uint8_t *buf, size_t buf_size, uint8_t base_type, uint32_t key_pos, void *user); CHIAKI_EXPORT ChiakiErrorCode chiaki_nagare_run(ChiakiSession *session) @@ -493,7 +493,7 @@ static ChiakiErrorCode nagare_send_disconnect(ChiakiNagare *nagare) } -static void nagare_takion_av(uint8_t *buf, size_t buf_size, uint32_t key_pos, void *user) +static void nagare_takion_av(uint8_t *buf, size_t buf_size, uint8_t base_type, uint32_t key_pos, void *user) { ChiakiNagare *nagare = user; @@ -503,6 +503,10 @@ static void nagare_takion_av(uint8_t *buf, size_t buf_size, uint32_t key_pos, vo { chiaki_audio_receiver_frame_packet(nagare->session->audio_receiver, buf, 0x50); } + else if(base_type == 2 && buf[0] != 0xf4) + { + CHIAKI_LOGD(nagare->log, "av frame 2, which is not audio\n"); + } //CHIAKI_LOGD(nagare->log, "Nagare AV %lu\n", buf_size); //chiaki_log_hexdump(nagare->log, CHIAKI_LOG_DEBUG, buf, buf_size); diff --git a/lib/src/takion.c b/lib/src/takion.c index d944936..4567389 100644 --- a/lib/src/takion.c +++ b/lib/src/takion.c @@ -646,7 +646,7 @@ static ChiakiErrorCode takion_recv_message_cookie_ack(ChiakiTakion *takion) static void takion_handle_packet_av(ChiakiTakion *takion, uint8_t base_type, uint8_t *buf, size_t buf_size) { - // HHIxxxxxIx + // HHIxIIx if(buf_size < AV_HEADER_SIZE + 1) { @@ -654,15 +654,19 @@ static void takion_handle_packet_av(ChiakiTakion *takion, uint8_t base_type, uin return; } - uint16_t word_0 = ntohs(*((uint16_t *)(buf + 0))); - uint16_t word_1 = ntohs(*((uint16_t *)(buf + 2))); + uint16_t packet_index = ntohs(*((uint16_t *)(buf + 0))); + uint16_t frame_index = ntohs(*((uint16_t *)(buf + 2))); uint32_t dword_2 = ntohl(*((uint32_t *)(buf + 4))); + uint8_t *gmac = buf + 9; // uint8_t[4] uint32_t key_pos = ntohl(*((uint32_t *)(buf + 0xd))); uint8_t unknown_1 = buf[0x11]; + CHIAKI_LOGD(takion->log, "packet index %u, frame index %u\n", packet_index, frame_index); + chiaki_log_hexdump(takion->log, CHIAKI_LOG_DEBUG, buf, buf_size); + uint8_t *data = buf + AV_HEADER_SIZE; size_t data_size = buf_size - AV_HEADER_SIZE; if(takion->av_cb) - takion->av_cb(data, data_size, key_pos, takion->av_cb_user); + takion->av_cb(data, data_size, base_type, key_pos, takion->av_cb_user); } \ No newline at end of file