summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jingle/libjingle/talk/third_party/mediastreamer/mediastream.h
blob: 4cf9f425483beb7e68637d0431c0825bf610c38d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
  The mediastreamer library aims at providing modular media processing and I/O
	for linphone, but also for any telephony application.
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
  										
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/


#ifndef MEDIASTREAM_H
#define MEDIASTREAM_H

#include "msrtprecv.h"
#include "msrtpsend.h"
#include "ms.h"
#include "msosswrite.h"
#include "msossread.h"
#include "msread.h"
#include "mswrite.h"
#include "mstimer.h"
#include "mscodec.h"
#ifdef HAVE_SPEEX
#include "msspeexdec.h"
#endif
#include "msringplayer.h"


struct _AudioStream
{
	MSSync *timer;
	RtpSession *send_session;
	RtpSession *recv_session;
	MSFilter *soundread;
	MSFilter *soundwrite;
	MSFilter *encoder;
	MSFilter *decoder;
	MSFilter *rtprecv;
	MSFilter *rtpsend;
};


typedef struct _AudioStream AudioStream;

struct _RingStream
{
	MSSync *timer;
	MSFilter *source;
	MSFilter *sndwrite;
};

typedef struct _RingStream RingStream;

/* start a thread that does sampling->encoding->rtp_sending|rtp_receiving->decoding->playing */
AudioStream *audio_stream_start (RtpProfile * prof, int locport, char *remip,
				 int remport, int profile, int jitt_comp);

AudioStream *audio_stream_start_with_sndcards(RtpProfile * prof, int locport, char *remip4,
				 int remport, int profile, int jitt_comp, SndCard *playcard, SndCard *captcard);

AudioStream *audio_stream_start_with_files (RtpProfile * prof, int locport,
					    char *remip4, int remport,
					    int profile, int jitt_comp,
					    gchar * infile, gchar * outfile);
void audio_stream_set_rtcp_information(AudioStream *st, const char *cname);


/* stop the above process*/
void audio_stream_stop (AudioStream * stream);

RingStream *ring_start (gchar * file, gint interval, SndCard *sndcard);
RingStream *ring_start_with_cb(gchar * file, gint interval, SndCard *sndcard, MSFilterNotifyFunc func,gpointer user_data);
void ring_stop (RingStream * stream);

/* returns the latency in samples if the audio device with id dev_id is openable in full duplex mode, else 0 */
gint test_audio_dev (int dev_id);

/* send a dtmf */
gint audio_stream_send_dtmf (AudioStream * stream, gchar dtmf);

void audio_stream_set_default_card(int cardindex);


#ifdef VIDEO_ENABLED

/*****************
  Video Support
 *****************/



struct _VideoStream
{
	MSSync *timer;
	RtpSession *send_session;
	RtpSession *recv_session;
	MSFilter *source;
	MSFilter *output;
	MSFilter *encoder;
	MSFilter *decoder;
	MSFilter *rtprecv;
	MSFilter *rtpsend;
	gboolean show_local;
};


typedef struct _VideoStream VideoStream;

VideoStream *video_stream_start(RtpProfile *profile, int locport, char *remip4, int remport,
				      int payload, int jitt_comp, gboolean show_local, const gchar *source, const gchar *device);
void video_stream_set_rtcp_information(VideoStream *st, const char *cname);
void video_stream_stop (VideoStream * stream);

VideoStream * video_preview_start(const gchar *source, const gchar *device);
void video_preview_stop(VideoStream *stream);

#endif

#endif