feat(sender): 支持把串流画面弹出为独立原生窗口
- 新增 windows/runner/video_window.{h,cpp}:Win32 顶层窗口,GDI 直接绘制解码后的 BGRA 帧,支持拖到任意显示器/最大化/双击或 F11 全屏/ESC 退出
- FrameStore 增加 Snapshot()(shared_ptr 保活),独立窗口与主窗口共享同一份帧,不重复解码、不抢 Rust 单消费者帧队列
- 独立窗口在播时跳过 MarkTextureFrameAvailable,省一次 BGRA 拷贝;主界面显示占位提示
- ttstd/video 通道新增 openWindow/closeWindow/windowOpen,stats 带 windowOpen
- VideoView 按真实码流宽高算显示比例,竖屏投屏不再被压成 16:9
This commit is contained in:
1 parent
f87ef59d98
commit
0cff2b011a
8 files changed
+419
-4
No files matched your search
@@ -8,6 +8,8 @@ class VideoView extends StatelessWidget {
|
||||
this.resolution = '',
|
||||
this.pts,
|
||||
this.error = '',
|
||||
this.standalone = false,
|
||||
this.aspectRatio = 16 / 9,
|
||||
});
|
||||
|
||||
final int? textureId;
|
||||
@@ -18,11 +20,17 @@ class VideoView extends StatelessWidget {
|
||||
/// 原生解码链路的失败原因,为空表示没有错误。
|
||||
final String error;
|
||||
|
||||
/// 画面已弹出到独立窗口:主界面不再渲染纹理,只显示提示。
|
||||
final bool standalone;
|
||||
|
||||
/// 按实际码流宽高算出的比例(竖屏投屏时不再是 16:9)。
|
||||
final double aspectRatio;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
aspectRatio: aspectRatio > 0 ? aspectRatio : 16 / 9,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: DecoratedBox(
|
||||
@@ -39,7 +47,22 @@ class VideoView extends StatelessWidget {
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
if (textureId != null)
|
||||
if (standalone)
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.open_in_new,
|
||||
size: 72,
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.6)),
|
||||
const SizedBox(height: 12),
|
||||
Text('画面已在独立窗口播放', style: theme.textTheme.titleMedium),
|
||||
const SizedBox(height: 4),
|
||||
Text('把它拖到任意显示器,双击可全屏;关闭独立窗口后画面回到这里',
|
||||
style: theme.textTheme.bodySmall,
|
||||
textAlign: TextAlign.center),
|
||||
],
|
||||
)
|
||||
else if (textureId != null)
|
||||
Texture(textureId: textureId!)
|
||||
else
|
||||
Column(
|
||||
|
||||
Reference in new issue
Block a user