mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	plugins: small fixes
This commit is contained in:
		
							parent
							
								
									618f5ec2b2
								
							
						
					
					
						commit
						2f18af1fb2
					
				
					 2 changed files with 13 additions and 15 deletions
				
			
		| 
						 | 
					@ -86,6 +86,7 @@ struct _SpaAudioTestSrc {
 | 
				
			||||||
  SpaAllocParam *params[2];
 | 
					  SpaAllocParam *params[2];
 | 
				
			||||||
  SpaAllocParamBuffers param_buffers;
 | 
					  SpaAllocParamBuffers param_buffers;
 | 
				
			||||||
  SpaAllocParamMetaEnable param_meta;
 | 
					  SpaAllocParamMetaEnable param_meta;
 | 
				
			||||||
 | 
					  SpaPortOutput *output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool have_format;
 | 
					  bool have_format;
 | 
				
			||||||
  SpaFormatAudio query_format;
 | 
					  SpaFormatAudio query_format;
 | 
				
			||||||
| 
						 | 
					@ -95,8 +96,6 @@ struct _SpaAudioTestSrc {
 | 
				
			||||||
  ATSBuffer buffers[MAX_BUFFERS];
 | 
					  ATSBuffer buffers[MAX_BUFFERS];
 | 
				
			||||||
  unsigned int n_buffers;
 | 
					  unsigned int n_buffers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SpaPortOutput *output;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  bool started;
 | 
					  bool started;
 | 
				
			||||||
  uint64_t start_time;
 | 
					  uint64_t start_time;
 | 
				
			||||||
  uint64_t elapsed_time;
 | 
					  uint64_t elapsed_time;
 | 
				
			||||||
| 
						 | 
					@ -266,8 +265,7 @@ audiotestsrc_on_output (SpaSource *source)
 | 
				
			||||||
  SpaPortOutput *output;
 | 
					  SpaPortOutput *output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (spa_list_is_empty (&this->empty)) {
 | 
					  if (spa_list_is_empty (&this->empty)) {
 | 
				
			||||||
    if (!this->props[1].live)
 | 
					    update_loop_enabled (this, false);
 | 
				
			||||||
      update_loop_enabled (this, false);
 | 
					 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  b = spa_list_first (&this->empty, ATSBuffer, link);
 | 
					  b = spa_list_first (&this->empty, ATSBuffer, link);
 | 
				
			||||||
| 
						 | 
					@ -313,7 +311,7 @@ update_state (SpaAudioTestSrc *this, SpaNodeState state)
 | 
				
			||||||
static SpaResult
 | 
					static SpaResult
 | 
				
			||||||
update_loop_enabled (SpaAudioTestSrc *this, bool enabled)
 | 
					update_loop_enabled (SpaAudioTestSrc *this, bool enabled)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (this->event_cb) {
 | 
					  if (this->event_cb && this->timer_enabled != enabled) {
 | 
				
			||||||
    this->timer_enabled = enabled;
 | 
					    this->timer_enabled = enabled;
 | 
				
			||||||
    if (enabled)
 | 
					    if (enabled)
 | 
				
			||||||
      this->timer_source.mask = SPA_IO_IN;
 | 
					      this->timer_source.mask = SPA_IO_IN;
 | 
				
			||||||
| 
						 | 
					@ -331,8 +329,6 @@ update_loop_enabled (SpaAudioTestSrc *this, bool enabled)
 | 
				
			||||||
        this->timerspec.it_value.tv_nsec = 0;
 | 
					        this->timerspec.it_value.tv_nsec = 0;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      timerfd_settime (this->timer_source.fd, TFD_TIMER_ABSTIME, &this->timerspec, NULL);
 | 
					      timerfd_settime (this->timer_source.fd, TFD_TIMER_ABSTIME, &this->timerspec, NULL);
 | 
				
			||||||
 | 
					 | 
				
			||||||
      this->timer_source.func = audiotestsrc_on_output;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    spa_loop_update_source (this->data_loop, &this->timer_source);
 | 
					    spa_loop_update_source (this->data_loop, &this->timer_source);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -417,9 +413,8 @@ spa_audiotestsrc_node_set_event_callback (SpaNode              *node,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
 | 
					  this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (event_cb == NULL && this->event_cb) {
 | 
					  if (event_cb == NULL && this->event_cb)
 | 
				
			||||||
    spa_loop_remove_source (this->data_loop, &this->timer_source);
 | 
					    spa_loop_remove_source (this->data_loop, &this->timer_source);
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->event_cb = event_cb;
 | 
					  this->event_cb = event_cb;
 | 
				
			||||||
  this->user_data = user_data;
 | 
					  this->user_data = user_data;
 | 
				
			||||||
| 
						 | 
					@ -760,7 +755,7 @@ spa_audiotestsrc_node_port_set_output (SpaNode       *node,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
 | 
					  this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!CHECK_PORT (this, SPA_DIRECTION_INPUT, port_id))
 | 
					  if (!CHECK_PORT (this, SPA_DIRECTION_OUTPUT, port_id))
 | 
				
			||||||
    return SPA_RESULT_INVALID_PORT;
 | 
					    return SPA_RESULT_INVALID_PORT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->output = output;
 | 
					  this->output = output;
 | 
				
			||||||
| 
						 | 
					@ -768,7 +763,6 @@ spa_audiotestsrc_node_port_set_output (SpaNode       *node,
 | 
				
			||||||
  return SPA_RESULT_OK;
 | 
					  return SPA_RESULT_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
static SpaResult
 | 
					static SpaResult
 | 
				
			||||||
spa_audiotestsrc_node_port_reuse_buffer (SpaNode         *node,
 | 
					spa_audiotestsrc_node_port_reuse_buffer (SpaNode         *node,
 | 
				
			||||||
                                         uint32_t         port_id,
 | 
					                                         uint32_t         port_id,
 | 
				
			||||||
| 
						 | 
					@ -987,7 +981,8 @@ audiotestsrc_init (const SpaHandleFactory  *factory,
 | 
				
			||||||
  this->timer_source.func = audiotestsrc_on_output;
 | 
					  this->timer_source.func = audiotestsrc_on_output;
 | 
				
			||||||
  this->timer_source.data = this;
 | 
					  this->timer_source.data = this;
 | 
				
			||||||
  this->timer_source.fd = timerfd_create (CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
 | 
					  this->timer_source.fd = timerfd_create (CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
 | 
				
			||||||
  this->timer_source.mask = SPA_IO_IN | SPA_IO_ERR;
 | 
					  this->timer_source.mask = SPA_IO_IN;
 | 
				
			||||||
 | 
					  this->timer_source.rmask = 0;
 | 
				
			||||||
  this->timerspec.it_value.tv_sec = 0;
 | 
					  this->timerspec.it_value.tv_sec = 0;
 | 
				
			||||||
  this->timerspec.it_value.tv_nsec = 0;
 | 
					  this->timerspec.it_value.tv_nsec = 0;
 | 
				
			||||||
  this->timerspec.it_interval.tv_sec = 0;
 | 
					  this->timerspec.it_interval.tv_sec = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,8 +224,7 @@ videotestsrc_on_output (SpaSource *source)
 | 
				
			||||||
  SpaPortOutput *output;
 | 
					  SpaPortOutput *output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (spa_list_is_empty (&this->empty)) {
 | 
					  if (spa_list_is_empty (&this->empty)) {
 | 
				
			||||||
    if (!this->props[1].live)
 | 
					    update_loop_enabled (this, false);
 | 
				
			||||||
      update_loop_enabled (this, false);
 | 
					 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  b = spa_list_first (&this->empty, VTSBuffer, link);
 | 
					  b = spa_list_first (&this->empty, VTSBuffer, link);
 | 
				
			||||||
| 
						 | 
					@ -644,7 +643,7 @@ spa_videotestsrc_node_port_use_buffers (SpaNode         *node,
 | 
				
			||||||
  clear_buffers (this);
 | 
					  clear_buffers (this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (i = 0; i < n_buffers; i++) {
 | 
					  for (i = 0; i < n_buffers; i++) {
 | 
				
			||||||
    VTSBuffer *b = &this->buffers[i];
 | 
					    VTSBuffer *b;
 | 
				
			||||||
    SpaData *d = buffers[i]->datas;
 | 
					    SpaData *d = buffers[i]->datas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    b = &this->buffers[i];
 | 
					    b = &this->buffers[i];
 | 
				
			||||||
| 
						 | 
					@ -935,6 +934,10 @@ videotestsrc_init (const SpaHandleFactory  *factory,
 | 
				
			||||||
    spa_log_error (this->log, "an id-map is needed");
 | 
					    spa_log_error (this->log, "an id-map is needed");
 | 
				
			||||||
    return SPA_RESULT_ERROR;
 | 
					    return SPA_RESULT_ERROR;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (this->data_loop == NULL) {
 | 
				
			||||||
 | 
					    spa_log_error (this->log, "a data_loop is needed");
 | 
				
			||||||
 | 
					    return SPA_RESULT_ERROR;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
 | 
					  this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
 | 
				
			||||||
  this->uri.clock = spa_id_map_get_id (this->map, SPA_CLOCK_URI);
 | 
					  this->uri.clock = spa_id_map_get_id (this->map, SPA_CLOCK_URI);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue