ffmpeg_bridge: fix cross-platform CI failures (Ubuntu/macOS/Windows)
Ubuntu (FFmpeg 7.0) build failure: the public FB_PIX_FMT_* values were hardcoded to AVPixelFormat enum values, but those shift between FFmpeg releases (new formats are inserted mid-enum: X2RGB10 in 7.0, RGBF16/GRAYF16 later), so the static_asserts in internal.h failed and RGBF16LE/GRAYF16LE did not exist at all. The FB pixel format values are now fixed identifiers translated inside the library by pixel format name (stable across releases): - fb::PixFmtToAV/PixFmtFromAV resolve the static table by name; formats a decoder produces that have no static identifier (hardware downloads like nv12/p010le/p210le) receive process-local dynamic ids >= 1000 so they keep round-tripping through the API (scaler etc.) instead of collapsing to NONE and crashing sws. - All crossing points translated: scaler, frame get/set format, decoder/probe stream info, encoder config and write_video_frame, fb_pix_fmt_* utilities, fb_find_best_pix_fmt_of_list (which also reinterpret_cast the caller's list; now translated element-wise and properly NONE-terminated). - nv12 and p010le get static identifiers as the common hardware download formats. - Hardware frame detection no longer compares pixel formats (breaks across format spaces); it uses the existing fb_frame_is_hw(). macOS test failures (FFmpegBridgeEncoder.WritePngVideoAndProbeBack, WritePcmAudioAndProbeBack): config.filename held a dangling pointer to a temporary QByteArray (UB; happened to work on Linux). Keep the QByteArray alive for the encoder's lifetime. Windows (MSYS2 UCRT64) build failure: timecodefunctions.h used int64_t without including <cstdint> (previously pulled in transitively). Full gtest suite: 584 passed.
This commit is contained in:
@@ -30,8 +30,8 @@ FBScaler *fb_scaler_create(int src_width, int src_height, int src_format,
|
||||
int flags)
|
||||
{
|
||||
SwsContext *ctx = sws_getContext(
|
||||
src_width, src_height, static_cast<AVPixelFormat>(src_format),
|
||||
dst_width, dst_height, static_cast<AVPixelFormat>(dst_format), flags,
|
||||
src_width, src_height, fb::PixFmtToAV(src_format),
|
||||
dst_width, dst_height, fb::PixFmtToAV(dst_format), flags,
|
||||
nullptr, nullptr, nullptr);
|
||||
if (!ctx) {
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user