root/rat/trunk/playout.h @ 2240

Revision 2240, 4.6 KB (checked in by ucacoxh, 15 years ago)

- Added back functions to get playout delay and amount of audio buffered.

NB initial playout delay estimate looks high at home, but this could
be related to link.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2 * FILE:    playout.h
3 * AUTHORS: Orion Hodson
4 *
5 * $Revision$
6 * $Date$
7 *
8 * Copyright (c) 1999 University College London
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, is permitted, for non-commercial use only, provided
13 * that the following conditions are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 *    must display the following acknowledgement:
21 *      This product includes software developed by the Computer Science
22 *      Department at University College London
23 * 4. Neither the name of the University nor of the Department may be used
24 *    to endorse or promote products derived from this software without
25 *    specific prior written permission.
26 * Use of this software for commercial purposes is explicitly forbidden
27 * unless prior written permission is obtained from the authors.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 */
41
42
43#ifndef __UCLMM_PLAYOUT_BUFFER_H__
44#define __UCLMM_PLAYOUT_BUFFER_H__
45
46#include "ts.h"
47
48struct  s_pb;
49struct  s_pb_iterator;
50
51typedef void (*playoutfreeproc)(u_char**, u_int32);
52
53/* All functions return TRUE on success, and FALSE on failure */
54int pb_create  (struct s_pb     **pb,
55                playoutfreeproc   callback);
56
57int pb_destroy (struct s_pb **pb);
58
59int pb_add    (struct s_pb *pb,
60               u_char*      data,
61               u_int32      datalen,
62               ts_t         playout);
63
64void pb_flush (struct s_pb *pb);
65
66/*
67 * These following three functions return data stored in the playout buffer. 
68 * The playout buffer has a playout point iterator.  playout_buffer_get
69 * returns the data at that point, advance steps to the next unit and
70 * returns that, and rewind steps to the previous unit
71 * and returns that.
72 */
73
74int
75pb_iterator_create (struct s_pb           *pb,
76                 struct s_pb_iterator **pbi);
77 
78void
79pb_iterator_destroy (struct s_pb           *pb,
80                     struct s_pb_iterator **pbi);
81
82int
83pb_iterator_dup (struct s_pb_iterator **pbi_dst,
84                 struct s_pb_iterator *pbi_src);
85
86int
87pb_iterator_get_at (struct s_pb_iterator *pbi,
88                    u_char              **data,
89                    u_int32              *datalen,
90                    ts_t                 *playout);
91
92int
93pb_iterator_detach_at (struct s_pb_iterator *pbi,
94                       u_char              **data,
95                       u_int32              *datalen,
96                       ts_t                 *playout);
97
98/* Single step movements */
99int
100pb_iterator_advance (struct s_pb_iterator *pbi);
101
102int
103pb_iterator_retreat (struct s_pb_iterator *pbi);
104
105/* Shift to head / tail */
106
107int
108pb_iterator_ffwd (struct s_pb_iterator *pbi);
109
110int
111pb_iterator_rwd  (struct s_pb_iterator *pbi);
112
113/* Trims data more than history_len before iterator */
114int 
115pb_iterator_audit (struct s_pb_iterator *pi,
116                   ts_t                  history_len);
117
118/* Return whether 2 iterators refer to same time interval */
119int
120pb_iterators_equal(struct s_pb_iterator *pi1,
121                   struct s_pb_iterator *pi2);
122
123/* Returns whether playout buffer has data to be played out */
124int 
125pb_relevant (struct s_pb *pb,
126             ts_t         now);
127
128/* Return the times of interest for playout buffer in ts, returns
129 * TRUE or FALSE depending on whether request successful
130 */
131__inline int pb_get_start_ts     (struct s_pb *pb, ts_t *ts);
132__inline int pb_get_end_ts       (struct s_pb *pb, ts_t *ts);
133__inline int pb_iterator_get_ts  (struct s_pb_iterator *pbi, ts_t *ts);
134
135#endif /* __UCLMM_PLAYOUT_BUFFER_H__ */
Note: See TracBrowser for help on using the browser.