2023-01-05 13:25:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  camera_server.cpp                                                     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "camera_server.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-08-05 03:41:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "core/variant/typed_array.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-03-27 15:21:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "rendering_server.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "servers/camera/camera_feed.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////////////////////////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// CameraServer
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								CameraServer : : CreateFunc  CameraServer : : create_func  =  nullptr ;  
						 
					
						
							
								
									
										
										
										
											2019-11-29 08:54:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  CameraServer : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_monitoring_feeds " ,  " is_monitoring_feeds " ) ,  & CameraServer : : set_monitoring_feeds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_monitoring_feeds " ) ,  & CameraServer : : is_monitoring_feeds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " monitoring_feeds " ) ,  " set_monitoring_feeds " ,  " is_monitoring_feeds " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-03 15:19:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY_DEFAULT ( " monitoring_feeds " ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_feed " ,  " index " ) ,  & CameraServer : : get_feed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_feed_count " ) ,  & CameraServer : : get_feed_count ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " feeds " ) ,  & CameraServer : : get_feeds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " add_feed " ,  " feed " ) ,  & CameraServer : : add_feed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " remove_feed " ,  " feed " ) ,  & CameraServer : : remove_feed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " camera_feed_added " ,  PropertyInfo ( Variant : : INT ,  " id " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " camera_feed_removed " ,  PropertyInfo ( Variant : : INT ,  " id " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-07-17 13:05:46 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( feeds_updated_signal_name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( FEED_RGBA_IMAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 22:21:13 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( FEED_YCBCR_IMAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( FEED_Y_IMAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 22:21:13 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( FEED_CBCR_IMAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								CameraServer  * CameraServer : : singleton  =  nullptr ;  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CameraServer  * CameraServer : : get_singleton ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  singleton ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  CameraServer : : set_monitoring_feeds ( bool  p_monitoring_feeds )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									monitoring_feeds  =  p_monitoring_feeds ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								int  CameraServer : : get_free_id ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  id_exists  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  newid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// find a free id
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( id_exists )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										newid + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id_exists  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  feeds . size ( )  & &  ! id_exists ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( feeds [ i ] - > get_id ( )  = =  newid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												id_exists  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  newid ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  CameraServer : : get_feed_index ( int  p_id )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  - 1 ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  feeds . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( feeds [ i ] - > get_id ( )  = =  p_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Ref < CameraFeed >  CameraServer : : get_feed_by_id ( int  p_id )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  nullptr ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  index  =  get_feed_index ( p_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( index  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  feeds [ index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  CameraServer : : add_feed ( const  Ref < CameraFeed >  & p_feed )  {  
						 
					
						
							
								
									
										
										
										
											2021-04-02 16:16:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_feed . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									// add our feed
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									feeds . push_back ( p_feed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 23:25:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									print_verbose ( " CameraServer: Registered camera  "  +  p_feed - > get_name ( )  +  "  with ID  "  +  itos ( p_feed - > get_id ( ) )  +  "  and position  "  +  itos ( p_feed - > get_position ( ) )  +  "  at index  "  +  itos ( feeds . size ( )  -  1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// let whomever is interested know
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " camera_feed_added " ) ,  p_feed - > get_id ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  CameraServer : : remove_feed ( const  Ref < CameraFeed >  & p_feed )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  feeds . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( feeds [ i ]  = =  p_feed )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  feed_id  =  p_feed - > get_id ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 23:25:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											print_verbose ( " CameraServer: Removed camera  "  +  p_feed - > get_name ( )  +  "  with ID  "  +  itos ( feed_id )  +  "  and position  "  +  itos ( p_feed - > get_position ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// remove it from our array, if this results in our feed being unreferenced it will be destroyed
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 16:17:03 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											feeds . remove_at ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// let whomever is interested know
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " camera_feed_removed " ) ,  feed_id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Ref < CameraFeed >  CameraServer : : get_feed ( int  p_index )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  nullptr ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_INDEX_V ( p_index ,  feeds . size ( ) ,  nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  feeds [ p_index ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  CameraServer : : get_feed_count ( )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  0 ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  feeds . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-05 03:41:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TypedArray < CameraFeed >  CameraServer : : get_feeds ( )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  { } ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-05 03:41:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TypedArray < CameraFeed >  return_feeds ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  cc  =  get_feed_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return_feeds . resize ( cc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  feeds . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return_feeds [ i ]  =  get_feed ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  return_feeds ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								RID  CameraServer : : feed_texture ( int  p_id ,  CameraServer : : FeedImage  p_texture )  {  
						 
					
						
							
								
									
										
										
										
											2025-03-16 13:03:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( ! monitoring_feeds ,  RID ( ) ,  " CameraServer is not actively monitoring feeds; call set_monitoring_feeds(true) first. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  index  =  get_feed_index ( p_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND_V ( index  = =  - 1 ,  RID ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < CameraFeed >  feed  =  get_feed ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  feed - > get_texture ( p_texture ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CameraServer : : CameraServer ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									singleton  =  this ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-08-21 00:17:24 +10:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CameraServer : : ~ CameraServer ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									singleton  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}