[pulseaudio-commits] r2402 - in /branches/coling/airtunes/src/modules/rtp: raop_client.c raop_client.h rtsp_client.c rtsp_client.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sun May 11 07:18:48 PDT 2008
Author: coling
Date: Sun May 11 16:18:48 2008
New Revision: 2402
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2402&root=pulseaudio&view=rev
Log:
Add a new callback structure to propigate when the RTSP connection dies
Modified:
branches/coling/airtunes/src/modules/rtp/raop_client.c
branches/coling/airtunes/src/modules/rtp/raop_client.h
branches/coling/airtunes/src/modules/rtp/rtsp_client.c
branches/coling/airtunes/src/modules/rtp/rtsp_client.h
Modified: branches/coling/airtunes/src/modules/rtp/raop_client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/raop_client.c?rev=2402&root=pulseaudio&r1=2401&r2=2402&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/raop_client.c (original)
+++ branches/coling/airtunes/src/modules/rtp/raop_client.c Sun May 11 16:18:48 2008
@@ -89,8 +89,11 @@
pa_socket_client *sc;
int fd;
+
pa_raop_client_cb_t callback;
void* userdata;
+ pa_raop_client_closed_cb_t closed_callback;
+ void* closed_userdata;
uint8_t *buffer;
uint32_t buffer_length;
@@ -339,6 +342,19 @@
case STATE_SET_PARAMETER:
case STATE_FLUSH:
break;
+ case STATE_DISCONNECTED:
+ pa_assert(c->closed_callback);
+ pa_log_debug("RTSP channel closed");
+ if (c->fd > 0) {
+ pa_close(c->fd);
+ c->fd = -1;
+ }
+ if (c->sc) {
+ pa_socket_client_unref(c->sc);
+ c->sc = NULL;
+ }
+ c->closed_callback(c->closed_userdata);
+ break;
}
}
@@ -437,7 +453,6 @@
c->buffer = pa_xrealloc(c->buffer, bufmax);
c->buffer_length = bufmax;
- pa_log_debug("Creating new memblock");
c->memchunk.memblock = pa_memblock_new_user(mempool, c->buffer, bufmax, noop, 0);
}
c->memchunk.index = 0;
@@ -499,3 +514,11 @@
c->callback = callback;
c->userdata = userdata;
}
+
+void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata)
+{
+ pa_assert(c);
+
+ c->closed_callback = callback;
+ c->closed_userdata = userdata;
+}
Modified: branches/coling/airtunes/src/modules/rtp/raop_client.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/raop_client.h?rev=2402&root=pulseaudio&r1=2401&r2=2402&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/raop_client.h (original)
+++ branches/coling/airtunes/src/modules/rtp/raop_client.h Sun May 11 16:18:48 2008
@@ -38,4 +38,7 @@
typedef void (*pa_raop_client_cb_t)(int fd, void *userdata);
void pa_raop_client_set_callback(pa_raop_client* c, pa_raop_client_cb_t callback, void *userdata);
+typedef void (*pa_raop_client_closed_cb_t)(void *userdata);
+void pa_raop_client_set_closed_callback(pa_raop_client* c, pa_raop_client_closed_cb_t callback, void *userdata);
+
#endif
Modified: branches/coling/airtunes/src/modules/rtp/rtsp_client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/rtsp_client.c?rev=2402&root=pulseaudio&r1=2401&r2=2402&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/rtsp_client.c (original)
+++ branches/coling/airtunes/src/modules/rtp/rtsp_client.c Sun May 11 16:18:48 2008
@@ -173,6 +173,7 @@
pa_assert(c);
pa_assert(c->response_headers);
+ pa_assert(c->callback);
/* Deal with a SETUP response */
if (STATE_SETUP == c->state) {
@@ -209,8 +210,7 @@
}
/* Call our callback */
- if (c->callback)
- c->callback(c, c->state, c->response_headers, c->userdata);
+ c->callback(c, c->state, c->response_headers, c->userdata);
pa_headerlist_free(c->response_headers);
c->response_headers = NULL;
@@ -224,12 +224,13 @@
pa_rtsp_client *c = userdata;
pa_assert(line);
pa_assert(c);
+ pa_assert(c->callback);
if (!s) {
- pa_log_warn("Connection closed");
pa_ioline_unref(c->ioline);
c->ioline = NULL;
pa_rtsp_disconnect(c);
+ c->callback(c, STATE_DISCONNECTED, NULL, c->userdata);
return;
}
Modified: branches/coling/airtunes/src/modules/rtp/rtsp_client.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/rtsp_client.h?rev=2402&root=pulseaudio&r1=2401&r2=2402&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/rtsp_client.h (original)
+++ branches/coling/airtunes/src/modules/rtp/rtsp_client.h Sun May 11 16:18:48 2008
@@ -44,7 +44,8 @@
STATE_RECORD,
STATE_TEARDOWN,
STATE_SET_PARAMETER,
- STATE_FLUSH
+ STATE_FLUSH,
+ STATE_DISCONNECTED
} pa_rtsp_state;
typedef void (*pa_rtsp_cb_t)(pa_rtsp_client *c, pa_rtsp_state state, pa_headerlist* hl, void *userdata);
More information about the pulseaudio-commits
mailing list