Files
SimpleRemoter/client
yuanyuanxiang 82f59b2469 Fix: Make the x264 opt-out real, and unchain libyuv from it
DISABLE_X264_FOR_TEST never actually removed the x264 dependency. Two
separate reasons:

1. X264Encoder.h included <x264/x264.h> unconditionally and only pulled in
   common/config.h afterwards, so the macro was not even visible at the point
   where it mattered. The class also carried x264_t / x264_picture_t /
   x264_param_t members, so the header was required to compile regardless of
   the switch. Moving the config.h include to the top and splitting the class
   declaration in two fixes it: with the switch on, the class is a stub with
   no x264 types at all, and open() returns false so EncoderFactory falls
   through. The open(x264_param_t*) overload is dropped in that branch; it had
   no callers outside X264Encoder.cpp.

2. libyuv was collateral damage. Its only #pragma comment(lib) lived inside
   the #else branch of the x264 switch, but CFFmpegAV1Encoder.cpp and
   CFFmpegH264Encoder.cpp both call libyuv::RGB24ToI420 / ARGBToNV12 /
   I420ToNV12 without carrying a pragma of their own. Turning x264 off
   therefore dropped libyuv too and the link failed with LNK2001 on those
   three symbols. libyuv is BSD-3 and unrelated to x264: the pragma is now
   unconditional in X264Encoder.cpp, and CFFmpegH264Encoder.cpp declares it
   alongside its ffmpeg libs so the encoder pair is self-sufficient.

Verified with Release x64 builds of both ServerDll and ghost:

  switches 0/0, compress/ intact          -> builds
  switch x264=1, compress/x264 deleted    -> builds (was LNK2001 before)
  switches 1/1, both dirs deleted         -> builds

So a compliant build needs neither the x264 library nor its headers.

Note for anyone flipping these switches: do a full rebuild, not an
incremental one. config.h reaches X264Encoder.cpp indirectly through
X264Encoder.h, which the .tlog dependency tracking does not record, so an
incremental build happily links a stale object against a freshly compiled one
and reports bogus LNK2001 errors.
2026-10-30 11:04:44 +01:00
..
2026-10-20 15:00:35 +02:00