Skip to content

Instantly share code, notes, and snippets.

@kepstin
Created May 11, 2012 15:23
Show Gist options
  • Save kepstin/2660431 to your computer and use it in GitHub Desktop.
Save kepstin/2660431 to your computer and use it in GitHub Desktop.
Add 'POST' support to HTTP push stream.
From 560d117af2c88bc701cdc01a555de52e8a74527a Mon Sep 17 00:00:00 2001
From: Calvin Walton <calvin.walton@kepstin.ca>
Date: Fri, 11 May 2012 11:15:12 -0400
Subject: [PATCH] Add 'POST' support to HTTP push stream.
This allows ffmpeg's integral http support to be used to push streams
into the streaming server, with a command like:
ffmpeg -f alsa -i default -f v4l2 -s 640x360 -i /dev/video0 \
-c:v libvpx -b:v 500000 -c:a libvorbis -b:a 100000 -f webm \
-headers $'Content-Type:video/webm\r\n' -chunked_post 0 \
http://localhost:8080/push
---
gst-stream-server/gss-server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gst-stream-server/gss-server.c b/gst-stream-server/gss-server.c
index 25205dd..4cc9d30 100644
--- a/gst-stream-server/gss-server.c
+++ b/gst-stream-server/gss-server.c
@@ -1144,7 +1144,7 @@ push_callback (SoupServer * server, SoupMessage * msg,
GssServer *ewserver = (GssServer *) user_data;
const char *content_type;
- if (msg->method != SOUP_METHOD_PUT && strcmp (msg->method, "SOURCE") != 0) {
+ if (!(msg->method == SOUP_METHOD_PUT || msg->method == SOUP_METHOD_POST) && strcmp (msg->method, "SOURCE") != 0) {
soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
return;
}
@@ -1530,7 +1530,7 @@ gss_server_handle_program (SoupServer * server, SoupMessage * msg,
gss_server_handle_program_get (program, server, msg, path, query, client);
return;
}
- if (msg->method == SOUP_METHOD_PUT || strcmp (msg->method, "SOURCE") == 0) {
+ if (msg->method == SOUP_METHOD_PUT || msg->method == SOUP_METHOD_POST || strcmp (msg->method, "SOURCE") == 0) {
gss_server_handle_program_put (program, server, msg, path, query, client);
}
}
--
1.7.9.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment