]> git.sesse.net Git - nageru/commitdiff
Remove the --http-uncompressed-video flag.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 21 Jul 2022 21:39:19 +0000 (23:39 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 21 Jul 2022 21:39:19 +0000 (23:39 +0200)
This is probably unused; it is so expensive to send uncompressed data
across sockets, and it was made at a time where it was envisioned
that we do most of our encoding externally.

nageru/flags.cpp
nageru/flags.h
nageru/quicksync_encoder.cpp
nageru/quicksync_encoder_impl.h
nageru/video_encoder.cpp
shared/mux.cpp
shared/mux.h

index bd807319c92fcb649073e2a5fe683686543a7f51..2a31422f854b723502a3680c536525a63da4dde8 100644 (file)
@@ -163,7 +163,6 @@ void usage(Program program)
                fprintf(stderr, "      --default-hdmi-input        default to HDMI over SDI inputs for cards that have both\n");
                fprintf(stderr, "      --fake-cards-audio          make fake (disconnected) cards output a simple tone\n");
                fprintf(stderr, "      --v4l-output DEVICE         send video (no audio) to V4L2 output/loopback\n");
-               fprintf(stderr, "      --http-uncompressed-video   send uncompressed NV12 video to HTTP clients\n");
                fprintf(stderr, "      --http-x264-video           send x264-compressed video to HTTP clients\n");
                fprintf(stderr, "      --record-x264-video         store x264-compressed video to disk (implies --http-x264-video,\n");
                fprintf(stderr, "                                    removes the need for working VA-API encoding)\n");
@@ -285,7 +284,6 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "default-hdmi-input", no_argument, 0, OPTION_DEFAULT_HDMI_INPUT },
                { "fake-cards-audio", no_argument, 0, OPTION_FAKE_CARDS_AUDIO },
                { "v4l-output", required_argument, 0, OPTION_V4L_OUTPUT },
-               { "http-uncompressed-video", no_argument, 0, OPTION_HTTP_UNCOMPRESSED_VIDEO },
                { "http-x264-video", no_argument, 0, OPTION_HTTP_X264_VIDEO },
                { "record-x264-video", no_argument, 0, OPTION_RECORD_X264_VIDEO },
                { "separate-x264-disk-encode", no_argument, 0, OPTION_SEPARATE_X264_DISK_ENCODE },
@@ -427,9 +425,6 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_V4L_OUTPUT:
                        global_flags.v4l_output_device = optarg;
                        break;
-               case OPTION_HTTP_UNCOMPRESSED_VIDEO:
-                       global_flags.uncompressed_video_to_http = true;
-                       break;
                case OPTION_HTTP_MUX:
                        global_flags.stream_mux_name = optarg;
                        break;
@@ -697,10 +692,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                }
        }
 
-       if (global_flags.uncompressed_video_to_http +
-           global_flags.x264_video_to_http +
+       if (global_flags.x264_video_to_http +
            global_flags.av1_video_to_http > 1) {
-               fprintf(stderr, "ERROR: --http-{uncompressed,x264,av1}-video are mutually incompatible\n");
+               fprintf(stderr, "ERROR: --http-{x264,av1}-video are mutually incompatible\n");
                exit(1);
        }
        if (global_flags.bit_depth == 10) {
@@ -709,7 +703,7 @@ void parse_flags(Program program, int argc, char * const argv[])
                        global_flags.x264_video_to_http = true;
                }
        }
-       if (global_flags.x264_video_to_disk && !global_flags.uncompressed_video_to_http && !global_flags.av1_video_to_http) {
+       if (global_flags.x264_video_to_disk && !global_flags.av1_video_to_http) {
                global_flags.x264_video_to_http = true;  // Quick Sync to HTTP but x264 to disk doesn't make sense.
        }
        if (global_flags.min_num_cards <= 0) {
index baecb7ae007718a7cb3afe0b2048e0d424bc8576..40f88f3bd315659295565a02dd55395f553fff7f 100644 (file)
@@ -16,7 +16,6 @@ struct Flags {
        int max_num_cards = MAX_VIDEO_CARDS;
        std::string va_display;
        bool fake_cards_audio = false;
-       bool uncompressed_video_to_http = false;
        bool x264_video_to_http = false;
        bool x264_video_to_disk = false;  // Disables Quick Sync entirely. Implies x264_video_to_http == true.
        bool x264_separate_disk_encode = false;  // Disables Quick Sync entirely. Implies x264_video_to_disk == true.
index d0ca914e2901b031cc8f56899a4ed81eb1a78bd1..9a6bd6d9bf2095f02fd79934590624b77875058e 100644 (file)
@@ -713,9 +713,6 @@ void QuickSyncEncoderImpl::enable_zerocopy_if_possible()
        if (global_flags.x264_video_to_disk) {
                // Quick Sync is entirely disabled.
                use_zerocopy = false;
-       } else if (global_flags.uncompressed_video_to_http) {
-               fprintf(stderr, "Disabling zerocopy H.264 encoding due to --http-uncompressed-video.\n");
-               use_zerocopy = false;
        } else if (global_flags.x264_video_to_http) {
                fprintf(stderr, "Disabling zerocopy H.264 encoding due to --http-x264-video.\n");
                use_zerocopy = false;
@@ -1344,8 +1341,7 @@ void QuickSyncEncoderImpl::save_codeddata(GLSurface *surf, storage_task task)
                if (file_mux) {
                        file_mux->add_packet(pkt, task.pts + global_delay(), task.dts + global_delay());
                }
-               if (!global_flags.uncompressed_video_to_http &&
-                   !global_flags.x264_video_to_http &&
+               if (!global_flags.x264_video_to_http &&
                    !global_flags.av1_video_to_http) {
                        stream_mux->add_packet(pkt, task.pts + global_delay(), task.dts + global_delay());
                }
@@ -1860,19 +1856,6 @@ void QuickSyncEncoderImpl::encode_remaining_frames_as_p(int encoding_frame_num,
        }
 }
 
-void QuickSyncEncoderImpl::add_packet_for_uncompressed_frame(int64_t pts, int64_t duration, const uint8_t *data)
-{
-       AVPacket pkt;
-       memset(&pkt, 0, sizeof(pkt));
-       pkt.buf = nullptr;
-       pkt.data = const_cast<uint8_t *>(data);
-       pkt.size = frame_width * frame_height * 2;
-       pkt.stream_index = 0;
-       pkt.flags = AV_PKT_FLAG_KEY;
-       pkt.duration = duration;
-       stream_mux->add_packet(pkt, pts, pts);
-}
-
 void memcpy_with_pitch(uint8_t *dst, const uint8_t *src, size_t src_width, size_t dst_pitch, size_t height)
 {
        if (src_width == dst_pitch) {
@@ -1915,9 +1898,7 @@ void QuickSyncEncoderImpl::pass_frame(QuickSyncEncoderImpl::PendingFrame frame,
                assert(surf != nullptr);
        }
        uint8_t *data = reinterpret_cast<uint8_t *>(surf->y_ptr);
-       if (global_flags.uncompressed_video_to_http) {
-               add_packet_for_uncompressed_frame(pts, duration, data);
-       } else if (http_encoder != nullptr) {
+       if (http_encoder != nullptr) {
                http_encoder->add_frame(pts, duration, frame.ycbcr_coefficients, data, received_ts);
        } if (disk_encoder != nullptr && disk_encoder != http_encoder) {
                disk_encoder->add_frame(pts, duration, frame.ycbcr_coefficients, data, received_ts);
index 4c82131468002153455ae3dc0d1ac65a339c7546..421ff9540c231475c94541b6b4635241aa57aa5a 100644 (file)
@@ -111,7 +111,6 @@ private:
        void open_output_file(const std::string &filename);
        void encode_thread_func();
        void encode_remaining_frames_as_p(int encoding_frame_num, int gop_start_display_frame_num, int64_t last_dts);
-       void add_packet_for_uncompressed_frame(int64_t pts, int64_t duration, const uint8_t *data);
        void pass_frame(PendingFrame frame, int display_frame_num, int64_t pts, int64_t duration);
        void encode_frame(PendingFrame frame, int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num,
                          int frame_type, int64_t pts, int64_t dts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients);
index 31c6b4d8e24834d960205a3790e8dcc02169d88f..877cbffe0521680fa8ecd71dcb3c55458039c296 100644 (file)
@@ -213,9 +213,7 @@ void VideoEncoder::open_output_stream()
        avctx->pb->ignore_boundary_point = 1;
 
        Mux::Codec video_codec;
-       if (global_flags.uncompressed_video_to_http) {
-               video_codec = Mux::CODEC_NV12;
-       } else if (global_flags.av1_video_to_http) {
+       if (global_flags.av1_video_to_http) {
                video_codec = Mux::CODEC_AV1;
        } else {
                video_codec = Mux::CODEC_H264;
index 0a2eaef6a8310f53b5f7ea0d9a175ea1eb226570..2130752b4c98f0e8bfa5f94c228bc7a947ff215c 100644 (file)
@@ -61,9 +61,6 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const
                avstream_video->codecpar->codec_id = AV_CODEC_ID_H264;
        } else if (video_codec == CODEC_AV1) {
                avstream_video->codecpar->codec_id = AV_CODEC_ID_AV1;
-       } else if (video_codec == CODEC_NV12) {
-               avstream_video->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
-               avstream_video->codecpar->codec_tag = avcodec_pix_fmt_to_codec_tag(AV_PIX_FMT_NV12);
        } else {
                assert(video_codec == CODEC_MJPEG);
                avstream_video->codecpar->codec_id = AV_CODEC_ID_MJPEG;
index 075da1688f76d4dcba6a1760913657602463638d..e85cac234ae7dd6916cc71e26376c7da4ab288b8 100644 (file)
@@ -51,7 +51,6 @@ public:
        enum Codec {
                CODEC_H264,
                CODEC_AV1,
-               CODEC_NV12,  // Uncompressed 4:2:0.
                CODEC_MJPEG
        };
        enum WriteStrategy {