summaryrefslogtreecommitdiff
path: root/toxav/video.h
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2015-04-21 02:31:12 +0200
committermannol <eniz_vukovic@hotmail.com>2015-04-21 02:31:12 +0200
commit3fd0ee5f0873924b4881b0e33eb1c17ea877ab4a (patch)
tree6a4ee64a3ea7f0191ccfd0205a68411cf0b84063 /toxav/video.h
parentcbb8fdd4eab3bae4db1179f1fa04cdaa35957aeb (diff)
Final touchups
Diffstat (limited to 'toxav/video.h')
-rw-r--r--toxav/video.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/toxav/video.h b/toxav/video.h
new file mode 100644
index 00000000..c1678ad2
--- /dev/null
+++ b/toxav/video.h
@@ -0,0 +1,81 @@
1/** video.h
2 *
3 * Copyright (C) 2013-2015 Tox project All Rights Reserved.
4 *
5 * This file is part of Tox.
6 *
7 * Tox is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Tox is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef VIDEO_H
23#define VIDEO_H
24
25#include <vpx/vpx_decoder.h>
26#include <vpx/vpx_encoder.h>
27#include <vpx/vp8dx.h>
28#include <vpx/vp8cx.h>
29#include <vpx/vpx_image.h>
30#define VIDEO_CODEC_DECODER_INTERFACE (vpx_codec_vp8_dx())
31#define VIDEO_CODEC_ENCODER_INTERFACE (vpx_codec_vp8_cx())
32
33#include <pthread.h>
34
35#include "toxav.h"
36
37#include "../toxcore/util.h"
38
39typedef struct VCSession_s {
40
41 /* encoding */
42 vpx_codec_ctx_t v_encoder[1];
43 uint32_t frame_counter;
44
45 /* decoding */
46 vpx_codec_ctx_t v_decoder[1];
47 void *vbuf_raw; /* Un-decoded data */
48
49 /* Data handling */
50 uint8_t *frame_buf; /* buffer for split video payloads */
51 uint32_t frame_size; /* largest address written to in frame_buf for current input frame */
52 uint8_t frameid_in, frameid_out; /* id of input and output video frame */
53 uint64_t linfts; /* Last received frame time stamp */
54 uint32_t lcfd; /* Last calculated frame duration for incoming video payload */
55
56 /* Limits */
57 uint32_t peer_video_frame_piece_size;
58
59 /* Splitting */
60 uint8_t *split_video_frame;
61 const uint8_t *processing_video_frame;
62 uint16_t processing_video_frame_size;
63
64
65 ToxAV *av;
66 int32_t friend_id;
67
68 PAIR(toxav_receive_video_frame_cb *, void *) vcb; /* Video frame receive callback */
69
70 pthread_mutex_t queue_mutex[1];
71} VCSession;
72
73VCSession* vc_new(ToxAV* av, uint32_t friend_id, toxav_receive_video_frame_cb *cb, void *cb_data, uint32_t mvfpsz);
74void vc_kill(VCSession* vc);
75void vc_do(VCSession* vc);
76void vc_init_video_splitter_cycle(VCSession* vc);
77int vc_update_video_splitter_cycle(VCSession* vc, const uint8_t* payload, uint16_t length);
78const uint8_t *vc_iterate_split_video_frame(VCSession* vc, uint16_t *size);
79int vc_reconfigure_encoder(VCSession* vc, int32_t bitrate, uint16_t width, uint16_t height);
80
81#endif /* VIDEO_H */ \ No newline at end of file