]> code.delx.au - pulseaudio/commitdiff
sink-input: Add a format-lost event
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 28 Mar 2011 03:16:40 +0000 (08:46 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Sun, 15 May 2011 04:39:34 +0000 (10:09 +0530)
This event is emitted if the sink-input could not be moved to a new sink
because it doesn't support the format of the sink-input. Clients can
reconnect their stream with a different format if they wish or
gracefully exit.

src/pulse/def.h
src/pulsecore/sink-input.c

index 91a027e3480f228fc0d59332fa91f10d13c4cbf7..e01e667f12ed1da21bf9ee2931f0b5646c71455f 100644 (file)
@@ -912,6 +912,13 @@ typedef void (*pa_free_cb_t)(void *p);
  * information, \since 0.9.15 */
 #define PA_STREAM_EVENT_REQUEST_UNCORK "request-uncork"
 
+/** A stream event notifying that the stream is going to be
+ * disconnected because the underlying sink changed and no longer
+ * supports the format that was originally negotiated. Clients need
+ * to connect a new stream to renegotiate a format and continue
+ * playback, \since 1.0 */
+#define PA_STREAM_EVENT_FORMAT_LOST "format-lost"
+
 PA_C_DECL_END
 
 #endif
index 196d7712077213aea8e297b04f8fdeb149e3d5e0..f0558f4015c60139dd39e51d4ff814ed27f38c4a 100644 (file)
@@ -1594,7 +1594,8 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
         return -PA_ERR_NOTSUPPORTED;
 
     if (pa_sink_input_is_passthrough(i) && !pa_sink_check_format(dest, i->format)) {
-        /* FIXME: Fire a message here so the client can renegotiate */
+        pa_log_debug("New sink doesn't support stream format, sending format-changed and killing");
+        pa_sink_input_send_event(i, PA_STREAM_EVENT_FORMAT_LOST, NULL);
         return -PA_ERR_NOTSUPPORTED;
     }