From 236cdb59df3518222cca245434602cdd6fdeca47 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 14 Nov 2015 01:42:39 +0100 Subject: [PATCH] Add an option to defs.h to set ffmpeg mux options. --- defs.h | 1 + httpd.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/defs.h b/defs.h index 3ee96c1..7b3a9ae 100644 --- a/defs.h +++ b/defs.h @@ -11,5 +11,6 @@ #define LOCAL_DUMP_FILE_NAME "test.ts" #define STREAM_MUX_NAME "mpegts" +#define MUX_OPTS {} #endif // !defined(_DEFS_H) diff --git a/httpd.cpp b/httpd.cpp index a841cd0..689291e 100644 --- a/httpd.cpp +++ b/httpd.cpp @@ -127,7 +127,12 @@ HTTPD::Mux::Mux(AVFormatContext *avctx, int width, int height) avstream_audio->codec->channel_layout = AV_CH_LAYOUT_STEREO; avstream_audio->codec->time_base = AVRational{1, TIMEBASE}; - if (avformat_write_header(avctx, NULL) < 0) { + AVDictionary *options = NULL; + vector> opts = MUX_OPTS; + for (pair opt : opts) { + av_dict_set(&options, opt.first.c_str(), opt.second.c_str(), 0); + } + if (avformat_write_header(avctx, &options) < 0) { fprintf(stderr, "avformat_write_header() failed\n"); exit(1); } -- 2.39.2