diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 50 |
1 files changed, 16 insertions, 34 deletions
@@ -104,38 +104,6 @@ err: goto out; } -static GstFlowReturn -write_first_client_chunk_cb (GstElement *appsink, - TranscodeClientCtx *ctx) -{ - GstMapInfo info; - GstSample *sample; - GstBuffer *buffer; - GstMemory *memory; - - g_assert (ctx->first_sample_handler_id); - - g_signal_handler_disconnect (appsink, ctx->first_sample_handler_id); - ctx->first_sample_handler_id = 0; - - /* XXX: If no samples are available, this will block till a sample is available */ - g_signal_emit_by_name (appsink, "pull-sample", &sample); - buffer = gst_sample_get_buffer (sample); - memory = gst_buffer_get_all_memory (buffer); /* copy */ - gst_memory_map (memory, &info, GST_MAP_READ); - - soup_message_body_append (ctx->msg->response_body, SOUP_MEMORY_COPY, - info.data, info.size); /* copy */ - - gst_memory_unmap (memory, &info); - gst_memory_unref (memory); - gst_sample_unref (sample); - - soup_server_unpause_message (server, ctx->msg); - g_print ("."); - return GST_FLOW_OK; -} - static void write_next_client_chunk_cb (SoupMessage *msg, TranscodeClientCtx *ctx) @@ -174,6 +142,20 @@ write_next_client_chunk_cb (SoupMessage *msg, return; } +static GstFlowReturn +write_first_client_chunk_cb (GstElement *appsink, + TranscodeClientCtx *ctx) +{ + g_assert (ctx->first_sample_handler_id); + + //g_signal_handler_disconnect (appsink, ctx->first_sample_handler_id); + //ctx->first_sample_handler_id = 0; + + write_next_client_chunk_cb (ctx->msg, ctx); + + return GST_FLOW_OK; +} + static void client_finished_cb (SoupMessage *msg, TranscodeClientCtx *ctx) @@ -298,8 +280,8 @@ GET: client_ctx->first_sample_handler_id = g_signal_connect (appsink, "new-sample", G_CALLBACK (write_first_client_chunk_cb), client_ctx); - g_signal_connect (client_ctx->msg, "wrote-chunk", - G_CALLBACK (write_next_client_chunk_cb), client_ctx); + /*g_signal_connect (client_ctx->msg, "wrote-chunk", + G_CALLBACK (write_next_client_chunk_cb), client_ctx);*/ g_signal_connect (client_ctx->msg, "finished", G_CALLBACK (client_finished_cb), client_ctx); |