From patchwork Thu Jun 28 00:51:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Holljes X-Patchwork-Id: 9544 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1482234jad; Wed, 27 Jun 2018 17:57:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekXiHB72xlYDxJ3616NZFZiahxUALVko8KJiJKnwaGaJviLyAW7JJpwubN4dlaM9C24GjY X-Received: by 2002:a1c:7e8c:: with SMTP id z134-v6mr6414305wmc.156.1530147431346; Wed, 27 Jun 2018 17:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530147431; cv=none; d=google.com; s=arc-20160816; b=eWT3QDV/pjOsgrOr8F3O8X+RssW/Gk54vt4tdpr/MkAtN66QO3K6YpHfak5CVLD9vg IWlnNfnEjft8ePvrqtw0TFOkJsVsgNd82xbSLe0rYMjvuZ9bmSEeLFJQlusbs68j4e7h C+0b0ou3tL64Ee4WYKNciDmEvDLeBkWaDxqDU//sj+XlpgLDGnrvLyxOBydpcrrpvzP1 mySwASUTiGyAlXpIW6HqZmPEv9CJjzuLDX9DbtbvRUcpIPkjbmb5V4F5yiAz543y/0qk 1a8HKZ+MWKtxfBCkzwYdHfdS6A9V6WPKDtom7IrrOcGh18WLqpqPlA53FHWKyE2nYHZ7 0VGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=8+mU283q27RiLegKTfUGBjgJQ3lDPvGp8e8NQbQRuis=; b=R/o15NrmXQnG10fY6OYeAU4ga4Ki2RKt5y5lPI3/iz1UF1xFOgS335ED43S/+7c3Se bv/SuQO/Oabjsu4keLjJs/QbgMT2mcvnjQwlNpQzme+WARbccB9KC3gYoceGQcK/bEZZ HqZcIXr8v6fvUZr1uROQfR9MYA4I+8nacZxIr6xCkHXrz8uOLVcNI4rAgh1XMfytZ01o fjuwTjy+uViP8DTzx92VEr+I2hz+kldvO54NGb6lG/e7ZIbATOBJUOJz0zs/hlxGyw/y TlhlQptArU/FL7315mHRBcayU3KmL87MuGFkRRBgXupT5ORc+fb1zNV7VBinmBtpWjw0 IyWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=rrf7xZmB; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 12-v6si5322989wmr.108.2018.06.27.17.57.11; Wed, 27 Jun 2018 17:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=rrf7xZmB; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6B8E268A611; Thu, 28 Jun 2018 03:57:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7BF868A361 for ; Thu, 28 Jun 2018 03:57:01 +0300 (EEST) Received: by mail-wr0-f193.google.com with SMTP id b8-v6so3715836wro.6 for ; Wed, 27 Jun 2018 17:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o6oB4jow532Jt/DEAtfRuKNsa14muWwmfY1T+pYwKeQ=; b=rrf7xZmB2d+m7/DXx+9noHScfEON12h7sC9pDJWsRW/TUE+TdLqaTCiESXmB0+6U1D 7DbwUwZBVC/r4PYilwTucwRKiyQCvCGBqnyonqHLWM3m0qDbUVEoLXJpXEAIKOhRdcwv FFKH7Y3Sj0+5Bdcd5thQBwtsqNKc/VlSUQaRPlShYD98+GAg18LB2HTNCwlaqrhQJ+mj ETYuvccVrpRnC3Ts2I3tpkuQjJ1R7PK2Z3vNhUcCPqot/ZxlG5AycMoP2+x9SsvioLBo lhf0l4pTRI/V36G2GWYL3Dhz6WC0ZFVkyAI3CWqRbNXv9tIHG911G5vMSqXLQNrMkJUt IMVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o6oB4jow532Jt/DEAtfRuKNsa14muWwmfY1T+pYwKeQ=; b=qDhKSKgEP8aY8pGWKmpYM62hFlaGVYWxmzWHkO60M7qHjUIgypJWTf9T6KhccW3a4N 3U5jigw5rWIolwepNLNQGDJa/5IMbK188yyqkJTz3d268ao5LxUByY/ha0i4t3vnkmn0 Z735rL7WXBFIzpmqqHd1FAYyjYQskkO1v81tM14mAX792oi00nLdyIl5xiH3cDAGYlJc BuchVKB9cO7/wmfUrxAl2u8PRqHBBNGH7HphengpSOff2AMmX4Bnb9OWEuXZqowxHfk8 s1ULaUE7Bcs0P3QtANvjcqJUaDFQ+AFQCJ+0hd4d4lkuJfb+KQjWU2C7W9aRrJ7j1fAg NMew== X-Gm-Message-State: APt69E2gs5UOUEyxtLNvKvdGU6wRgb/r6jPS0Y5H9OGzYn5NF8DzpsR8 Ad8pmCnAhsIurPBYMPCTS8VBTg== X-Received: by 2002:adf:8188:: with SMTP id 8-v6mr7119218wra.89.1530147098530; Wed, 27 Jun 2018 17:51:38 -0700 (PDT) Received: from localhost.localdomain ([46.5.2.0]) by smtp.gmail.com with ESMTPSA id a9-v6sm1363017wrq.1.2018.06.27.17.51.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 17:51:37 -0700 (PDT) From: Stephan Holljes To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Jun 2018 02:51:10 +0200 Message-Id: <20180628005117.18902-11-klaxa1337@googlemail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180628005117.18902-1-klaxa1337@googlemail.com> References: <20180628005117.18902-1-klaxa1337@googlemail.com> Subject: [FFmpeg-devel] [PATCH 10/17] configreader.c/.h/httpd.h: Add hls and dash, slightly change httpd interface, remove publisher.h include X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Stephan Holljes MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Stephan Holljes --- configreader.c | 8 ++++++-- configreader.h | 1 + httpd.h | 9 +++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/configreader.c b/configreader.c index 3f5b896..966dc84 100644 --- a/configreader.c +++ b/configreader.c @@ -27,7 +27,7 @@ #include #include -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 /** * 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);