aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/encoder_plugin.h2
-rw-r--r--src/output/recorder_output_plugin.c19
-rw-r--r--src/output/shout_output_plugin.c18
4 files changed, 24 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index a78002e97..c08a779e0 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ ver 0.17.3 (2012/??/??)
* output:
- recorder: fix I/O error check
- shout: fix memory leak in error handler
+ - recorder, shout: support Ogg packets that span more than one page
ver 0.17.2 (2012/09/30)
* protocol:
diff --git a/src/encoder_plugin.h b/src/encoder_plugin.h
index cae0c8048..3a42d79f4 100644
--- a/src/encoder_plugin.h
+++ b/src/encoder_plugin.h
@@ -295,6 +295,8 @@ encoder_write(struct encoder *encoder, const void *data, size_t length,
/**
* Reads encoded data from the encoder.
*
+ * Call this repeatedly until no more data is returned.
+ *
* @param encoder the encoder
* @param dest the destination buffer to copy to
* @param length the maximum length of the destination buffer
diff --git a/src/output/recorder_output_plugin.c b/src/output/recorder_output_plugin.c
index ac4a52107..b84cb244c 100644
--- a/src/output/recorder_output_plugin.c
+++ b/src/output/recorder_output_plugin.c
@@ -160,17 +160,20 @@ recorder_output_encoder_to_file(struct recorder_output *recorder,
{
assert(recorder->fd >= 0);
- /* read from the encoder */
+ while (true) {
+ /* read from the encoder */
- size_t size = encoder_read(recorder->encoder, recorder->buffer,
- sizeof(recorder->buffer));
- if (size == 0)
- return true;
+ size_t size = encoder_read(recorder->encoder, recorder->buffer,
+ sizeof(recorder->buffer));
+ if (size == 0)
+ return true;
- /* write everything into the file */
+ /* write everything into the file */
- return recorder_write_to_file(recorder, recorder->buffer, size,
- error_r);
+ if (!recorder_write_to_file(recorder, recorder->buffer, size,
+ error_r))
+ return false;
+ }
}
static bool
diff --git a/src/output/shout_output_plugin.c b/src/output/shout_output_plugin.c
index 63f1001ba..56456a0ea 100644
--- a/src/output/shout_output_plugin.c
+++ b/src/output/shout_output_plugin.c
@@ -342,14 +342,16 @@ write_page(struct shout_data *sd, GError **error)
{
assert(sd->encoder != NULL);
- size_t nbytes = encoder_read(sd->encoder,
- sd->buffer, sizeof(sd->buffer));
- if (nbytes == 0)
- return true;
-
- int err = shout_send(sd->shout_conn, sd->buffer, nbytes);
- if (!handle_shout_error(sd, err, error))
- return false;
+ while (true) {
+ size_t nbytes = encoder_read(sd->encoder,
+ sd->buffer, sizeof(sd->buffer));
+ if (nbytes == 0)
+ return true;
+
+ int err = shout_send(sd->shout_conn, sd->buffer, nbytes);
+ if (!handle_shout_error(sd, err, error))
+ return false;
+ }
return true;
}