memset(y.get(), 16, global_flags.width * global_flags.height);
memset(cb_or_cr.get(), 128, (global_flags.width / 2) * global_flags.height);
last_frame = encode_jpeg(y.get(), cb_or_cr.get(), cb_or_cr.get(), global_flags.width, global_flags.height);
+
+ if (file_avctx != nullptr) {
+ with_subtitles = Mux::WITHOUT_SUBTITLES;
+ } else {
+ with_subtitles = Mux::WITH_SUBTITLES;
+ }
}
VideoStream::~VideoStream()
size_t width = global_flags.width, height = global_flags.height; // Doesn't matter for MJPEG.
mux.reset(new Mux(avctx, width, height, Mux::CODEC_MJPEG, /*video_extradata=*/"", audio_codecpar,
- AVCOL_SPC_BT709, COARSE_TIMEBASE, /*write_callback=*/nullptr, Mux::WRITE_FOREGROUND, {}, Mux::WITH_SUBTITLES));
+ AVCOL_SPC_BT709, COARSE_TIMEBASE, /*write_callback=*/nullptr, Mux::WRITE_FOREGROUND, {}, with_subtitles));
avcodec_parameters_free(&audio_codecpar);
encode_thread = thread(&VideoStream::encode_thread_func, this);
// Hack: We mux the subtitle packet one time unit before the actual frame,
// so that Nageru is sure to get it first.
- if (!qf.subtitle.empty()) {
+ if (!qf.subtitle.empty() && with_subtitles == Mux::WITH_SUBTITLES) {
AVPacket pkt;
av_init_packet(&pkt);
pkt.stream_index = mux->get_subtitle_stream_idx();
#include "frame_on_disk.h"
#include "jpeg_frame_view.h"
#include "queue_spot_holder.h"
+#include "shared/mux.h"
#include "shared/ref_counted_gl_sync.h"
#include <atomic>
class ChromaSubsampler;
class DISComputeFlow;
class Interpolate;
-class Mux;
class QSurface;
class QSurfaceFormat;
class YCbCrConverter;
FrameOnDisk last_frame1, last_frame2;
std::string last_frame;
+ Mux::WithSubtitles with_subtitles; // true for streaming, false for export to file.
};
#endif // !defined(_VIDEO_STREAM_H)