Move closer to an asynchronous structure (still some parsing code to be converted).
[platform/upstream/pulseaudio.git] / src / modules / rtp / rtsp.h
1 #ifndef foortsphfoo
2 #define foortsphfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of PulseAudio.
8
9   Copyright 2008 Colin Guthrie
10
11   PulseAudio is free software; you can redistribute it and/or modify
12   it under the terms of the GNU Lesser General Public License as published
13   by the Free Software Foundation; either version 2 of the License,
14   or (at your option) any later version.
15
16   PulseAudio is distributed in the hope that it will be useful, but
17   WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   General Public License for more details.
20
21   You should have received a copy of the GNU Lesser General Public License
22   along with PulseAudio; if not, write to the Free Software
23   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24   USA.
25 ***/
26
27 #include <inttypes.h>
28 #include <sys/socket.h>
29 #include <sys/types.h>
30 #include <netdb.h>
31
32 #include <pulsecore/memblockq.h>
33 #include <pulsecore/memchunk.h>
34 #include <pulsecore/socket-client.h>
35 #include <pulse/mainloop-api.h>
36
37 #include "headerlist.h"
38
39 typedef struct pa_rtsp_context pa_rtsp_context;
40 typedef enum {
41   STATE_CONNECT,
42   STATE_ANNOUNCE,
43   STATE_SETUP,
44   STATE_RECORD,
45   STATE_TEARDOWN,
46   STATE_SET_PARAMETER,
47   STATE_FLUSH
48 } pa_rtsp_state;
49 typedef void (*pa_rtsp_cb_t)(pa_rtsp_context *c, pa_rtsp_state state, pa_headerlist* hl, void *userdata);
50
51 pa_rtsp_context* pa_rtsp_context_new(const char* useragent);
52 void pa_rtsp_context_free(pa_rtsp_context* c);
53
54 int pa_rtsp_connect(pa_rtsp_context* c, pa_mainloop_api *mainloop, const char* hostname, uint16_t port);
55 void pa_rtsp_set_callback(pa_rtsp_context *c, pa_rtsp_cb_t callback, void *userdata);
56
57 void pa_rtsp_disconnect(pa_rtsp_context* c);
58
59 const char* pa_rtsp_localip(pa_rtsp_context* c);
60 uint32_t pa_rtsp_serverport(pa_rtsp_context* c);
61 void pa_rtsp_set_url(pa_rtsp_context* c, const char* url);
62 void pa_rtsp_add_header(pa_rtsp_context *c, const char* key, const char* value);
63 void pa_rtsp_remove_header(pa_rtsp_context *c, const char* key);
64
65 int pa_rtsp_announce(pa_rtsp_context* c, const char* sdp);
66
67 int pa_rtsp_setup(pa_rtsp_context* c);
68 int pa_rtsp_record(pa_rtsp_context* c);
69 int pa_rtsp_teardown(pa_rtsp_context* c);
70
71 int pa_rtsp_setparameter(pa_rtsp_context* c, const char* param);
72 int pa_rtsp_flush(pa_rtsp_context* c);
73
74 #endif