zhuizhu 8 mesiacov pred
rodič
commit
5697076ddc
36 zmenil súbory, kde vykonal 333 pridanie a 314 odobranie
  1. 2 2
      .xmake/windows/x64/cache/config
  2. 3 0
      .xmake/windows/x64/cache/history
  3. 34 18
      AV/code/base/types.h
  4. 28 28
      AV/code/capture/capture_audio_capturer.cpp
  5. 28 28
      AV/code/capture/capture_video_capturer.cpp
  6. 4 4
      AV/code/codec/codec_abstract_codec.cpp
  7. 7 7
      AV/code/codec/codec_abstract_codec.h
  8. 19 19
      AV/code/codec/codec_audio_decoder.cpp
  9. 14 14
      AV/code/codec/codec_audio_encoder.cpp
  10. 16 16
      AV/code/codec/codec_video_decoder.cpp
  11. 15 15
      AV/code/codec/codec_video_encoder.cpp
  12. 18 18
      AV/code/muxer/muxer_abstract_muxer.cpp
  13. 44 44
      AV/code/muxer/muxer_file_muxer.cpp
  14. 9 9
      AV/code/muxer/muxer_stream_muxer.cpp
  15. 1 1
      AV/code/player/SimplePlayerWindow.cpp
  16. 3 3
      AV/code/player/player_adapter.cpp
  17. 14 14
      AV/code/player/player_core.cpp
  18. 5 5
      AV/code/player/thread_manager.cpp
  19. 3 3
      AV/code/utils/utils_frame_queue.cpp
  20. 4 4
      AV/code/utils/utils_packet_queue.cpp
  21. 2 2
      AV/code/utils/utils_performance_monitor.cpp
  22. 2 2
      AV/code/utils/utils_synchronizer.cpp
  23. 2 2
      AV/code/utils/utils_thread_pool.cpp
  24. 6 6
      AV/test_audio_encoder.cpp
  25. 3 3
      AV/test_codec.cpp
  26. 8 8
      AV/test_decoder.cpp
  27. 7 7
      AV/test_player.cpp
  28. 10 10
      AV/test_window_capture.cpp
  29. 1 1
      fmt/include/fmt/base.h
  30. 1 1
      fmt/test/compile-test.cc
  31. 5 5
      fmt/test/gtest/gmock-gtest-all.cc
  32. 1 1
      fmt/test/gtest/gmock/gmock.h
  33. 1 1
      fmt/test/gtest/gtest/gtest.h
  34. 6 6
      qwindowkit/qmsetup/src/syscmdline/tests/basic/main.cpp
  35. 5 5
      qwindowkit/src/core/contexts/win32windowcontext.cpp
  36. 2 2
      test/request-client/modules/uploader.test.ts

+ 2 - 2
.xmake/windows/x64/cache/config

@@ -3,8 +3,8 @@
         qt = [[D:\Qt\5.15.2\msvc2019_64]]
     },
     mtimes = {
-        ["xmake.lua"] = 1753559920,
-        ["AV\\xmake.lua"] = 1753559657
+        ["AV\\xmake.lua"] = 1753559657,
+        ["xmake.lua"] = 1753559920
     },
     recheck = false
 }

+ 3 - 0
.xmake/windows/x64/cache/history

@@ -12,6 +12,9 @@
         "xmake build",
         "xmake build",
         "xmake build",
+        "xmake build",
+        "xmake build",
+        "xmake build",
         "xmake build"
     }
 }

+ 34 - 18
AV/code/base/types.h

@@ -68,46 +68,62 @@ struct VideoFrame {
 
 // 错误码定义
 enum class ErrorCode {
+    // 成功状态
     SUCCESS = 0,
-    OK = 0,  // 兼容别名
+    
+    // 参数错误
     INVALID_PARAMS,
-    INVALID_ARGUMENT,  // 兼容别名
+    INVALID_PATH,
+    
+    // 编解码错误
     CODEC_NOT_FOUND,
     CODEC_OPEN_FAILED,
     ENCODE_FAILED,
     DECODE_FAILED,
+    
+    // 内存错误
     MEMORY_ALLOC_FAILED,
-    OUT_OF_MEMORY,  // 兼容别名
+    
+    // 文件操作错误
     FILE_OPEN_FAILED,
+    FILE_EXISTS,
+    FILE_OPERATION_FAILED,
+    
+    // 状态错误
     INVALID_STATE,
+    NOT_STARTED,
+    NOT_PAUSED,
+    ALREADY_INITIALIZED,
+    NOT_INITIALIZED,
+    ALREADY_STARTED,
+    ALREADY_PAUSED,
+    
+    // 格式和转换错误
     CONVERSION_FAILED,
-    CONVERSION_ERROR,  // 兼容别名
+    FORMAT_NOT_SUPPORTED,
     NOT_SUPPORTED,
+    
+    // 硬件和设备错误
     HARDWARE_ERROR,
+    DEVICE_NOT_FOUND,
+    
+    // 流操作错误
     STREAM_NOT_FOUND,
-    PROCESSING_ERROR,
     STREAM_EXISTS,
-    FORMAT_NOT_SUPPORTED,
-    FILE_EXISTS,
     STREAM_CREATE_FAILED,
-    INVALID_PATH,
+    END_OF_STREAM,
+    
+    // 线程和队列错误
     THREAD_ERROR,
     QUEUE_FULL,
-    DEVICE_NOT_FOUND,
-    END_OF_STREAM,
+    
+    // 通用错误
     ALREADY_EXISTS,
     NOT_FOUND,
     TIMEOUT,
     COPY_FAILED,
-    INVALID_PARAMETER,
-    NOT_STARTED,
-    NOT_PAUSED,
-    ALREADY_INITIALIZED,
-    NOT_INITIALIZED,
-    ALREADY_STARTED,
-    ALREADY_PAUSED,
+    PROCESSING_ERROR,
     INITIALIZATION_FAILED,
-    FILE_OPERATION_FAILED,
     OPERATION_FAILED,
     UNKNOWN_ERROR
 };

+ 28 - 28
AV/code/capture/capture_audio_capturer.cpp

@@ -40,7 +40,7 @@ AudioCapturer::~AudioCapturer() {
 ErrorCode AudioCapturer::initialize(const CapturerParams& params) {
     if (params.mediaType != MediaType::AUDIO) {
         AV_LOGGER_ERROR("参数媒体类型不是音频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     audioParams_ = static_cast<const AudioCaptureParams&>(params);
@@ -49,7 +49,7 @@ ErrorCode AudioCapturer::initialize(const CapturerParams& params) {
         return ErrorCode::INVALID_PARAMS;
     }
     
-    ErrorCode result = ErrorCode::OK;
+    ErrorCode result = ErrorCode::SUCCESS;
     
     if (audioParams_.type == CapturerType::AUDIO_MIC) {
         result = initializeMicrophone();
@@ -61,7 +61,7 @@ ErrorCode AudioCapturer::initialize(const CapturerParams& params) {
         return ErrorCode::NOT_SUPPORTED;
     }
     
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         setState(CapturerState::INITIALIZED);
         AV_LOGGER_INFOF("音频采集器初始化成功: {}Hz, {}ch, {}", 
                        audioParams_.sampleRate, audioParams_.channels,
@@ -87,7 +87,7 @@ ErrorCode AudioCapturer::start() {
         setState(CapturerState::STARTED);
         
         AV_LOGGER_INFO("音频采集已启动");
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     } catch (const std::exception& e) {
         AV_LOGGER_ERRORF("启动音频采集线程失败: {}", e.what());
         return ErrorCode::THREAD_ERROR;
@@ -98,7 +98,7 @@ ErrorCode AudioCapturer::stop() {
     std::lock_guard<std::mutex> lock(captureMutex_);
     
     if (getState() != CapturerState::STARTED) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     shouldStop_ = true;
@@ -118,7 +118,7 @@ ErrorCode AudioCapturer::stop() {
     setState(CapturerState::STOPPED);
     AV_LOGGER_INFO("音频采集已停止");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::pause() {
@@ -129,7 +129,7 @@ ErrorCode AudioCapturer::pause() {
     paused_ = true;
     AV_LOGGER_INFO("音频采集已暂停");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::resume() {
@@ -145,12 +145,12 @@ ErrorCode AudioCapturer::resume() {
     
     AV_LOGGER_INFO("音频采集已恢复");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::reset() {
     ErrorCode result = stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -168,7 +168,7 @@ ErrorCode AudioCapturer::reset() {
     
     AV_LOGGER_INFO("音频采集器已重置");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::close() {
@@ -194,7 +194,7 @@ ErrorCode AudioCapturer::close() {
     setState(CapturerState::IDLE);
     AV_LOGGER_INFO("音频采集器已关闭");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 std::vector<std::string> AudioCapturer::getAvailableDevices() const {
@@ -240,13 +240,13 @@ ErrorCode AudioCapturer::setAudioParams(int sampleRate, int channels, AVSampleFo
     AV_LOGGER_INFOF("音频参数已更新: {}Hz, {}ch, {}", 
                    sampleRate, channels, av_get_sample_fmt_name(sampleFormat));
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::setVolume(float volume) {
     if (volume < 0.0f || volume > 2.0f) {
         AV_LOGGER_ERROR("音量值超出范围 (0.0-2.0)");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     currentVolume_ = volume;
@@ -254,7 +254,7 @@ ErrorCode AudioCapturer::setVolume(float volume) {
     
     AV_LOGGER_INFOF("音量已设置为: {:.2f}", volume);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 float AudioCapturer::getVolume() const {
@@ -267,7 +267,7 @@ ErrorCode AudioCapturer::setNoiseReduction(bool enable) {
     
     AV_LOGGER_INFOF("Noise reduction {}", enable ? "enabled" : "disabled");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioCapturer::setEchoCancellation(bool enable) {
@@ -276,7 +276,7 @@ ErrorCode AudioCapturer::setEchoCancellation(bool enable) {
     
     AV_LOGGER_INFOF("Echo cancellation {}", enable ? "enabled" : "disabled");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AudioCaptureParams AudioCapturer::getCurrentParams() const {
@@ -396,7 +396,7 @@ ErrorCode AudioCapturer::openInputDevice() {
     codecCtx_ = avcodec_alloc_context3(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配音频解码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 复制流参数到解码上下文
@@ -441,7 +441,7 @@ ErrorCode AudioCapturer::setupAudioResampling() {
         swrCtx_ = swr_alloc();
         if (!swrCtx_) {
             AV_LOGGER_ERROR("分配音频重采样器失败");
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         // 设置重采样参数
@@ -464,7 +464,7 @@ ErrorCode AudioCapturer::setupAudioResampling() {
         // 创建重采样输出帧
         resampledFrame_ = makeAVFrame();
         if (!resampledFrame_) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         resampledFrame_->format = dstFormat;
@@ -472,7 +472,7 @@ ErrorCode AudioCapturer::setupAudioResampling() {
         av_channel_layout_copy(&resampledFrame_->ch_layout, &dstChannelLayout);
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void AudioCapturer::captureThreadFunc() {
@@ -490,7 +490,7 @@ void AudioCapturer::captureThreadFunc() {
         }
         
         ErrorCode result = captureFrame();
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             onError(result, "采集音频帧失败");
             
             // 短暂休眠后重试
@@ -504,7 +504,7 @@ void AudioCapturer::captureThreadFunc() {
 ErrorCode AudioCapturer::captureFrame() {
     AVPacket* packet = av_packet_alloc();
     if (!packet) {
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 读取包
@@ -523,7 +523,7 @@ ErrorCode AudioCapturer::captureFrame() {
     // 检查是否是音频包
     if (packet->stream_index != audioStreamIndex_) {
         av_packet_free(&packet);
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 发送包到解码器
@@ -538,12 +538,12 @@ ErrorCode AudioCapturer::captureFrame() {
     // 接收解码后的帧
     AVFramePtr frame = makeAVFrame();
     if (!frame) {
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     ret = avcodec_receive_frame(codecCtx_, frame.get());
     if (ret == AVERROR(EAGAIN)) {
-        return ErrorCode::OK; // 需要更多输入
+        return ErrorCode::SUCCESS; // 需要更多输入
     } else if (ret < 0) {
         AV_LOGGER_ERRORF("接收音频解码帧失败: {}", ffmpeg_utils::errorToString(ret));
         return static_cast<ErrorCode>(ret);
@@ -561,7 +561,7 @@ ErrorCode AudioCapturer::captureFrame() {
     // 回调
     onFrameCaptured(processedFrame);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr AudioCapturer::processAudioFrame(const AVFramePtr& frame) {
@@ -876,7 +876,7 @@ std::unique_ptr<AudioCapturer> AudioCapturer::AudioCaptureFactory::createMicroph
     params.micIndex = micIndex;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建麦克风采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }
@@ -891,7 +891,7 @@ std::unique_ptr<AudioCapturer> AudioCapturer::AudioCaptureFactory::createSystemA
     params.captureLoopback = loopback;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建系统音频采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }

+ 28 - 28
AV/code/capture/capture_video_capturer.cpp

@@ -36,7 +36,7 @@ VideoCapturer::~VideoCapturer() {
 ErrorCode VideoCapturer::initialize(const CapturerParams& params) {
     if (params.mediaType != MediaType::VIDEO) {
         AV_LOGGER_ERROR("参数媒体类型不是视频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     videoParams_ = static_cast<const VideoCaptureParams&>(params);
@@ -45,7 +45,7 @@ ErrorCode VideoCapturer::initialize(const CapturerParams& params) {
         return ErrorCode::INVALID_PARAMS;
     }
     
-    ErrorCode result = ErrorCode::OK;
+    ErrorCode result = ErrorCode::SUCCESS;
     
     if (videoParams_.type == CapturerType::VIDEO_CAMERA) {
         result = initializeCamera();
@@ -58,7 +58,7 @@ ErrorCode VideoCapturer::initialize(const CapturerParams& params) {
         return ErrorCode::NOT_SUPPORTED;
     }
     
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         setState(CapturerState::INITIALIZED);
         AV_LOGGER_INFOF("视频采集器初始化成功: {}x{}@{}fps", 
                        videoParams_.width, videoParams_.height, videoParams_.fps);
@@ -83,7 +83,7 @@ ErrorCode VideoCapturer::start() {
         setState(CapturerState::STARTED);
         
         AV_LOGGER_INFO("视频采集已启动");
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     } catch (const std::exception& e) {
         AV_LOGGER_ERRORF("启动采集线程失败: {}", e.what());
         return ErrorCode::THREAD_ERROR;
@@ -94,7 +94,7 @@ ErrorCode VideoCapturer::stop() {
     std::lock_guard<std::mutex> lock(captureMutex_);
     
     if (getState() != CapturerState::STARTED) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     shouldStop_ = true;
@@ -114,7 +114,7 @@ ErrorCode VideoCapturer::stop() {
     setState(CapturerState::STOPPED);
     AV_LOGGER_INFO("视频采集已停止");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoCapturer::pause() {
@@ -125,7 +125,7 @@ ErrorCode VideoCapturer::pause() {
     paused_ = true;
     AV_LOGGER_INFO("视频采集已暂停");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoCapturer::resume() {
@@ -141,12 +141,12 @@ ErrorCode VideoCapturer::resume() {
     
     AV_LOGGER_INFO("视频采集已恢复");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoCapturer::reset() {
     ErrorCode result = stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -163,7 +163,7 @@ ErrorCode VideoCapturer::reset() {
     
     AV_LOGGER_INFO("视频采集器已重置");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoCapturer::close() {
@@ -188,7 +188,7 @@ ErrorCode VideoCapturer::close() {
     setState(CapturerState::IDLE);
     AV_LOGGER_INFO("视频采集器已关闭");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 std::vector<std::string> VideoCapturer::getAvailableDevices() const {
@@ -235,7 +235,7 @@ ErrorCode VideoCapturer::setVideoParams(int width, int height, int fps) {
     
     AV_LOGGER_INFOF("视频参数已更新: {}x{}@{}fps", width, height, fps);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoCapturer::setPixelFormat(AVPixelFormat format) {
@@ -248,7 +248,7 @@ ErrorCode VideoCapturer::setPixelFormat(AVPixelFormat format) {
     
     AV_LOGGER_INFOF("像素格式已更新: {}", av_get_pix_fmt_name(format));
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 VideoCaptureParams VideoCapturer::getCurrentParams() const {
@@ -402,7 +402,7 @@ ErrorCode VideoCapturer::openInputDevice() {
     codecCtx_ = avcodec_alloc_context3(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配解码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 复制流参数到解码上下文
@@ -442,13 +442,13 @@ ErrorCode VideoCapturer::setupPixelFormatConversion() {
         
         if (!swsCtx_) {
             AV_LOGGER_ERROR("创建像素格式转换上下文失败");
-            return ErrorCode::CONVERSION_ERROR;
+            return ErrorCode::CONVERSION_FAILED;
         }
         
         // 创建转换后的帧
         convertedFrame_ = makeAVFrame();
         if (!convertedFrame_) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         convertedFrame_->format = dstFormat;
@@ -462,7 +462,7 @@ ErrorCode VideoCapturer::setupPixelFormatConversion() {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void VideoCapturer::captureThreadFunc() {
@@ -480,7 +480,7 @@ void VideoCapturer::captureThreadFunc() {
         }
         
         ErrorCode result = captureFrame();
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             onError(result, "采集帧失败");
             
             // 短暂休眠后重试
@@ -494,7 +494,7 @@ void VideoCapturer::captureThreadFunc() {
 ErrorCode VideoCapturer::captureFrame() {
     AVPacket* packet = av_packet_alloc();
     if (!packet) {
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 读取包
@@ -512,7 +512,7 @@ ErrorCode VideoCapturer::captureFrame() {
     // 检查是否是视频包
     if (packet->stream_index != videoStreamIndex_) {
         av_packet_free(&packet);
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 发送包到解码器
@@ -527,12 +527,12 @@ ErrorCode VideoCapturer::captureFrame() {
     // 接收解码后的帧
     AVFramePtr frame = makeAVFrame();
     if (!frame) {
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     ret = avcodec_receive_frame(codecCtx_, frame.get());
     if (ret == AVERROR(EAGAIN)) {
-        return ErrorCode::OK; // 需要更多输入
+        return ErrorCode::SUCCESS; // 需要更多输入
     } else if (ret < 0) {
         AV_LOGGER_ERRORF("接收解码帧失败: {}", ffmpeg_utils::errorToString(ret));
         return static_cast<ErrorCode>(ret);
@@ -543,7 +543,7 @@ ErrorCode VideoCapturer::captureFrame() {
     if (needConversion_) {
         outputFrame = convertPixelFormat(frame);
         if (!outputFrame) {
-            return ErrorCode::CONVERSION_ERROR;
+            return ErrorCode::CONVERSION_FAILED;
         }
     } else {
         outputFrame = std::move(frame);
@@ -552,7 +552,7 @@ ErrorCode VideoCapturer::captureFrame() {
     // 添加到队列或直接回调
     onFrameCaptured(outputFrame);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr VideoCapturer::convertPixelFormat(const AVFramePtr& srcFrame) {
@@ -788,7 +788,7 @@ std::unique_ptr<VideoCapturer> VideoCapturer::VideoCaptureFactory::createCamera(
     params.cameraIndex = cameraIndex;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建摄像头采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }
@@ -803,7 +803,7 @@ std::unique_ptr<VideoCapturer> VideoCapturer::VideoCaptureFactory::createScreen(
     params.screenIndex = screenIndex;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建屏幕录制采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }
@@ -822,7 +822,7 @@ std::unique_ptr<VideoCapturer> VideoCapturer::VideoCaptureFactory::createWindow(
     params.windowTitle = windowTitle;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建窗口采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }
@@ -837,7 +837,7 @@ std::unique_ptr<VideoCapturer> VideoCapturer::VideoCaptureFactory::createWindowB
     params.windowHandle = windowHandle;
     
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建窗口采集器失败: {}", static_cast<int>(result));
         return nullptr;
     }

+ 4 - 4
AV/code/codec/codec_abstract_codec.cpp

@@ -33,12 +33,12 @@ ErrorCode AbstractCodec::reset() {
     AV_LOGGER_DEBUG("重置编解码器");
     
     if (state_ == CodecState::IDLE || state_ == CodecState::CLOSED) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 先刷新缓冲区
     ErrorCode result = flush();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("刷新编解码器失败: {}", static_cast<int>(result));
         return result;
     }
@@ -47,7 +47,7 @@ ErrorCode AbstractCodec::reset() {
     resetStatistics();
     
     setState(CodecState::OPENED);
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void AbstractCodec::resetStatistics() {
@@ -235,7 +235,7 @@ ErrorCode AbstractCodec::flush() {
     avcodec_flush_buffers(codecCtx_.get());
     
     AV_LOGGER_DEBUG("编解码器缓冲区已刷新");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 } // namespace codec

+ 7 - 7
AV/code/codec/codec_abstract_codec.h

@@ -45,7 +45,7 @@ public:
     /**
      * 打开编解码器
      * @param params 编解码参数
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode open(const CodecParams& params) = 0;
 
@@ -56,13 +56,13 @@ public:
 
     /**
      * 刷新编解码器缓冲区
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode flush() = 0;
 
     /**
      * 重置编解码器
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode reset();
 
@@ -139,14 +139,14 @@ public:
      * 编码一帧数据
      * @param frame 输入帧
      * @param packets 输出包列表
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode encode(const AVFramePtr& frame, std::vector<AVPacketPtr>& packets) = 0;
 
     /**
      * 结束编码(刷新缓冲区)
      * @param packets 输出包列表
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode finishEncode(std::vector<AVPacketPtr>& packets) = 0;
 
@@ -174,14 +174,14 @@ public:
      * 解码一个包
      * @param packet 输入包
      * @param frames 输出帧列表
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode decode(const AVPacketPtr& packet, std::vector<AVFramePtr>& frames) = 0;
 
     /**
      * 结束解码(刷新缓冲区)
      * @param frames 输出帧列表
-     * @return 成功返回ErrorCode::OK
+     * @return 成功返回ErrorCode::SUCCESS
      */
     virtual ErrorCode finishDecode(std::vector<AVFramePtr>& frames) = 0;
 

+ 19 - 19
AV/code/codec/codec_audio_decoder.cpp

@@ -31,7 +31,7 @@ AudioDecoder::~AudioDecoder() {
 ErrorCode AudioDecoder::initialize(const CodecParams& params) {
     if (params.type != MediaType::AUDIO) {
         AV_LOGGER_ERROR("参数类型不是音频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     audioParams_ = static_cast<const AudioDecoderParams&>(params);
@@ -43,7 +43,7 @@ ErrorCode AudioDecoder::initialize(const CodecParams& params) {
     setState(CodecState::IDLE);
     AV_LOGGER_INFOF("音频解码器初始化成功: {}", audioParams_.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioDecoder::open(const CodecParams& params) {
@@ -52,7 +52,7 @@ ErrorCode AudioDecoder::open(const CodecParams& params) {
     // 如果提供了参数,先初始化
     if (params.type != MediaType::UNKNOWN) {
         ErrorCode initResult = initialize(params);
-        if (initResult != ErrorCode::OK) {
+        if (initResult != ErrorCode::SUCCESS) {
             return initResult;
         }
     }
@@ -63,7 +63,7 @@ ErrorCode AudioDecoder::open(const CodecParams& params) {
     }
     
     ErrorCode result = initDecoder();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -74,7 +74,7 @@ ErrorCode AudioDecoder::open(const CodecParams& params) {
                    codecCtx_->ch_layout.nb_channels,
                    av_get_sample_fmt_name(codecCtx_->sample_fmt));
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void AudioDecoder::close() {
@@ -115,7 +115,7 @@ ErrorCode AudioDecoder::flush() {
     setState(CodecState::OPENED);
     AV_LOGGER_DEBUG("音频解码器已重置");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioDecoder::reset() {
@@ -145,7 +145,7 @@ ErrorCode AudioDecoder::decode(const AVPacketPtr& packet, std::vector<AVFramePtr
         }
     }
     
-    updateStats(result == ErrorCode::OK, processTime, 
+    updateStats(result == ErrorCode::SUCCESS, processTime, 
                 packet ? packet->size : 0, totalSamples);
     
     if (frameCallback_) {
@@ -199,19 +199,19 @@ ErrorCode AudioDecoder::initDecoder() {
     
     if (codec_->type != AVMEDIA_TYPE_AUDIO) {
         AV_LOGGER_ERROR("解码器类型不是音频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 创建解码上下文
     codecCtx_ = makeAVCodecContext(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配解码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 设置解码器参数
     ErrorCode result = setupDecoderParams();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -243,7 +243,7 @@ ErrorCode AudioDecoder::initDecoder() {
     
     AV_LOGGER_INFOF("音频解码器打开成功: {}", audioParams_.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioDecoder::setupDecoderParams() {
@@ -291,7 +291,7 @@ ErrorCode AudioDecoder::setupDecoderParams() {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioDecoder::decodeFrame(const AVPacketPtr& packet, std::vector<AVFramePtr>& frames) {
@@ -310,7 +310,7 @@ ErrorCode AudioDecoder::receiveFrames(std::vector<AVFramePtr>& frames) {
     while (true) {
         AVFramePtr frame = makeAVFrame();
         if (!frame) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         int ret = avcodec_receive_frame(codecCtx_.get(), frame.get());
@@ -330,7 +330,7 @@ ErrorCode AudioDecoder::receiveFrames(std::vector<AVFramePtr>& frames) {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr AudioDecoder::convertFrame(AVFramePtr frame) {
@@ -349,7 +349,7 @@ AVFramePtr AudioDecoder::convertFrame(AVFramePtr frame) {
     
     // 设置重采样器
     ErrorCode result = setupResampler(frame.get());
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERROR("设置重采样器失败");
         return nullptr;
     }
@@ -394,7 +394,7 @@ AVFramePtr AudioDecoder::convertFrame(AVFramePtr frame) {
 
 ErrorCode AudioDecoder::setupResampler(const AVFrame* inputFrame) {
     if (!inputFrame) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 检查是否需要重新配置重采样器
@@ -405,7 +405,7 @@ ErrorCode AudioDecoder::setupResampler(const AVFrame* inputFrame) {
                           (inputFrame->ch_layout.nb_channels != codecCtx_->ch_layout.nb_channels);
     
     if (!needReconfigure) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 清理旧的重采样器
@@ -415,7 +415,7 @@ ErrorCode AudioDecoder::setupResampler(const AVFrame* inputFrame) {
     swrCtx_ = swr_alloc();
     if (!swrCtx_) {
         AV_LOGGER_ERROR("分配重采样器失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 设置输入参数
@@ -446,7 +446,7 @@ ErrorCode AudioDecoder::setupResampler(const AVFrame* inputFrame) {
                    audioParams_.sampleRate, audioParams_.channels,
                    av_get_sample_fmt_name(audioParams_.sampleFormat));
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void AudioDecoder::cleanupResampler() {

+ 14 - 14
AV/code/codec/codec_audio_encoder.cpp

@@ -196,14 +196,14 @@ ErrorCode AudioEncoder::open(const CodecParams& params) {
     }
     
     if (!validateParams(params)) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     audioParams_ = static_cast<const AudioEncoderParams&>(params);
     params_ = params;
     
     ErrorCode result = initEncoder();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         close();
         return result;
     }
@@ -213,7 +213,7 @@ ErrorCode AudioEncoder::open(const CodecParams& params) {
                  audioParams_.codecName, audioParams_.sampleRate, 
                  audioParams_.channels, audioParams_.bitRate / 1000);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void AudioEncoder::close() {
@@ -253,7 +253,7 @@ ErrorCode AudioEncoder::flush() {
     }
     
     setState(CodecState::OPENED);
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioEncoder::encode(const AVFramePtr& frame, std::vector<AVPacketPtr>& packets) {
@@ -272,7 +272,7 @@ ErrorCode AudioEncoder::encode(const AVFramePtr& frame, std::vector<AVPacketPtr>
     auto endTime = std::chrono::high_resolution_clock::now();
     double processTime = std::chrono::duration<double, std::milli>(endTime - startTime).count();
     
-    updateStats(result == ErrorCode::OK, processTime, 
+    updateStats(result == ErrorCode::SUCCESS, processTime, 
                 frame ? frame->nb_samples * audioParams_.channels * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format)) : 0);
     
     if (frameCallback_ && frame) {
@@ -346,19 +346,19 @@ ErrorCode AudioEncoder::initEncoder() {
     
     if (codec_->type != AVMEDIA_TYPE_AUDIO) {
         AV_LOGGER_ERROR("编码器类型不是音频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 创建编码上下文
     codecCtx_ = makeAVCodecContext(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配编码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 设置编码器参数
     ErrorCode result = setupEncoderParams();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -369,7 +369,7 @@ ErrorCode AudioEncoder::initEncoder() {
         return static_cast<ErrorCode>(ret);
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioEncoder::setupEncoderParams() {
@@ -378,7 +378,7 @@ ErrorCode AudioEncoder::setupEncoderParams() {
     
     // 设置声道布局
     ErrorCode result = setupChannelLayout();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -395,7 +395,7 @@ ErrorCode AudioEncoder::setupEncoderParams() {
         av_opt_set(codecCtx_->priv_data, "profile", audioParams_.profile.c_str(), 0);
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AudioEncoder::setupChannelLayout() {
@@ -407,7 +407,7 @@ ErrorCode AudioEncoder::setupChannelLayout() {
         av_channel_layout_default(&codecCtx_->ch_layout, audioParams_.channels);
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr AudioEncoder::convertFrame(const AVFramePtr& frame) {
@@ -485,7 +485,7 @@ ErrorCode AudioEncoder::receivePackets(std::vector<AVPacketPtr>& packets) {
     while (true) {
         AVPacketPtr packet = makeAVPacket();
         if (!packet) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         int ret = avcodec_receive_packet(codecCtx_.get(), packet.get());
@@ -501,7 +501,7 @@ ErrorCode AudioEncoder::receivePackets(std::vector<AVPacketPtr>& packets) {
         packets.push_back(std::move(packet));
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVSampleFormat AudioEncoder::getBestSampleFormat() const {

+ 16 - 16
AV/code/codec/codec_video_decoder.cpp

@@ -32,7 +32,7 @@ VideoDecoder::~VideoDecoder() {
 ErrorCode VideoDecoder::initialize(const CodecParams& params) {
     if (params.type != MediaType::VIDEO) {
         AV_LOGGER_ERROR("参数类型不是视频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     videoParams_ = static_cast<const VideoDecoderParams&>(params);
@@ -44,7 +44,7 @@ ErrorCode VideoDecoder::initialize(const CodecParams& params) {
     setState(CodecState::IDLE);
     AV_LOGGER_INFOF("视频解码器初始化成功: {}", videoParams_.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoDecoder::open(const CodecParams& params) {
@@ -53,7 +53,7 @@ ErrorCode VideoDecoder::open(const CodecParams& params) {
     // 如果提供了参数,先初始化
     if (params.type != MediaType::UNKNOWN) {
         ErrorCode initResult = initialize(params);
-        if (initResult != ErrorCode::OK) {
+        if (initResult != ErrorCode::SUCCESS) {
             return initResult;
         }
     }
@@ -64,7 +64,7 @@ ErrorCode VideoDecoder::open(const CodecParams& params) {
     }
     
     ErrorCode result = initDecoder();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -73,7 +73,7 @@ ErrorCode VideoDecoder::open(const CodecParams& params) {
                    videoParams_.codecName, 
                    codecCtx_->width, codecCtx_->height);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void VideoDecoder::close() {
@@ -112,7 +112,7 @@ ErrorCode VideoDecoder::flush() {
     setState(CodecState::OPENED);
     AV_LOGGER_DEBUG("视频解码器已重置");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoDecoder::reset() {
@@ -135,7 +135,7 @@ ErrorCode VideoDecoder::decode(const AVPacketPtr& packet, std::vector<AVFramePtr
     auto endTime = std::chrono::high_resolution_clock::now();
     double processTime = std::chrono::duration<double, std::milli>(endTime - startTime).count();
     
-    updateStats(result == ErrorCode::OK, processTime, 
+    updateStats(result == ErrorCode::SUCCESS, processTime, 
                 packet ? packet->size : 0);
     
     if (frameCallback_) {
@@ -177,20 +177,20 @@ ErrorCode VideoDecoder::initDecoder() {
     
     if (codec_->type != AVMEDIA_TYPE_VIDEO) {
         AV_LOGGER_ERROR("解码器类型不是视频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 创建解码上下文
     codecCtx_ = makeAVCodecContext(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配解码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 设置硬件加速
     if (videoParams_.hardwareAccel && isHardwareDecoder(videoParams_.codecName)) {
         ErrorCode result = setupHardwareAcceleration();
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             AV_LOGGER_WARNING("硬件加速设置失败,回退到软件解码");
             isHardwareDecoder_ = false;
             
@@ -204,7 +204,7 @@ ErrorCode VideoDecoder::initDecoder() {
     
     // 设置解码器参数
     ErrorCode result = setupDecoderParams();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -242,7 +242,7 @@ ErrorCode VideoDecoder::initDecoder() {
     
     AV_LOGGER_INFOF("解码器打开成功: {}", videoParams_.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoDecoder::setupDecoderParams() {
@@ -281,7 +281,7 @@ ErrorCode VideoDecoder::setupDecoderParams() {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoDecoder::setupHardwareAcceleration() {
@@ -325,7 +325,7 @@ ErrorCode VideoDecoder::setupHardwareAcceleration() {
     // 设置硬件设备上下文到解码器
     codecCtx_->hw_device_ctx = av_buffer_ref(hwDeviceCtx_);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoDecoder::decodeFrame(const AVPacketPtr& packet, std::vector<AVFramePtr>& frames) {
@@ -344,7 +344,7 @@ ErrorCode VideoDecoder::receiveFrames(std::vector<AVFramePtr>& frames) {
     while (true) {
         AVFramePtr frame = makeAVFrame();
         if (!frame) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         int ret = avcodec_receive_frame(codecCtx_.get(), frame.get());
@@ -378,7 +378,7 @@ ErrorCode VideoDecoder::receiveFrames(std::vector<AVFramePtr>& frames) {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr VideoDecoder::convertFrame(const AVFramePtr& frame) {

+ 15 - 15
AV/code/codec/codec_video_encoder.cpp

@@ -133,14 +133,14 @@ ErrorCode VideoEncoder::open(const CodecParams& params) {
     }
     
     if (!validateParams(params)) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     videoParams_ = static_cast<const VideoEncoderParams&>(params);
     params_ = params;
     
     ErrorCode result = initEncoder();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         close();
         return result;
     }
@@ -150,7 +150,7 @@ ErrorCode VideoEncoder::open(const CodecParams& params) {
                  videoParams_.codecName, videoParams_.width, 
                  videoParams_.height, videoParams_.fps);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void VideoEncoder::close() {
@@ -196,7 +196,7 @@ ErrorCode VideoEncoder::flush() {
     }
     
     setState(CodecState::OPENED);
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoEncoder::encode(const AVFramePtr& frame, std::vector<AVPacketPtr>& packets) {
@@ -215,7 +215,7 @@ ErrorCode VideoEncoder::encode(const AVFramePtr& frame, std::vector<AVPacketPtr>
     auto endTime = std::chrono::high_resolution_clock::now();
     double processTime = std::chrono::duration<double, std::milli>(endTime - startTime).count();
     
-    updateStats(result == ErrorCode::OK, processTime, 
+    updateStats(result == ErrorCode::SUCCESS, processTime, 
                 frame ? frame->width * frame->height * 3 / 2 : 0);
     
     if (frameCallback_ && frame) {
@@ -276,20 +276,20 @@ ErrorCode VideoEncoder::initEncoder() {
     
     if (codec_->type != AVMEDIA_TYPE_VIDEO) {
         AV_LOGGER_ERROR("编码器类型不是视频");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 创建编码上下文
     codecCtx_ = makeAVCodecContext(codec_);
     if (!codecCtx_) {
         AV_LOGGER_ERROR("分配编码上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 设置硬件加速
     if (videoParams_.hardwareAccel && isHardwareEncoder(videoParams_.codecName)) {
         ErrorCode result = setupHardwareAcceleration();
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             AV_LOGGER_WARNING("硬件加速设置失败,回退到软件编码");
             isHardwareEncoder_ = false;
             
@@ -303,7 +303,7 @@ ErrorCode VideoEncoder::initEncoder() {
     
     // 设置编码器参数(在硬件加速设置之后)
     ErrorCode result = setupEncoderParams();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -352,7 +352,7 @@ ErrorCode VideoEncoder::initEncoder() {
     
     AV_LOGGER_INFOF("编码器打开成功: {}", videoParams_.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoEncoder::setupEncoderParams() {
@@ -442,7 +442,7 @@ ErrorCode VideoEncoder::setupEncoderParams() {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode VideoEncoder::setupHardwareAcceleration() {
@@ -497,7 +497,7 @@ ErrorCode VideoEncoder::setupHardwareFrameContext() {
     AVBufferRef* hwFramesRef = av_hwframe_ctx_alloc(hwDeviceCtx_);
     if (!hwFramesRef) {
         AV_LOGGER_ERROR("分配硬件帧上下文失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     AVHWFramesContext* framesCtx = reinterpret_cast<AVHWFramesContext*>(hwFramesRef->data);
@@ -527,7 +527,7 @@ ErrorCode VideoEncoder::setupHardwareFrameContext() {
     av_buffer_unref(&hwFramesRef);
     
     AV_LOGGER_INFO("硬件帧上下文初始化成功");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVFramePtr VideoEncoder::convertFrame(const AVFramePtr& frame) {
@@ -651,7 +651,7 @@ ErrorCode VideoEncoder::receivePackets(std::vector<AVPacketPtr>& packets) {
     while (true) {
         AVPacketPtr packet = makeAVPacket();
         if (!packet) {
-            return ErrorCode::OUT_OF_MEMORY;
+            return ErrorCode::MEMORY_ALLOC_FAILED;
         }
         
         int ret = avcodec_receive_packet(codecCtx_.get(), packet.get());
@@ -667,7 +667,7 @@ ErrorCode VideoEncoder::receivePackets(std::vector<AVPacketPtr>& packets) {
         packets.push_back(std::move(packet));
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVHWDeviceType VideoEncoder::getHardwareDeviceType() const {

+ 18 - 18
AV/code/muxer/muxer_abstract_muxer.cpp

@@ -33,7 +33,7 @@ ErrorCode AbstractMuxer::pause() {
     setState(MuxerState::PAUSED);
     AV_LOGGER_INFO("复用器已暂停");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::resume() {
@@ -45,12 +45,12 @@ ErrorCode AbstractMuxer::resume() {
     setState(MuxerState::STARTED);
     AV_LOGGER_INFO("复用器已恢复");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::reset() {
     ErrorCode result = stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -67,7 +67,7 @@ ErrorCode AbstractMuxer::reset() {
     setState(MuxerState::INITIALIZED);
     AV_LOGGER_INFO("复用器已重置");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::removeStream(int streamIndex) {
@@ -88,7 +88,7 @@ ErrorCode AbstractMuxer::removeStream(int streamIndex) {
     
     AV_LOGGER_INFOF("已移除流: 索引={}", streamIndex);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 std::vector<StreamInfo> AbstractMuxer::getStreams() const {
@@ -412,7 +412,7 @@ ErrorCode AbstractMuxer::initialize(const MuxerParams& params) {
     
     setState(MuxerState::INITIALIZED);
     AV_LOGGER_INFO("抽象复用器初始化完成");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::start() {
@@ -423,7 +423,7 @@ ErrorCode AbstractMuxer::start() {
     
     setState(MuxerState::STARTED);
     AV_LOGGER_INFO("抽象复用器已启动");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::stop() {
@@ -433,35 +433,35 @@ ErrorCode AbstractMuxer::stop() {
     
     setState(MuxerState::STOPPED);
     AV_LOGGER_INFO("抽象复用器已停止");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::close() {
     stop();
     setState(MuxerState::IDLE);
     AV_LOGGER_INFO("抽象复用器已关闭");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::writePacket(AVPacket* packet) {
     if (!packet) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     updateStats(packet);
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::writeFrame(AVFrame* frame, int streamIndex) {
     if (!frame) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::flush() {
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::addStream(const StreamInfo& streamInfo) {
@@ -481,19 +481,19 @@ ErrorCode AbstractMuxer::addStream(const StreamInfo& streamInfo) {
     streams_.push_back(streamInfo);
     AV_LOGGER_INFOF("已添加流: 索引={}, 类型={}", streamInfo.index, static_cast<int>(streamInfo.type));
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::setupOutput() {
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::writeHeader() {
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode AbstractMuxer::writeTrailer() {
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 // 默认工厂实现

+ 44 - 44
AV/code/muxer/muxer_file_muxer.cpp

@@ -29,7 +29,7 @@ FileMuxer::~FileMuxer() {
 ErrorCode FileMuxer::initialize(const MuxerParams& params) {
     if (params.type != MuxerType::FILE_MUXER) {
         AV_LOGGER_ERROR("参数类型不是文件复用器");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     fileMuxerParams_ = static_cast<const FileMuxerParams&>(params);
@@ -40,7 +40,7 @@ ErrorCode FileMuxer::initialize(const MuxerParams& params) {
     
     // 调用父类的initialize方法来处理streams
     ErrorCode result = AbstractMuxer::initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -52,7 +52,7 @@ ErrorCode FileMuxer::initialize(const MuxerParams& params) {
     }
     
     ErrorCode validateResult = validateFilePath(currentOutputFile_);
-    if (validateResult != ErrorCode::OK) {
+    if (validateResult != ErrorCode::SUCCESS) {
         return validateResult;
     }
     
@@ -70,7 +70,7 @@ ErrorCode FileMuxer::initialize(const MuxerParams& params) {
     
     AV_LOGGER_INFOF("文件复用器初始化成功: {}", currentOutputFile_);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::start() {
@@ -80,12 +80,12 @@ ErrorCode FileMuxer::start() {
     }
     
     ErrorCode result = setupOutput();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
     result = writeHeader();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -98,7 +98,7 @@ ErrorCode FileMuxer::start() {
         fileStartTime_ = std::chrono::steady_clock::now();
         AV_LOGGER_INFO("文件复用器已启动");
         
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     } catch (const std::exception& e) {
         AV_LOGGER_ERRORF("启动写入线程失败: {}", e.what());
         return ErrorCode::THREAD_ERROR;
@@ -107,7 +107,7 @@ ErrorCode FileMuxer::start() {
 
 ErrorCode FileMuxer::stop() {
     if (getState() != MuxerState::STARTED && getState() != MuxerState::PAUSED) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 停止写入线程
@@ -123,14 +123,14 @@ ErrorCode FileMuxer::stop() {
     
     // 写入文件尾
     ErrorCode result = writeTrailer();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("写入文件尾失败: {}", static_cast<int>(result));
     }
     
     setState(MuxerState::STOPPED);
     AV_LOGGER_INFO("文件复用器已停止");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::close() {
@@ -155,7 +155,7 @@ ErrorCode FileMuxer::close() {
 ErrorCode FileMuxer::writePacket(AVPacket* packet) {
     if (!packet) {
         AV_LOGGER_ERROR("包指针为空");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     if (getState() != MuxerState::STARTED) {
@@ -180,7 +180,7 @@ ErrorCode FileMuxer::writePacket(AVPacket* packet) {
     AVPacket* packetCopy = av_packet_alloc();
     if (!packetCopy) {
         AV_LOGGER_ERROR("分配包内存失败");
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     int ret = av_packet_ref(packetCopy, packet);
@@ -201,13 +201,13 @@ ErrorCode FileMuxer::writePacket(AVPacket* packet) {
     
     queueCondition_.notify_one();
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::writeFrame(AVFrame* frame, int streamIndex) {
     if (!frame) {
         AV_LOGGER_ERROR("帧指针为空");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 这里需要编码器将帧编码为包,然后调用writePacket
@@ -219,7 +219,7 @@ ErrorCode FileMuxer::writeFrame(AVFrame* frame, int streamIndex) {
 
 ErrorCode FileMuxer::flush() {
     if (!formatCtx_) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     std::lock_guard<std::mutex> lock(fileMutex_);
@@ -237,7 +237,7 @@ ErrorCode FileMuxer::flush() {
     lastFlushTime_ = std::chrono::steady_clock::now();
     AV_LOGGER_DEBUG("复用器已刷新");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::addStream(const StreamInfo& streamInfo) {
@@ -265,7 +265,7 @@ ErrorCode FileMuxer::addStream(const StreamInfo& streamInfo) {
                    streamInfo.index, static_cast<int>(streamInfo.type), 
                    streamInfo.codecName);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::setOutputFile(const std::string& filename) {
@@ -275,7 +275,7 @@ ErrorCode FileMuxer::setOutputFile(const std::string& filename) {
     }
     
     ErrorCode result = validateFilePath(filename);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -284,7 +284,7 @@ ErrorCode FileMuxer::setOutputFile(const std::string& filename) {
     
     AV_LOGGER_INFOF("输出文件已设置为: {}", filename);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 std::string FileMuxer::getOutputFile() const {
@@ -312,7 +312,7 @@ ErrorCode FileMuxer::enableSegmentation(bool enable, int duration) {
     
     AV_LOGGER_INFOF("Segmentation {}: duration={}s", enable ? "enabled" : "disabled", duration);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::forceNewSegment() {
@@ -344,14 +344,14 @@ ErrorCode FileMuxer::setFastStart(bool enable) {
     
     AV_LOGGER_INFOF("Fast start {}", enable ? "enabled" : "disabled");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::setMovFlags(int flags) {
     fileMuxerParams_.movFlags = flags;
     AV_LOGGER_INFOF("MOV标志已设置为: 0x{:X}", flags);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::setupOutput() {
@@ -374,7 +374,7 @@ ErrorCode FileMuxer::setupOutput() {
     
     // 设置流
     ErrorCode result = setupStreams();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -416,12 +416,12 @@ ErrorCode FileMuxer::writeHeader() {
     
     AV_LOGGER_INFO("文件头已写入");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::writeTrailer() {
     if (!formatCtx_) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     std::lock_guard<std::mutex> lock(fileMutex_);
@@ -434,7 +434,7 @@ ErrorCode FileMuxer::writeTrailer() {
     
     AV_LOGGER_INFO("文件尾已写入");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::openOutputFile() {
@@ -461,12 +461,12 @@ ErrorCode FileMuxer::openOutputFile() {
     currentFileSize_ = 0;
     AV_LOGGER_INFOF("输出文件已打开: {}", currentOutputFile_);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::closeOutputFile() {
     if (!formatCtx_) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     std::lock_guard<std::mutex> lock(fileMutex_);
@@ -485,23 +485,23 @@ ErrorCode FileMuxer::closeOutputFile() {
     
     AV_LOGGER_INFO("输出文件已关闭");
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::createNewSegment() {
     if (!segmentationEnabled_) {
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 写入当前段的尾部
     ErrorCode result = writeTrailer();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
     // 关闭当前文件
     result = closeOutputFile();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -514,13 +514,13 @@ ErrorCode FileMuxer::createNewSegment() {
     
     // 重新设置输出
     result = setupOutput();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
     // 写入新段的头部
     result = writeHeader();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         return result;
     }
     
@@ -528,7 +528,7 @@ ErrorCode FileMuxer::createNewSegment() {
     
     AV_LOGGER_INFOF("创建新段: {}", currentOutputFile_);
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode FileMuxer::setupStreams() {
@@ -546,7 +546,7 @@ ErrorCode FileMuxer::setupStreams() {
     
     AV_LOGGER_INFOF("已设置 {} 个流", streams_.size());
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 AVStream* FileMuxer::createAVStream(const StreamInfo& streamInfo) {
@@ -591,7 +591,7 @@ AVStream* FileMuxer::createAVStream(const StreamInfo& streamInfo) {
 
 ErrorCode FileMuxer::processPacket(AVPacket* packet) {
     if (!packet || !formatCtx_) {
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 检查流索引
@@ -604,7 +604,7 @@ ErrorCode FileMuxer::processPacket(AVPacket* packet) {
     // 检查是否需要创建新段
     if (shouldCreateNewSegment()) {
         ErrorCode result = createNewSegment();
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             return result;
         }
     }
@@ -643,7 +643,7 @@ ErrorCode FileMuxer::writePacketInternal(AVPacket* packet) {
         }
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 void FileMuxer::writeThreadFunc() {
@@ -671,7 +671,7 @@ void FileMuxer::writeThreadFunc() {
         
         if (item && item->packet) {
             ErrorCode result = processPacket(item->packet);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 onError(result, "写入包失败");
             }
         }
@@ -740,7 +740,7 @@ bool FileMuxer::shouldCreateNewSegment() const {
 ErrorCode FileMuxer::validateFilePath(const std::string& path) {
     if (path.empty()) {
         AV_LOGGER_ERROR("文件路径不能为空");
-        return ErrorCode::INVALID_ARGUMENT;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     try {
@@ -764,7 +764,7 @@ ErrorCode FileMuxer::validateFilePath(const std::string& path) {
         return ErrorCode::INVALID_PATH;
     }
     
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 bool FileMuxer::validateParams(const MuxerParams& params) {
@@ -822,7 +822,7 @@ std::unique_ptr<FileMuxer> FileMuxer::FileMuxerFactory::createFileMuxer(const st
     params.format = AbstractMuxer::getFormatFromExtension(filename);
     
     ErrorCode result = muxer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建文件复用器失败: {}", static_cast<int>(result));
         return nullptr;
     }
@@ -848,7 +848,7 @@ std::unique_ptr<FileMuxer> FileMuxer::FileMuxerFactory::createSegmentedMuxer(con
     params.format = AbstractMuxer::getFormatFromExtension(firstFile);
     
     ErrorCode result = muxer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         AV_LOGGER_ERRORF("创建分段复用器失败: {}", static_cast<int>(result));
         return nullptr;
     }

+ 9 - 9
AV/code/muxer/muxer_stream_muxer.cpp

@@ -25,7 +25,7 @@ StreamMuxer::~StreamMuxer() {
 ErrorCode StreamMuxer::initialize(const MuxerParams& params) {
     if (!validateParams(params)) {
         Logger::instance().error("Invalid stream muxer parameters");
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     streamParams_ = static_cast<const StreamMuxerParams&>(params);
@@ -104,7 +104,7 @@ ErrorCode StreamMuxer::close() {
 
 ErrorCode StreamMuxer::writePacket(AVPacket* packet) {
     if (!packet) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     if (!isConnected()) {
@@ -117,7 +117,7 @@ ErrorCode StreamMuxer::writePacket(AVPacket* packet) {
 
 ErrorCode StreamMuxer::writeFrame(AVFrame* frame, int streamIndex) {
     if (!frame || streamIndex < 0) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     if (!isConnected()) {
@@ -128,7 +128,7 @@ ErrorCode StreamMuxer::writeFrame(AVFrame* frame, int streamIndex) {
     // 将帧编码为包
     AVPacket* packet = av_packet_alloc();
     if (!packet) {
-        return ErrorCode::OUT_OF_MEMORY;
+        return ErrorCode::MEMORY_ALLOC_FAILED;
     }
     
     // 这里需要编码器支持,暂时返回成功
@@ -241,7 +241,7 @@ ErrorCode StreamMuxer::setUrl(const std::string& url) {
     
     if (!validateUrl(url)) {
         Logger::instance().errorf("Invalid URL: {}", url);
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     streamParams_.url = url;
@@ -267,7 +267,7 @@ ErrorCode StreamMuxer::enableAdaptiveBitrate(bool enable) {
 
 ErrorCode StreamMuxer::setBitrateRange(int minBitrate, int maxBitrate) {
     if (minBitrate <= 0 || maxBitrate <= minBitrate) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     streamParams_.minBitrate = minBitrate;
@@ -279,7 +279,7 @@ ErrorCode StreamMuxer::setBitrateRange(int minBitrate, int maxBitrate) {
 
 ErrorCode StreamMuxer::adjustBitrate(double factor) {
     if (factor <= 0.0 || factor > 2.0) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     int newBitrate = static_cast<int>(currentBitrate_ * factor);
@@ -541,7 +541,7 @@ ErrorCode StreamMuxer::setupSRT() {
 
 ErrorCode StreamMuxer::processPacket(AVPacket* packet) {
     if (!packet || !formatCtx_) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 发送包
@@ -567,7 +567,7 @@ ErrorCode StreamMuxer::processPacket(AVPacket* packet) {
 
 ErrorCode StreamMuxer::sendPacket(AVPacket* packet) {
     if (!packet || !formatCtx_) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     int ret = av_interleaved_write_frame(formatCtx_, packet);

+ 1 - 1
AV/code/player/SimplePlayerWindow.cpp

@@ -40,7 +40,7 @@ void SimplePlayerWindow::openFile()
     
     if (!filename.isEmpty()) {
         av::ErrorCode result = m_playerAdapter->openFile(filename);
-        if (result != av::ErrorCode::OK) {
+        if (result != av::ErrorCode::SUCCESS) {
             QMessageBox::critical(this, "Error", "Failed to open file: " + filename);
         } else {
             m_fileLabel->setText("File: " + QFileInfo(filename).fileName());

+ 3 - 3
AV/code/player/player_adapter.cpp

@@ -49,7 +49,7 @@ av::ErrorCode PlayerAdapter::openFile(const QString& filename)
     std::string stdFilename = filename.toStdString();
     av::ErrorCode result = m_playerCore->openFile(stdFilename);
     
-    if (result == av::ErrorCode::OK) {
+    if (result == av::ErrorCode::SUCCESS) {
         // 启动更新定时器
         startUpdateTimer();
     }
@@ -71,7 +71,7 @@ av::ErrorCode PlayerAdapter::stop()
 {
     av::ErrorCode result = m_playerCore->stop();
     
-    if (result == av::ErrorCode::OK) {
+    if (result == av::ErrorCode::SUCCESS) {
         // 停止更新定时器
         stopUpdateTimer();
     }
@@ -88,7 +88,7 @@ av::ErrorCode PlayerAdapter::setPlaybackSpeed(double speed)
 {
     av::ErrorCode result = m_playerCore->setPlaybackSpeed(speed);
     
-    if (result == av::ErrorCode::OK && std::abs(m_lastPlaybackSpeed - speed) > 0.001) {
+    if (result == av::ErrorCode::SUCCESS && std::abs(m_lastPlaybackSpeed - speed) > 0.001) {
         m_lastPlaybackSpeed = speed;
         emit playbackSpeedChanged(speed);
     }

+ 14 - 14
AV/code/player/player_core.cpp

@@ -115,7 +115,7 @@ ErrorCode PlayerCore::openFile(const std::string& filename)
     }
     
     av::Logger::instance().info("File opened successfully: " + filename);
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode PlayerCore::play()
@@ -124,7 +124,7 @@ ErrorCode PlayerCore::play()
     
     if (m_state == PlayerState::Playing) {
         av::Logger::instance().debug("Already playing");
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     if (m_state != PlayerState::Stopped && m_state != PlayerState::Paused) {
@@ -151,7 +151,7 @@ ErrorCode PlayerCore::play()
     
     setState(PlayerState::Playing);
     av::Logger::instance().info("Playback started");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode PlayerCore::pause()
@@ -170,7 +170,7 @@ ErrorCode PlayerCore::pause()
     
     setState(PlayerState::Paused);
     av::Logger::instance().info("Playback paused");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode PlayerCore::stop()
@@ -179,7 +179,7 @@ ErrorCode PlayerCore::stop()
     
     if (m_state == PlayerState::Idle || m_state == PlayerState::Stopped) {
         av::Logger::instance().debug("Already stopped");
-        return ErrorCode::OK;
+        return ErrorCode::SUCCESS;
     }
     
     // 停止音频输出
@@ -205,7 +205,7 @@ ErrorCode PlayerCore::stop()
     
     setState(PlayerState::Stopped);
     av::Logger::instance().info("Playback stopped");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode PlayerCore::seek(int64_t timestamp)
@@ -228,21 +228,21 @@ ErrorCode PlayerCore::seek(int64_t timestamp)
     
     setState(PlayerState::Seeking);
     av::Logger::instance().info("Seek initiated");
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 ErrorCode PlayerCore::setPlaybackSpeed(double speed)
 {
     if (speed <= 0.0 || speed > 4.0) {
         av::Logger::instance().error("Invalid playback speed: " + std::to_string(speed));
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     std::lock_guard<std::mutex> lock(m_mutex);
     m_playbackSpeed = speed;
     
     av::Logger::instance().info("Playback speed set to: " + std::to_string(speed));
-    return ErrorCode::OK;
+    return ErrorCode::SUCCESS;
 }
 
 MediaInfo PlayerCore::getMediaInfo() const
@@ -497,7 +497,7 @@ void PlayerCore::readThreadFunc()
         
         // 将数据包放入队列
         if (m_packetQueue) {
-            if (m_packetQueue->enqueue(packet) != av::ErrorCode::OK) {
+            if (m_packetQueue->enqueue(packet) != av::ErrorCode::SUCCESS) {
                 av_packet_free(&packet);
             }
         } else {
@@ -522,7 +522,7 @@ void PlayerCore::videoDecodeThreadFunc()
                 AVPacketPtr packetPtr(packet);
                 std::vector<AVFramePtr> frames;
                 ErrorCode result = m_videoDecoder->decode(packetPtr, frames);
-                if (result == ErrorCode::OK) {
+                if (result == ErrorCode::SUCCESS) {
                     for (auto& frame : frames) {
                         // 直接渲染到视频渲染器
                         if (m_videoRenderer && frame) {
@@ -560,7 +560,7 @@ void PlayerCore::audioDecodeThreadFunc()
                 AVPacketPtr packetPtr(packet);
                 std::vector<AVFramePtr> frames;
                 ErrorCode result = m_audioDecoder->decode(packetPtr, frames);
-                if (result == ErrorCode::OK) {
+                if (result == ErrorCode::SUCCESS) {
                     for (auto& frame : frames) {
                         // 直接输出到音频设备
                         if (m_audioOutput && frame && m_state == PlayerState::Playing) {
@@ -606,7 +606,7 @@ bool PlayerCore::setupVideoDecoder()
     params.threadCount = 4;
     
     ErrorCode result = m_videoDecoder->open(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         av::Logger::instance().error("Failed to open video decoder");
         return false;
     }
@@ -640,7 +640,7 @@ bool PlayerCore::setupAudioDecoder()
     params.enableResampling = true;
     
     ErrorCode result = m_audioDecoder->open(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         av::Logger::instance().error("Failed to open audio decoder");
         return false;
     }

+ 5 - 5
AV/code/player/thread_manager.cpp

@@ -160,7 +160,7 @@ bool ReadThread::readPacket()
     // 只处理我们关心的流
     if (packet->stream_index == m_videoStreamIndex || 
         packet->stream_index == m_audioStreamIndex) {
-        if (m_packetQueue->enqueue(packet) != av::ErrorCode::OK) {
+        if (m_packetQueue->enqueue(packet) != av::ErrorCode::SUCCESS) {
             av_packet_free(&packet);
             return false;
         }
@@ -285,7 +285,7 @@ bool VideoDecodeThread::decodeFrame()
     AVPacketPtr packetPtr(filteredPacket);
     ErrorCode result = m_decoder->decode(packetPtr, frames);
     
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         av::Logger::instance().errorf("Video decode failed with error: {}", static_cast<int>(result));
         return false;
     }
@@ -307,7 +307,7 @@ bool VideoDecodeThread::decodeFrame()
         }
         
         // 添加到帧队列
-        if (m_frameQueue->enqueue(frame.release()) != av::ErrorCode::OK) {
+        if (m_frameQueue->enqueue(frame.release()) != av::ErrorCode::SUCCESS) {
             return false;
         }
     }
@@ -422,7 +422,7 @@ bool AudioDecodeThread::decodeFrame()
     AVPacketPtr packetPtr(packet);
     ErrorCode result = m_decoder->decode(packetPtr, frames);
     
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         av::Logger::instance().errorf("Audio decode failed with error: {}", static_cast<int>(result));
         return false;
     }
@@ -444,7 +444,7 @@ bool AudioDecodeThread::decodeFrame()
         }
         
         // 添加到帧队列
-        if (m_frameQueue->enqueue(frame.release()) != av::ErrorCode::OK) {
+        if (m_frameQueue->enqueue(frame.release()) != av::ErrorCode::SUCCESS) {
             return false;
         }
     }

+ 3 - 3
AV/code/utils/utils_frame_queue.cpp

@@ -23,7 +23,7 @@ FrameQueue::~FrameQueue() {
 
 ErrorCode FrameQueue::enqueue(std::unique_ptr<FrameQueueItem> item) {
     if (!item) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     if (shutdown_) {
@@ -139,7 +139,7 @@ std::unique_ptr<FrameQueueItem> FrameQueue::dequeue(int timeoutMs) {
 
 ErrorCode FrameQueue::enqueue(AVFrame* frame, int streamIndex) {
     if (!frame) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     auto item = std::make_unique<FrameQueueItem>(frame, streamIndex);
@@ -461,7 +461,7 @@ ErrorCode MultiStreamFrameQueue::enqueueToAll(AVFrame* frame) {
         // 为每个流创建帧的副本
         AVFrame* frameCopy = av_frame_alloc();
         if (!frameCopy) {
-            result = ErrorCode::OUT_OF_MEMORY;
+            result = ErrorCode::MEMORY_ALLOC_FAILED;
             continue;
         }
         

+ 4 - 4
AV/code/utils/utils_packet_queue.cpp

@@ -24,7 +24,7 @@ PacketQueue::~PacketQueue() {
 
 ErrorCode PacketQueue::enqueue(std::unique_ptr<PacketQueueItem> item) {
     if (!item) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     if (shutdown_) {
@@ -192,7 +192,7 @@ std::unique_ptr<PacketQueueItem> PacketQueue::dequeue(int timeoutMs) {
 
 ErrorCode PacketQueue::enqueue(AVPacket* packet, int streamIndex, int priority) {
     if (!packet) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     auto item = std::make_unique<PacketQueueItem>(packet, streamIndex, priority);
@@ -221,7 +221,7 @@ AVPacket* PacketQueue::dequeuePacket(int timeoutMs) {
 
 ErrorCode PacketQueue::enqueueWithPriority(AVPacket* packet, int priority, int streamIndex) {
     if (!packet) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     auto item = std::make_unique<PacketQueueItem>(packet, streamIndex, priority);
@@ -757,7 +757,7 @@ ErrorCode MultiStreamPacketQueue::enqueueToAll(AVPacket* packet) {
         // 为每个流创建包的副本
         AVPacket* packetCopy = av_packet_alloc();
         if (!packetCopy) {
-            result = ErrorCode::OUT_OF_MEMORY;
+            result = ErrorCode::MEMORY_ALLOC_FAILED;
             continue;
         }
         

+ 2 - 2
AV/code/utils/utils_performance_monitor.cpp

@@ -131,7 +131,7 @@ ErrorCode PerformanceMonitor::close() {
 
 ErrorCode PerformanceMonitor::registerMetric(const std::string& name, MetricType type, double alertThreshold) {
     if (name.empty()) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     std::lock_guard<std::mutex> lock(metricsMutex_);
@@ -750,7 +750,7 @@ std::string SystemPerformanceMonitor::getGpuInfo() const {
 
 ErrorCode SystemPerformanceMonitor::integrateWithMonitor(PerformanceMonitor* monitor) {
     if (!monitor) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 定期更新系统指标到性能监控器

+ 2 - 2
AV/code/utils/utils_synchronizer.cpp

@@ -231,7 +231,7 @@ ErrorCode Synchronizer::updateClock(ClockType type, double pts, double time) {
     }
     
     if (!clock) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     // 平滑处理
@@ -983,7 +983,7 @@ ErrorCode MultiStreamSynchronizer::synchronizeStream(int streamIndex, double pts
         return it->second->synchronizeVideo(pts, delay);
     }
     
-    return ErrorCode::INVALID_PARAMETER;
+    return ErrorCode::INVALID_PARAMS;
 }
 
 ErrorCode MultiStreamSynchronizer::synchronizeAllStreams() {

+ 2 - 2
AV/code/utils/utils_thread_pool.cpp

@@ -378,7 +378,7 @@ ThreadPoolConfig ThreadPool::getConfig() const {
 
 ErrorCode ThreadPool::resizeThreadPool(size_t newSize) {
     if (newSize == 0) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     std::lock_guard<std::mutex> lock(configMutex_);
@@ -762,7 +762,7 @@ ThreadPool* ThreadPoolManager::getDefaultPool() {
 
 ErrorCode ThreadPoolManager::createPool(const std::string& name, const ThreadPoolConfig& config) {
     if (name.empty()) {
-        return ErrorCode::INVALID_PARAMETER;
+        return ErrorCode::INVALID_PARAMS;
     }
     
     std::lock_guard<std::mutex> lock(poolsMutex_);

+ 6 - 6
AV/test_audio_encoder.cpp

@@ -48,7 +48,7 @@ public:
             
             // 打开编码器
             ErrorCode result = encoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 Logger::instance().errorf("[失败] 打开编码器失败: {}", static_cast<int>(result));
                 return false;
             }
@@ -63,7 +63,7 @@ public:
             // 编码音频帧
             std::vector<AVPacketPtr> packets;
             result = encoder->encode(frame, packets);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 Logger::instance().errorf("[失败] 编码音频帧失败: {}", static_cast<int>(result));
                 return false;
             }
@@ -125,7 +125,7 @@ public:
                 params.sampleFormat = AV_SAMPLE_FMT_FLTP;
                 
                 ErrorCode result = encoder->open(params);
-                if (result == ErrorCode::OK) {
+                if (result == ErrorCode::SUCCESS) {
                     Logger::instance().infof("  [成功] {} 编码器打开成功", codecName);
                     successCount++;
                 } else {
@@ -255,7 +255,7 @@ public:
             params.channels = 2;
             
             ErrorCode result = encoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 Logger::instance().error("[失败] 打开编码器失败");
                 return false;
             }
@@ -294,7 +294,7 @@ public:
                 AudioEncoderParams params;
                 params.codecName = "invalid_codec";
                 ErrorCode result = encoder->open(params);
-                if (result == ErrorCode::OK) {
+                if (result == ErrorCode::SUCCESS) {
                     Logger::instance().error("[失败] 应该拒绝无效编码器");
                     return false;
                 }
@@ -309,7 +309,7 @@ public:
                 params.channels = 0;    // 无效声道数
                 
                 ErrorCode result = encoder->open(params);
-                if (result == ErrorCode::OK) {
+                if (result == ErrorCode::SUCCESS) {
                     Logger::instance().error("[失败] 应该拒绝无效参数");
                     return false;
                 }

+ 3 - 3
AV/test_codec.cpp

@@ -62,7 +62,7 @@ int main() {
                 videoParams.hardwareAccel = true;  // 启用硬件加速
                 
                 AVResult result = videoEncoder->open(videoParams);
-                if (result == AVResult::OK) {
+                if (result == AVResult::SUCCESS) {
                     AV_LOGGER_INFO("视频编码器打开成功");
                     
                     // 测试编码器状态
@@ -82,7 +82,7 @@ int main() {
                     auto softwareEncoder = VideoEncoderFactory::create("libx264");
                     if (softwareEncoder) {
                         AVResult softResult = softwareEncoder->open(videoParams);
-                        if (softResult == AVResult::OK) {
+                        if (softResult == AVResult::SUCCESS) {
                             AV_LOGGER_INFO("软件视频编码器打开成功");
                             softwareEncoder->close();
                             AV_LOGGER_INFO("软件视频编码器已关闭");
@@ -114,7 +114,7 @@ int main() {
                 av_channel_layout_default(&audioParams.channelLayout, 2);
                 
                 AVResult result = audioEncoder->open(audioParams);
-                if (result == AVResult::OK) {
+                if (result == AVResult::SUCCESS) {
                     AV_LOGGER_INFO("音频编码器打开成功");
                     
                     // 测试编码器状态

+ 8 - 8
AV/test_decoder.cpp

@@ -63,7 +63,7 @@ public:
             params.threadCount = 4;
             
             ErrorCode result = decoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 std::cerr << "打开H.264解码器失败: " << static_cast<int>(result) << std::endl;
                 return false;
             }
@@ -106,7 +106,7 @@ public:
              params.enableResampling = true;
             
             ErrorCode result = decoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 std::cerr << "打开AAC解码器失败: " << static_cast<int>(result) << std::endl;
                 return false;
             }
@@ -154,7 +154,7 @@ public:
             params.lowLatency = true;
             
             ErrorCode result = decoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 std::cout << "硬件解码器打开失败,可能不支持: " << static_cast<int>(result) << std::endl;
                 return true; // 不算失败,因为硬件支持因环境而异
             }
@@ -230,7 +230,7 @@ public:
             params.codecName = "h264";
             
             ErrorCode result = decoder->open(params);
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 std::cerr << "打开失败" << std::endl;
                 return false;
             }
@@ -242,7 +242,7 @@ public:
             
             // 测试重置
             result = decoder->reset();
-            if (result != ErrorCode::OK) {
+            if (result != ErrorCode::SUCCESS) {
                 std::cerr << "重置失败" << std::endl;
                 return false;
             }
@@ -281,7 +281,7 @@ public:
             invalidParams.codecName = ""; // 空名称
             
             ErrorCode result = decoder->open(invalidParams);
-            if (result == ErrorCode::OK) {
+            if (result == ErrorCode::SUCCESS) {
                 std::cerr << "应该拒绝空解码器名称" << std::endl;
                 return false;
             }
@@ -291,7 +291,7 @@ public:
             nonExistentParams.codecName = "non_existent_codec";
             
             result = decoder->open(nonExistentParams);
-            if (result == ErrorCode::OK) {
+            if (result == ErrorCode::SUCCESS) {
                 std::cerr << "应该拒绝不存在的解码器" << std::endl;
                 return false;
             }
@@ -300,7 +300,7 @@ public:
             auto decoder2 = std::make_unique<VideoDecoder>();
             VideoDecoderParams emptyParams;
             result = decoder2->open(emptyParams); // 空参数打开
-            if (result == ErrorCode::OK) {
+            if (result == ErrorCode::SUCCESS) {
                 std::cerr << "应该拒绝空参数的打开操作" << std::endl;
                 return false;
             }

+ 7 - 7
AV/test_player.cpp

@@ -77,14 +77,14 @@ bool testPlayerBasicFunctions() {
     
     // 测试播放速度设置
     ErrorCode result = player.setPlaybackSpeed(1.5);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Playback speed setting failed" << std::endl;
         return false;
     }
     
     // 测试无效播放速度
     result = player.setPlaybackSpeed(-1.0);
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Should reject invalid playback speed" << std::endl;
         return false;
     }
@@ -105,21 +105,21 @@ bool testPlayerStateTransitions() {
     
     // 测试在Idle状态下播放(应该失败)
     ErrorCode result = player.play();
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Should not be able to play in Idle state" << std::endl;
         return false;
     }
     
     // 测试在Idle状态下暂停(应该失败)
     result = player.pause();
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Should not be able to pause in Idle state" << std::endl;
         return false;
     }
     
     // 测试停止(应该成功,因为已经是停止状态)
     result = player.stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Stop should always succeed" << std::endl;
         return false;
     }
@@ -140,14 +140,14 @@ bool testMediaFileHandling() {
     
     // 测试打开不存在的文件
     ErrorCode result = player.openFile("nonexistent_file.mp4");
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Should fail to open nonexistent file" << std::endl;
         return false;
     }
     
     // 测试打开空文件名
     result = player.openFile("");
-    if (result == ErrorCode::OK) {
+    if (result == ErrorCode::SUCCESS) {
         std::cout << "[FAIL] Should fail to open empty filename" << std::endl;
         return false;
     }

+ 10 - 10
AV/test_window_capture.cpp

@@ -68,7 +68,7 @@ void testWindowEnumeration() {
     
     // 初始化以获取设备信息
     ErrorCode result = capturer->initialize(params);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("初始化采集器失败: {}", static_cast<int>(result));
         Logger::instance().warning("窗口枚举功能需要有效的采集器初始化,将跳过详细枚举");
         
@@ -122,14 +122,14 @@ void testDesktopCapture() {
     
     // 设置采集参数
     ErrorCode result = capturer->setVideoParams(1280, 720, 30);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("设置视频参数失败: {}", static_cast<int>(result));
         return;
     }
     
     // 启动采集
     result = capturer->start();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("启动桌面采集失败: {}", static_cast<int>(result));
         return;
     }
@@ -150,7 +150,7 @@ void testDesktopCapture() {
     // 停止采集
     Logger::instance().info("正在停止桌面采集...");
     result = capturer->stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("停止采集失败: {}", static_cast<int>(result));
     }
     
@@ -184,14 +184,14 @@ void testWindowCapture(const std::string& windowTitle) {
     
     // 设置采集参数
     ErrorCode result = capturer->setVideoParams(1280, 720, 30);
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("设置视频参数失败: {}", static_cast<int>(result));
         return;
     }
     
     // 启动采集
     result = capturer->start();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("启动窗口采集失败: {}", static_cast<int>(result));
         return;
     }
@@ -212,7 +212,7 @@ void testWindowCapture(const std::string& windowTitle) {
     // 停止采集
     Logger::instance().info("正在停止窗口采集...");
     result = capturer->stop();
-    if (result != ErrorCode::OK) {
+    if (result != ErrorCode::SUCCESS) {
         Logger::instance().errorf("停止采集失败: {}", static_cast<int>(result));
     }
     
@@ -286,7 +286,7 @@ void testParameterValidation() {
         validParams.fps = 30;
         
         ErrorCode result = capturer->initialize(validParams);
-        if (result == ErrorCode::OK) {
+        if (result == ErrorCode::SUCCESS) {
             Logger::instance().info("✓ 有效参数验证通过");
         } else {
             Logger::instance().errorf("✗ 有效参数验证失败: {}", static_cast<int>(result));
@@ -302,7 +302,7 @@ void testParameterValidation() {
         invalidParams.fps = 30;
         
         ErrorCode result = capturer->initialize(invalidParams);
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             Logger::instance().info("✓ 无效参数验证通过(正确拒绝)");
         } else {
             Logger::instance().error("✗ 无效参数验证失败(应该拒绝但接受了)");
@@ -319,7 +319,7 @@ void testParameterValidation() {
         invalidParams.fps = 30;
         
         ErrorCode result = capturer->initialize(invalidParams);
-        if (result != ErrorCode::OK) {
+        if (result != ErrorCode::SUCCESS) {
             Logger::instance().info("✓ 无效分辨率验证通过(正确拒绝)");
         } else {
             Logger::instance().error("✗ 无效分辨率验证失败(应该拒绝但接受了)");

+ 1 - 1
fmt/include/fmt/base.h

@@ -2547,7 +2547,7 @@ template <typename Context> class basic_format_arg {
  * should only be used as a parameter type in type-erased functions such as
  * `vformat`:
  *
- *     void vlog(fmt::string_view fmt, fmt::format_args args);  // OK
+ *     void vlog(fmt::string_view fmt, fmt::format_args args);  // SUCCESS
  *     fmt::format_args args = fmt::make_format_args();  // Dangling reference
  */
 template <typename Context> class basic_format_args {

+ 1 - 1
fmt/test/compile-test.cc

@@ -327,7 +327,7 @@ TEST(compile_test, is_compiled_string) {
 }
 #endif
 
-// MSVS 2019 19.29.30145.0 - OK
+// MSVS 2019 19.29.30145.0 - SUCCESS
 // MSVS 2022 19.32.31332.0, 19.37.32826.1 - compile-test.cc(362,3): fatal error
 // C1001: Internal compiler error.
 //  (compiler file

+ 5 - 5
fmt/test/gtest/gmock-gtest-all.cc

@@ -4970,7 +4970,7 @@ void PrettyUnitTestResultPrinter::OnTestPartResult(
 
 void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
   if (test_info.result()->Passed()) {
-    ColoredPrintf(GTestColor::kGreen, "[       OK ] ");
+    ColoredPrintf(GTestColor::kGreen, "[       SUCCESS ] ");
   } else if (test_info.result()->Skipped()) {
     ColoredPrintf(GTestColor::kGreen, "[  SKIPPED ] ");
   } else {
@@ -7768,7 +7768,7 @@ static const char* ParseFlagValue(const char* str, const char* flag,
   // Skips the flag name.
   const char* flag_end = str + flag_len;
 
-  // When def_optional is true, it's OK to not have a "=value" part.
+  // When def_optional is true, it's SUCCESS to not have a "=value" part.
   if (def_optional && (flag_end[0] == '\0')) {
     return flag_end;
   }
@@ -10203,7 +10203,7 @@ bool FilePath::CreateFolder() const {
 #endif  // GTEST_OS_WINDOWS_MOBILE
 
   if (result == -1) {
-    return this->DirectoryExists();  // An error is OK if the directory exists.
+    return this->DirectoryExists();  // An error is SUCCESS if the directory exists.
   }
   return true;  // No error.
 }
@@ -13911,7 +13911,7 @@ struct MockObjectState {
   int first_used_line;
   ::std::string first_used_test_suite;
   ::std::string first_used_test;
-  bool leakable;  // true if and only if it's OK to leak the object.
+  bool leakable;  // true if and only if it's SUCCESS to leak the object.
   FunctionMockers function_mockers;  // All registered methods of the object.
 };
 
@@ -14301,7 +14301,7 @@ static const char* ParseGoogleMockFlagValue(const char* str,
   // Skips the flag name.
   const char* flag_end = str + flag_len;
 
-  // When def_optional is true, it's OK to not have a "=value" part.
+  // When def_optional is true, it's SUCCESS to not have a "=value" part.
   if (def_optional && (flag_end[0] == '\0')) {
     return flag_end;
   }

+ 1 - 1
fmt/test/gtest/gmock/gmock.h

@@ -6926,7 +6926,7 @@ UnorderedElementsAreArray(::std::initializer_list<T> xs) {
 //   1. The C++ standard permits using the name _ in a namespace that
 //      is not the global namespace or ::std.
 //   2. The AnythingMatcher class has no data member or constructor,
-//      so it's OK to create global variables of this type.
+//      so it's SUCCESS to create global variables of this type.
 //   3. c-style has approved of using _ in this case.
 const internal::AnythingMatcher _ = {};
 // Creates a matcher that matches any value of the given type T.

+ 1 - 1
fmt/test/gtest/gtest/gtest.h

@@ -3892,7 +3892,7 @@ template <typename T>
 //  SuiteApiResolver can access them.
 struct SuiteApiResolver : T {
   // testing::Test is only forward declared at this point. So we make it a
-  // dependend class for the compiler to be OK with it.
+  // dependend class for the compiler to be SUCCESS with it.
   using Test =
       typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
 

+ 6 - 6
qwindowkit/qmsetup/src/syscmdline/tests/basic/main.cpp

@@ -24,14 +24,14 @@ int main(int argc, char *argv[]) {
             ParseResult res = parser.parse({"cmd", "1"});
             assert(res.error() == ParseResult::MissingCommandArgument);
         }
-        std::cout << "Missing argument: OK" << std::endl;
+        std::cout << "Missing argument: SUCCESS" << std::endl;
 
         {
             Parser parser(cmd);
             ParseResult res = parser.parse({"cmd", "1", "2", "3"});
             assert(res.error() == ParseResult::TooManyArguments);
         }
-        std::cout << "Too many argument: OK" << std::endl;
+        std::cout << "Too many argument: SUCCESS" << std::endl;
 
         {
             Parser parser(cmd);
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
             assert(res.value("arg1") == "1");
             assert(res.value("arg2") == "2");
         }
-        std::cout << "Get positional arguments: OK" << std::endl;
+        std::cout << "Get positional arguments: SUCCESS" << std::endl;
     }
     std::cout << std::endl;
 
@@ -65,14 +65,14 @@ int main(int argc, char *argv[]) {
             ParseResult res = parser.parse({"cmd", "4"});
             assert(res.error() == ParseResult::InvalidArgumentValue);
         }
-        std::cout << "Unexpected argument: OK" << std::endl;
+        std::cout << "Unexpected argument: SUCCESS" << std::endl;
 
         {
             Parser parser(cmd);
             ParseResult res = parser.parse({"cmd", "1", "str"});
             assert(res.error() == ParseResult::ArgumentTypeMismatch);
         }
-        std::cout << "Argument type mismatch: OK" << std::endl;
+        std::cout << "Argument type mismatch: SUCCESS" << std::endl;
     }
     std::cout << std::endl;
 
@@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
             ParseResult res = parser.parse({"cmd", "--opt1", "--opt2"});
             assert(res.error() == ParseResult::MutuallyExclusiveOptions);
         }
-        std::cout << "Mutually exclusive options: OK" << std::endl;
+        std::cout << "Mutually exclusive options: SUCCESS" << std::endl;
     }
     std::cout << std::endl;
 

+ 5 - 5
qwindowkit/src/core/contexts/win32windowcontext.cpp

@@ -191,7 +191,7 @@ namespace QWK {
             // So return early here, we don't need the following code to bring it to front.
             return;
         }
-        // OK, our window is not minimized, so now we will try to bring it to front manually.
+        // SUCCESS, our window is not minimized, so now we will try to bring it to front manually.
         // First try to send a message to the current foreground window to check whether
         // it is currently hanging or not.
         if (!::SendMessageTimeoutW(oldForegroundWindow, WM_NULL, 0, 0,
@@ -1667,7 +1667,7 @@ namespace QWK {
                         }
                     }
                     if (*result == HTNOWHERE) {
-                        // OK, we are now really inside one of the chrome buttons, tell Windows the
+                        // SUCCESS, we are now really inside one of the chrome buttons, tell Windows the
                         // exact role of our button. The Snap Layout feature introduced in Windows
                         // 11 won't work without this.
                         switch (sysButtonType) {
@@ -1692,14 +1692,14 @@ namespace QWK {
                         }
                     }
                     if (*result == HTNOWHERE) {
-                        // OK, it seems we are not inside the window resize area, nor inside the
+                        // SUCCESS, it seems we are not inside the window resize area, nor inside the
                         // chrome buttons, tell Windows we are in the client area to let Qt handle
                         // this event.
                         *result = HTCLIENT;
                     }
                     return true;
                 }
-                // OK, we are not inside any chrome buttons, try to find out which part of the
+                // SUCCESS, we are not inside any chrome buttons, try to find out which part of the
                 // window are we hitting.
 
                 bool max = isMaximized(hWnd);
@@ -2102,7 +2102,7 @@ namespace QWK {
             // here directly, the whole window frame will be removed (which means there will
             // be no resizable frame border and the frame shadow will also disappear), and
             // that's also how most applications customize their title bars on Windows. It's
-            // totally OK but since we want to preserve as much original frame as possible,
+            // totally SUCCESS but since we want to preserve as much original frame as possible,
             // we can't use that solution.
             const LRESULT originalResult = ::DefWindowProcW(hWnd, WM_NCCALCSIZE, wParam, lParam);
             if (originalResult != 0) {

+ 2 - 2
test/request-client/modules/uploader.test.ts

@@ -27,7 +27,7 @@ describe('fileUploader', () => {
       data: { success: true },
       headers: {},
       status: 200,
-      statusText: 'OK',
+      statusText: 'SUCCESS',
     };
 
     (
@@ -55,7 +55,7 @@ describe('fileUploader', () => {
       data: { success: true },
       headers: {},
       status: 200,
-      statusText: 'OK',
+      statusText: 'SUCCESS',
     };
 
     (