15
15
import sys
16
16
import wave
17
17
18
- from dataclasses import dataclass
19
-
20
18
from PySide6 import QtCore , QtGui , QtWidgets
21
19
22
- import numpy as np
23
-
24
20
from daily import *
25
21
26
22
class DailyQtWidget (QtWidgets .QWidget ):
27
- @dataclass
28
- class VideoFrameData :
29
- buffer : np .ndarray
30
- width : int
31
- height : int
32
-
33
- frame_signal = QtCore .Signal (VideoFrameData )
23
+ frame_signal = QtCore .Signal (VideoFrame )
34
24
35
25
def __init__ (self , meeting_url , participant_id , save_audio , screen_share ):
36
26
super ().__init__ ()
@@ -138,9 +128,9 @@ def join(self, meeting_url, participant_id):
138
128
def leave (self ):
139
129
self .__client .leave (completion = self .on_left )
140
130
141
- def draw_image (self , frame_data ):
142
- image = QtGui .QImage (frame_data .buffer , frame_data .width , frame_data .height ,
143
- frame_data .width * 4 , QtGui .QImage .Format .Format_ARGB32 )
131
+ def draw_image (self , video_frame ):
132
+ image = QtGui .QImage (video_frame .buffer , video_frame .width , video_frame .height ,
133
+ video_frame .width * 4 , QtGui .QImage .Format .Format_ARGB32 )
144
134
scaled = image .scaled (self .__frame_width , self .__frame_height , QtCore .Qt .AspectRatioMode .KeepAspectRatio )
145
135
pixmap = QtGui .QPixmap .fromImage (scaled )
146
136
self .__image_label .setPixmap (pixmap )
@@ -149,9 +139,7 @@ def on_audio_data(self, participant_id, audio_data):
149
139
self .__wave .writeframes (audio_data .audio_frames )
150
140
151
141
def on_video_frame (self , participant_id , video_frame ):
152
- data = np .frombuffer (video_frame .buffer , dtype = np .uint8 ).copy ()
153
- frame_data = self .VideoFrameData (data , video_frame .width , video_frame .height )
154
- self .frame_signal .emit (frame_data )
142
+ self .frame_signal .emit (video_frame )
155
143
156
144
def main ():
157
145
parser = argparse .ArgumentParser ()
0 commit comments