Show
Ignore:
Timestamp:
02/27/08 20:47:34 (9 months ago)
Author:
astrange
Message:

Write a lot of debug tracing to /tmp/perian.log if PerianDebugLogging? is set in the environment.

Files:

Legend:

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

    r332 r816  
    1515#ifdef DEBUG_BUILD 
    1616#define CODEC_HEADER                    "Perian Codec: " 
     17#define FILELOG 
    1718 
    1819static int Codecvprintf(FILE *fileLog, const char *format, va_list va, int print_header) 
     
    2425        { 
    2526                if(print_header) 
    26                         fprintf(glob->fileLog, CODEC_HEADER); 
     27                        fprintf(fileLog, CODEC_HEADER); 
    2728                ret = vfprintf(fileLog, format, va); 
    28                 fflush(glob->fileLog); 
     29                fflush(fileLog); 
    2930        } 
    3031        else 
     
    4748        va_list va; 
    4849        va_start(va, format); 
    49         ret = Codecvprintf(fileLog, format, va, 1); 
     50        ret = Codecvprintf(fileLog, format, va, !fileLog); 
    5051        va_end(va); 
    5152        return ret; 
    5253} 
    5354 
    54 void FourCCprintf (char *string, unsigned long a
     55const char *FourCCString(FourCharCode c
    5556{ 
    56     if (a < 64) 
    57     { 
    58         Codecprintf(NULL, "%s%ld\n", string, a); 
    59     } 
    60     else 
    61     { 
    62         Codecprintf(NULL, "%s%c%c%c%c\n", string, 
    63                            (unsigned char)((a >> 24) & 0xff),  
    64                            (unsigned char)((a >> 16) & 0xff),  
    65                            (unsigned char)((a >> 8) & 0xff),  
    66                            (unsigned char)(a & 0xff)); 
    67     } 
     57    static unsigned char fourcc[5] = {0}; 
     58    int i; 
     59     
     60    for (i = 0; i < 4; i++) fourcc[i] = c >> 8*(3-i); 
     61     
     62    return (char*)fourcc; 
    6863} 
     64 
     65void FourCCprintf (char *string, FourCharCode a) 
     66{ 
     67    Codecprintf(NULL, "%s%s\n", string, FourCCString(a)); 
     68} 
     69 
    6970#else 
    7071#define Codecvprintf(file, fmt, va, print_header) /**/