X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=mux.cpp;h=1fd8e30ba3ff836a6b92521f96cda2b91a20f611;hb=b6089b76678e76271616131672c5ba454a5d336d;hp=4f9f4d04a04d9a7221fbe696784c5b43f3158fbc;hpb=b561d43a60201395f1354a585aa37670eda45883;p=nageru diff --git a/mux.cpp b/mux.cpp index 4f9f4d0..1fd8e30 100644 --- a/mux.cpp +++ b/mux.cpp @@ -1,12 +1,28 @@ -#include +#include "mux.h" +#include +#include +#include +#include +#include #include #include #include +#include #include +extern "C" { +#include +#include +#include +#include +#include +#include +#include +} + #include "defs.h" -#include "mux.h" +#include "flags.h" #include "timebase.h" using namespace std; @@ -53,9 +69,16 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const // as noted in each comment. // Note that the H.264 stream also contains this information and depending on the // mux, this might simply get ignored. See sps_rbsp(). + // Note that there's no way to change this per-frame as the H.264 stream + // would like to be able to. avstream_video->codecpar->color_primaries = AVCOL_PRI_BT709; // RGB colorspace (inout_format.color_space). avstream_video->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; // Gamma curve (inout_format.gamma_curve). - avstream_video->codecpar->color_space = AVCOL_SPC_SMPTE170M; // YUV colorspace (output_ycbcr_format.luma_coefficients). + // YUV colorspace (output_ycbcr_format.luma_coefficients). + if (global_flags.ycbcr_rec709_coefficients) { + avstream_video->codecpar->color_space = AVCOL_SPC_BT709; + } else { + avstream_video->codecpar->color_space = AVCOL_SPC_SMPTE170M; + } avstream_video->codecpar->color_range = AVCOL_RANGE_MPEG; // Full vs. limited range (output_ycbcr_format.full_range). avstream_video->codecpar->chroma_location = AVCHROMA_LOC_LEFT; // Chroma sample location. See chroma_offset_0[] in Mixer::subsample_chroma(). avstream_video->codecpar->field_order = AV_FIELD_PROGRESSIVE;