IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 14, 2007, 2:51:20 PM (19 years ago)
Author:
Paul Price
Message:

Fixing issues with file formats: some formats weren't getting the PHU where required (because the create was following the open, and the open was attempting to write the blank PHU). Added pmFPAfileBlank to write a blank where required. Cleaned up the pmFPAfile stuff a little.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r11687 r11801  
    180180    }
    181181
    182     file->camera = psMemIncrRefCounter(config->camera);
     182    psMetadata *camera;                 // Camera to use
     183    if (fpa && fpa->camera) {
     184        camera = (psMetadata*)fpa->camera; // Casting away const, so I can put it in the file
     185    } else {
     186        camera = config->camera;
     187    }
     188    file->camera = psMemIncrRefCounter(camera);
     189
     190    // select the format list from the selected camera
    183191    const char *formatName = psMetadataLookupStr (&status, data, "FILE.FORMAT");
    184     psMetadata *format = NULL;          // Camera format to use
    185     if (formatName && strcasecmp(formatName, "NONE") != 0) {
    186         // select the format list from the selected camera
    187         psMetadata *formats = psMetadataLookupMetadata(&status, file->camera, "FORMATS"); // List of formats
    188 
    189         // select the desired format
    190         format = psMetadataLookupMetadata(&status, formats, formatName);
    191         if (!format) {
    192             psError(PS_ERR_IO, false, "format %s for %s not defined", formatName, name);
    193             psFree(file);
    194             return NULL;
    195         }
    196         file->format = psMemIncrRefCounter(format);
    197         #if 0
    198 
    199         file->src = psMemIncrRefCounter(fpa);
    200         file->fpa = pmFPAConstruct(file->camera);
    201         #endif
    202 
    203     } else {
     192    if (!formatName) {
     193        formatName = config->formatName;
     194    }
     195    psMetadata *formats = psMetadataLookupMetadata(&status, file->camera, "FORMATS"); // List of formats
     196    psMetadata *format = psMetadataLookupMetadata(&status, formats, formatName); // Camera format to use
     197    if (!format) {
     198        // Try to get by with the default
    204199        format = config->format;
    205         #if 0
    206 
    207         file->fpa = psMemIncrRefCounter(fpa);
    208         #endif
    209 
    210     }
    211     #if 1
     200    }
     201    file->format = psMemIncrRefCounter(format);
     202
    212203    file->fpa = psMemIncrRefCounter(fpa);
    213     #endif
    214 
    215204
    216205    file->fileLevel = pmFPAPHULevel(format);
     
    925914    file->xBin = xBin;
    926915    file->yBin = yBin;
    927     psFree (file->format);
    928     file->format = psMemIncrRefCounter(format);
    929 
    930916    psFree (fpa);
    931917    return file;
Note: See TracChangeset for help on using the changeset viewer.