mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 05:13:03 +01:00
make it dynamic
This commit is contained in:
parent
f47991e18e
commit
476b056ed0
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
typedef struct _Call {
|
typedef struct _Call {
|
||||||
pthread_t ttid; /* Transmission thread id */
|
pthread_t ttid; /* Transmission thread id */
|
||||||
_Bool ttas; /* Transmission thread active status (0 - stopped, 1- running) */
|
_Bool ttas, has_output; /* Transmission thread active status (0 - stopped, 1- running) */
|
||||||
int in_idx, out_idx;
|
int in_idx, out_idx;
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
} Call;
|
} Call;
|
||||||
@ -189,7 +189,7 @@ void *transmission(void *arg)
|
|||||||
|
|
||||||
int32_t dec_frame_len;
|
int32_t dec_frame_len;
|
||||||
int16_t PCM[frame_size];
|
int16_t PCM[frame_size];
|
||||||
_Bool has_output = 1;
|
this_call->has_output = 1;
|
||||||
|
|
||||||
if ( open_primary_device(input, &this_call->in_idx) != de_None )
|
if ( open_primary_device(input, &this_call->in_idx) != de_None )
|
||||||
line_info_add(self, NULL, NULL, NULL, "Failed to open input device!", SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, "Failed to open input device!", SYS_MSG, 0, 0);
|
||||||
@ -199,13 +199,13 @@ void *transmission(void *arg)
|
|||||||
|
|
||||||
if ( open_primary_device(output, &this_call->out_idx) != de_None ) {
|
if ( open_primary_device(output, &this_call->out_idx) != de_None ) {
|
||||||
line_info_add(self, NULL, NULL, NULL, "Failed to open output device!", SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, "Failed to open output device!", SYS_MSG, 0, 0);
|
||||||
has_output = 0;
|
this_call->has_output = 0;
|
||||||
}
|
}
|
||||||
/* Start transmission */
|
/* Start transmission */
|
||||||
while (this_call->ttas) {
|
while (this_call->ttas) {
|
||||||
|
|
||||||
if ( has_output ) {
|
lock;
|
||||||
lock;
|
if ( this_call->has_output ) {
|
||||||
|
|
||||||
if (playback_device_ready(this_call->out_idx) == de_Busy) {
|
if (playback_device_ready(this_call->out_idx) == de_Busy) {
|
||||||
unlock;
|
unlock;
|
||||||
@ -222,8 +222,9 @@ void *transmission(void *arg)
|
|||||||
/* >implying it'll ever get an error */
|
/* >implying it'll ever get an error */
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock;
|
|
||||||
}
|
}
|
||||||
|
unlock;
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +654,8 @@ void cmd_ccur_device(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (
|
|||||||
if (type == output) {
|
if (type == output) {
|
||||||
pthread_mutex_lock(&this_call->mutex);
|
pthread_mutex_lock(&this_call->mutex);
|
||||||
close_device(output, this_call->out_idx);
|
close_device(output, this_call->out_idx);
|
||||||
open_device(output, selection, &this_call->out_idx);
|
this_call->has_output = open_device(output, selection, &this_call->out_idx)
|
||||||
|
== de_None ? 1 : 0;
|
||||||
pthread_mutex_unlock(&this_call->mutex);
|
pthread_mutex_unlock(&this_call->mutex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user