]> git.sesse.net Git - nageru/blobdiff - nageru/quicksync_encoder.cpp
IWYU-fix nageru/*.cpp.
[nageru] / nageru / quicksync_encoder.cpp
index 0d0fbec7d23f42155c2ae5165148976dbd745644..36bf15883a3db975f40e90118102950f0f083390 100644 (file)
@@ -1,25 +1,24 @@
 #include "quicksync_encoder.h"
 
+#include <atomic>
+#include <errno.h>
+#include <epoxy/egl.h>
+#include <epoxy/gl.h>
 #include <movit/image_format.h>
 #include <movit/resource_pool.h>  // Must be above the Xlib includes.
 #include <movit/util.h>
 
 #include <EGL/eglplatform.h>
-#include <X11/Xlib.h>
 #include <assert.h>
 #include <epoxy/egl.h>
-#include <fcntl.h>
 #include <glob.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <va/va.h>
-#include <va/va_drm.h>
 #include <va/va_drmcommon.h>
 #include <va/va_enc_h264.h>
-#include <va/va_x11.h>
 #include <algorithm>
 #include <chrono>
 #include <condition_variable>
 #include <memory>
 #include <mutex>
 #include <queue>
-#include <stack>
 #include <string>
 #include <thread>
 #include <utility>
+#include <vector>
 
 extern "C" {
 
-#include <libavcodec/avcodec.h>
+#include <drm_fourcc.h>
+#include <libavcodec/packet.h>
+#include <libavformat/avformat.h>
 #include <libavformat/avio.h>
 #include <libavutil/error.h>
-#include <drm_fourcc.h>
 
 }  // namespace
 
 #include "audio_encoder.h"
-#include "shared/context.h"
 #include "defs.h"
-#include "shared/disk_space_estimator.h"
-#include "shared/ffmpeg_raii.h"
 #include "flags.h"
-#include "shared/mux.h"
 #include "print_latency.h"
 #include "quicksync_encoder_impl.h"
 #include "ref_counted_frame.h"
+#include "shared/context.h"
+#include "shared/disk_space_estimator.h"
+#include "shared/ffmpeg_raii.h"
+#include "shared/metrics.h"
+#include "shared/mux.h"
+#include "shared/ref_counted_gl_sync.h"
 #include "shared/timebase.h"
+#include "shared/va_display.h"
+#include "v4l_output.h"
 #include "x264_encoder.h"
 
 using namespace movit;
@@ -1353,6 +1357,9 @@ void QuickSyncEncoderImpl::save_codeddata(GLSurface *surf, storage_task task)
                if (!global_flags.x264_video_to_http &&
                    !global_flags.av1_video_to_http) {
                        http_mux->add_packet(pkt, task.pts + global_delay(), task.dts + global_delay());
+                       if (srt_mux != nullptr) {
+                               srt_mux->add_packet(pkt, task.pts + global_delay(), task.dts + global_delay());
+                       }
                }
        }
 }
@@ -1856,7 +1863,6 @@ void QuickSyncEncoderImpl::encode_remaining_frames_as_p(int encoding_frame_num,
                assert(display_frame_num > 0);
                PendingFrame frame = move(pending_frame.second);
                int64_t dts = last_dts + (TIMEBASE / TYPICAL_FPS);
-               printf("Finalizing encode: Encoding leftover frame %d as P-frame instead of B-frame.\n", display_frame_num);
                encode_frame(frame, encoding_frame_num++, display_frame_num, gop_start_display_frame_num, FRAME_P, frame.pts, dts, frame.duration, frame.ycbcr_coefficients);
                last_dts = dts;
        }
@@ -2050,6 +2056,11 @@ void QuickSyncEncoder::set_http_mux(Mux *mux)
        impl->set_http_mux(mux);
 }
 
+void QuickSyncEncoder::set_srt_mux(Mux *mux)
+{
+       impl->set_srt_mux(mux);
+}
+
 int64_t QuickSyncEncoder::global_delay() const {
        return impl->global_delay();
 }