]> git.sesse.net Git - nageru/commitdiff
Add an option to defs.h to set ffmpeg mux options.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 14 Nov 2015 00:42:39 +0000 (01:42 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 14 Nov 2015 00:42:39 +0000 (01:42 +0100)
defs.h
httpd.cpp

diff --git a/defs.h b/defs.h
index 3ee96c1e54d8cb6fed4ba5dfb0be46f8c80c2852..7b3a9ae39e91921f374dae94b98c8c0b132ce0c5 100644 (file)
--- 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)
index a841cd0bb7311526ce0177d5c40f199cdbc47e03..689291e2c7628644f4f4b4ee5aa9c94cb870264d 100644 (file)
--- 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<pair<string, string>> opts = MUX_OPTS;
+       for (pair<string, string> 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);
        }