diff -r 1be4b68bfb0e -r 1603bc7804da gmyth-stream/gmemcoder/src/gmencoder.c --- a/gmyth-stream/gmemcoder/src/gmencoder.c Sat Jun 30 00:25:48 2007 +0100 +++ b/gmyth-stream/gmemcoder/src/gmencoder.c Tue Jul 03 21:20:15 2007 +0100 @@ -51,6 +51,7 @@ gint sources; gint tick_id; gint64 duration; + gboolean send_chunked; #ifdef USE_MANUAL_SINK GByteArray *queue; #endif @@ -464,6 +465,7 @@ gboolean g_mencoder_setup_stream(GMencoder * self, + gboolean chunked, const gchar * mux_name, const gchar * video_encode, gchar ** video_encode_prop, @@ -487,6 +489,7 @@ return FALSE; priv->sources = 0; + priv->send_chunked = chunked; priv->pipe = _create_pipeline(self, video_encode, mux_name, @@ -902,7 +905,8 @@ i = g_strsplit(uri, "://", 0); if (strcmp(i[0], "fd") == 0) { priv->fd = atoi(i[1]); - fcntl (priv->fd, F_SETFL, O_ASYNC); + if (priv->send_chunked) + fcntl (priv->fd, F_SETFL, O_ASYNC); } else if (strcmp(i[0], "file") == 0) { if (g_file_test (i[1], G_FILE_TEST_EXISTS)) { if (unlink (i[1]) != 0) { @@ -1134,9 +1138,14 @@ priv->queue = g_byte_array_append (priv->queue, GST_BUFFER_DATA (buff), GST_BUFFER_SIZE (buff)); while (priv->queue->len >= BUFFER_SIZE) { - //g_usleep (0.2 * G_USEC_PER_SEC); - if (_send_buffer (priv->fd, priv->queue->data, BUFFER_SIZE) == FALSE) - goto error; + //g_usleep (0.2 * G_USEC_PER_SEC); + if (priv->send_chunked) { + if (_send_buffer (priv->fd, priv->queue->data, BUFFER_SIZE) == FALSE) + goto error; + } else { + if (write (priv->fd, priv->queue->data, BUFFER_SIZE) == -1) + goto error; + } priv->queue = g_byte_array_remove_range (priv->queue, 0, BUFFER_SIZE); } return;