mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	libcamera: update buffers datas information according to plane info
This commit is contained in:
		
							parent
							
								
									359b70e2ba
								
							
						
					
					
						commit
						d5e2a0df6c
					
				
					 1 changed files with 26 additions and 3 deletions
				
			
		| 
						 | 
					@ -822,11 +822,34 @@ mmap_init(struct impl *impl, struct port *port,
 | 
				
			||||||
			d[j].type = port->memtype;
 | 
								d[j].type = port->memtype;
 | 
				
			||||||
			d[j].flags = SPA_DATA_FLAG_READABLE;
 | 
								d[j].flags = SPA_DATA_FLAG_READABLE;
 | 
				
			||||||
			d[j].mapoffset = 0;
 | 
								d[j].mapoffset = 0;
 | 
				
			||||||
 | 
								d[j].chunk->stride = port->streamConfig.stride;
 | 
				
			||||||
 | 
								d[j].chunk->flags = 0;
 | 
				
			||||||
 | 
								/* Update parameters according to the plane information */
 | 
				
			||||||
 | 
								unsigned int numPlanes = bufs[i]->planes().size();
 | 
				
			||||||
 | 
								if (buffers[i]->n_datas < numPlanes) {
 | 
				
			||||||
 | 
									if (j < buffers[i]->n_datas - 1) {
 | 
				
			||||||
 | 
										d[j].maxsize = bufs[i]->planes()[j].length;
 | 
				
			||||||
 | 
										d[j].chunk->offset = bufs[i]->planes()[j].offset;
 | 
				
			||||||
 | 
										d[j].chunk->size = bufs[i]->planes()[j].length;
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										d[j].chunk->offset = bufs[i]->planes()[j].offset;
 | 
				
			||||||
 | 
										for (uint8_t k = j; k < numPlanes; k++) {
 | 
				
			||||||
 | 
											d[j].maxsize += bufs[i]->planes()[k].length;
 | 
				
			||||||
 | 
											d[j].chunk->size += bufs[i]->planes()[k].length;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								} else if (buffers[i]->n_datas == numPlanes) {
 | 
				
			||||||
 | 
									d[j].maxsize = bufs[i]->planes()[j].length;
 | 
				
			||||||
 | 
									d[j].chunk->offset = bufs[i]->planes()[j].offset;
 | 
				
			||||||
 | 
									d[j].chunk->size = bufs[i]->planes()[j].length;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									spa_log_warn(impl->log, "buffer index: i: %d, data member "
 | 
				
			||||||
 | 
										"numbers: %d is greater than plane number: %d",
 | 
				
			||||||
 | 
										i, buffers[i]->n_datas, numPlanes);
 | 
				
			||||||
				d[j].maxsize = port->streamConfig.frameSize;
 | 
									d[j].maxsize = port->streamConfig.frameSize;
 | 
				
			||||||
				d[j].chunk->offset = 0;
 | 
									d[j].chunk->offset = 0;
 | 
				
			||||||
				d[j].chunk->size = port->streamConfig.frameSize;
 | 
									d[j].chunk->size = port->streamConfig.frameSize;
 | 
				
			||||||
			d[j].chunk->stride = port->streamConfig.stride;
 | 
								}
 | 
				
			||||||
			d[j].chunk->flags = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (port->memtype == SPA_DATA_DmaBuf ||
 | 
								if (port->memtype == SPA_DATA_DmaBuf ||
 | 
				
			||||||
			    port->memtype == SPA_DATA_MemFd) {
 | 
								    port->memtype == SPA_DATA_MemFd) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue