Changeset 960

Show
Ignore:
Timestamp:
10/10/08 20:16:08 (1 month ago)
Author:
astrange
Message:

Change experimental QT flags and debug logging to be defaults options.
Improve logging, and make log files work in Deployment too.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/perian-1.1/Codecprintf.c

    r887 r960  
    1313#include "log.h" 
    1414 
    15 #ifdef DEBUG_BUILD 
    1615#define CODEC_HEADER                    "Perian Codec: " 
    17 #define FILELOG 
    1816 
    1917static int Codecvprintf(FILE *fileLog, const char *format, va_list va, int print_header) 
    2018{ 
    21         int ret
     19        int ret = 0
    2220         
    23 #ifdef FILELOG 
    2421        if(fileLog) 
    2522        { 
     
    3128        else 
    3229        { 
    33 #endif 
     30#ifdef DEBUG_BUILD 
    3431                if(print_header) 
    3532                        printf(CODEC_HEADER); 
    3633                 
    3734                ret = vprintf(format, va); 
    38 #ifdef FILELOG 
     35#endif 
    3936        } 
    40 #endif 
    4137         
    4238        return ret; 
     
    6864} 
    6965 
    70 #else 
    71 #define Codecvprintf(file, fmt, va, print_header) /**/ 
    72 #endif 
    73  
    7466void FFMpegCodecprintf(void* ptr, int level, const char* fmt, va_list vl) 
    7567{ 
  • branches/perian-1.1/Codecprintf.h

    r887 r960  
    1212#endif 
    1313 
    14 #ifdef DEBUG_BUILD 
    1514int Codecprintf(FILE *, const char *format, ...); 
    1615void FourCCprintf(char *string, FourCharCode a); 
    1716const char *FourCCString(FourCharCode c); 
    18 #else 
    19 #define Codecprintf(file, fmt, ...) /**/ 
    20 #define FourCCprintf(string,a) /**/ 
    21 #endif 
    2217 
    2318void FFMpegCodecprintf(void* ptr, int level, const char* fmt, va_list vl); 
  • branches/perian-1.1/CommonUtils.c

    r959 r960  
    341341                enabled = findNameInList(myProcessName, defaultFrameDroppingWhiteList, count); 
    342342            } 
    343             //Codecprintf(NULL, "Frame Dropping enabled is %d for %s\n", enabled, CFStringGetCStringPtr(myProcessName, kCFStringEncodingMacRoman)); 
    344343            CFRelease(myProcessName); 
    345344            CFRelease(processInformation); 
  • branches/perian-1.1/FFusionCodec.c

    r956 r960  
    266266        if (!glob->fileLog || glob->decode.lastFrame == 0) return; 
    267267         
    268         Codecprintf(glob->fileLog, "Type\t| BeginBand\t| DecodeBand\t| DrawBand\t| dropped before decode\t| dropped before draw\n"); 
     268        Codecprintf(glob->fileLog, "%p frame drop stats\nType\t| BeginBand\t| DecodeBand\t| DrawBand\t| dropped before decode\t| dropped before draw\n", glob); 
    269269         
    270270        for (i = 0; i < 4; i++) { 
     
    319319    else 
    320320    { 
     321                CFStringRef pathToLogFile = CFPreferencesCopyAppValue(CFSTR("DebugLogFile"), CFSTR("org.perian.Perian")); 
     322                char path[PATH_MAX]; 
    321323        SetComponentInstanceStorage(self, (Handle)glob); 
    322          
     324 
    323325        glob->self = self; 
    324326        glob->target = self; 
     
    331333                glob->data.frames = NULL; 
    332334                glob->begin.parser = NULL; 
    333                 if (getenv("PerianDebugLogging")) glob->fileLog = fopen("/tmp/perian.log", "a"); 
    334                 else glob->fileLog = NULL; 
     335                if (pathToLogFile) { 
     336                        CFStringGetCString(pathToLogFile, path, PATH_MAX, kCFStringEncodingUTF8); 
     337                        CFRelease(pathToLogFile); 
     338                        glob->fileLog = fopen(path, "a"); 
     339                } 
    335340                glob->shouldUseReturnedFrame = 0; 
    336                  
     341 
    337342//        c = FindNextComponent(c, &cd); 
    338343                 
     
    485490pascal ComponentResult FFusionCodecInitialize(FFusionGlobals glob, ImageSubCodecDecompressCapabilities *cap) 
    486491{ 
    487         Boolean doExperimentalFlags = getenv("PerianExperimentalQTFlags") != NULL
     492        Boolean doExperimentalFlags = CFPreferencesGetAppBooleanValue(CFSTR("ExperimentalQTFlags"), CFSTR("org.perian.Perian"), NULL)
    488493         
    489494    // Secifies the size of the ImageSubCodecDecompressRecord structure 
     
    537542     
    538543        FFusionDebugPrint("%p Preflight called.\n", glob); 
     544        FFusionDebugPrint("%p Frame dropping is %senabled\n", glob, not(IsFrameDroppingEnabled())); 
    539545         
    540546    if (!glob->avCodec) 
     
    775781                if(glob->avContext->extradata_size != 0 && glob->begin.parser != NULL) 
    776782                        ffusionParseExtraData(glob->begin.parser, glob->avContext->extradata, glob->avContext->extradata_size); 
     783                 
     784                if (glob->fileLog) 
     785                        ffusionLogDebugInfo(glob->begin.parser, glob->fileLog); 
    777786                 
    778787                // XXX: at the moment ffmpeg can't handle interlaced H.264 right 
     
    11751184                        /* If this is a key frame or the P frame before us is after the last frame (skip ahead), or we are before the last decoded frame (skip back) * 
    11761185                         * then we are in a whole new GOP */ 
    1177                         FFusionDebugPrint("%p - in a new GOP.\n", glob); 
    11781186                        avcodec_flush_buffers(glob->avContext); 
    11791187                } 
     
    12361244        avcodec_get_frame_defaults(&tempFrame); 
    12371245        err = FFusionDecompress(glob, glob->avContext, dataPtr, dataProc, myDrp->width, myDrp->height, &tempFrame, dataSize); 
    1238                  
     1246                        
    12391247        if (glob->packedType == PACKED_QUICKTIME_KNOWS_ORDER) { 
    12401248                myDrp->buffer = &glob->buffers[glob->lastAllocatedBuffer]; 
     
    12431251                myDrp->buffer->returnedFrame = tempFrame; 
    12441252                myDrp->decoded = true; 
     1253                glob->decode.lastFrame = myDrp->frameNumber; 
    12451254                return err; 
    12461255        } 
     
    12591268        FFusionDataMarkRead(&(glob->data), frameData); 
    12601269         
    1261         FFusionDebugPrint("%p DecodeBand decoded #%d.\n", glob, glob->decode.lastFrame); 
    1262  
    12631270        return err; 
    12641271} 
     
    13041311        { 
    13051312                picture = myDrp->buffer->frame; 
    1306                 FFusionDebugPrint("%p DrawBand #%d. found %d\n", glob, myDrp->frameNumber, myDrp->buffer->frameNumber); 
    13071313        } 
    13081314        else 
     
    17381744    long availableData = dataProc ? codecMinimumDataSize : kInfiniteDataSize; 
    17391745         
    1740         FFusionDebugPrint("%p Decompress on frame #%d (%d bytes).\n", glob, glob->decode.lastFrame, length); 
     1746        FFusionDebugPrint("%p Decompress %d bytes.\n", glob, length); 
    17411747    picture->data[0] = 0; 
    17421748         
  • branches/perian-1.1/bitstream_info.c

    r947 r960  
    251251        int prevPts; 
    252252         
     253        int profile_idc; 
     254        int level_idc; 
     255         
    253256        int poc_type; 
    254257        int log2_max_frame_num; 
     
    266269         
    267270        int chroma_format_idc; 
     271         
     272        int gaps_in_frame_num_value_allowed_flag; 
    268273}H264ParserContext; 
    269274 
     
    334339{ 
    335340        GetBitContext getbit, *gb = &getbit; 
    336         int profile_idc; 
    337341         
    338342        init_get_bits(gb, buf, 8 * buf_size); 
    339     profile_idc= get_bits(gb, 8); 
     343    context->profile_idc= get_bits(gb, 8); 
    340344    get_bits1(gb);              //constraint_set0_flag 
    341345    get_bits1(gb);              //constraint_set1_flag 
     
    343347    get_bits1(gb);              //constraint_set3_flag 
    344348    get_bits(gb, 4);    //reserved 
    345         get_bits(gb, 8);      //level_idc 
     349        context->level_idc = get_bits(gb, 8); //level_idc 
    346350        get_ue_golomb(gb);      //seq_parameter_set_id 
    347         if(profile_idc >= 100) 
     351        if(context->profile_idc >= 100) 
    348352        { 
    349353                context->chroma_format_idc = get_ue_golomb(gb); 
     
    373377        } 
    374378        get_ue_golomb(gb);      //num_ref_frames 
    375         get_bits1(gb);                //gaps_in_frame_num_value_allowed_flag 
     379        context->gaps_in_frame_num_value_allowed_flag = get_bits1(gb);                //gaps_in_frame_num_value_allowed_flag 
    376380        get_ue_golomb(gb);      //pic_width_in_mbs_minus1 
    377381        get_ue_golomb(gb);      //pic_height_in_map_units_minus1 
     
    862866} 
    863867 
     868void ffusionLogDebugInfo(FFusionParserContext *parser, FILE *log) 
     869{ 
     870        if (parser) { 
     871                if (parser->parserStructure == &ffusionH264Parser) { 
     872                        H264ParserContext *h264parser = parser->internalContext; 
     873                         
     874                        Codecprintf(log, "H.264 format: profile %d level %d\n\tis_avc %d\n\tframe_mbs_only %d\n\tchroma_format_idc %d\n\tframe_num_gaps %d\n", 
     875                                                h264parser->profile_idc, h264parser->level_idc, h264parser->is_avc, h264parser->frame_mbs_only_flag, h264parser->chroma_format_idc, h264parser->gaps_in_frame_num_value_allowed_flag); 
     876                } 
     877        } 
     878} 
     879 
    864880int ffusionIsParsedVideoDecodable(FFusionParserContext *parser) 
    865881{ 
  • branches/perian-1.1/bitstream_info.h

    r797 r960  
    4343int ffusionParseExtraData(FFusionParserContext *parser, const uint8_t *buf, int buf_size); 
    4444int ffusionParse(FFusionParserContext *parser, const uint8_t *buf, int buf_size, int *out_buf_size, int *type, int *skippable); 
     45void ffusionLogDebugInfo(FFusionParserContext *parser, FILE *log); 
    4546int ffusionIsParsedVideoDecodable(FFusionParserContext *parser); 
    4647