UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
pbuf.h
Go to the documentation of this file.
1/*
2 * FILE: pbuf.h
3 * AUTHOR: N.Cihan Tas
4 * MODIFIED: Ladan Gharai
5 * Colin Perkins
6 * Martin Benes <martinbenesh@gmail.com>
7 * Lukas Hejtmanek <xhejtman@ics.muni.cz>
8 * Petr Holub <hopet@ics.muni.cz>
9 * Milos Liska <xliska@fi.muni.cz>
10 * Jiri Matela <matela@ics.muni.cz>
11 * Dalibor Matura <255899@mail.muni.cz>
12 * Ian Wesley-Smith <iwsmith@cct.lsu.edu>
13 *
14 * Copyright (c) 2003-2004 University of Southern California
15 * Copyright (c) 2005-2021 CESNET z.s.p.o.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, is permitted provided that the following conditions
19 * are met:
20 *
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 *
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 *
28 * 3. All advertising materials mentioning features or use of this software
29 * must display the following acknowledgement:
30 *
31 * This product includes software developed by the University of Southern
32 * California Information Sciences Institute. This product also includes
33 * software developed by CESNET z.s.p.o.
34 *
35 * 4. Neither the name of the University, Institute, CESNET nor the names of
36 * its contributors may be used to endorse or promote products derived from
37 * this software without specific prior written permission.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
40 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
41 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
42 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
43 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
44 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
45 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
46 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
48 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
49 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
50 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 *
52 * $Revision: 1.5 $
53 * $Date: 2010/01/28 10:06:59 $
54 *
55 */
56
57/******************************************************************************/
58/* The main playout buffer data structures. See "RTP: Audio and Video for the */
59/* Internet" Figure 6.8 (page 167) for a diagram. [csp] */
60/******************************************************************************/
61
62#include "audio/types.h"
63#include "rtp/rtp.h"
64#include "tv.h"
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70/* The coded representation of a single frame */
71struct coded_data {
72 struct coded_data *nxt;
73 struct coded_data *prv;
74 uint16_t seqno;
76};
77
78struct pbuf_stats {
79 long long int received_pkts_cum;
80 long long int expected_pkts_cum;
81};
82
83/* The playout buffer */
84struct pbuf;
85struct state_decoder;
87
93 unsigned int max_frame_size; // maximal frame size
94 // to be returned to caller by a decoder to allow him adjust buffers accordingly
95 unsigned int decoded;
96};
97
100 struct sockaddr_storage source; // network source address
102
104 size_t frame_size;
105};
106
110typedef int decode_frame_t(struct coded_data *cdata, void *decode_data, struct pbuf_stats *stats);
111
112/*
113 * External interface:
114 */
115struct pbuf *pbuf_init(volatile int *delay_ms);
116void pbuf_destroy(struct pbuf *);
117void pbuf_insert(struct pbuf *playout_buf, rtp_packet *r);
118int pbuf_is_empty(struct pbuf *playout_buf);
119int pbuf_decode(struct pbuf *playout_buf, time_ns_t curr_time,
120 decode_frame_t decode_func, void *data);
121 //struct video_frame *framebuffer, int i, struct state_decoder *decoder);
122void pbuf_remove(struct pbuf *playout_buf, time_ns_t curr_time);
123void pbuf_set_playout_delay(struct pbuf *playout_buf, double playout_delay);
124
125#ifdef __cplusplus
126}
127#endif
128
This file contains definition of some common audio types.
void pbuf_destroy(struct pbuf *)
Definition pbuf.c:195
void pbuf_insert(struct pbuf *playout_buf, rtp_packet *r)
Definition pbuf.c:420
int pbuf_decode(struct pbuf *playout_buf, time_ns_t curr_time, decode_frame_t decode_func, void *data)
Definition pbuf.c:562
void pbuf_set_playout_delay(struct pbuf *playout_buf, double playout_delay)
Definition pbuf.c:597
int pbuf_is_empty(struct pbuf *playout_buf)
Definition pbuf.c:553
struct pbuf * pbuf_init(volatile int *delay_ms)
Definition pbuf.c:174
void pbuf_remove(struct pbuf *playout_buf, time_ns_t curr_time)
Definition pbuf.c:498
int decode_frame_t(struct coded_data *cdata, void *decode_data, struct pbuf_stats *stats)
Definition pbuf.h:110
rtp_packet
Definition rtp.h:126
Definition rtp.c:206
struct used to comunicate with audio capture/playback device
Definition types.h:99
rtp_packet * data
Definition pbuf.h:75
struct coded_data * nxt
Definition pbuf.h:72
struct coded_data * prv
Definition pbuf.h:73
uint16_t seqno
Definition pbuf.h:74
size_t frame_size
currently decoded audio frame size (used similarly as vcodec_state::max_frame_size to allow caller ad...
Definition pbuf.h:104
struct state_audio_decoder * decoder
Definition pbuf.h:101
bool reconfigured
Definition pbuf.h:103
audio_frame buffer
Definition pbuf.h:99
long long int received_pkts_cum
Definition pbuf.h:79
long long int expected_pkts_cum
Definition pbuf.h:80
Definition pbuf.c:96
unsigned int decoded
Definition pbuf.h:95
unsigned int max_frame_size
Definition pbuf.h:93
struct state_video_decoder * decoder
Definition pbuf.h:92
long long time_ns_t
Definition tv.h:81