1#ifndef foortspclienthfoo
2#define foortspclienthfoo
3
4/***
5  This file is part of PulseAudio.
6
7  Copyright 2008 Colin Guthrie
8
9  PulseAudio is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published
11  by the Free Software Foundation; either version 2.1 of the License,
12  or (at your option) any later version.
13
14  PulseAudio is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU Lesser General Public License
20  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include <inttypes.h>
24#include <sys/socket.h>
25#include <sys/types.h>
26#include <netdb.h>
27
28#include <pulsecore/socket-client.h>
29#include <pulse/mainloop-api.h>
30
31#include "headerlist.h"
32
33typedef struct pa_rtsp_client pa_rtsp_client;
34
35typedef enum pa_rtsp_state {
36  STATE_CONNECT,
37  STATE_OPTIONS,
38  STATE_ANNOUNCE,
39  STATE_SETUP,
40  STATE_RECORD,
41  STATE_SET_PARAMETER,
42  STATE_FLUSH,
43  STATE_TEARDOWN,
44  STATE_DISCONNECTED
45} pa_rtsp_state_t;
46
47typedef enum pa_rtsp_status {
48  STATUS_OK             = 200,
49  STATUS_BAD_REQUEST    = 400,
50  STATUS_UNAUTHORIZED   = 401,
51  STATUS_NO_RESPONSE    = 444,
52  STATUS_INTERNAL_ERROR = 500
53} pa_rtsp_status_t;
54
55typedef void (*pa_rtsp_cb_t)(pa_rtsp_client *c, pa_rtsp_state_t state, pa_rtsp_status_t code, pa_headerlist *headers, void *userdata);
56
57pa_rtsp_client* pa_rtsp_client_new(pa_mainloop_api *mainloop, const char *hostname, uint16_t port, const char *useragent, bool autoreconnect);
58void pa_rtsp_client_free(pa_rtsp_client *c);
59
60int pa_rtsp_connect(pa_rtsp_client *c);
61void pa_rtsp_set_callback(pa_rtsp_client *c, pa_rtsp_cb_t callback, void *userdata);
62void pa_rtsp_disconnect(pa_rtsp_client *c);
63
64const char* pa_rtsp_localip(pa_rtsp_client *c);
65uint32_t pa_rtsp_serverport(pa_rtsp_client *c);
66bool pa_rtsp_exec_ready(const pa_rtsp_client *c);
67
68void pa_rtsp_set_url(pa_rtsp_client *c, const char *url);
69
70bool pa_rtsp_has_header(pa_rtsp_client *c, const char *key);
71void pa_rtsp_add_header(pa_rtsp_client *c, const char *key, const char *value);
72const char* pa_rtsp_get_header(pa_rtsp_client *c, const char *key);
73void pa_rtsp_remove_header(pa_rtsp_client *c, const char *key);
74
75int pa_rtsp_options(pa_rtsp_client *c);
76int pa_rtsp_announce(pa_rtsp_client *c, const char *sdp);
77int pa_rtsp_setup(pa_rtsp_client *c, const char *transport);
78int pa_rtsp_record(pa_rtsp_client *c, uint16_t *seq, uint32_t *rtptime);
79int pa_rtsp_setparameter(pa_rtsp_client *c, const char *param);
80int pa_rtsp_flush(pa_rtsp_client *c, uint16_t seq, uint32_t rtptime);
81int pa_rtsp_teardown(pa_rtsp_client *c);
82
83#endif
84