]> git.sesse.net Git - nageru/blobdiff - nageru/kaeru.cpp
Make number of cards flexible at runtime.
[nageru] / nageru / kaeru.cpp
index b10324c8b4091516072294a521ce66b76760041e..e4fba7f03630e399f0000c5b42c2ef2e837754f6 100644 (file)
@@ -47,11 +47,12 @@ int write_packet(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType ty
                type = AVIO_DATA_MARKER_SYNC_POINT;
        }
 
+       HTTPD::StreamID stream_id{ HTTPD::MAIN_STREAM, 0 };
        if (type == AVIO_DATA_MARKER_HEADER) {
                stream_mux_header.append((char *)buf, buf_size);
-               httpd->set_header(HTTPD::MAIN_STREAM, stream_mux_header);
+               httpd->set_header(stream_id, stream_mux_header);
        } else {
-               httpd->add_data(HTTPD::MAIN_STREAM, (char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT, time, AVRational{ AV_TIME_BASE, 1 });
+               httpd->add_data(stream_id, (char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT, time, AVRational{ AV_TIME_BASE, 1 });
        }
        return buf_size;
 }
@@ -74,7 +75,7 @@ unique_ptr<Mux> create_mux(HTTPD *httpd, AVOutputFormat *oformat, X264Encoder *x
        // If audio is disabled (ie., we won't ever see any audio packets),
        // set nullptr here to also not include the stream in the mux.
        AVCodecParameters *audio_codecpar =
-               global_flags.enable_audio ? audio_encoder->get_codec_parameters().get() : nullptr;
+               global_flags.enable_audio ? audio_encoder->get_codec_parameters().release() : nullptr;
 
        unique_ptr<Mux> mux;
        mux.reset(new Mux(avctx, global_flags.width, global_flags.height, Mux::CODEC_H264, video_extradata, audio_codecpar,
@@ -180,7 +181,7 @@ int main(int argc, char *argv[])
                usage(PROGRAM_KAERU);
                abort();
        }
-       global_flags.num_cards = 1;  // For latency metrics.
+       global_flags.max_num_cards = 1;  // For latency metrics.
 
 #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100)
        av_register_all();