沉默流星 发表于 2025-10-27 10:01
你可以制作个封装工具,这样封库快点
哥们儿,咱能不能把安卓设计器优化一下,框框太难用,优化成拖拽的?				
			
		感谢分享!!				
			
		zhh044 发表于 2025-10-27 13:45
哥们儿,咱能不能把安卓设计器优化一下,框框太难用,优化成拖拽的?
你给我说没用啊
1.我不是吴总
2.我也不是给官方封库的人员				
			
		看看好东西				
			
		11111				
			
		谢谢分享,帅得不得了				
			
		置视频大小,宽高比,旋转都失败是什么情况				
			
		学习一下				
			
		王震1 发表于 2025-10-29 09:34
置视频大小,宽高比,旋转都失败是什么情况
先解决置视频大小      找到MPV播放器重新建立\MPV\mpv\MpvCore.cpp用记事本打开!查找bool MpvInstance::SetVideoSize(int width, int height) { 这个命令!然后替换掉下面这个命令!
bool MpvInstance::SetVideoSize(int width, int height) {
    if (!mpv_) {
      return false;
    }
    
    // 设置窗口大小(如果支持)
    std::string cmd1 = "set window-scale 1"; // 重置缩放
    ExecuteCommandString(cmd1);
    
    // 设置视频输出矩形
    std::string cmd2 = "set video-zoom " + std::to_string(0); // 重置缩放
    ExecuteCommandString(cmd2);
    
    // 更好的方式是调整窗口大小,而不是视频大小
    if (hwnd_) {
      RECT rect;
      GetWindowRect(hwnd_, &rect);
      SetWindowPos(hwnd_, NULL, rect.left, rect.top, width, height, SWP_NOZORDER);
    }
    
    return true;
}
主窗口增加一个组件命令!
MPV组件1ID = MPV组件1.初始化 (图片框1.取窗口句柄 (), 0)
调试输出 ("实例1实例ID", MPV组件1ID)
调试输出 ("实例1加载文件", MPV组件1.加载文件 (MPV组件1ID, 取运行目录 () + "文件列表\\3D演示片--蛇出屏.mp4"))
调试输出 (MPV组件1.置视频大小 (MPV组件1ID, 800, 600))
图片框1.移动 (0, 0, , ) //这个是增加的!因为大小调整后视频位置会有变化!所以需要重新调整组件位置!
剩下的问题还在处理!后期我会修复这些问题上传最新的源码!你着急用可以先这样修改!				
			
		王震1 发表于 2025-10-29 09:34
置视频大小,宽高比,旋转都失败是什么情况
下面这个是旋转!还是老样子找到MPV播放器重新建立\MPV\mpv\MpvCore.cpp用记事本打开!查找bool MpvInstance::SetVideoRotation(int rotation) {这个命令!然后替换掉下面这个命令!
bool MpvInstance::SetVideoRotation(int rotation) {
    if (!mpv_) {
      UpdateDebugInfo(L"SetVideoRotation failed: mpv not initialized");
      return false;
    }
    
    // 确保是90的倍数
    if (rotation % 90 != 0) {
      UpdateDebugInfo(L"SetVideoRotation failed: rotation must be multiple of 90");
      return false;
    }
    
    // 规范化旋转角度到0-270范围
    rotation = rotation % 360;
    if (rotation < 0) rotation += 360;
    
    // 方法1:使用属性设置
    int result = mpv_set_property(mpv_, "video-rotate", MPV_FORMAT_INT64, &rotation);
    
    if (result < 0) {
      // 方法1失败,尝试方法2:使用命令
      std::string cmd = "set video-rotate " + std::to_string(rotation);
      if (ExecuteCommandString(cmd)) {
            UpdateDebugInfo(L"SetVideoRotation succeeded via command");
            return true;
      }
      
      // 方法2失败,尝试方法3:使用数组命令
      const char* cmd_array[] = {"set", "video-rotate", std::to_string(rotation).c_str(), NULL};
      if (ExecuteCommand(cmd_array)) {
            UpdateDebugInfo(L"SetVideoRotation succeeded via array command");
            return true;
      }
      
      // 所有方法都失败
      const char* error_msg = mpv_error_string(result);
      std::wstring error_info = L"SetVideoRotation failed all methods. MPV error: ";
      if (error_msg) {
            error_info += SafeUTF8ToWide(error_msg);
      } else {
            error_info += L"Unknown error, code: " + std::to_wstring(result);
      }
      UpdateDebugInfo(error_info);
      return false;
    }
    
    UpdateDebugInfo(L"SetVideoRotation succeeded via property");
    return true;
}
其他地方不用修改!无法旋转可能是平台或其他不一致导致了!所以我加入两种旋转方式!一种失败自动切换下一种!都失败就表示视频本身格式不支持!