1515import sys
1616import wave
1717
18- from dataclasses import dataclass
19-
2018from PySide6 import QtCore , QtGui , QtWidgets
2119
22- import numpy as np
23-
2420from daily import *
2521
2622class 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 )
3424
3525 def __init__ (self , meeting_url , participant_id , save_audio , screen_share ):
3626 super ().__init__ ()
@@ -138,9 +128,9 @@ def join(self, meeting_url, participant_id):
138128 def leave (self ):
139129 self .__client .leave (completion = self .on_left )
140130
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 )
144134 scaled = image .scaled (self .__frame_width , self .__frame_height , QtCore .Qt .AspectRatioMode .KeepAspectRatio )
145135 pixmap = QtGui .QPixmap .fromImage (scaled )
146136 self .__image_label .setPixmap (pixmap )
@@ -149,9 +139,7 @@ def on_audio_data(self, participant_id, audio_data):
149139 self .__wave .writeframes (audio_data .audio_frames )
150140
151141 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 )
155143
156144def main ():
157145 parser = argparse .ArgumentParser ()
0 commit comments