diff options
Diffstat (limited to 'toxav/media.h')
-rw-r--r-- | toxav/media.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/toxav/media.h b/toxav/media.h new file mode 100644 index 00000000..aed57ea2 --- /dev/null +++ b/toxav/media.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /** media.h | ||
2 | * | ||
3 | * Audio and video codec intitialization, encoding/decoding and playback | ||
4 | * | ||
5 | * Copyright (C) 2013 Tox project All Rights Reserved. | ||
6 | * | ||
7 | * This file is part of Tox. | ||
8 | * | ||
9 | * Tox is free software: you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation, either version 3 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * Tox is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _AVCODEC_H_ | ||
25 | #define _AVCODEC_H_ | ||
26 | |||
27 | #include <stdio.h> | ||
28 | #include <math.h> | ||
29 | #include <pthread.h> | ||
30 | |||
31 | #include <vpx/vpx_decoder.h> | ||
32 | #include <vpx/vpx_encoder.h> | ||
33 | #include <vpx/vp8dx.h> | ||
34 | #include <vpx/vp8cx.h> | ||
35 | #define VIDEO_CODEC_DECODER_INTERFACE (vpx_codec_vp8_dx()) | ||
36 | #define VIDEO_CODEC_ENCODER_INTERFACE (vpx_codec_vp8_cx()) | ||
37 | |||
38 | /* Audio encoding/decoding */ | ||
39 | #include <opus/opus.h> | ||
40 | |||
41 | |||
42 | typedef struct _CodecState { | ||
43 | |||
44 | /* video encoding */ | ||
45 | vpx_codec_ctx_t v_encoder; | ||
46 | uint32_t frame_counter; | ||
47 | |||
48 | /* video decoding */ | ||
49 | vpx_codec_ctx_t v_decoder; | ||
50 | |||
51 | /* audio encoding */ | ||
52 | OpusEncoder *audio_encoder; | ||
53 | int audio_bitrate; | ||
54 | int audio_sample_rate; | ||
55 | |||
56 | /* audio decoding */ | ||
57 | OpusDecoder *audio_decoder; | ||
58 | |||
59 | } CodecState; | ||
60 | |||
61 | typedef struct _RTPMessage RTPMessage; | ||
62 | |||
63 | struct jitter_buffer *create_queue(int capacity); | ||
64 | int empty_queue(struct jitter_buffer *q); | ||
65 | |||
66 | int queue(struct jitter_buffer *q, RTPMessage *pk); | ||
67 | RTPMessage *dequeue(struct jitter_buffer *q, int *success); | ||
68 | |||
69 | |||
70 | CodecState *codec_init_session ( uint32_t audio_bitrate, | ||
71 | uint16_t audio_frame_duration, | ||
72 | uint32_t audio_sample_rate, | ||
73 | uint32_t audio_channels, | ||
74 | uint16_t video_width, | ||
75 | uint16_t video_height, | ||
76 | uint32_t video_bitrate ); | ||
77 | |||
78 | void codec_terminate_session(CodecState *cs); | ||
79 | |||
80 | #endif | ||