X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=inline;f=futatabi%2Fvideo_stream.cpp;h=6fb8c5c400589a93fc811823421b499c12a8b7cf;hb=012f5333c8958ed3da410ef53493c347028b44c4;hp=3df272ac08b5836b6f49c3277bff6de5504c3ef6;hpb=131a051c4cd3719a9be415386fdf0f4e15da7c66;p=nageru diff --git a/futatabi/video_stream.cpp b/futatabi/video_stream.cpp index 3df272a..6fb8c5c 100644 --- a/futatabi/video_stream.cpp +++ b/futatabi/video_stream.cpp @@ -6,10 +6,10 @@ extern "C" { } #include "chroma_subsampler.h" -#include "context.h" +#include "shared/context.h" #include "flags.h" #include "flow.h" -#include "httpd.h" +#include "shared/httpd.h" #include "jpeg_frame_view.h" #include "movit/util.h" #include "shared/mux.h" @@ -107,6 +107,10 @@ vector encode_jpeg(const uint8_t *y_data, const uint8_t *cb_data, const cinfo.CCIR601_sampling = true; // Seems to be mostly ignored by libjpeg, though. jpeg_start_compress(&cinfo, true); + // This comment marker is private to FFmpeg. It signals limited Y'CbCr range + // (and nothing else). + jpeg_write_marker(&cinfo, JPEG_COM, (const JOCTET *)"CS=ITU601", strlen("CS=ITU601")); + JSAMPROW yptr[8], cbptr[8], crptr[8]; JSAMPARRAY data[3] = { yptr, cbptr, crptr }; for (unsigned y = 0; y < height; y += 8) { @@ -649,9 +653,9 @@ int VideoStream::write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType ty if (type == AVIO_DATA_MARKER_HEADER) { stream_mux_header.append((char *)buf, buf_size); - global_httpd->set_header(stream_mux_header); + global_httpd->set_header(HTTPD::MAIN_STREAM, stream_mux_header); } else { - global_httpd->add_data((char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT, time, AVRational{ AV_TIME_BASE, 1 }); + global_httpd->add_data(HTTPD::MAIN_STREAM, (char *)buf, buf_size, type == AVIO_DATA_MARKER_SYNC_POINT, time, AVRational{ AV_TIME_BASE, 1 }); } return buf_size; }