1.1 --- a/gmyth-stream/gmemcoder/src/gmencoder.c Sat Jun 30 00:25:48 2007 +0100
1.2 +++ b/gmyth-stream/gmemcoder/src/gmencoder.c Tue Jul 03 21:20:15 2007 +0100
1.3 @@ -51,6 +51,7 @@
1.4 gint sources;
1.5 gint tick_id;
1.6 gint64 duration;
1.7 + gboolean send_chunked;
1.8 #ifdef USE_MANUAL_SINK
1.9 GByteArray *queue;
1.10 #endif
1.11 @@ -464,6 +465,7 @@
1.12
1.13 gboolean
1.14 g_mencoder_setup_stream(GMencoder * self,
1.15 + gboolean chunked,
1.16 const gchar * mux_name,
1.17 const gchar * video_encode,
1.18 gchar ** video_encode_prop,
1.19 @@ -487,6 +489,7 @@
1.20 return FALSE;
1.21
1.22 priv->sources = 0;
1.23 + priv->send_chunked = chunked;
1.24 priv->pipe = _create_pipeline(self,
1.25 video_encode,
1.26 mux_name,
1.27 @@ -902,7 +905,8 @@
1.28 i = g_strsplit(uri, "://", 0);
1.29 if (strcmp(i[0], "fd") == 0) {
1.30 priv->fd = atoi(i[1]);
1.31 - fcntl (priv->fd, F_SETFL, O_ASYNC);
1.32 + if (priv->send_chunked)
1.33 + fcntl (priv->fd, F_SETFL, O_ASYNC);
1.34 } else if (strcmp(i[0], "file") == 0) {
1.35 if (g_file_test (i[1], G_FILE_TEST_EXISTS)) {
1.36 if (unlink (i[1]) != 0) {
1.37 @@ -1134,9 +1138,14 @@
1.38
1.39 priv->queue = g_byte_array_append (priv->queue, GST_BUFFER_DATA (buff), GST_BUFFER_SIZE (buff));
1.40 while (priv->queue->len >= BUFFER_SIZE) {
1.41 - //g_usleep (0.2 * G_USEC_PER_SEC);
1.42 - if (_send_buffer (priv->fd, priv->queue->data, BUFFER_SIZE) == FALSE)
1.43 - goto error;
1.44 + //g_usleep (0.2 * G_USEC_PER_SEC);
1.45 + if (priv->send_chunked) {
1.46 + if (_send_buffer (priv->fd, priv->queue->data, BUFFER_SIZE) == FALSE)
1.47 + goto error;
1.48 + } else {
1.49 + if (write (priv->fd, priv->queue->data, BUFFER_SIZE) == -1)
1.50 + goto error;
1.51 + }
1.52 priv->queue = g_byte_array_remove_range (priv->queue, 0, BUFFER_SIZE);
1.53 }
1.54 return;