mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v4l2: suggest stride in Buffer param
This commit is contained in:
		
							parent
							
								
									c3206fa687
								
							
						
					
					
						commit
						11ab47e4c9
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -1233,7 +1233,7 @@ static void on_stream_param_changed(void *data, uint32_t id, const struct spa_po
 | 
				
			||||||
	uint32_t n_params = 0;
 | 
						uint32_t n_params = 0;
 | 
				
			||||||
	uint8_t buffer[4096];
 | 
						uint8_t buffer[4096];
 | 
				
			||||||
	struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
 | 
						struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
 | 
				
			||||||
	uint32_t buffers, size;
 | 
						uint32_t buffers, size, stride;
 | 
				
			||||||
	struct v4l2_format fmt;
 | 
						struct v4l2_format fmt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (param == NULL || id != SPA_PARAM_Format)
 | 
						if (param == NULL || id != SPA_PARAM_Format)
 | 
				
			||||||
| 
						 | 
					@ -1246,6 +1246,7 @@ static void on_stream_param_changed(void *data, uint32_t id, const struct spa_po
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	buffers = SPA_CLAMP(file->reqbufs, 1u, MAX_BUFFERS);
 | 
						buffers = SPA_CLAMP(file->reqbufs, 1u, MAX_BUFFERS);
 | 
				
			||||||
	size = fmt.fmt.pix.sizeimage;
 | 
						size = fmt.fmt.pix.sizeimage;
 | 
				
			||||||
 | 
						stride = fmt.fmt.pix.bytesperline;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	params[n_params++] = spa_pod_builder_add_object(&b,
 | 
						params[n_params++] = spa_pod_builder_add_object(&b,
 | 
				
			||||||
			SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
 | 
								SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
 | 
				
			||||||
| 
						 | 
					@ -1253,7 +1254,7 @@ static void on_stream_param_changed(void *data, uint32_t id, const struct spa_po
 | 
				
			||||||
							1, MAX_BUFFERS),
 | 
												1, MAX_BUFFERS),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
								SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_size,    SPA_POD_CHOICE_RANGE_Int(size, 0, INT_MAX),
 | 
								SPA_PARAM_BUFFERS_size,    SPA_POD_CHOICE_RANGE_Int(size, 0, INT_MAX),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_stride,  SPA_POD_CHOICE_RANGE_Int(0, 0, INT_MAX),
 | 
								SPA_PARAM_BUFFERS_stride,  SPA_POD_CHOICE_RANGE_Int(stride, 0, INT_MAX),
 | 
				
			||||||
			SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemFd)));
 | 
								SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int((1<<SPA_DATA_MemFd)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_stream_update_params(file->stream, params, n_params);
 | 
						pw_stream_update_params(file->stream, params, n_params);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue