+ mux->add_packet(*pkt, pkt->pts, pkt->dts == AV_NOPTS_VALUE ? pkt->pts : pkt->dts, timebase, /*stream_index=*/1);
+}
+
+void adjust_bitrate(int signal)
+{
+ int new_bitrate = global_flags.x264_bitrate;
+ if (signal == SIGUSR1) {
+ new_bitrate += 100;
+ if (new_bitrate > 100000) {
+ fprintf(stderr, "Ignoring SIGUSR1, can't increase bitrate below 100000 kbit/sec (currently at %d kbit/sec)\n",
+ global_flags.x264_bitrate);
+ } else {
+ fprintf(stderr, "Increasing bitrate to %d kbit/sec due to SIGUSR1.\n", new_bitrate);
+ global_flags.x264_bitrate = new_bitrate;
+ global_x264_encoder->change_bitrate(new_bitrate);
+ }
+ } else if (signal == SIGUSR2) {
+ new_bitrate -= 100;
+ if (new_bitrate < 100) {
+ fprintf(stderr, "Ignoring SIGUSR2, can't decrease bitrate below 100 kbit/sec (currently at %d kbit/sec)\n",
+ global_flags.x264_bitrate);
+ } else {
+ fprintf(stderr, "Decreasing bitrate to %d kbit/sec due to SIGUSR2.\n", new_bitrate);
+ global_flags.x264_bitrate = new_bitrate;
+ global_x264_encoder->change_bitrate(new_bitrate);
+ }
+ }
+}
+
+void request_quit(int signal)
+{
+ should_quit.quit();