+
+ // Note: This will be wrong in the case of plugged packets, but that only happens
+ // for network streams, not for files, and write callbacks are only really relevant
+ // for files. (We don't want to do this from write_packet_or_die, as it only has
+ // the rescaled pts, which is unsuitable for callback.)
+ if (pkt.stream_index == 0 && write_callback != nullptr) {
+ write_callback(pts);
+ }
+}
+
+void Mux::write_packet_or_die(const AVPacket &pkt)
+{
+ if (av_interleaved_write_frame(avctx, const_cast<AVPacket *>(&pkt)) < 0) {
+ fprintf(stderr, "av_interleaved_write_frame() failed\n");
+ exit(1);
+ }
+ avio_flush(avctx->pb);