diff options
author | Eniz Vukovic <eniz_vukovic@hotmail.com> | 2015-10-10 23:54:23 +0200 |
---|---|---|
committer | Eniz Vukovic <eniz_vukovic@hotmail.com> | 2015-10-10 23:54:23 +0200 |
commit | d6fdf16520b6f242935ca95eeb739ec9a8eaa14c (patch) | |
tree | 069f3355835aa0497fe494c36554ea24d0b222f1 /toxav/video.h | |
parent | bf5e9b89d2a67c293aae503c03e193307ea7990b (diff) |
New Adaptive BR algorithm, cleanups and fixes
Diffstat (limited to 'toxav/video.h')
-rw-r--r-- | toxav/video.h | 65 |
1 files changed, 10 insertions, 55 deletions
diff --git a/toxav/video.h b/toxav/video.h index ac165df6..1ad1f6f5 100644 --- a/toxav/video.h +++ b/toxav/video.h | |||
@@ -36,77 +36,32 @@ | |||
36 | 36 | ||
37 | #include "../toxcore/util.h" | 37 | #include "../toxcore/util.h" |
38 | 38 | ||
39 | struct RTPMessage_s; | 39 | struct RTPMessage; |
40 | 40 | ||
41 | /* | ||
42 | * Base Video Codec session type. | ||
43 | */ | ||
44 | typedef struct VCSession_s { | 41 | typedef struct VCSession_s { |
45 | |||
46 | /* encoding */ | 42 | /* encoding */ |
47 | vpx_codec_ctx_t encoder[1]; | 43 | vpx_codec_ctx_t encoder[1]; |
48 | vpx_codec_ctx_t test_encoder[1]; | ||
49 | uint32_t frame_counter; | 44 | uint32_t frame_counter; |
50 | uint32_t test_frame_counter; | ||
51 | 45 | ||
52 | /* decoding */ | 46 | /* decoding */ |
53 | vpx_codec_ctx_t decoder[1]; | 47 | vpx_codec_ctx_t decoder[1]; |
54 | void *vbuf_raw; /* Un-decoded data */ | 48 | void *vbuf_raw; /* Un-decoded data */ |
55 | 49 | ||
56 | /* Data handling */ | ||
57 | uint8_t *frame_buf; /* buffer for split video payloads */ | ||
58 | uint32_t frame_size; /* largest address written to in frame_buf for current input frame */ | ||
59 | uint8_t frameid_in, frameid_out; /* id of input and output video frame */ | ||
60 | uint64_t linfts; /* Last received frame time stamp */ | 50 | uint64_t linfts; /* Last received frame time stamp */ |
61 | uint32_t lcfd; /* Last calculated frame duration for incoming video payload */ | 51 | uint32_t lcfd; /* Last calculated frame duration for incoming video payload */ |
62 | |||
63 | /* Limits */ | ||
64 | uint32_t peer_video_frame_piece_size; | ||
65 | 52 | ||
66 | /* Splitting */ | ||
67 | uint8_t *split_video_frame; | ||
68 | const uint8_t *processing_video_frame; | ||
69 | uint16_t processing_video_frame_size; | ||
70 | |||
71 | ToxAV *av; | 53 | ToxAV *av; |
72 | uint32_t friend_number; | 54 | uint32_t friend_number; |
73 | 55 | ||
74 | PAIR(toxav_video_receive_frame_cb *, void *) vcb; /* Video frame receive callback */ | 56 | PAIR(toxav_video_receive_frame_cb *, void *) vcb; /* Video frame receive callback */ |
75 | 57 | ||
76 | pthread_mutex_t queue_mutex[1]; | 58 | pthread_mutex_t queue_mutex[1]; |
77 | } VCSession; | 59 | } VCSession; |
78 | 60 | ||
79 | /* | 61 | VCSession *vc_new(ToxAV* av, uint32_t friend_number, toxav_video_receive_frame_cb* cb, void* cb_data); |
80 | * Create new Video Codec session. | 62 | void vc_kill(VCSession *vc); |
81 | */ | 63 | void vc_iterate(VCSession *vc); |
82 | VCSession* vc_new(ToxAV* av, uint32_t friend_number, toxav_video_receive_frame_cb *cb, void *cb_data, uint32_t mvfpsz); | 64 | int vc_queue_message(void *vcp, struct RTPMessage *msg); |
83 | /* | 65 | int vc_reconfigure_encoder(vpx_codec_ctx_t *vccdc, uint32_t bit_rate, uint16_t width, uint16_t height); |
84 | * Kill the Video Codec session. | ||
85 | */ | ||
86 | void vc_kill(VCSession* vc); | ||
87 | /* | ||
88 | * Do periodic work. Work is consisted out of decoding only. | ||
89 | */ | ||
90 | void vc_do(VCSession* vc); | ||
91 | /* | ||
92 | * Set new video splitting cycle. This is requirement in order to send video packets. | ||
93 | */ | ||
94 | void vc_init_video_splitter_cycle(VCSession* vc); | ||
95 | /* | ||
96 | * Update the video splitter cycle with new data. | ||
97 | */ | ||
98 | int vc_update_video_splitter_cycle(VCSession* vc, const uint8_t* payload, uint16_t length); | ||
99 | /* | ||
100 | * Iterate over splitted cycle. | ||
101 | */ | ||
102 | const uint8_t *vc_iterate_split_video_frame(VCSession* vc, uint16_t *size); | ||
103 | /* | ||
104 | * Queue new rtp message. | ||
105 | */ | ||
106 | int vc_queue_message(void *vcp, struct RTPMessage_s *msg); | ||
107 | /* | ||
108 | * Set new values to the encoders. | ||
109 | */ | ||
110 | int vc_reconfigure_encoder(vpx_codec_ctx_t* vccdc, uint32_t bit_rate, uint16_t width, uint16_t height); | ||
111 | 66 | ||
112 | #endif /* VIDEO_H */ \ No newline at end of file | 67 | #endif /* VIDEO_H */ |