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:
@@ -735,8 +735,10 @@ TEST(FFmpegBridgeEncoder, WritePngVideoAndProbeBack)
|
||||
const int height = 64;
|
||||
const int frame_count = 5;
|
||||
|
||||
const QByteArray filename = path.toUtf8();
|
||||
|
||||
FBEncoderConfig config = {};
|
||||
config.filename = path.toUtf8().constData();
|
||||
config.filename = filename.constData();
|
||||
config.video_enabled = 1;
|
||||
config.video_codec = FB_CODEC_PNG;
|
||||
config.video_width = width;
|
||||
@@ -799,8 +801,10 @@ TEST(FFmpegBridgeEncoder, WritePcmAudioAndProbeBack)
|
||||
const QString path = TempFilePath(QStringLiteral("fb_bridge_test.wav"));
|
||||
QFile::remove(path);
|
||||
|
||||
const QByteArray filename = path.toUtf8();
|
||||
|
||||
FBEncoderConfig config = {};
|
||||
config.filename = path.toUtf8().constData();
|
||||
config.filename = filename.constData();
|
||||
config.audio_enabled = 1;
|
||||
config.audio_codec = FB_CODEC_PCM;
|
||||
config.audio_sample_rate = 44100;
|
||||
|
||||
Reference in New Issue
Block a user