Changeset 16912 for trunk/psModules/src/camera/pmFPAConstruct.c
- Timestamp:
- Mar 10, 2008, 3:27:05 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAConstruct.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAConstruct.c
r15940 r16912 415 415 psArray *cellNames = NULL; // Cell names 416 416 psArray *cellTypes = NULL; // Cell types 417 417 418 418 int nParsed = 0; 419 419 420 420 switch (chipContents->type) { 421 421 case PS_DATA_STRING: { 422 nParsed = parseContent(&cellNames, &cellTypes, NULL, chipContents->data.str);423 break;422 nParsed = parseContent(&cellNames, &cellTypes, NULL, chipContents->data.str); 423 break; 424 424 } 425 425 case PS_DATA_METADATA: { 426 psMetadataIterator *iter = psMetadataIteratorAlloc(chipContents->data.md, PS_LIST_HEAD, NULL); // Iterator427 psMetadataItem *item; // Item from iteration428 while ((item = psMetadataGetAndIncrement(iter))) {429 if (item->type != PS_DATA_STRING) {430 psWarning ("Item %s in camera format chip table is not of type STR.", item->name);431 continue;432 }433 nParsed += parseContent(&cellNames, &cellTypes, NULL, item->data.str);434 }435 psFree (iter);436 break;426 psMetadataIterator *iter = psMetadataIteratorAlloc(chipContents->data.md, PS_LIST_HEAD, NULL); // Iterator 427 psMetadataItem *item; // Item from iteration 428 while ((item = psMetadataGetAndIncrement(iter))) { 429 if (item->type != PS_DATA_STRING) { 430 psWarning ("Item %s in camera format chip table is not of type STR.", item->name); 431 continue; 432 } 433 nParsed += parseContent(&cellNames, &cellTypes, NULL, item->data.str); 434 } 435 psFree (iter); 436 break; 437 437 } 438 438 default: 439 psWarning ("Item %s in camera format chip table is not of type STR.", chipContents->name);440 break;439 psWarning ("Item %s in camera format chip table is not of type STR.", chipContents->name); 440 break; 441 441 } 442 442 443 443 if (nParsed == 0) { 444 psError(PS_ERR_BAD_PARAMETER_VALUE, false,445 "Unable to parse chip contents (within %s in camera format) as cellName:cellType",446 CHIP_TYPES);447 psFree(cellNames);448 psFree(cellTypes);449 return false;444 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 445 "Unable to parse chip contents (within %s in camera format) as cellName:cellType", 446 CHIP_TYPES); 447 psFree(cellNames); 448 psFree(cellTypes); 449 return false; 450 450 } 451 451 … … 1349 1349 } 1350 1350 1351 bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaname, const psMetadata *format) 1352 { 1353 PS_ASSERT_PTR_NON_NULL(fpa, false); 1354 PS_ASSERT_METADATA_NON_NULL(format, false); 1355 1356 // Generate the correct structure 1357 pmFPALevel phuLevel = pmFPAPHULevel(format); // Level at which PHU goes 1358 pmFPAview *view = pmFPAviewAlloc(0);// View for current level 1359 if (phuLevel == PM_FPA_LEVEL_FPA) { 1360 if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) { 1361 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 1362 psFree(view); 1363 return false; 1364 } 1365 } else { 1366 pmChip *chip; // Chip from FPA 1367 while ((chip = pmFPAviewNextChip(view, fpa, 1))) { 1368 if (phuLevel == PM_FPA_LEVEL_CHIP) { 1369 if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) { 1370 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 1371 psFree(view); 1372 return false; 1373 } 1374 } else { 1375 pmCell *cell; // Cell from chip 1376 while ((cell = pmFPAviewNextCell(view, fpa, 1))) { 1377 if (phuLevel == PM_FPA_LEVEL_CELL) { 1378 if (!pmFPAAddSourceFromView(fpa, fpaname, view, format)) { 1379 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 1380 psFree(view); 1381 return false; 1382 } 1383 } 1384 } 1385 } 1386 } 1387 } 1388 psFree(view); 1389 1390 return true; 1391 } 1392 1351 1393 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaname, const pmFPAview *phuView, 1352 1394 const psMetadata *format)
Note:
See TracChangeset
for help on using the changeset viewer.
