diff options
Diffstat (limited to 'toxav/video.c')
-rw-r--r-- | toxav/video.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/toxav/video.c b/toxav/video.c index e786bc4c..de028c7c 100644 --- a/toxav/video.c +++ b/toxav/video.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #define MAX_DECODE_TIME_US 0 /* Good quality encode. */ | 37 | #define MAX_DECODE_TIME_US 0 /* Good quality encode. */ |
38 | #define VIDEO_DECODE_BUFFER_SIZE 20 | 38 | #define VIDEO_DECODE_BUFFER_SIZE 20 |
39 | 39 | ||
40 | VCSession *vc_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_video_receive_frame_cb *cb) | 40 | VCSession *vc_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_video_receive_frame_cb *cb, void *cb_data) |
41 | { | 41 | { |
42 | VCSession *vc = calloc(sizeof(VCSession), 1); | 42 | VCSession *vc = calloc(sizeof(VCSession), 1); |
43 | 43 | ||
@@ -104,7 +104,8 @@ VCSession *vc_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_video_re | |||
104 | 104 | ||
105 | vc->linfts = current_time_monotonic(); | 105 | vc->linfts = current_time_monotonic(); |
106 | vc->lcfd = 60; | 106 | vc->lcfd = 60; |
107 | vc->on_video_frame = cb; | 107 | vc->vcb.first = cb; |
108 | vc->vcb.second = cb_data; | ||
108 | vc->friend_number = friend_number; | 109 | vc->friend_number = friend_number; |
109 | vc->av = av; | 110 | vc->av = av; |
110 | vc->log = log; | 111 | vc->log = log; |
@@ -141,7 +142,7 @@ void vc_kill(VCSession *vc) | |||
141 | LOGGER_DEBUG(vc->log, "Terminated video handler: %p", vc); | 142 | LOGGER_DEBUG(vc->log, "Terminated video handler: %p", vc); |
142 | free(vc); | 143 | free(vc); |
143 | } | 144 | } |
144 | void vc_iterate(VCSession *vc, void *userdata) | 145 | void vc_iterate(VCSession *vc) |
145 | { | 146 | { |
146 | if (!vc) { | 147 | if (!vc) { |
147 | return; | 148 | return; |
@@ -167,10 +168,10 @@ void vc_iterate(VCSession *vc, void *userdata) | |||
167 | 168 | ||
168 | /* Play decoded images */ | 169 | /* Play decoded images */ |
169 | for (; dest; dest = vpx_codec_get_frame(vc->decoder, &iter)) { | 170 | for (; dest; dest = vpx_codec_get_frame(vc->decoder, &iter)) { |
170 | if (vc->on_video_frame) { | 171 | if (vc->vcb.first) { |
171 | vc->on_video_frame(vc->av, vc->friend_number, dest->d_w, dest->d_h, | 172 | vc->vcb.first(vc->av, vc->friend_number, dest->d_w, dest->d_h, |
172 | (const uint8_t *)dest->planes[0], (const uint8_t *)dest->planes[1], (const uint8_t *)dest->planes[2], | 173 | (const uint8_t *)dest->planes[0], (const uint8_t *)dest->planes[1], (const uint8_t *)dest->planes[2], |
173 | dest->stride[0], dest->stride[1], dest->stride[2], userdata); | 174 | dest->stride[0], dest->stride[1], dest->stride[2], vc->vcb.second); |
174 | } | 175 | } |
175 | 176 | ||
176 | vpx_img_free(dest); | 177 | vpx_img_free(dest); |