Skip to content

Commit

Permalink
Remove all uses of the PAIR macro in toxav.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Aug 12, 2018
1 parent 5d15b59 commit 1de8b02
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 121 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ if(BUILD_TOXAV)
toxav/groupav.h
toxav/msi.c
toxav/msi.h
toxav/pair.h
toxav/ring_buffer.c
toxav/ring_buffer.h
toxav/rtp.c
Expand Down
7 changes: 0 additions & 7 deletions toxav/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,11 @@ cc_test(
],
)

cc_library(
name = "pair",
hdrs = ["pair.h"],
)

cc_library(
name = "audio",
srcs = ["audio.c"],
hdrs = ["audio.h"],
deps = [
":pair",
":public",
":rtp",
"//c-toxcore/toxcore:network",
Expand All @@ -94,7 +88,6 @@ cc_library(
],
deps = [
":audio",
":pair",
":public",
"//c-toxcore/toxcore:network",
"@libvpx",
Expand Down
1 change: 0 additions & 1 deletion toxav/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ libtoxav_la_SOURCES = ../toxav/rtp.h \
../toxav/video.c \
../toxav/bwcontroller.h \
../toxav/bwcontroller.c \
../toxav/pair.h \
../toxav/ring_buffer.h \
../toxav/ring_buffer.c \
../toxav/toxav.h \
Expand Down
10 changes: 5 additions & 5 deletions toxav/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ ACSession *ac_new(const Logger *log, ToxAV *av, uint32_t friend_number, toxav_au

ac->av = av;
ac->friend_number = friend_number;
ac->acb.first = cb;
ac->acb.second = cb_data;
ac->acb = cb;
ac->acb_user_data = cb_data;

return ac;

Expand Down Expand Up @@ -201,11 +201,11 @@ void ac_iterate(ACSession *ac)

if (rc < 0) {
LOGGER_WARNING(ac->log, "Decoding error: %s", opus_strerror(rc));
} else if (ac->acb.first) {
} else if (ac->acb) {
ac->lp_frame_duration = (rc * 1000) / ac->lp_sampling_rate;

ac->acb.first(ac->av, ac->friend_number, temp_audio_buffer, rc, ac->lp_channel_count,
ac->lp_sampling_rate, ac->acb.second);
ac->acb(ac->av, ac->friend_number, temp_audio_buffer, rc, ac->lp_channel_count,
ac->lp_sampling_rate, ac->acb_user_data);
}

return;
Expand Down
5 changes: 3 additions & 2 deletions toxav/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include "pair.h"

#include <opus.h>
#include <pthread.h>
Expand Down Expand Up @@ -74,7 +73,9 @@ typedef struct ACSession_s {

ToxAV *av;
uint32_t friend_number;
PAIR(toxav_audio_receive_frame_cb *, void *) acb; /* Audio frame receive callback */
/* Audio frame receive callback */
toxav_audio_receive_frame_cb *acb;
void *acb_user_data;
} ACSession;

ACSession *ac_new(const Logger *log, ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb,
Expand Down
6 changes: 0 additions & 6 deletions toxav/pair.h

This file was deleted.

Loading

0 comments on commit 1de8b02

Please sign in to comment.