+
    ~j$                        ^ RI Ht ^ RIHt ^ RIHtHt ^RIHtH	t	 ^RI
Ht ^RI
Ht  ! R R]4      t ! R	 R
]4      t] ! R R4      4       t] ! R R4      4       t ! R R4      t ! R R4      t ! R R4      tR# )    )annotations)	dataclass)AsyncIteratorOptional)	FfiClient	FfiHandle)ffi_pb2)data_track_pb2c                  &    ] tR t^tRtR R ltRtR# )SubscribeDataTrackErrorz9An error that can occur when subscribing to a data track.c                    V ^8  d   QhRRRR/#    messagestrreturnNone )formats   "k/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/rtc/data_track.py__annotate__$SubscribeDataTrackError.__annotate__               c                	    Wn         R # Nr   selfr   s   &&r   __init__ SubscribeDataTrackError.__init__       r   r   N__name__
__module____qualname____firstlineno____doc__r    __static_attributes__r   r   r   r   r      s    C r   r   c                  &    ] tR t^ tRtR R ltRtR# )PushFrameErrorzFrame could not be pushed to a data track.

Pushing a frame can fail for several reasons:

- The track has been unpublished by the local participant or SFU
- The room is no longer connected
- Frames are being pushed too fast
c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   PushFrameError.__annotate__*   r   r   c                	    Wn         R # r   r   r   s   &&r   r    PushFrameError.__init__*   r"   r   r   Nr#   r   r   r   r+   r+       s     r   r+   c                  >    ] tR t^.t$ RtR]R&    R]R&    R]R&   RtR# )	DataTrackInfoz)Information about a published data track.r   sidnamebool	uses_e2eer   N)r$   r%   r&   r'   r(   __annotations__r)   r   r   r   r1   r1   .   s!    3	H I6OLr   r1   c                  6    ] tR t^@t$ RtR]R&    RtR]R&   RtR# )DataTrackFramezQA frame published on a data track, consisting of a payload and optional metadata.bytespayloadNOptional[int]user_timestampr   )r$   r%   r&   r'   r(   r6   r<   r)   r   r   r   r8   r8   @   s    [N$(NM(;r   r8   c                  l    ] tR t^KtRtR R lt]R R l4       tR R ltR R	 lt	R
 R lt
R R ltRtR# )LocalDataTrackz.Data track published by the local participant.c                    V ^8  d   QhRRRR/# )r   
owned_infoz$proto_data_track.OwnedLocalDataTrackr   r   r   )r   s   "r   r   LocalDataTrack.__annotate__N   s     ; ;#G ;D ;r   c                	    \        VP                  P                  VP                  P                  VP                  P                  R 7      V n        \        VP                  P                  4      V n	        R# )r2   r3   r5   N)
r1   infor2   r3   r5   _infor   handleid_ffi_handler   r@   s   &&r   r    LocalDataTrack.__init__N   sP    "##%% oo//


 %Z%6%6%9%9:r   c                   V ^8  d   QhRR/# r   r   r1   r   )r   s   "r   r   rA   W         m r   c                    V P                   # z!Information about the data track.rE   r   s   &r   rD   LocalDataTrack.infoV        zzr   c                    V ^8  d   QhRRRR/# )r   framer8   r   r   r   )r   s   "r   r   rA   [   s     O On O Or   c                (   \         P                  ! \        VP                  4      R7      pVP                  e   VP                  Vn        \
        P                  ! 4       pV P                  P                  VP                  n
        VP                  P                  P                  V4       \        P                  P                  V4      pVP                  P!                  R4      '       d*   \#        VP                  P$                  P&                  4      hR# )zTry pushing a frame to subscribers of the track.

See :class:`DataTrackFrame` for how to construct a frame and attach metadata.

Args:
    frame: The data track frame to send.

Raises:
    PushFrameError: If the push fails.
)r:   Nerror)proto_data_trackr8   r9   r:   r<   	proto_ffi
FfiRequestrH   rF   local_data_track_try_pushtrack_handlerU   CopyFromr   instancerequestHasFieldr+   rW   r   )r   rU   proto_framereqresps   &&   r   try_pushLocalDataTrack.try_push[   s     '55eEMM>RS+).)=)=K&""$595E5E5L5L%%2%%++44[A!!))#.))227;; !?!?!E!E!M!MNN <r   c                   V ^8  d   QhRR/# r   r   r4   r   )r   s   "r   r   rA   r   s     ? ?d ?r   c                    \         P                  ! 4       pV P                  P                  VP                  n        \        P                  P                  V4      pVP                  P                  # z,Whether or not the track is still published.)
rY   rZ   rH   rF   local_data_track_is_publishedr\   r   r^   r_   is_publishedr   rb   rc   s   &  r   rk   LocalDataTrack.is_publishedr   sR    ""$9=9I9I9P9P))6!!))#.11>>>r   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   rA   z   s     ( ( (r   c                   "   \         P                  ! 4       pV P                  P                  VP                  n        \        P                  P                  V4       R# 5i)zUnpublishes the track.N)	rY   rZ   rH   rF   local_data_track_unpublishr\   r   r^   r_   r   rb   s   & r   	unpublishLocalDataTrack.unpublishz   sA     ""$6:6F6F6M6M&&3""3's   AAc                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   rA      s     S S# Sr   c                	d    R V P                   P                   RV P                   P                   R2# )zrtc.LocalDataTrack(sid=, name=))rE   r2   r3   rQ   s   &r   __repr__LocalDataTrack.__repr__   s*    ((8

?PPQRRr   )rH   rE   N)r$   r%   r&   r'   r(   r    propertyrD   rd   rk   rs   rz   r)   r   r   r   r>   r>   K   s:    8;  O.?(S Sr   r>   c                  ~    ] tR t^tRtR R lt]R R l4       t]R R l4       tRR	/R
 R llt	R R lt
R R ltRtR	# )RemoteDataTrackz-Data track published by a remote participant.c                    V ^8  d   QhRRRR/# )r   r@   z%proto_data_track.OwnedRemoteDataTrackr   r   r   )r   s   "r   r   RemoteDataTrack.__annotate__   s     A A#H AT Ar   c                	   \        VP                  P                  VP                  P                  VP                  P                  R 7      V n        \        VP                  P                  4      V n	        VP                  V n        R# rC   )r1   rD   r2   r3   r5   rE   r   rF   rG   rH   publisher_identity_publisher_identityrI   s   &&r   r    RemoteDataTrack.__init__   s^    "##%% oo//


 %Z%6%6%9%9:#-#@#@ r   c                   V ^8  d   QhRR/# rL   r   )r   s   "r   r   r      rM   r   c                    V P                   # rO   rP   rQ   s   &r   rD   RemoteDataTrack.info   rS   r   c                   V ^8  d   QhRR/# rv   r   )r   s   "r   r   r      s     ( (C (r   c                    V P                   # )z4Identity of the participant who published the track.)r   rQ   s   &r   r   "RemoteDataTrack.publisher_identity   s     '''r   buffer_sizeNc                    V ^8  d   QhRRRR/# )r   r   r;   r   DataTrackStreamr   )r   s   "r   r   r      s     A A A Ar   c               z   \         P                  ! 4       pVe   Wn        \        P                  ! 4       pV P
                  P                  VP                  n        VP                  P                  P                  V4       \        P                  P                  V4      p\        VP                  P                  4      # )a  Subscribes to the data track to receive frames.

Args:
    buffer_size: Maximum number of received frames to buffer internally.
        When ``None``, the default buffer size is used.
        Zero is not a valid buffer size; if a value of zero is provided, it will be clamped to one.

Returns a :class:`DataTrackStream` that yields
:class:`DataTrackFrame` instances as they arrive. If the
subscription encounters an error, it is raised as
:class:`SubscribeDataTrackError` when iteration ends.
)rX   DataTrackSubscribeOptionsr   rY   rZ   rH   rF   subscribe_data_trackr\   optionsr]   r   r^   r_   r   stream)r   r   optsrb   rc   s   &$   r   	subscribeRemoteDataTrack.subscribe   s      99;"*""$040@0@0G0G  -  ((11$7!!))#.t88??@@r   c                   V ^8  d   QhRR/# rg   r   )r   s   "r   r   r      s     @ @d @r   c                    \         P                  ! 4       pV P                  P                  VP                  n        \        P                  P                  V4      pVP                  P                  # ri   )
rY   rZ   rH   rF   remote_data_track_is_publishedr\   r   r^   r_   rk   rl   s   &  r   rk   RemoteDataTrack.is_published   sR    ""$:>:J:J:Q:Q**7!!))#.22???r   c                   V ^8  d   QhRR/# rv   r   )r   s   "r   r   r      s     
 
# 
r   c                	~    R V P                   P                   RV P                   P                   RV P                   R2# )zrtc.RemoteDataTrack(sid=rx   z, publisher_identity=ry   )rE   r2   r3   r   rQ   s   &r   rz   RemoteDataTrack.__repr__   s?    &tzz~~&6gdjjoo=N O""&":":!;1>	
r   )rH   rE   r   )r$   r%   r&   r'   r(   r    r|   rD   r   r   rk   rz   r)   r   r   r   r~   r~      sQ    7A   ( (A A0@
 
r   r~   c                  z    ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltR R ltRtR# )r   a  An active subscription to a remote data track.

Use as an async iterator to receive frames::

    stream = remote_track.subscribe()
    async for frame in stream:
        process(frame.payload)

Dropping or closing the stream unsubscribes from the track.

If subscribing to the track fails, :class:`SubscribeDataTrackError`
is raised when iteration ends instead of a normal ``StopAsyncIteration``.
c                    V ^8  d   QhRRRR/# )r   r@   z%proto_data_track.OwnedDataTrackStreamr   r   r   )r   s   "r   r   DataTrackStream.__annotate__   s     
 
#H 
T 
r   c                	   a \        VP                  P                  4      V n        VP                  P                  o\        P
                  P                  P                  V3R  lR7      V n        RV n	        R# )c                n   < V P                  R 4      R8H  ;'       d    V P                  P                  S8H  # )r   data_track_stream_event)
WhichOneofr   stream_handle)e	handle_ids   &r   <lambda>*DataTrackStream.__init__.<locals>.<lambda>   s;    Y'+DD I I--;;yHIr   )	filter_fnFN)
r   rF   rG   rH   r   r^   queuer   _queue_closed)r   r@   r   s   &&@r   r    DataTrackStream.__init__   s^    $Z%6%6%9%9:%%((	((..88 9 
 r   c                   V ^8  d   QhRR/# )r   r   zOptional[DataTrackFrame]r   )r   s   "r   r   r      s      4 r   c                d   "    V P                  4       G Rj  xL
 #  L  \         d     R# i ; i5i)z9Read a single frame, or ``None`` if the stream has ended.N)	__anext__StopAsyncIterationrQ   s   &r   readDataTrackStream.read   s.     	))))! 		s(   0  0 -0-0c                   V ^8  d   QhRR/# )r   r   zAsyncIterator[DataTrackFrame]r   )r   s   "r   r   r      s      8 r   c                	    V # r   r   rQ   s   &r   	__aiter__DataTrackStream.__aiter__   s    r   c                   V ^8  d   QhRR/# )r   r   r8   r   )r   s   "r   r   r      s     % % %r   c                	  "   V P                   '       d   \        hV P                  4        V P                  P	                  4       G R j  xL
 pVP
                  pVP                  R4      pVR8X  dS   VP                  P                  pR pVP                  R4      '       d   VP                  p\        VP                  VR7      # VR8X  da   V P                  4        VP                  P                  R4      '       d*   \        VP                  P                   P"                  4      h\        hV P                  4        \        h L5i)Ndetailframe_receivedr<   )r:   r<   eosrW   )r   r   _send_read_requestr   getr   r   r   rU   r`   r<   r8   r:   _closer   r   rW   r   )r   eventstream_eventr   ra   user_tss   &     r   r   DataTrackStream.__anext__   s    <<<$$!*.++//*;$;44((2%%&55;;K%)G##$455%44!#++&  u_KKM((11-l.>.>.D.D.L.LMM$$KKM$$) %<s!   AEE 	AE AE;AEc                   V ^8  d   QhRR/# ro   r   )r   s   "r   r   r     s     ( (D (r   c                	    \         P                  ! 4       pV P                  P                  VP                  n        \        P                  P                  V4       R # r   )	rY   rZ   rH   rF   data_track_stream_readr   r   r^   r_   rr   s   & r   r   "DataTrackStream._send_read_request  s>    ""$373C3C3J3J""0""3'r   c                   V ^8  d   QhRR/# ro   r   )r   s   "r   r   r     s     > > >r   c                	    V P                   '       g=   R V n         \        P                  P                  P	                  V P
                  4       R# R# )TN)r   r   r^   r   unsubscriber   rQ   s   &r   r   DataTrackStream._close  s5    |||DL$$00= r   c                   V ^8  d   QhRR/# ro   r   )r   s   "r   r   r     s     # #t #r   c                Z    V P                  4        V P                  P                  4        R# )z2Explicitly close the subscription and unsubscribe.N)r   rH   disposerQ   s   &r   closeDataTrackStream.close  s      "r   c                   V ^8  d   QhRR/# ro   r   )r   s   "r   r   r     s      d r   c                	.   "   V P                  4        R # 5ir   )r   rQ   s   &r   acloseDataTrackStream.aclose  s     

s   )r   rH   r   N)r$   r%   r&   r'   r(   r    r   r   r   r   r   r   r   r)   r   r   r   r   r      s4    
%6(
>
#
 r   r   N)
__future__r   dataclassesr   typingr   r   _ffi_clientr   r   _protor	   rY   r
   rX   	Exceptionr   r+   r1   r8   r>   r~   r   r   r   r   <module>r      s    # ! * - ( 6i Y  M M M" < < <6S 6Sr:
 :
zP Pr   