Changeset 11801 for trunk/psModules/src/camera/pmFPAConstruct.c
- Timestamp:
- Feb 14, 2007, 2:51:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAConstruct.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAConstruct.c
r11792 r11801 469 469 // It returns a view corresponding to the PHU 470 470 static pmFPAview *addSource(pmFPA *fpa, // The FPA 471 const char *fpaname, // The desired FPA name 471 472 const pmFPAview *phuView, // The view corresponding to the PHU, or NULL 472 473 const psMetadata *header, // The PHU header, or NULL … … 479 480 assert(format); 480 481 481 bool mdok = true; // Status from metadata lookups 482 bool mdok; // Status of MD lookup 483 484 // If FPA.NAME is already defined, new name must match it; otherwise, warn the user that something 485 // potentially bad is happening. 486 if (fpaname && install) { 487 const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.NAME"); // Current name 488 if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaname) != 0) { 489 psLogMsg(__func__, PS_LOG_WARN, "FPA.NAME for new source (%s) doesn't match FPA.NAME for current " 490 "fpa (%s).\n", fpaname, currentName); 491 } 492 psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.NAME", PS_META_REPLACE, "Name of FPA", fpaname); 493 } else if (!psMetadataLookup(fpa->concepts, "FPA.NAME")) { 494 // Make sure there is an FPA.NAME 495 psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.NAME", 0, "Name of FPA", "UNKNOWN"); 496 } 497 482 498 psMetadata *fileInfo = psMetadataLookupMetadata(&mdok, format, "FILE"); // The file information 483 499 if (!mdok || !fileInfo) { … … 759 775 760 776 761 bool pmFPAAddSourceFromView(pmFPA *fpa, const pmFPAview *phuView, const psMetadata *format) 777 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaname, const pmFPAview *phuView, 778 const psMetadata *format) 762 779 { 763 780 PS_ASSERT_PTR_NON_NULL(fpa, false); … … 765 782 PS_ASSERT_PTR_NON_NULL(format, false); 766 783 767 pmFPAview *view = addSource(fpa, phuView, NULL, format, true);784 pmFPAview *view = addSource(fpa, fpaname, phuView, NULL, format, true); 768 785 bool status = (view != NULL); 769 786 psFree(view); … … 785 802 786 803 // Check the name of the FPA 787 psString newFPAname = phuNameFromHeader("FPA.NAME", fileInfo, phu); // New name for the FPA 788 if (!newFPAname) { 789 psError(PS_ERR_IO, true, "Unable to determine FPA.NAME : check for FPA.NAME in FILE in FORMAT"); 790 return NULL; 791 } 792 793 // If FPAname already defined, new name must match it; otherwise, warn the user that something potentially 794 // bad is happening. 795 const char *currentFPAname = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.NAME"); // Current name 796 if (mdok && currentFPAname && strlen(currentFPAname) > 0 && strcmp(currentFPAname, newFPAname) != 0) { 797 psLogMsg(__func__, PS_LOG_WARN, "FPA.NAME for new source (%s) doesn't match FPA.NAME for current " 798 "fpa (%s).\n", newFPAname, currentFPAname); 799 } 800 psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.NAME", PS_META_REPLACE, "Name of FPA", newFPAname); 801 psFree(newFPAname); // Drop reference 802 803 return addSource(fpa, NULL, phu, format, true); 804 psString fpaname = phuNameFromHeader("FPA.NAME", fileInfo, phu); // New name for the FPA 805 if (!fpaname || strlen(fpaname) == 0) { 806 psError(PS_ERR_IO, true, "Unable to determine FPA.NAME: check for FPA.NAME in FILE in camera format"); 807 return NULL; 808 } 809 810 pmFPAview *view = addSource(fpa, fpaname, NULL, phu, format, true); // View of PHU, to return 811 psFree(fpaname); 812 813 return view; 804 814 } 805 815 … … 811 821 PS_ASSERT_PTR_NON_NULL(format, NULL); 812 822 813 return addSource(fpa, NULL, phu, format, false);823 return addSource(fpa, NULL, NULL, phu, format, false); 814 824 } 815 825
Note:
See TracChangeset
for help on using the changeset viewer.
