diff mbox

[FFmpeg-devel,10/17] configreader.c/.h/httpd.h: Add hls and dash, slightly change httpd interface, remove publisher.h include

Message ID 20180628005117.18902-11-klaxa1337@googlemail.com
State New
Headers show

Commit Message

Stephan Holljes June 28, 2018, 12:51 a.m. UTC
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
---
 configreader.c | 8 ++++++--
 configreader.h | 1 +
 httpd.h        | 9 +++++----
 3 files changed, 12 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/configreader.c b/configreader.c
index 3f5b896..966dc84 100644
--- a/configreader.c
+++ b/configreader.c
@@ -27,7 +27,7 @@ 
 #include <libavutil/mem.h>
 #include <libavutil/error.h>
 
-const char *stream_format_names[] = { "mkv" };
+const char *stream_format_names[] = { "mkv", "hls", "dash" };
 
 static struct HTTPDConfig *parsed_configs = NULL;
 
@@ -152,8 +152,12 @@  int configs_parse(lua_State *L)
                                 return luaL_error(L, "Error could not allocate stream formats");
                             }
                             key = lua_tostring(L, -1);
-                            if (!strncmp("mkv", key, 3)) {
+                            if (!strcmp("mkv", key)) {
                                 stream->formats[nb_formats++] = FMT_MATROSKA;
+                            } else if (!strcmp("hls", key)) {
+                                stream->formats[nb_formats++] = FMT_HLS;
+                            } else if (!strcmp("dash", key)) {
+                                stream->formats[nb_formats++] = FMT_DASH;
                             } else {
                                 fprintf(stderr, "Warning unknown format (%s) in stream format configuration.\n",
                                                                                                            key);
diff --git a/configreader.h b/configreader.h
index 38a3ea5..2e49999 100644
--- a/configreader.h
+++ b/configreader.h
@@ -20,6 +20,7 @@ 
 #define CONFIGREADER_H
 
 #include "httpd.h"
+#include <stdio.h>
 
 /**
  * Read configurations from a file using the lua format. The configurations
diff --git a/httpd.h b/httpd.h
index 83535e0..a988916 100644
--- a/httpd.h
+++ b/httpd.h
@@ -24,11 +24,11 @@ 
 #define HTTPD_CLIENT_ERROR -2
 #define HTTPD_OTHER_ERROR -3
 
-#include "publisher.h"
-
-/** Supported stream formats, for now only matroska */
+/** Supported stream formats */
 enum StreamFormat {
     FMT_MATROSKA = 0,
+    FMT_HLS,
+    FMT_DASH,
     FMT_NB,
 };
 
@@ -60,11 +60,12 @@  struct HTTPClient {
     void *httpd_data;
 };
 
+
 /** HTTPDInterface that an httpd implementation must provide */
 struct HTTPDInterface {
     int (*init)  (void **server, struct HTTPDConfig config);
     int (*free)  (void *server);
-    int (*accept)(void *server, struct HTTPClient **client, int reply_code);
+    int (*accept)(void *server, struct HTTPClient **client, const char **valid_files);
     int (*write) (void *server, struct HTTPClient *client, const unsigned char *buf, int size);
     int (*read)  (void *server, struct HTTPClient *client, unsigned char *buf, int size);
     void (*close)(void *server, struct HTTPClient *client);