summaryrefslogtreecommitdiff
path: root/toxav/codec.h
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2015-04-22 02:09:37 +0200
committermannol <eniz_vukovic@hotmail.com>2015-04-22 02:09:37 +0200
commit1bfd93e64a2a6d3bf9c90a9aa89abd29f3d826a7 (patch)
tree094af1cad749bef83678071476075160d956bfeb /toxav/codec.h
parent3fd0ee5f0873924b4881b0e33eb1c17ea877ab4a (diff)
Finished refactoring
Diffstat (limited to 'toxav/codec.h')
-rw-r--r--toxav/codec.h125
1 files changed, 0 insertions, 125 deletions
diff --git a/toxav/codec.h b/toxav/codec.h
deleted file mode 100644
index 497016eb..00000000
--- a/toxav/codec.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/** codec.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 CODEC_H
23#define CODEC_H
24
25#include "toxav.h"
26#include "rtp.h"
27
28#include "../toxcore/util.h"
29
30#include <stdio.h>
31#include <math.h>
32#include <pthread.h>
33
34#include <vpx/vpx_decoder.h>
35#include <vpx/vpx_encoder.h>
36#include <vpx/vp8dx.h>
37#include <vpx/vp8cx.h>
38#include <vpx/vpx_image.h>
39#define VIDEO_CODEC_DECODER_INTERFACE (vpx_codec_vp8_dx())
40#define VIDEO_CODEC_ENCODER_INTERFACE (vpx_codec_vp8_cx())
41
42/* Audio encoding/decoding */
43#include <opus.h>
44
45typedef struct CSession_s {
46
47 /* VIDEO
48 *
49 *
50 */
51
52 /* video encoding */
53 vpx_codec_ctx_t v_encoder[1];
54 uint32_t frame_counter;
55
56 /* video decoding */
57 vpx_codec_ctx_t v_decoder[1];
58 void *vbuf_raw; /* Un-decoded data */
59
60 /* Data handling */
61 uint8_t *frame_buf; /* buffer for split video payloads */
62 uint32_t frame_size; /* largest address written to in frame_buf for current input frame */
63 uint8_t frameid_in, frameid_out; /* id of input and output video frame */
64 uint64_t linfts; /* Last received frame time stamp */
65 uint32_t lcfd; /* Last calculated frame duration for incoming video payload */
66
67 /* Limits */
68 uint32_t peer_video_frame_piece_size;
69
70 /* Splitting */
71 uint8_t *split_video_frame;
72 const uint8_t *processing_video_frame;
73 uint16_t processing_video_frame_size;
74
75
76
77 /* AUDIO
78 *
79 *
80 */
81
82 /* audio encoding */
83 OpusEncoder *audio_encoder;
84 int32_t last_encoding_sampling_rate;
85 int32_t last_encoding_channel_count;
86 int32_t last_encoding_bitrate;
87
88 /* audio decoding */
89 OpusDecoder *audio_decoder;
90 int32_t last_packet_channel_count;
91 int32_t last_packet_sampling_rate;
92 int32_t last_packet_frame_duration;
93 int32_t last_decoding_sampling_rate;
94 int32_t last_decoding_channel_count;
95 uint64_t last_decoder_reconfiguration;
96 struct JitterBuffer_s *j_buf;
97
98
99 /* OTHER
100 *
101 *
102 */
103 ToxAV *av;
104 int32_t friend_id;
105
106 PAIR(toxav_receive_audio_frame_cb *, void *) acb; /* Audio frame receive callback */
107 PAIR(toxav_receive_video_frame_cb *, void *) vcb; /* Video frame receive callback */
108
109 pthread_mutex_t queue_mutex[1];
110} CSession;
111
112
113void cs_do(CSession *cs);
114/* Make sure to be called BEFORE corresponding rtp_new */
115CSession *cs_new(uint32_t peer_mvfpsz);
116/* Make sure to be called AFTER corresponding rtp_kill */
117void cs_kill(CSession *cs);
118
119void cs_init_video_splitter_cycle(CSession *cs);
120int cs_update_video_splitter_cycle(CSession* cs, const uint8_t* payload, uint16_t length);
121const uint8_t *cs_iterate_split_video_frame(CSession *cs, uint16_t *size);
122
123int cs_reconfigure_video_encoder(CSession* cs, int32_t bitrate, uint16_t width, uint16_t height);
124int cs_reconfigure_audio_encoder(CSession* cs, int32_t bitrate, int32_t sampling_rate, uint8_t channels);
125#endif /* CODEC_H */