Compared with d03f064:
- Pause the sample video and audio readers after signal disconnect events and resume them only after reconnect or stream-ready notification.
- Serialize plug, unplug, and format transitions against active reads and held zero-copy frames while keeping stop and close able to interrupt lifecycle waits.
- Treat ERROR_BAD_COMMAND as unplug-revoked zero-copy ownership only after the backend has confirmed signal loss, while preserving all other release failures for retry and diagnosis.
- Stop submitting frames when the user closes an independent preview window, account those frames as intentionally skipped, and resume submission when preview is reopened.
- Emit UTF-16 Windows debug output so localized Win32 error messages remain readable in Qt and debugger output.
- Add startup and first-frame timing diagnostics, reduce routine stream-ready logging, and update public and internal documentation for the new disconnect and ownership behavior.
Validation: git diff --check and focused symbol/document consistency searches passed; no build or hardware validation was run.
48 lines
1003 B
C++
48 lines
1003 B
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
|
|
class QKeyEvent;
|
|
class QMouseEvent;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui
|
|
{
|
|
class PreviewWindow;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class PreviewWindow final : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PreviewWindow(QWidget *parent = nullptr);
|
|
~PreviewWindow() override;
|
|
|
|
void *nativePreviewHandle() const;
|
|
void setSourceSize(int sourceWidth, int sourceHeight);
|
|
void closePreview();
|
|
|
|
public slots:
|
|
void showPreview(int sourceWidth = 0, int sourceHeight = 0);
|
|
void showFullscreenPreview(int sourceWidth = 0, int sourceHeight = 0);
|
|
|
|
signals:
|
|
void previewVisibilityChanged(bool visible);
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event) override;
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
|
|
|
private:
|
|
void enterFullscreen();
|
|
void exitFullscreen();
|
|
|
|
Ui::PreviewWindow *ui_ = nullptr;
|
|
bool closeAllowed_ = false;
|
|
int sourceWidth_ = 0;
|
|
int sourceHeight_ = 0;
|
|
};
|