integration_example.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include <QApplication>
  2. #include <QDebug>
  3. #include <QFileDialog>
  4. #include <QHBoxLayout>
  5. #include <QLabel>
  6. #include <QMainWindow>
  7. #include <QMessageBox>
  8. #include <QPushButton>
  9. #include <QSlider>
  10. #include <QTimer>
  11. #include <QVBoxLayout>
  12. #include <QDir>
  13. #include <QStandardPaths>
  14. #include "code/base/logger.h"
  15. #include "code/player/SimplePlayerWindow.h"
  16. int main(int argc, char* argv[])
  17. {
  18. // 初始化日志系统
  19. QString logPath = "./AV_Player/log.txt";
  20. QDir().mkpath(QFileInfo(logPath).absolutePath());
  21. av::Logger::initialize(logPath.toStdString(), av::LogLevel::DEBUG, true, true);
  22. QApplication app(argc, argv);
  23. // 设置应用程序信息
  24. app.setApplicationName("AV Player");
  25. app.setApplicationVersion("1.0.0");
  26. app.setOrganizationName("AV Framework");
  27. qDebug() << "=== AV Player Integration Example Started ===";
  28. qDebug() << "Log file:" << logPath;
  29. qDebug() << "This example demonstrates how to integrate the new player core with Qt UI";
  30. // 检查FFmpeg库
  31. qDebug() << "Checking FFmpeg library availability...";
  32. // 创建并显示播放器窗口
  33. try {
  34. SimplePlayerWindow window;
  35. window.show();
  36. qDebug() << "Player window created and shown successfully";
  37. return app.exec();
  38. } catch (const std::exception& e) {
  39. qCritical() << "Exception during player initialization:" << e.what();
  40. QMessageBox::critical(nullptr, "Error",
  41. QString("Failed to initialize player: %1").arg(e.what()));
  42. return -1;
  43. } catch (...) {
  44. qCritical() << "Unknown exception during player initialization";
  45. QMessageBox::critical(nullptr, "Error", "Unknown error during player initialization");
  46. return -1;
  47. }
  48. }