diff options
Diffstat (limited to 'toxav/codec.h')
-rw-r--r-- | toxav/codec.h | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/toxav/codec.h b/toxav/codec.h index 92262ef8..951d6d2f 100644 --- a/toxav/codec.h +++ b/toxav/codec.h | |||
@@ -96,7 +96,7 @@ typedef struct _CSSession { | |||
96 | uint32_t video_frame_piece_size; | 96 | uint32_t video_frame_piece_size; |
97 | uint32_t max_video_frame_size; | 97 | uint32_t max_video_frame_size; |
98 | 98 | ||
99 | /* Reassembling */ | 99 | /* Splitting */ |
100 | uint8_t *split_video_frame; | 100 | uint8_t *split_video_frame; |
101 | const uint8_t *processing_video_frame; | 101 | const uint8_t *processing_video_frame; |
102 | uint16_t processing_video_frame_size; | 102 | uint16_t processing_video_frame_size; |
@@ -110,10 +110,13 @@ typedef struct _CSSession { | |||
110 | 110 | ||
111 | /* audio encoding */ | 111 | /* audio encoding */ |
112 | OpusEncoder *audio_encoder; | 112 | OpusEncoder *audio_encoder; |
113 | int32_t channels; | 113 | int32_t encoder_channels; |
114 | 114 | ||
115 | /* audio decoding */ | 115 | /* audio decoding */ |
116 | OpusDecoder *audio_decoder; | 116 | OpusDecoder *audio_decoder; |
117 | int32_t last_pack_channels; | ||
118 | int32_t last_packet_sampling_rate; | ||
119 | int32_t last_packet_frame_duration; | ||
117 | struct _JitterBuffer *j_buf; | 120 | struct _JitterBuffer *j_buf; |
118 | 121 | ||
119 | 122 | ||
@@ -127,54 +130,55 @@ typedef struct _CSSession { | |||
127 | * | 130 | * |
128 | * | 131 | * |
129 | */ | 132 | */ |
130 | 133 | void *agent; /* Pointer to ToxAV TODO make this pointer to ToxAV*/ | |
131 | /* Callbacks */ | ||
132 | PAIR(CSAudioCallback, void *) acb; | ||
133 | PAIR(CSVideoCallback, void *) vcb; | ||
134 | |||
135 | void *agent; /* Pointer to ToxAv */ | ||
136 | int32_t call_idx; | 134 | int32_t call_idx; |
137 | 135 | ||
138 | pthread_mutex_t queue_mutex[1]; | 136 | pthread_mutex_t queue_mutex[1]; |
139 | } CSSession; | 137 | } CSSession; |
140 | 138 | ||
141 | int cs_split_video_payload(CSSession *cs, const uint8_t *payload, uint16_t length); | ||
142 | const uint8_t *cs_get_split_video_frame(CSSession *cs, uint16_t *size); | ||
143 | 139 | ||
144 | /** | 140 | /** |
145 | * Call playback callbacks | 141 | * Generic |
146 | */ | 142 | */ |
147 | void cs_do(CSSession *cs); | 143 | void cs_do(CSSession *cs); |
148 | 144 | ||
149 | /** | 145 | /* Make sure to be called BEFORE corresponding rtp_new */ |
150 | * Reconfigure video settings; return 0 on success or -1 on failure. | 146 | CSSession *cs_new(uint32_t s_audio_b, uint32_t p_audio_b, uint32_t s_video_b, uint32_t p_video_b); |
147 | /* Make sure to be called AFTER corresponding rtp_kill */ | ||
148 | void cs_kill(CSSession *cs); | ||
149 | |||
150 | |||
151 | /** | ||
152 | * VIDEO HANDLING | ||
151 | */ | 153 | */ |
154 | void cs_init_video_splitter_cycle(CSSession *cs); | ||
155 | int cs_update_video_splitter_cycle(CSSession* cs, const uint8_t* payload, uint16_t length); | ||
156 | const uint8_t *cs_iterate_split_video_frame(CSSession *cs, uint16_t *size); | ||
157 | |||
152 | int cs_set_sending_video_resolution(CSSession *cs, uint16_t width, uint16_t height); | 158 | int cs_set_sending_video_resolution(CSSession *cs, uint16_t width, uint16_t height); |
153 | int cs_set_sending_video_bitrate(CSSession *cs, uint32_t bitrate); | 159 | int cs_set_sending_video_bitrate(CSSession *cs, uint32_t bitrate); |
154 | 160 | ||
161 | int cs_enable_video_sending(CSSession* cs, uint32_t bitrate); | ||
162 | int cs_enable_video_receiving(CSSession* cs); | ||
163 | |||
164 | void cs_disable_video_sending(CSSession* cs); | ||
165 | void cs_disable_video_receiving(CSSession* cs); | ||
166 | |||
167 | /** | ||
168 | * AUDIO HANDLING | ||
169 | */ | ||
155 | int cs_set_sending_audio_bitrate(CSSession* cs, int32_t rate); | 170 | int cs_set_sending_audio_bitrate(CSSession* cs, int32_t rate); |
156 | /* NOTE: Try not to call these a lot */ | ||
157 | int cs_set_sending_audio_sampling_rate(CSSession* cs, int32_t rate); | 171 | int cs_set_sending_audio_sampling_rate(CSSession* cs, int32_t rate); |
158 | int cs_set_sending_audio_channels(CSSession* cs, int32_t count); | 172 | int cs_set_sending_audio_channels(CSSession* cs, int32_t count); |
159 | 173 | ||
160 | /** | 174 | int cs_enable_audio_sending(CSSession* cs, uint32_t bitrate, int channels); |
161 | * Make sure to be called BEFORE corresponding rtp_new | ||
162 | */ | ||
163 | CSSession *cs_new(uint32_t s_audio_b, uint32_t p_audio_b, uint32_t s_video_b, uint32_t p_video_b); | ||
164 | /** | ||
165 | * Make sure to be called AFTER corresponding rtp_kill | ||
166 | */ | ||
167 | void cs_kill(CSSession *cs); | ||
168 | |||
169 | int cs_enable_audio_sending(CSSession* cs, uint32_t bitrate); | ||
170 | int cs_enable_audio_receiving(CSSession* cs); | 175 | int cs_enable_audio_receiving(CSSession* cs); |
171 | int cs_enable_video_sending(CSSession* cs, uint32_t bitrate); | ||
172 | int cs_enable_video_receiving(CSSession* cs); | ||
173 | 176 | ||
174 | void cs_disable_audio_sending(CSSession* cs); | 177 | void cs_disable_audio_sending(CSSession* cs); |
175 | void cs_disable_audio_receiving(CSSession* cs); | 178 | void cs_disable_audio_receiving(CSSession* cs); |
176 | void cs_disable_video_sending(CSSession* cs); | 179 | |
177 | void cs_disable_video_receiving(CSSession* cs); | 180 | |
181 | |||
178 | 182 | ||
179 | /* Internal. Called from rtp_handle_message */ | 183 | /* Internal. Called from rtp_handle_message */ |
180 | void queue_message(RTPSession *session, RTPMessage *msg); | 184 | void queue_message(RTPSession *session, RTPMessage *msg); |