12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Lesser General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2.1 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Lesser General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Lesser General Public
|
|
17 License along with this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 #ifndef MSRINGPLAYER_H
|
|
22 #define MSRINGPLAYER_H
|
|
23
|
|
24 #include "msfilter.h"
|
|
25 #include "mssync.h"
|
|
26
|
|
27
|
|
28 /*this is the class that implements file reading source filter*/
|
|
29
|
|
30 #define MS_RING_PLAYER_MAX_OUTPUTS 1 /* max output per filter*/
|
|
31
|
|
32 #define MS_RING_PLAYER_DEF_GRAN 8192 /* the default granularity*/
|
|
33
|
|
34 #define MS_RING_PLAYER_END_OF_RING_EVENT 1
|
|
35
|
|
36 struct _MSRingPlayer
|
|
37 {
|
|
38 /* the MSRingPlayer derivates from MSFilter, so the MSFilter object MUST be the first of the MSRingPlayer object
|
|
39 in order to the object mechanism to work*/
|
|
40 MSFilter filter;
|
|
41 MSFifo *foutputs[MS_RING_PLAYER_MAX_OUTPUTS];
|
|
42 MSQueue *qoutputs[MS_RING_PLAYER_MAX_OUTPUTS];\
|
|
43 MSSync *sync;
|
|
44 gint gran;
|
|
45 gint freq;
|
|
46 gint rate;
|
|
47 gint channel; /* number of interleaved channels */
|
|
48 gint silence; /* silence time between each ring, in seconds */
|
|
49 gint state;
|
|
50 gint fd; /* the file descriptor of the file being read*/
|
|
51 gint silence_bytes; /*silence in number of bytes between each ring */
|
|
52 gint current_pos;
|
|
53 gint need_swap;
|
|
54 };
|
|
55
|
|
56 typedef struct _MSRingPlayer MSRingPlayer;
|
|
57
|
|
58 struct _MSRingPlayerClass
|
|
59 {
|
|
60 /* the MSRingPlayer derivates from MSFilter, so the MSFilter class MUST be the first of the MSRingPlayer class
|
|
61 in order to the class mechanism to work*/
|
|
62 MSFilterClass parent_class;
|
|
63 };
|
|
64
|
|
65 typedef struct _MSRingPlayerClass MSRingPlayerClass;
|
|
66
|
|
67 /* PUBLIC */
|
|
68 #define MS_RING_PLAYER(filter) ((MSRingPlayer*)(filter))
|
|
69 #define MS_RING_PLAYER_CLASS(klass) ((MSRingPlayerClass*)(klass))
|
|
70 MSFilter * ms_ring_player_new(char *name, gint seconds);
|
|
71 gint ms_ring_player_get_sample_freq(MSRingPlayer *obj);
|
|
72
|
|
73
|
|
74 /* FOR INTERNAL USE*/
|
|
75 void ms_ring_player_init(MSRingPlayer *r);
|
|
76 void ms_ring_player_class_init(MSRingPlayerClass *klass);
|
|
77 void ms_ring_player_destroy( MSRingPlayer *obj);
|
|
78 void ms_ring_player_process(MSRingPlayer *r);
|
|
79 #define ms_ring_player_set_bufsize(filter,sz) (filter)->gran=(sz)
|
|
80 void ms_ring_player_setup(MSRingPlayer *r,MSSync *sync);
|
|
81 #endif
|