Changeset 194

Show
Ignore:
Timestamp:
11/17/06 18:08:23 (2 years ago)
Author:
durin42
Message:

Patch from Allan Hsu (allan <at> counterpop <dot> net):
Minor fixes to the fourcc printf patch and removal of an unused variable from my data handler fix.

Fixes #34. Many thanks Allan!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Codecprintf.c

    r57 r194  
    5555    if (a < 64) 
    5656    { 
    57         printf("%s: %ld\n", string, a); 
     57        Codecprintf(NULL, "%s%ld\n", string, a); 
    5858    } 
    5959    else 
    6060    { 
    61         printf("%s: %c%c%c%c\n", string, (unsigned char)((a >> 24) & 0xff),  
     61        Codecprintf(NULL, "%s%c%c%c%c\n", string, 
     62                           (unsigned char)((a >> 24) & 0xff),  
    6263                           (unsigned char)((a >> 16) & 0xff),  
    6364                           (unsigned char)((a >> 8) & 0xff),  
  • trunk/FFusionCodec.c

    r154 r194  
    171171    GetComponentInfo((Component)self, &descout, 0, 0, 0); 
    172172         
    173     Codecprintf(NULL, "Opening component for type"); 
    174     FourCCprintf(" ", descout.componentSubType); 
     173    FourCCprintf("Opening component for type ", descout.componentSubType); 
    175174         
    176175    // Allocate memory for our globals, set them up and inform the component manager that we've done so 
     
    12301229#define kInfiniteDataSize (0x7fffffff) 
    12311230 
    1232 //--------------------------------------------------------------------------- 
    1233 // Private SubRoutines 
    1234 //--------------------------------------------------------------------------- 
    1235  
    1236 //----------------------------------------------------------------- 
    1237 // FourCCcopy 
    1238 //----------------------------------------------------------------- 
    1239 // Copy src FourCC in dest FourCC 
    1240 //----------------------------------------------------------------- 
    1241  
    1242 void FourCCcopy(OSType *dest, OSType *src) 
    1243 { 
    1244     int i; 
    1245      
    1246     for (i=0; i<3; i++) 
    1247         dest[i] = src[i]; 
    1248 } 
    1249  
    1250 //----------------------------------------------------------------- 
    1251 // FourCCprintf 
    1252 //----------------------------------------------------------------- 
    1253 // Compare two FourCC (case sensitive) 
    1254 // Returns 1 if equal, 0 if not equal 
    1255 //----------------------------------------------------------------- 
    1256  
    1257 int FourCCcompare(OSType *a, OSType *b) 
    1258 { 
    1259     return ((a[0] == b[0]) && (a[1] == b[1]) && (a[2] == b[2]) && (a[3] == b[3])); 
    1260 } 
    1261  
    12621231//----------------------------------------------------------------- 
    12631232// FFusionDecompress 
  • trunk/ff_dataref.c

    r45 r194  
    3131        int64_t pos; 
    3232        int64_t size; 
     33        unsigned char supportsWideOffsets; 
    3334}; 
    3435typedef struct _dataref_private dataref_private; 
     
    7273        private->size = 0ll; 
    7374         
    74         DataHGetFileSize64(private->dh, &fsize); 
    75         private->size = (int64_t)fsize.lo; 
    76         private->size += (int64_t)fsize.hi << 32; 
     75        result = DataHGetFileSize64(private->dh, &fsize); 
     76        if(result == noErr) { 
     77                private->size = (int64_t)fsize.lo; 
     78                private->size += (int64_t)fsize.hi << 32; 
     79                // Our data handler supports wide offsets. Remember for later use. 
     80                private->supportsWideOffsets = 1; 
     81        } else { 
     82                long size32; 
     83                result = DataHGetFileSize(private->dh, &size32); 
     84                require_noerr(result, bail); 
     85                private->size = size32; 
     86        } 
    7787         
    7888bail: 
     
    8494        int result; 
    8595        int64_t read; 
    86         wide offset; 
     96 
    8797        dataref_private *p = (dataref_private*)h->priv_data; 
    8898         
     
    90100        read = (read < size) ? read : size; 
    91101         
    92         offset.hi = p->pos >> 32; 
    93         offset.lo = (UInt32)p->pos; 
    94          
    95         result = DataHScheduleData64(p->dh, (Ptr)buf, &offset, (long)read, 0, NULL, NULL); 
     102        if(p->supportsWideOffsets) { 
     103                wide offset; 
     104                offset.hi = p->pos >> 32; 
     105                offset.lo = (UInt32)p->pos; 
     106                 
     107                result = DataHScheduleData64(p->dh, (Ptr)buf, &offset, (long)read, 0, NULL, NULL); 
     108        } else { 
     109                result = DataHScheduleData(p->dh, (Ptr)buf, (long)p->pos, (long)read, 0, NULL, NULL); 
     110        } 
     111         
    96112        if(result != noErr) { 
    97113                read = -1; 
     
    109125        int result; 
    110126        int written = size; 
    111         wide offset; 
    112         dataref_private *p = (dataref_private*)h->priv_data; 
    113          
    114         offset.hi = p->pos >> 32; 
    115         offset.lo = (UInt32)p->pos; 
    116          
    117         result = DataHWrite64(p->dh, (Ptr)buf, &offset, size, NULL, 0); 
     127        dataref_private *p = (dataref_private*)h->priv_data; 
     128         
     129        if(p->supportsWideOffsets) { 
     130                wide offset; 
     131                offset.hi = p->pos >> 32; 
     132                offset.lo = (UInt32)p->pos; 
     133                 
     134                result = DataHWrite64(p->dh, (Ptr)buf, &offset, size, NULL, 0); 
     135        } else { 
     136                result = DataHWrite(p->dh, (Ptr)buf, (long)p->pos, size, NULL, 0); 
     137        } 
     138         
    118139        if(result != noErr) { 
    119140                written = -1; 
  • trunk/ff_private.c

    r175 r194  
    150150                // need to lookup the fourcc from the codec_id 
    151151                (*imgHdl)->cType = map_video_codec_to_mov_tag(codec->codec_id); 
    152         Codecprintf(NULL, "fourcc: %c%c%c%c\n",0xff & (*imgHdl)->cType,0xff & (*imgHdl)->cType>>8,0xff & (*imgHdl)->cType>>16,0xff & (*imgHdl)->cType>>24); 
     152        FourCCprintf("fourcc: ", (*imgHdl)->cType); 
    153153         
    154154        (*imgHdl)->temporalQuality = codecMaxQuality;